Skip to content

Commit

Permalink
Merge pull request #395 from recurly/aaron-suarez/token-support
Browse files Browse the repository at this point in the history
Add gateway_token and gateway_code attributes to BillingInfo class
  • Loading branch information
bhelx authored Jul 17, 2018
2 parents 005f46f + 0c6a81e commit 647fd99
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/recurly/billing_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class BillingInfo < Resource
geo_code
updated_at
external_hpp_type
gateway_token
gateway_code
) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES

# @return ["credit_card", "paypal", "amazon", "bank_account", "roku", nil] The type of billing info.
Expand Down
28 changes: 28 additions & 0 deletions spec/recurly/billing_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

describe BillingInfo do

let(:binfo) {
BillingInfo.new(
:first_name => "Larry",
:last_name => "David",
:card_type => "Visa",
:last_four => "1111",
:city => "Los Angeles",
:state => "CA",
)
}

it "must serialize" do
binfo.gateway_token = "gatewaytoken123"
binfo.gateway_code = "gatewaycode123"
binfo.to_xml.must_equal <<XML.chomp
<billing_info>\
<card_type>Visa</card_type>\
<city>Los Angeles</city>\
<first_name>Larry</first_name>\
<gateway_code>gatewaycode123</gateway_code>\
<gateway_token>gatewaytoken123</gateway_token>\
<last_four>1111</last_four>\
<last_name>David</last_name>\
<state>CA</state>\
</billing_info>
XML
end

describe ".find" do
it "must return an account's billing info when available" do
stub_api_request(
Expand Down

0 comments on commit 647fd99

Please sign in to comment.