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

BECS support #520

Merged
merged 1 commit into from
Jul 22, 2020
Merged
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
8 changes: 8 additions & 0 deletions Tests/Recurly/Billing_Info_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function defaultResponses() {
array('GET', '/accounts/bankaccount1234567890/billing_info', 'billing_info/show-bank-account-200.xml'),
array('GET', '/accounts/sepa1234567890/billing_info', 'billing_info/show-sepa-200.xml'),
array('GET', '/accounts/bacs1234567890/billing_info', 'billing_info/show-bacs-200.xml'),
array('GET', '/accounts/becs1234567890/billing_info', 'billing_info/show-becs-200.xml'),
array('PUT', '/accounts/abcdef1234567890/billing_info', 'billing_info/show-200.xml'),
array('DELETE', '/accounts/abcdef1234567890/billing_info', 'billing_info/destroy-204.xml'),
array('DELETE', 'https://api.recurly.com/v2/accounts/abcdef1234567890/billing_info', 'billing_info/destroy-204.xml'),
Expand Down Expand Up @@ -91,6 +92,13 @@ public function testGetBacsBillingInfo() {
$this->assertEquals($billing_info->name_on_account, 'BACS');
}

public function testGetBecsBillingInfo() {
$billing_info = Recurly_BillingInfo::get('becs1234567890', $this->client);
$this->assertInstanceOf('Recurly_BillingInfo', $billing_info);
$this->assertEquals($billing_info->bsb_code, '082-082');
$this->assertEquals($billing_info->name_on_account, 'BECS');
}

public function testDelete() {
$billing_info = Recurly_BillingInfo::get('abcdef1234567890', $this->client);

Expand Down
18 changes: 18 additions & 0 deletions Tests/fixtures/billing_info/show-becs-200.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<billing_info href="https://api.recurly.com/v2/accounts/becs1234567890/billing_info" type="becs">
<account href="https://api.recurly.com/v2/accounts/becs1234567890"/>
<company nil="nil"></company>
<address1>123 Fake St.</address1>
<address2 nil="nil"></address2>
<city>Adelaide</city>
<state></state>
<zip>123456</zip>
<country>AU</country>
<phone nil="nil"></phone>
<bsb_code>082-082</bsb_code>
<last_two>78</last_two>
<name_on_account>BECS</name_on_account>
</billing_info>
5 changes: 3 additions & 2 deletions lib/recurly/billing_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
* @property string $card_type Visa, MasterCard, American Express, Discover, JCB, etc
* @property-write string $three_d_secure_action_result_token_id An id returned by Recurly.js referencing the result of the 3DS authentication for PSD2
* @property string $iban International bank account number developed to identify an overseas bank account
* @property string $type The payment method type for a non-credit card based billing info. The value of `bacs` is the only accepted value (Bacs only)
* @property string $type The payment method type for a non-credit card based billing info. `bacs` and `becs` are the only accepted values
* @property string $sort_code Bank identifier code for UK based banks. Required for Bacs based billing infos. (Bacs only)
* @property string $bsb_code Bank identifier code for AU based banks. Required for Becs based billing infos.
*/
class Recurly_BillingInfo extends Recurly_Resource
{
Expand Down Expand Up @@ -109,7 +110,7 @@ protected function getWriteableAttributes() {
'paypal_billing_agreement_id', 'amazon_billing_agreement_id', 'currency',
'token_id', 'external_hpp_type', 'gateway_token', 'gateway_code',
'braintree_payment_nonce', 'roku_billing_agreement_id',
'three_d_secure_action_result_token_id', 'transaction_type', 'iban', 'sort_code', 'type'
'three_d_secure_action_result_token_id', 'transaction_type', 'iban', 'sort_code', 'bsb_code', 'type'
);
}
}