Skip to content

Commit d052b58

Browse files
Merge branch 'master' into fetch-subscription-schedules
2 parents 3dc0777 + 3878249 commit d052b58

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/Message/CreateSubscriptionRequest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ public function getTaxPercent()
4545
return $this->getParameter('tax_percent');
4646
}
4747

48+
49+
/**
50+
* Get the the trial end timestamp
51+
*
52+
* @return int
53+
*/
54+
public function getTrialEnd()
55+
{
56+
return $this->getParameter('trial_end');
57+
}
58+
59+
/**
60+
* Set the trial end timestamp.
61+
*
62+
* @param int $value
63+
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
64+
*/
65+
public function setTrialEnd($value)
66+
{
67+
return $this->setParameter('trial_end', $value);
68+
}
69+
4870
/**
4971
* Set the tax percentage
5072
*
@@ -72,6 +94,9 @@ public function getData()
7294
$data['metadata'] = $this->getMetadata();
7395
}
7496

97+
if ($this->getTrialEnd()) {
98+
$data['trial_end'] = $this->getTrialEnd();
99+
}
75100
return $data;
76101
}
77102

tests/Message/CreateSubscriptionRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function setUp()
1313
{
1414
$this->request = new CreateSubscriptionRequest($this->getHttpClient(), $this->getHttpRequest());
1515
$this->request->setCustomerReference('cus_7lqqgOm33t4xSU');
16+
$this->request->setTrialEnd(1606460031);
1617
$this->request->setPlan('basic');
1718
}
1819

tests/Mock/CreateSubscriptionSuccess.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ Cache-Control: no-cache, no-store
3636
"start": 1453672798,
3737
"status": "active",
3838
"tax_percent": null,
39-
"trial_end": null,
40-
"trial_start": null
41-
}
39+
"trial_end": 1606460031,
40+
"trial_start": 1593241598
41+
}

0 commit comments

Comments
 (0)