-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ba0feb
commit c1ea0ab
Showing
18 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
|
||
class Recurly_ExternalPaymentPhaseListTest extends Recurly_TestCase | ||
{ | ||
|
||
public function testGetAll() { | ||
$url = '/external_subscriptions/swifdu8c9om9/external_payment_phases'; | ||
$this->client->addResponse('GET', $url, 'external_payment_phases/index-200.xml'); | ||
|
||
$external_subscription = new Recurly_ExternalSubscription(); | ||
$external_subscription->uuid = 'swifdu8c9om9'; | ||
|
||
$external_payment_phases = $external_subscription->listExternalPaymentPhases($this->client); | ||
$external_payment_phase = $external_payment_phases[0]; | ||
|
||
$this->assertInstanceOf('Recurly_ExternalPaymentPhase', $external_payment_phase); | ||
$this->assertEquals($external_payment_phase->id, 'sd28t3zdm59r'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->started_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->ends_at); | ||
$this->assertEquals($external_payment_phase->starting_billing_period_index, '1'); | ||
$this->assertEquals($external_payment_phase->ending_billing_period_index, '4'); | ||
$this->assertEquals($external_payment_phase->period_count, '4'); | ||
$this->assertEquals($external_payment_phase->period_length, '4'); | ||
$this->assertEquals($external_payment_phase->amount, '0.00'); | ||
$this->assertEquals($external_payment_phase->currency, 'USD'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->created_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->updated_at); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
|
||
class Recurly_ExternalPaymentPhaseTest extends Recurly_TestCase | ||
{ | ||
public function testGetPaymentPhase() { | ||
$this->client->addResponse('GET', '/external_payment_phases/sd28t3zdm59r', 'external_payment_phases/show-200.xml'); | ||
|
||
$external_payment_phase = Recurly_ExternalPaymentPhase::get('sd28t3zdm59r', $this->client); | ||
$this->assertInstanceOf('Recurly_ExternalPaymentPhase', $external_payment_phase); | ||
$this->assertEquals($external_payment_phase->id, 'sd28t3zdm59r'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->started_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->ends_at); | ||
$this->assertEquals($external_payment_phase->starting_billing_period_index, '1'); | ||
$this->assertEquals($external_payment_phase->ending_billing_period_index, '4'); | ||
$this->assertEquals($external_payment_phase->period_count, '4'); | ||
$this->assertEquals($external_payment_phase->period_length, '4'); | ||
$this->assertEquals($external_payment_phase->amount, '0.00'); | ||
$this->assertEquals($external_payment_phase->currency, 'USD'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->created_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->updated_at); | ||
} | ||
|
||
public function testGetPaymentPhaseByExternalSubscription() { | ||
$this->client->addResponse('GET', '/external_subscriptions/swifdu8c9om9/external_payment_phases/sd28t3zdm59r', 'external_payment_phases/show-200.xml'); | ||
|
||
$external_subscription = new Recurly_ExternalSubscription(); | ||
$external_subscription->uuid = 'swifdu8c9om9'; | ||
|
||
$external_payment_phase = $external_subscription->getExternalPaymentPhase('sd28t3zdm59r', $this->client); | ||
$this->assertInstanceOf('Recurly_ExternalPaymentPhase', $external_payment_phase); | ||
$this->assertEquals($external_payment_phase->id, 'sd28t3zdm59r'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->started_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->ends_at); | ||
$this->assertEquals($external_payment_phase->starting_billing_period_index, '1'); | ||
$this->assertEquals($external_payment_phase->ending_billing_period_index, '4'); | ||
$this->assertEquals($external_payment_phase->period_count, '4'); | ||
$this->assertEquals($external_payment_phase->period_length, '4'); | ||
$this->assertEquals($external_payment_phase->amount, '0.00'); | ||
$this->assertEquals($external_payment_phase->currency, 'USD'); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->created_at); | ||
$this->assertInstanceOf('DateTime', $external_payment_phase->updated_at); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<external_payment_phases type="array"> | ||
<external_payment_phase href="https://api.recurly.com/v2/external_payment_phases/sk0bmpw0wbby"> | ||
<id>sk0bmpw0wbby</id> | ||
<started_at type="datetime">2023-03-14T19:55:07Z</started_at> | ||
<ends_at type="datetime">2023-04-14T19:55:07Z</ends_at> | ||
<starting_billing_period_index>1</starting_billing_period_index> | ||
<ending_billing_period_index>4</ending_billing_period_index> | ||
<offer_type></offer_type> | ||
<offer_name></offer_name> | ||
<period_count>1</period_count> | ||
<period_length>2 MONTHS</period_length> | ||
<amount>0.00</amount> | ||
<currency>USD</currency> | ||
<created_at type="datetime">2023-03-14T19:55:07Z</created_at> | ||
<updated_at type="datetime">2023-04-14T19:55:07Z</updated_at> | ||
</external_payment_phase> | ||
</external_payment_phases> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<external_payment_phase href="https://api.recurly.com/v2/external_payment_phases/sk0bmpw0wbby"> | ||
<id>sk0bmpw0wbby</id> | ||
<started_at type="datetime">2023-03-14T19:55:07Z</started_at> | ||
<ends_at type="datetime">2023-04-14T19:55:07Z</ends_at> | ||
<starting_billing_period_index></starting_billing_period_index> | ||
<ending_billing_period_index>4</ending_billing_period_index> | ||
<offer_type></offer_type> | ||
<offer_name></offer_name> | ||
<period_count>1</period_count> | ||
<period_length>2 MONTHS</period_length> | ||
<amount>0.00</amount> | ||
<currency>USD</currency> | ||
<created_at type="datetime">2023-03-14T19:55:07Z</created_at> | ||
<updated_at type="datetime">2023-04-14T19:55:07Z</updated_at> | ||
</external_payment_phase> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* class Recurly_ExternalPaymentPhase | ||
* @property string $id | ||
* @property DateTime $started_at | ||
* @property DateTime $ends_at | ||
* @property string $starting_billing_period_index | ||
* @property string $ending_billing_period_index | ||
* @property string $offer_type | ||
* @property string $offer_name | ||
* @property string $period_count | ||
* @property string $period_length | ||
* @property string $amount | ||
* @property string $currency | ||
* @property DateTime $created_at | ||
* @property DateTime $updated_at | ||
*/ | ||
class Recurly_ExternalPaymentPhase extends Recurly_Resource | ||
{ | ||
public function populateXmlDoc(&$doc, &$node, &$obj, $nested = false) { | ||
if ($this->isEmbedded($node, 'external_payment_phases')) { | ||
$external_payment_phase_node = $node->appendChild($doc->createElement($this->getNodeName())); | ||
parent::populateXmlDoc($doc, $external_payment_phase_node, $obj, $nested); | ||
} else { | ||
parent::populateXmlDoc($doc, $node, $obj, $nested); | ||
} | ||
} | ||
|
||
public static function get($uuid, $client = null) { | ||
return Recurly_Base::_get(Recurly_ExternalPaymentPhase::uriForExternalPaymentPhase($uuid), $client); | ||
} | ||
|
||
protected static function uriForExternalPaymentPhase($uuid) { | ||
return self::_safeUri(Recurly_Client::PATH_EXTERNAL_PAYMENT_PHASES, $uuid); | ||
} | ||
|
||
protected function getNodeName() { | ||
return 'external_payment_phase'; | ||
} | ||
|
||
|
||
protected function getWriteableAttributes() { | ||
return array(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters