Skip to content

Commit

Permalink
Decidir: Patagonia365 Card Type Mapping (activemerchant#5324)
Browse files Browse the repository at this point in the history
Decidir: Patagonia365 Card Type Mapping

Add card map for patagonia_365 to pass payment id to gateway
  • Loading branch information
naashton authored Nov 6, 2024
1 parent 0cb22ec commit d89ed81
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@
* Versapay: Store and Unstore transactions [gasb150] #5315
* Nuvei: Add 3DS Global [javierpedrozaing] #5308
* StripePI: Store the three_d_secure_usage field [yunnydang] #5321
* StripePI: Last4 From Payment Method [nashton] #5322
* StripePI: Last4 From Payment Method [naashton] #5322
* New Card Type: Patagonia365 [gasb150] #5265
* Decidir: Patagonia365 Card Type Mapping [naashton] #5324

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/gateways/decidir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ def add_payment_method_id(credit_card, options)
63
elsif CreditCard.brand?(credit_card.number) == 'naranja'
24
elsif CreditCard.brand?(credit_card.number) == 'patagonia_365'
55
else
1
end
Expand Down
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/gateways/decidir_plus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def add_payment_method_id(options)
63
when 'diners_club'
8
when 'patagonia_365'
55
else
1
end
Expand Down
12 changes: 12 additions & 0 deletions test/remote/gateways/remote_decidir_plus_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def setup
@credit_card = credit_card('4484590159923090')
@american_express = credit_card('376414000000009')
@cabal = credit_card('5896570000000008')
@patagonia_365 = credit_card('5046562602769006')
@visa_debit = credit_card('4517721004856075')
@declined_card = credit_card('4000300011112220')
@options = {
Expand Down Expand Up @@ -231,6 +232,17 @@ def test_successful_purchase_with_card_brand
assert_equal 63, response.params['payment_method_id']
end

def test_successful_purchase_with_card_brand_patagonia_365
options = @options.merge(card_brand: 'patagonia_365')

assert response = @gateway_purchase.store(@patagonia_365)
payment_reference = response.authorization

response = @gateway_purchase.purchase(@amount, payment_reference, options)
assert_success response
assert_equal 55, response.params['payment_method_id']
end

def test_successful_purchase_with_payment_method_id
options = @options.merge(payment_method_id: '63')

Expand Down
9 changes: 9 additions & 0 deletions test/remote/gateways/remote_decidir_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def setup
@credit_card = credit_card('4507990000004905')
@master_card_credit_card = credit_card('5299910010000015')
@amex_credit_card = credit_card('373953192351004')
@patagonia_365_card = credit_card('5046562602769006')
@diners_club_credit_card = credit_card('36463664750005')
@cabal_credit_card = credit_card('5896570000000008')
@naranja_credit_card = credit_card('5895627823453005')
Expand Down Expand Up @@ -66,6 +67,14 @@ def test_successful_purchase_with_amex
assert response.authorization
end

def test_successful_purchase_with_patagonia_365
@patagonia_365_card.brand = 'patagonia_365'
response = @gateway_for_purchase.purchase(@amount, @patagonia_365_card, @options)
assert_success response
assert_equal 'approved', response.message
assert response.authorization
end

def test_successful_purchase_with_network_token_visa
options = {
card_holder_door_number: 1234,
Expand Down

0 comments on commit d89ed81

Please sign in to comment.