lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.57.0 vs lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.58.0
- old
+ new
@@ -34,12 +34,10 @@
:electron => "UKE",
:diners_club => "DC",
:jcb => "JCB"
}
- ELECTRON = /^(424519|42496[23]|450875|48440[6-8]|4844[1-5][1-5]|4917[3-5][0-9]|491880)\d{10}(\d{3})?$/
-
AVS_CVV_CODE = {
"NOTPROVIDED" => nil,
"NOTCHECKED" => 'X',
"MATCHED" => 'Y',
"NOTMATCHED" => 'N'
@@ -290,11 +288,10 @@
def map_card_type(credit_card)
raise ArgumentError, "The credit card type must be provided" if card_brand(credit_card).blank?
card_type = card_brand(credit_card).to_sym
- # Check if it is an electron card
- if card_type == :visa && credit_card.number =~ ELECTRON
+ if card_type == :visa && credit_card.electron?
CREDIT_CARDS[:electron]
else
CREDIT_CARDS[card_type]
end
end