Skip to content

Commit

Permalink
Merge pull request #889 from recurly/add_revrec_gift_cards
Browse files Browse the repository at this point in the history
add revrec to gift cards
  • Loading branch information
faiberrec authored Feb 23, 2024
2 parents 9305c96 + bcaa1f3 commit cf497d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/recurly/gift_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GiftCard < Resource
gifter_account_code
recipient_account_code
invoice_number
)
) + RevRec::PRODUCT_ATTRIBUTES
alias to_param id

# Preview a GiftCard given some attributes
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/gift_cards/show-200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ Content-Type: application/xml; charset=utf-8
<delivered_at nil="nil"></delivered_at>
<redeemed_at type="datetime">2016-07-28T00:01:46Z</redeemed_at>
<canceled_at nil="nil"></canceled_at>
<liability_gl_account_id>uf0jwj5zhclg</liability_gl_account_id>
<revenue_gl_account_id>uf0jwincednb</revenue_gl_account_id>
<performance_obligation_id>1</performance_obligation_id>
</gift_card>
15 changes: 14 additions & 1 deletion spec/recurly/gift_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
address.country.must_equal "US"
address.phone.must_equal "337-555-5555"
end

it "should return RevRec settings" do
gift_card.revenue_gl_account_id.must_equal "uf0jwincednb"
gift_card.liability_gl_account_id.must_equal "uf0jwj5zhclg"
gift_card.performance_obligation_id.must_equal "1"
end
end

describe "#to_xml" do
Expand All @@ -86,6 +92,7 @@
gift_card.to_xml.must_equal expected
end
end

describe "when creating the account with the gift card purchase" do
let(:account_data) do
{
Expand Down Expand Up @@ -121,7 +128,10 @@
currency: 'USD',
unit_amount_in_cents: 2000,
gifter_account: account_data,
delivery: delivery_data
delivery: delivery_data,
liability_gl_account_id: "uf0jwj5zhclg",
revenue_gl_account_id: "uf0jwincednb",
performance_obligation_id: "1"
)
}

Expand Down Expand Up @@ -153,7 +163,10 @@
<first_name>Sally</first_name>
<last_name>Smith</last_name>
</gifter_account>
<liability_gl_account_id>uf0jwj5zhclg</liability_gl_account_id>
<performance_obligation_id>1</performance_obligation_id>
<product_code>gift_card</product_code>
<revenue_gl_account_id>uf0jwincednb</revenue_gl_account_id>
<unit_amount_in_cents>2000</unit_amount_in_cents>
</gift_card>
XML
Expand Down

0 comments on commit cf497d6

Please sign in to comment.