Skip to content

Commit

Permalink
Make payment_type optional when creating a payment_detail
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorbrooks committed Apr 2, 2024
1 parent 48f3c3b commit 5742022
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
5 changes: 3 additions & 2 deletions lib/rock_rms/resources/payment_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def list_payment_details(options = {})
end

def create_payment_detail(
payment_type:,
payment_type: nil,
foreign_key: nil,
card_type: nil,
last_4: nil,
Expand All @@ -24,12 +24,13 @@ def create_payment_detail(
post(payment_detail_path, options)
end

def update_payment_detail(id, foreign_key: nil, card_type: nil, last_4: nil)
def update_payment_detail(id, foreign_key: nil, card_type: nil, last_4: nil, currency_type_value_id: nil)
options = {}

options['CreditCardTypeValueId'] = cast_card_type(card_type) if card_type
options['ForeignKey'] = foreign_key if foreign_key
options['AccountNumberMasked'] = "************#{last_4}" if last_4
options['CurrencyTypeValueId'] = currency_type_value_id if currency_type_value_id

patch(payment_detail_path(id), options)
end
Expand Down
7 changes: 0 additions & 7 deletions spec/rock_rms/resources/payment_detail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
end

describe '#create_payment_detail' do
context 'arguments' do
it 'require `payment_type`' do
expect { client.create_payment_detail }
.to raise_error(ArgumentError, /payment_type/)
end
end

subject(:resource) do
client.create_payment_detail(payment_type: 'card', card_type: 'amex')
end
Expand Down

0 comments on commit 5742022

Please sign in to comment.