lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.112.0 vs lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.113.0

- old
+ new

@@ -246,11 +246,11 @@ add_pair(post, :BillingSurname, truncate(last_name, 20)) add_pair(post, :BillingFirstnames, truncate(first_name, 20)) add_pair(post, :BillingAddress1, truncate(billing_address[:address1], 100)) add_pair(post, :BillingAddress2, truncate(billing_address[:address2], 100)) add_pair(post, :BillingCity, truncate(billing_address[:city], 40)) - add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if is_usa(billing_address[:country]) + add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if usa?(billing_address[:country]) add_pair(post, :BillingCountry, truncate(billing_address[:country], 2)) add_pair(post, :BillingPhone, sanitize_phone(billing_address[:phone])) add_pair(post, :BillingPostCode, truncate(billing_address[:zip], 10)) end @@ -259,11 +259,11 @@ add_pair(post, :DeliverySurname, truncate(last_name, 20)) add_pair(post, :DeliveryFirstnames, truncate(first_name, 20)) add_pair(post, :DeliveryAddress1, truncate(shipping_address[:address1], 100)) add_pair(post, :DeliveryAddress2, truncate(shipping_address[:address2], 100)) add_pair(post, :DeliveryCity, truncate(shipping_address[:city], 40)) - add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if is_usa(shipping_address[:country]) + add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if usa?(shipping_address[:country]) add_pair(post, :DeliveryCountry, truncate(shipping_address[:country], 2)) add_pair(post, :DeliveryPhone, sanitize_phone(shipping_address[:phone])) add_pair(post, :DeliveryPostCode, truncate(shipping_address[:zip], 10)) end end @@ -315,11 +315,11 @@ cleansed = phone.to_s.gsub(/[^0-9+]/, '') truncate(cleansed, 20) end - def is_usa(country) + def usa?(country) truncate(country, 2) == 'US' end def map_card_type(credit_card) raise ArgumentError, 'The credit card type must be provided' if card_brand(credit_card).blank? @@ -349,10 +349,10 @@ Response.new(response['Status'] == APPROVED, message_from(response), response, test: test?, authorization: authorization_from(response, parameters, action), avs_result: { street_match: AVS_CODE[response['AddressResult']], - postal_match: AVS_CODE[response['PostCodeResult']], + postal_match: AVS_CODE[response['PostCodeResult']] }, cvv_result: CVV_CODE[response['CV2Result']] ) end