Skip to content

Commit

Permalink
Merge pull request #70 from gsingh1/feature-amazon-renewal-carbon
Browse files Browse the repository at this point in the history
Carbonise amazon renewal date
  • Loading branch information
aporat authored Apr 13, 2018
2 parents 226d732 + 74e08a8 commit 8d57b6d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Amazon/PurchaseItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ class PurchaseItem
*/
protected $_cancellation_date;

/**
* renewal_date
*
* @var Carbon
*/
protected $_renewal_date;

/**
* @return array
*/
Expand Down Expand Up @@ -97,6 +104,14 @@ public function getCancellationDate()
return $this->_cancellation_date;
}

/**
* @return Carbon
*/
public function getRenewalDate()
{
return $this->_renewal_date;
}


/**
* PurchaseItem constructor.
Expand Down Expand Up @@ -145,6 +160,10 @@ public function parseJsonResponse() : self
$this->_cancellation_date = Carbon::createFromTimestampUTC(round($jsonResponse['cancelDate'] / 1000));
}

if (array_key_exists('renewalDate', $jsonResponse) && !empty($jsonResponse['renewalDate'])) {
$this->_renewal_date = Carbon::createFromTimestampMs(round($jsonResponse['renewalDate'] / 1000), 'UTC');
}

return $this;
}
}

0 comments on commit 8d57b6d

Please sign in to comment.