-
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.
Merge pull request #246 from recurly/api-2.3
Changes for API 2.3
- Loading branch information
Showing
21 changed files
with
157 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Recurly_AccountBalanceTest extends Recurly_TestCase | ||
{ | ||
function defaultResponses() { | ||
return array( | ||
array('GET', '/accounts/abcdef1234567890/balance', 'balance/show-200.xml'), | ||
); | ||
} | ||
|
||
public function testGet() { | ||
$balance = Recurly_AccountBalance::get('abcdef1234567890', $this->client); | ||
|
||
$this->assertInstanceOf('Recurly_AccountBalance', $balance); | ||
$this->assertEquals($balance->getHref(), 'https://api.recurly.com/v2/accounts/abcdef1234567890/balance'); | ||
$this->assertInstanceOf('Recurly_Stub', $balance->account); | ||
$this->assertEquals(true, $balance->past_due); | ||
|
||
$this->assertInstanceOf('Recurly_CurrencyList', $balance->balance_in_cents); | ||
$this->assertEquals(2910, $balance->balance_in_cents['USD']->amount_in_cents); | ||
$this->assertEquals(-520, $balance->balance_in_cents['EUR']->amount_in_cents); | ||
} | ||
} |
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,12 @@ | ||
HTTP/1.1 200 OK | ||
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<account_balance href="https://api.recurly.com/v2/accounts/abcdef1234567890/balance"> | ||
<account href="https://api.recurly.com/v2/accounts/abcdef1234567890"/> | ||
<past_due type="boolean">true</past_due> | ||
<balance_in_cents> | ||
<USD type="integer">2910</USD> | ||
<EUR type="integer">-520</EUR> | ||
</balance_in_cents> | ||
</account_balance> |
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 | ||
X-Api-Version: 1.999 | ||
Recurly-Deprecated: true | ||
Recurly-Sunset-Date: 2014-01-01T00:00:00+00:00 | ||
Content-Language: en-US | ||
X-RateLimit-Limit: 2000 | ||
X-RateLimit-Remaining: 1998 | ||
X-RateLimit-Reset: 1467912540 | ||
X-Records: 3 | ||
Link: <https://api.recurly.com/v2/accounts?order=asc&per_page=1>; rel="start", <https://api.recurly.com/v2/accounts?cursor=-1963376195782139893&order=asc&per_page=1>; rel="prev" | ||
ETag: "d41d8cd98f00b204e9800998ecf8427e" | ||
Content-Type: application/xml; charset=utf-8 | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: 6a8c07775f9dac83402cea1a28752a55 | ||
X-Runtime: 0.048038 | ||
Connection: close | ||
Transfer-Encoding: chunked | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<accounts type="array"> | ||
</accounts> |
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 |
---|---|---|
|
@@ -2,12 +2,13 @@ HTTP/1.1 200 OK | |
Content-Type: application/xml; charset=utf-8 | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<transaction href="https://api.recurly.com/v2/transactions/abcdef1234567890"> | ||
<transaction href="https://api.recurly.com/v2/transactions/abcdef1234567890" type="credit_card"> | ||
<account href="https://api.recurly.com/v2/accounts/verena"/> | ||
<invoice href="https://api.recurly.com/v2/invoices/abcdef1234567890"/> | ||
<invoice href="https://api.recurly.com/v2/invoices/1012"/> | ||
<subscription href="https://api.recurly.com/v2/subscriptions/1234567890abcdef"/> | ||
<original_transaction href="https://api.recurly.com/v2/transactions/abcdef1000000000"/> | ||
<uuid>abcdef1234567890</uuid> | ||
<action>purchase</action> | ||
<action>refund</action> | ||
<amount_in_cents type="integer">30000</amount_in_cents> | ||
<tax_in_cents type="integer">0</tax_in_cents> | ||
<currency>USD</currency> | ||
|
@@ -18,13 +19,14 @@ Content-Type: application/xml; charset=utf-8 | |
<recurring type="boolean">false</recurring> | ||
<test type="boolean">true</test> | ||
<voidable type="boolean">true</voidable> | ||
<refundable type="boolean">true</refundable> | ||
<refundable type="boolean">false</refundable> | ||
<ip_address>127.0.0.1</ip_address> | ||
<cvv_result code="M">Match</cvv_result> | ||
<avs_result code="D">Street address and postal code match.</avs_result> | ||
<avs_result_street>Y</avs_result_street> | ||
<avs_result_postal>Y</avs_result_postal> | ||
<created_at type="datetime">2011-04-30T12:00:00Z</created_at> | ||
<ip_address>127.0.0.1</ip_address> | ||
<created_at type="datetime">2016-06-21T16:37:40Z</created_at> | ||
<updated_at type="datetime">2016-06-21T16:37:40Z</updated_at> | ||
<details> | ||
<account> | ||
<account_code>gob</account_code> | ||
|
@@ -33,19 +35,19 @@ Content-Type: application/xml; charset=utf-8 | |
<company nil="nil"></company> | ||
<email>[email protected]</email> | ||
<billing_info type="credit_card"> | ||
<first_name nil="nil"></first_name> | ||
<last_name nil="nil"></last_name> | ||
<address1 nil="nil"></address1> | ||
<first_name>Larry</first_name> | ||
<last_name>David</last_name> | ||
<address1>123 Pretty Pretty Good St.</address1> | ||
<address2 nil="nil"></address2> | ||
<city nil="nil"></city> | ||
<state nil="nil"></state> | ||
<zip nil="nil"></zip> | ||
<country nil="nil"></country> | ||
<city>Los Angeles</city> | ||
<state>CA</state> | ||
<zip>90210</zip> | ||
<country>US</country> | ||
<phone nil="nil"></phone> | ||
<vat_number nil="nil"></vat_number> | ||
<cc_type>visa</cc_type> | ||
<year type="integer">2011</year> | ||
<month type="integer">12</month> | ||
<vat_number>2000</vat_number> | ||
<card_type>Visa</card_type> | ||
<year type="integer">2016</year> | ||
<month type="integer">6</month> | ||
<first_six>411111</first_six> | ||
<last_four>1111</last_four> | ||
</billing_info> | ||
|
@@ -55,4 +57,5 @@ Content-Type: application/xml; charset=utf-8 | |
<score type="integer">99</score> | ||
<decision>DECLINE</decision> | ||
</fraud> | ||
<a name="refund" href="https://api.recurly.com/v2/transactions/abcdef1234567890" method="delete"/> | ||
</transaction> |
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 @@ | ||
<?php | ||
|
||
class Recurly_AccountBalance extends Recurly_Resource | ||
{ | ||
public static function get($accountCode, $client = null) { | ||
return Recurly_Base::_get(Recurly_Client::PATH_ACCOUNTS . '/' . rawurlencode($accountCode) . Recurly_Client::PATH_BALANCE, $client); | ||
} | ||
|
||
function __construct() { | ||
parent::__construct(); | ||
$this->balance_in_cents = new Recurly_CurrencyList('balance_in_cents'); | ||
} | ||
|
||
protected function getNodeName() { | ||
return 'balance'; | ||
} | ||
|
||
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
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
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