diff --git a/lib/chartmogul/transactions/payment.rb b/lib/chartmogul/transactions/payment.rb index ad8ba13..114518f 100644 --- a/lib/chartmogul/transactions/payment.rb +++ b/lib/chartmogul/transactions/payment.rb @@ -12,7 +12,7 @@ class Payment < APIResource writeable_attr :date, type: :time writeable_attr :result writeable_attr :external_id - + writeable_attr :amount_in_cents writeable_attr :invoice_uuid def initialize(attributes = {}) diff --git a/lib/chartmogul/transactions/refund.rb b/lib/chartmogul/transactions/refund.rb index 76593b7..6b5db40 100644 --- a/lib/chartmogul/transactions/refund.rb +++ b/lib/chartmogul/transactions/refund.rb @@ -12,7 +12,7 @@ class Refund < APIResource writeable_attr :date, type: :time writeable_attr :result writeable_attr :external_id - + writeable_attr :amount_in_cents writeable_attr :invoice_uuid def initialize(attributes = {}) diff --git a/lib/chartmogul/version.rb b/lib/chartmogul/version.rb index 6a7ca87..dc9270d 100644 --- a/lib/chartmogul/version.rb +++ b/lib/chartmogul/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ChartMogul - VERSION = '1.7.0' + VERSION = '1.7.1' end diff --git a/spec/chartmogul/transactions/payment_spec.rb b/spec/chartmogul/transactions/payment_spec.rb index 6ffe798..d373bba 100644 --- a/spec/chartmogul/transactions/payment_spec.rb +++ b/spec/chartmogul/transactions/payment_spec.rb @@ -9,7 +9,8 @@ date: '2016-01-01 12:00:00', result: 'successful', external_id: 'pay_ext_id', - uuid: 'tr_1234-5678-9012-34567' + uuid: 'tr_1234-5678-9012-34567', + amount_in_cents: 500 } end @@ -35,6 +36,10 @@ it 'sets the external_id attribute' do expect(subject.external_id).to eq('pay_ext_id') end + + it 'sets the amount_in_cents attribute' do + expect(subject.amount_in_cents).to eq(500) + end end describe '.new_from_json' do @@ -58,6 +63,10 @@ it 'sets the external_id attribute' do expect(subject.external_id).to eq('pay_ext_id') end + + it 'sets the amount_in_cents attribute' do + expect(subject.amount_in_cents).to eq(500) + end end describe 'API Interactions', vcr: true do @@ -90,7 +99,8 @@ date: Time.utc(2016, 1, 1, 12), result: 'successful', external_id: 'test_tr_ext_id', - invoice_uuid: invoice.uuid + invoice_uuid: invoice.uuid, + amount_in_cents: 500 ).create! expect(transaction.uuid).to be diff --git a/spec/chartmogul/transactions/refund_spec.rb b/spec/chartmogul/transactions/refund_spec.rb index 642ea77..fae4afd 100644 --- a/spec/chartmogul/transactions/refund_spec.rb +++ b/spec/chartmogul/transactions/refund_spec.rb @@ -9,7 +9,8 @@ date: '2016-01-01 12:00:00', result: 'successful', external_id: 'ref_ext_id', - uuid: 'tr_1234-5678-9012-34567' + uuid: 'tr_1234-5678-9012-34567', + amount_in_cents: 500 } end @@ -35,6 +36,10 @@ it 'sets the external_id attribute' do expect(subject.external_id).to eq('ref_ext_id') end + + it 'sets the amount_in_cents attribute' do + expect(subject.amount_in_cents).to eq(500) + end end describe '.new_from_json' do @@ -58,5 +63,9 @@ it 'sets the external_id attribute' do expect(subject.external_id).to eq('ref_ext_id') end + + it 'sets the amount_in_cents attribute' do + expect(subject.amount_in_cents).to eq(500) + end end end