diff --git a/Tests/Recurly/Billing_Info_Test.php b/Tests/Recurly/Billing_Info_Test.php index b053fbbe..721b60ef 100644 --- a/Tests/Recurly/Billing_Info_Test.php +++ b/Tests/Recurly/Billing_Info_Test.php @@ -214,15 +214,18 @@ public function testForOnlineBankingPaymentType() { public function testForGatewayToken() { $billing_info = new Recurly_BillingInfo(null, $this->client); + $gateway_attributes = new Recurly_GatewayAttributes(); + $gateway_attributes->account_reference = '123ABC'; $billing_info->gateway_token = 'x1x2x3'; $billing_info->gateway_code = 'abc123'; $billing_info->month = '11'; $billing_info->year = '2025'; + $billing_info->gateway_attributes = $gateway_attributes; $this->assertInstanceOf('Recurly_BillingInfo', $billing_info); $this->assertEquals( $billing_info->xml(), - "\n112025x1x2x3abc123\n" + "\n112025x1x2x3abc123123ABC\n" ); } diff --git a/lib/recurly.php b/lib/recurly.php index f994e787..30bd8b64 100644 --- a/lib/recurly.php +++ b/lib/recurly.php @@ -97,6 +97,7 @@ require_once(__DIR__ . '/recurly/gift_card.php'); require_once(__DIR__ . '/recurly/gift_card_list.php'); require_once(__DIR__ . '/recurly/delivery.php'); +require_once(__DIR__ . '/recurly/gateway_attributes.php'); require_once(__DIR__ . '/recurly/push_notification.php'); require_once(__DIR__ . '/recurly/util/hmac_hash.php'); diff --git a/lib/recurly/billing_info.php b/lib/recurly/billing_info.php index 8546df0b..d3ee35ee 100644 --- a/lib/recurly/billing_info.php +++ b/lib/recurly/billing_info.php @@ -29,6 +29,7 @@ * @property string $online_banking_payment_type Used to indicate payment made out of via an online banking (e.g. ideal). * @property string $gateway_token The token generated by the payment gateway (Vantiv for example). When using this attribute you must set gateway_code. Also, billing_info.month will be the month of the token's expiration instead of the card's expiration month, and billing_info.year will be the year of the token's expiration instead of the card's expiration year. * @property string $gateway_code The identifier for the gateway to use. This code can be found on the payment gateways page in the admin UI. + * @property Recurly_GatewayAttributes $gateway_attributes Additional attributes to send to the gateway * @property int $account_number Bank account number between 4 and 17 digits. * @property int $routing_number Must be a real U.S. bank account routing number. All routing numbers are 9 digits. * @property string $name_on_account The name associated with the bank account. This may be a person's full name or a business name. @@ -146,7 +147,7 @@ protected function getWriteableAttributes() { 'vat_number', 'number', 'month', 'year', 'verification_value', 'account_number', 'routing_number', 'account_type', 'paypal_billing_agreement_id', 'amazon_billing_agreement_id', 'currency', - 'token_id', 'external_hpp_type', 'gateway_token', 'gateway_code', + 'token_id', 'external_hpp_type', 'gateway_token', 'gateway_code', 'gateway_attributes', 'braintree_payment_nonce', 'roku_billing_agreement_id', 'three_d_secure_action_result_token_id', 'transaction_type', 'iban', 'sort_code', 'bsb_code', 'type', 'tax_identifier', 'tax_identifier_type', 'primary_payment_method', 'backup_payment_method', diff --git a/lib/recurly/gateway_attributes.php b/lib/recurly/gateway_attributes.php new file mode 100644 index 00000000..ccb8a111 --- /dev/null +++ b/lib/recurly/gateway_attributes.php @@ -0,0 +1,17 @@ + 'Recurly_ExternalSubscription', 'external_subscriptions' => 'Recurly_ExternalSubscriptionList', 'fraud' => 'Recurly_FraudInfo', + 'gateway_attributes' => 'Recurly_GatewayAttributes', 'gift_card' => 'Recurly_GiftCard', 'gift_cards' => 'Recurly_GiftCardList', 'gifter_account' => 'Recurly_Account',