Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue #119 #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/Paymill/Models/Request/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class Subscription extends Base
*/
private $_periodOfValidity;

/**
* @var int
*/
private $_endOfPeriod;

/**
* @var boolean
*/
Expand Down Expand Up @@ -281,6 +286,15 @@ public function getPeriodOfValidity()
return $this->_periodOfValidity;
}

/**
* Returns end of period
* @return int
*/
public function getEndOfPeriod()
{
return $this->_endOfPeriod;
}

/**
* Returns if subscription is paused or not
* @return boolean
Expand Down Expand Up @@ -461,6 +475,9 @@ public function parameterize($method)
if (!is_null($this->getPeriodOfValidity())) {
$parameterArray['period_of_validity'] = $this->getPeriodOfValidity();
}
if (!is_null($this->getEndOfPeriod())) {
$parameterArray['end_of_period'] = $this->getEndOfPeriod();
}
if (!is_null($this->getTrialEnd())) {
$parameterArray['trial_end'] = $this->getTrialEnd();
}
Expand Down Expand Up @@ -498,6 +515,9 @@ public function parameterize($method)
if (!is_null($this->getPeriodOfValidity())) {
$parameterArray['period_of_validity'] = $this->getPeriodOfValidity();
}
if (!is_null($this->getEndOfPeriod())) {
$parameterArray['end_of_period'] = $this->getEndOfPeriod();
}
if (!is_null($this->getTrialEnd())) {
$parameterArray['trial_end'] = $this->getTrialEnd();
}
Expand Down
14 changes: 14 additions & 0 deletions lib/Paymill/Models/Response/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ class Subscription extends Base
*/
private $_periodOfValidity;

/**
* @var int
*/
private $_endOfPeriod;

/**
* @var int
*/
Expand Down Expand Up @@ -363,6 +368,15 @@ public function getPeriodOfValidity()
return $this->_periodOfValidity;
}

/**
* Returns the end of the subscription (expiry time in unix time)
* @return int
*/
public function getEndOfPeriod()
{
return $this->_endOfPeriod;
}

/**
* Set amount change type
*
Expand Down
2 changes: 2 additions & 0 deletions lib/Paymill/Services/ResponseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ private function _createSubscription(array $response)
$model->setTrialStart($response['trial_start']);
$model->setTrialEnd($response['trial_end']);
$model->setNextCaptureAt($response['next_capture_at']);
$model->setEndOfPeriod($response['end_of_period']);
$model->setNextCaptureAt($response['next_capture_at']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is double.

$model->setCreatedAt($response['created_at']);
$model->setUpdatedAt($response['updated_at']);
$model->setCanceledAt($response['canceled_at']);
Expand Down