activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -5,11 +5,12 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT
|
6
6
|
NL NO PL PT RO SE SI SK TR VA)
|
7
7
|
|
8
|
-
self.supported_cardtypes = [
|
8
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover union_pay jcb]
|
9
9
|
self.homepage_url = 'https://paymill.com'
|
10
10
|
self.display_name = 'PAYMILL'
|
11
11
|
self.money_format = :cents
|
12
12
|
self.default_currency = 'EUR'
|
13
|
+
self.live_url = 'https://api.paymill.com/v2/'
|
13
14
|
|
14
15
|
def initialize(options = {})
|
15
16
|
requires!(options, :public_key, :private_key)
|
@@ -29,43 +30,73 @@ module ActiveMerchant #:nodoc:
|
|
29
30
|
|
30
31
|
add_amount(post, money, options)
|
31
32
|
post[:preauthorization] = preauth(authorization)
|
32
|
-
post[:description] = options[:
|
33
|
+
post[:description] = options[:order_id]
|
33
34
|
post[:source] = 'active_merchant'
|
34
35
|
commit(:post, 'transactions', post)
|
35
36
|
end
|
36
37
|
|
37
|
-
def refund(money, authorization, options={})
|
38
|
+
def refund(money, authorization, options = {})
|
38
39
|
post = {}
|
39
40
|
|
40
41
|
post[:amount] = amount(money)
|
41
|
-
post[:description] = options[:
|
42
|
+
post[:description] = options[:order_id]
|
42
43
|
commit(:post, "refunds/#{transaction_id(authorization)}", post)
|
43
44
|
end
|
44
45
|
|
45
|
-
def void(authorization, options={})
|
46
|
+
def void(authorization, options = {})
|
46
47
|
commit(:delete, "preauthorizations/#{preauth(authorization)}")
|
47
48
|
end
|
48
49
|
|
49
|
-
def store(credit_card, options={})
|
50
|
-
|
50
|
+
def store(credit_card, options = {})
|
51
|
+
# The store request requires a currency and amount of at least $1 USD.
|
52
|
+
# This is used for an authorization that is handled internally by Paymill.
|
53
|
+
options[:currency] = 'USD'
|
54
|
+
options[:money] = 100
|
55
|
+
|
56
|
+
save_card(credit_card, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def supports_scrubbing
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
def scrub(transcript)
|
64
|
+
transcript.
|
65
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
66
|
+
gsub(/(account.number=)(\d*)/, '\1[FILTERED]').
|
67
|
+
gsub(/(account.verification=)(\d*)/, '\1[FILTERED]')
|
68
|
+
end
|
69
|
+
|
70
|
+
def verify_credentials
|
71
|
+
begin
|
72
|
+
ssl_get(live_url + 'transactions/nonexistent', headers)
|
73
|
+
rescue ResponseError => e
|
74
|
+
return false if e.response.code.to_i == 401
|
75
|
+
end
|
76
|
+
|
77
|
+
true
|
51
78
|
end
|
52
79
|
|
53
80
|
private
|
54
81
|
|
55
|
-
def add_credit_card(post, credit_card)
|
82
|
+
def add_credit_card(post, credit_card, options)
|
83
|
+
post['account.holder'] = (credit_card.try(:name) || '')
|
56
84
|
post['account.number'] = credit_card.number
|
57
|
-
post['account.expiry.month'] = sprintf(
|
58
|
-
post['account.expiry.year'] = sprintf(
|
85
|
+
post['account.expiry.month'] = sprintf('%.2i', credit_card.month)
|
86
|
+
post['account.expiry.year'] = sprintf('%.4i', credit_card.year)
|
59
87
|
post['account.verification'] = credit_card.verification_value
|
88
|
+
post['account.email'] = (options[:email] || nil)
|
89
|
+
post['presentation.amount3D'] = (options[:money] || nil)
|
90
|
+
post['presentation.currency3D'] = (options[:currency] || currency(options[:money]))
|
60
91
|
end
|
61
92
|
|
62
93
|
def headers
|
63
94
|
{ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
|
64
95
|
end
|
65
96
|
|
66
|
-
def commit(method,
|
97
|
+
def commit(method, action, parameters = nil)
|
67
98
|
begin
|
68
|
-
raw_response = ssl_request(method,
|
99
|
+
raw_response = ssl_request(method, live_url + action, post_data(parameters), headers)
|
69
100
|
rescue ResponseError => e
|
70
101
|
begin
|
71
102
|
parsed = JSON.parse(e.response.body)
|
@@ -81,11 +112,11 @@ module ActiveMerchant #:nodoc:
|
|
81
112
|
def response_from(raw_response)
|
82
113
|
parsed = JSON.parse(raw_response)
|
83
114
|
options = {
|
84
|
-
:
|
85
|
-
:
|
115
|
+
authorization: authorization_from(parsed),
|
116
|
+
test: (parsed['mode'] == 'test')
|
86
117
|
}
|
87
118
|
|
88
|
-
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'] == 20000)
|
119
|
+
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'].to_i == 20000)
|
89
120
|
Response.new(succeeded, response_message(parsed), parsed, options)
|
90
121
|
end
|
91
122
|
|
@@ -96,16 +127,17 @@ module ActiveMerchant #:nodoc:
|
|
96
127
|
[
|
97
128
|
parsed_data['id'],
|
98
129
|
parsed_data['preauthorization'].try(:[], 'id')
|
99
|
-
].join(
|
130
|
+
].join(';')
|
100
131
|
end
|
101
132
|
|
102
133
|
def action_with_token(action, money, payment_method, options)
|
134
|
+
options[:money] = money
|
103
135
|
case payment_method
|
104
136
|
when String
|
105
137
|
self.send("#{action}_with_token", money, payment_method, options)
|
106
138
|
else
|
107
139
|
MultiResponse.run do |r|
|
108
|
-
r.process { save_card(payment_method) }
|
140
|
+
r.process { save_card(payment_method, options) }
|
109
141
|
r.process { self.send("#{action}_with_token", money, r.authorization, options) }
|
110
142
|
end
|
111
143
|
end
|
@@ -116,7 +148,7 @@ module ActiveMerchant #:nodoc:
|
|
116
148
|
|
117
149
|
add_amount(post, money, options)
|
118
150
|
post[:token] = card_token
|
119
|
-
post[:description] = options[:
|
151
|
+
post[:description] = options[:order_id]
|
120
152
|
post[:source] = 'active_merchant'
|
121
153
|
commit(:post, 'transactions', post)
|
122
154
|
end
|
@@ -126,15 +158,15 @@ module ActiveMerchant #:nodoc:
|
|
126
158
|
|
127
159
|
add_amount(post, money, options)
|
128
160
|
post[:token] = card_token
|
129
|
-
post[:description] = options[:
|
161
|
+
post[:description] = options[:order_id]
|
130
162
|
post[:source] = 'active_merchant'
|
131
163
|
commit(:post, 'preauthorizations', post)
|
132
164
|
end
|
133
165
|
|
134
|
-
def save_card(credit_card)
|
166
|
+
def save_card(credit_card, options)
|
135
167
|
post = {}
|
136
168
|
|
137
|
-
add_credit_card(post, credit_card)
|
169
|
+
add_credit_card(post, credit_card, options)
|
138
170
|
post['channel.id'] = @options[:public_key]
|
139
171
|
post['jsonPFunction'] = 'jsonPFunction'
|
140
172
|
post['transaction.mode'] = (test? ? 'CONNECTOR_TEST' : 'LIVE')
|
@@ -142,14 +174,14 @@ module ActiveMerchant #:nodoc:
|
|
142
174
|
begin
|
143
175
|
raw_response = ssl_request(:get, "#{save_card_url}?#{post_data(post)}", nil, {})
|
144
176
|
rescue ResponseError => e
|
145
|
-
return Response.new(false, e.response.body
|
177
|
+
return Response.new(false, e.response.body)
|
146
178
|
end
|
147
179
|
|
148
180
|
response_for_save_from(raw_response)
|
149
181
|
end
|
150
182
|
|
151
183
|
def response_for_save_from(raw_response)
|
152
|
-
options = { :
|
184
|
+
options = { test: test? }
|
153
185
|
|
154
186
|
parser = ResponseParser.new(raw_response, options)
|
155
187
|
parser.generate_response
|
@@ -166,8 +198,8 @@ module ActiveMerchant #:nodoc:
|
|
166
198
|
def post_data(params)
|
167
199
|
return nil unless params
|
168
200
|
|
169
|
-
no_blanks = params.reject { |
|
170
|
-
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
201
|
+
no_blanks = params.reject { |_key, value| value.blank? }
|
202
|
+
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
171
203
|
end
|
172
204
|
|
173
205
|
def add_amount(post, money, options)
|
@@ -176,7 +208,7 @@ module ActiveMerchant #:nodoc:
|
|
176
208
|
end
|
177
209
|
|
178
210
|
def preauth(authorization)
|
179
|
-
authorization.split(
|
211
|
+
authorization.split(';').last
|
180
212
|
end
|
181
213
|
|
182
214
|
def transaction_id(authorization)
|
@@ -184,61 +216,119 @@ module ActiveMerchant #:nodoc:
|
|
184
216
|
end
|
185
217
|
|
186
218
|
RESPONSE_CODES = {
|
187
|
-
10001 =>
|
188
|
-
10002 =>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
219
|
+
10001 => 'Undefined response',
|
220
|
+
10002 => 'Waiting for something',
|
221
|
+
11000 => 'Retry request at a later time',
|
222
|
+
|
223
|
+
20000 => 'Operation successful',
|
224
|
+
20100 => 'Funds held by acquirer',
|
225
|
+
20101 => 'Funds held by acquirer because merchant is new',
|
226
|
+
20200 => 'Transaction reversed',
|
227
|
+
20201 => 'Reversed due to chargeback',
|
228
|
+
20202 => 'Reversed due to money-back guarantee',
|
229
|
+
20203 => 'Reversed due to complaint by buyer',
|
230
|
+
20204 => 'Payment has been refunded',
|
231
|
+
20300 => 'Reversal has been canceled',
|
232
|
+
22000 => 'Initiation of transaction successful',
|
233
|
+
|
234
|
+
30000 => 'Transaction still in progress',
|
235
|
+
30100 => 'Transaction has been accepted',
|
236
|
+
31000 => 'Transaction pending',
|
237
|
+
31100 => 'Pending due to address',
|
238
|
+
31101 => 'Pending due to uncleared eCheck',
|
239
|
+
31102 => 'Pending due to risk review',
|
240
|
+
31103 => 'Pending due regulatory review',
|
241
|
+
31104 => 'Pending due to unregistered/unconfirmed receiver',
|
242
|
+
31200 => 'Pending due to unverified account',
|
243
|
+
31201 => 'Pending due to non-captured funds',
|
244
|
+
31202 => 'Pending due to international account (accept manually)',
|
245
|
+
31203 => 'Pending due to currency conflict (accept manually)',
|
246
|
+
31204 => 'Pending due to fraud filters (accept manually)',
|
247
|
+
|
248
|
+
40000 => 'Problem with transaction data',
|
249
|
+
40001 => 'Problem with payment data',
|
250
|
+
40002 => 'Invalid checksum',
|
251
|
+
40100 => 'Problem with credit card data',
|
252
|
+
40101 => 'Problem with CVV',
|
253
|
+
40102 => 'Card expired or not yet valid',
|
254
|
+
40103 => 'Card limit exceeded',
|
255
|
+
40104 => 'Card is not valid',
|
256
|
+
40105 => 'Expiry date not valid',
|
257
|
+
40106 => 'Credit card brand required',
|
258
|
+
40200 => 'Problem with bank account data',
|
259
|
+
40201 => 'Bank account data combination mismatch',
|
260
|
+
40202 => 'User authentication failed',
|
261
|
+
40300 => 'Problem with 3-D Secure data',
|
262
|
+
40301 => 'Currency/amount mismatch',
|
263
|
+
40400 => 'Problem with input data',
|
264
|
+
40401 => 'Amount too low or zero',
|
265
|
+
40402 => 'Usage field too long',
|
266
|
+
40403 => 'Currency not allowed',
|
267
|
+
40410 => 'Problem with shopping cart data',
|
268
|
+
40420 => 'Problem with address data',
|
269
|
+
40500 => 'Permission error with acquirer API',
|
270
|
+
40510 => 'Rate limit reached for acquirer API',
|
271
|
+
42000 => 'Initiation of transaction failed',
|
272
|
+
42410 => 'Initiation of transaction expired',
|
273
|
+
|
274
|
+
50000 => 'Problem with back end',
|
275
|
+
50001 => 'Country blacklisted',
|
276
|
+
50002 => 'IP address blacklisted',
|
277
|
+
50004 => 'Live mode not allowed',
|
278
|
+
50005 => 'Insufficient permissions (API key)',
|
279
|
+
50100 => 'Technical error with credit card',
|
280
|
+
50101 => 'Error limit exceeded',
|
281
|
+
50102 => 'Card declined',
|
282
|
+
50103 => 'Manipulation or stolen card',
|
283
|
+
50104 => 'Card restricted',
|
284
|
+
50105 => 'Invalid configuration data',
|
285
|
+
50200 => 'Technical error with bank account',
|
286
|
+
50201 => 'Account blacklisted',
|
287
|
+
50300 => 'Technical error with 3-D Secure',
|
288
|
+
50400 => 'Declined because of risk issues',
|
289
|
+
50401 => 'Checksum was wrong',
|
290
|
+
50402 => 'Bank account number was invalid (formal check)',
|
291
|
+
50403 => 'Technical error with risk check',
|
292
|
+
50404 => 'Unknown error with risk check',
|
293
|
+
50405 => 'Unknown bank code',
|
294
|
+
50406 => 'Open chargeback',
|
295
|
+
50407 => 'Historical chargeback',
|
296
|
+
50408 => 'Institution / public bank account (NCA)',
|
297
|
+
50409 => 'KUNO/Fraud',
|
298
|
+
50410 => 'Personal Account Protection (PAP)',
|
299
|
+
50420 => 'Rejected due to acquirer fraud settings',
|
300
|
+
50430 => 'Rejected due to acquirer risk settings',
|
301
|
+
50440 => 'Failed due to restrictions with acquirer account',
|
302
|
+
50450 => 'Failed due to restrictions with user account',
|
303
|
+
50500 => 'General timeout',
|
304
|
+
50501 => 'Timeout on side of the acquirer',
|
305
|
+
50502 => 'Risk management transaction timeout',
|
306
|
+
50600 => 'Duplicate operation',
|
307
|
+
50700 => 'Cancelled by user',
|
308
|
+
50710 => 'Failed due to funding source',
|
309
|
+
50711 => 'Payment method not usable, use other payment method',
|
310
|
+
50712 => 'Limit of funding source was exceeded',
|
311
|
+
50713 => 'Means of payment not reusable (canceled by user)',
|
312
|
+
50714 => 'Means of payment not reusable (expired)',
|
313
|
+
50720 => 'Rejected by acquirer',
|
314
|
+
50730 => 'Transaction denied by merchant',
|
315
|
+
50800 => 'Preauthorisation failed',
|
316
|
+
50810 => 'Authorisation has been voided',
|
317
|
+
50820 => 'Authorisation period expired'
|
227
318
|
}
|
228
319
|
|
229
320
|
def response_message(parsed_response)
|
230
|
-
return parsed_response[
|
231
|
-
return
|
321
|
+
return parsed_response['error'] if parsed_response['error']
|
322
|
+
return 'Transaction approved.' if parsed_response['data'] == []
|
232
323
|
|
233
|
-
code = parsed_response[
|
324
|
+
code = parsed_response['data']['response_code'].to_i
|
234
325
|
RESPONSE_CODES[code] || code.to_s
|
235
326
|
end
|
236
327
|
|
237
|
-
|
238
328
|
class ResponseParser
|
239
329
|
attr_reader :raw_response, :parsed, :succeeded, :message, :options
|
240
330
|
|
241
|
-
def initialize(raw_response=
|
331
|
+
def initialize(raw_response = '', options = {})
|
242
332
|
@raw_response = raw_response
|
243
333
|
@options = options
|
244
334
|
end
|
@@ -267,12 +357,10 @@ module ActiveMerchant #:nodoc:
|
|
267
357
|
|
268
358
|
def handle_response_correct_parsing
|
269
359
|
@message = parsed['transaction']['processing']['return']['message']
|
270
|
-
if @succeeded =
|
271
|
-
@options[:authorization] = parsed['transaction']['identification']['uniqueId']
|
272
|
-
end
|
360
|
+
@options[:authorization] = parsed['transaction']['identification']['uniqueId'] if @succeeded = ack?
|
273
361
|
end
|
274
362
|
|
275
|
-
def
|
363
|
+
def ack?
|
276
364
|
parsed['transaction']['processing']['result'] == 'ACK'
|
277
365
|
end
|
278
366
|
end
|
@@ -2,7 +2,10 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
# This module is included in both PaypalGateway and PaypalExpressGateway
|
4
4
|
module PaypalCommonAPI
|
5
|
-
|
5
|
+
include Empty
|
6
|
+
|
7
|
+
API_VERSION = '124'
|
8
|
+
API_VERSION_3DS2 = '214.0'
|
6
9
|
|
7
10
|
URLS = {
|
8
11
|
:test => { :certificate => 'https://api.sandbox.paypal.com/2.0/',
|
@@ -38,6 +41,20 @@ module ActiveMerchant #:nodoc:
|
|
38
41
|
|
39
42
|
FRAUD_REVIEW_CODE = "11610"
|
40
43
|
|
44
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
45
|
+
'15005' => :card_declined,
|
46
|
+
'10754' => :card_declined,
|
47
|
+
'10752' => :card_declined,
|
48
|
+
'10759' => :card_declined,
|
49
|
+
'10761' => :card_declined,
|
50
|
+
'15002' => :card_declined,
|
51
|
+
'11084' => :card_declined,
|
52
|
+
'15004' => :incorrect_cvc,
|
53
|
+
'10762' => :invalid_cvc,
|
54
|
+
}
|
55
|
+
|
56
|
+
STANDARD_ERROR_CODE_MAPPING.default = :processing_error
|
57
|
+
|
41
58
|
def self.included(base)
|
42
59
|
base.default_currency = 'USD'
|
43
60
|
base.cattr_accessor :pem_file
|
@@ -253,7 +270,21 @@ module ActiveMerchant #:nodoc:
|
|
253
270
|
commit 'ManagePendingTransactionStatus', build_manage_pending_transaction_status(transaction_id, action)
|
254
271
|
end
|
255
272
|
|
273
|
+
def supports_scrubbing?
|
274
|
+
true
|
275
|
+
end
|
276
|
+
|
277
|
+
def scrub(transcript)
|
278
|
+
transcript.
|
279
|
+
gsub(%r((<n1:Password>).+(</n1:Password>)), '\1[FILTERED]\2').
|
280
|
+
gsub(%r((<n1:Username>).+(</n1:Username>)), '\1[FILTERED]\2').
|
281
|
+
gsub(%r((<n1:Signature>).+(</n1:Signature>)), '\1[FILTERED]\2').
|
282
|
+
gsub(%r((<n2:CreditCardNumber>).+(</n2:CreditCardNumber)), '\1[FILTERED]\2').
|
283
|
+
gsub(%r((<n2:CVV2>)\d+(</n2:CVV2)), '\1[FILTERED]\2')
|
284
|
+
end
|
285
|
+
|
256
286
|
private
|
287
|
+
|
257
288
|
def build_request_wrapper(action, options = {})
|
258
289
|
xml = Builder::XmlMarkup.new :indent => 2
|
259
290
|
xml.tag! action + 'Req', 'xmlns' => PAYPAL_NAMESPACE do
|
@@ -556,7 +587,7 @@ module ActiveMerchant #:nodoc:
|
|
556
587
|
xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
|
557
588
|
|
558
589
|
# All of the values must be included together and add up to the order total
|
559
|
-
if [:subtotal, :shipping, :handling, :tax].all?{ |o| options.
|
590
|
+
if [:subtotal, :shipping, :handling, :tax].all?{ |o| options[o].present? }
|
560
591
|
xml.tag! 'n2:ItemTotal', localized_amount(options[:subtotal], currency_code), 'currencyID' => currency_code
|
561
592
|
xml.tag! 'n2:ShippingTotal', localized_amount(options[:shipping], currency_code),'currencyID' => currency_code
|
562
593
|
xml.tag! 'n2:HandlingTotal', localized_amount(options[:handling], currency_code),'currencyID' => currency_code
|
@@ -573,7 +604,7 @@ module ActiveMerchant #:nodoc:
|
|
573
604
|
xml.tag! 'n2:Custom', options[:custom] unless options[:custom].blank?
|
574
605
|
|
575
606
|
xml.tag! 'n2:InvoiceID', (options[:order_id] || options[:invoice_id]) unless (options[:order_id] || options[:invoice_id]).blank?
|
576
|
-
xml
|
607
|
+
add_button_source(xml)
|
577
608
|
|
578
609
|
# The notify URL applies only to DoExpressCheckoutPayment.
|
579
610
|
# This value is ignored when set in SetExpressCheckout or GetExpressCheckoutDetails
|
@@ -593,11 +624,18 @@ module ActiveMerchant #:nodoc:
|
|
593
624
|
end
|
594
625
|
end
|
595
626
|
|
627
|
+
def add_button_source(xml)
|
628
|
+
button_source = (@options[:button_source] || application_id)
|
629
|
+
if !empty?(button_source)
|
630
|
+
xml.tag! 'n2:ButtonSource', button_source.to_s.slice(0, 32)
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
596
634
|
def add_express_only_payment_details(xml, options = {})
|
597
635
|
add_optional_fields(xml,
|
598
|
-
%w{n2:NoteText n2:
|
599
|
-
n2:TransactionId n2:
|
600
|
-
n2:PaymentRequestID n2:
|
636
|
+
%w{n2:NoteText n2:PaymentAction
|
637
|
+
n2:TransactionId n2:AllowedPaymentMethod
|
638
|
+
n2:PaymentRequestID n2:SoftDescriptor },
|
601
639
|
options)
|
602
640
|
end
|
603
641
|
|
@@ -628,11 +666,21 @@ module ActiveMerchant #:nodoc:
|
|
628
666
|
:test => test?,
|
629
667
|
:authorization => authorization_from(response),
|
630
668
|
:fraud_review => fraud_review?(response),
|
669
|
+
:error_code => standardized_error_code(response),
|
631
670
|
:avs_result => { :code => response[:avs_code] },
|
632
671
|
:cvv_result => response[:cvv2_code]
|
633
672
|
)
|
634
673
|
end
|
635
674
|
|
675
|
+
def standardized_error_code(response)
|
676
|
+
STANDARD_ERROR_CODE_MAPPING[error_codes(response).first]
|
677
|
+
end
|
678
|
+
|
679
|
+
def error_codes(response)
|
680
|
+
return [] unless response.has_key?(:error_codes)
|
681
|
+
response[:error_codes].split(',')
|
682
|
+
end
|
683
|
+
|
636
684
|
def fraud_review?(response)
|
637
685
|
response[:error_codes] == FRAUD_REVIEW_CODE
|
638
686
|
end
|
@@ -659,7 +707,7 @@ module ActiveMerchant #:nodoc:
|
|
659
707
|
end
|
660
708
|
|
661
709
|
def item_amount(amount, currency_code)
|
662
|
-
if amount.to_i < 0 &&
|
710
|
+
if amount.to_i < 0 && non_fractional_currency?(currency_code)
|
663
711
|
amount(amount).to_f.floor
|
664
712
|
else
|
665
713
|
localized_amount(amount, currency_code)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
require 'active_merchant/billing/gateways/paypal/paypal_recurring_api'
|
3
|
+
require 'active_merchant/billing/gateways/paypal_express'
|
4
4
|
|
5
5
|
module ActiveMerchant #:nodoc:
|
6
6
|
module Billing #:nodoc:
|
@@ -8,8 +8,8 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
include PaypalCommonAPI
|
9
9
|
include PaypalRecurringApi
|
10
10
|
|
11
|
-
self.
|
12
|
-
self.
|
11
|
+
self.supported_countries = %w[CA NZ GB US]
|
12
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
13
13
|
self.homepage_url = 'https://www.paypal.com/us/webapps/mpp/paypal-payments-pro'
|
14
14
|
self.display_name = 'PayPal Payments Pro (US)'
|
15
15
|
|
@@ -50,18 +50,19 @@ module ActiveMerchant #:nodoc:
|
|
50
50
|
|
51
51
|
def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
|
52
52
|
transaction_type = define_transaction_type(credit_card_or_referenced_id)
|
53
|
-
reference_id = credit_card_or_referenced_id if transaction_type ==
|
53
|
+
reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'
|
54
54
|
|
55
55
|
billing_address = options[:billing_address] || options[:address]
|
56
56
|
currency_code = options[:currency] || currency(money)
|
57
57
|
|
58
|
-
xml = Builder::XmlMarkup.new :
|
58
|
+
xml = Builder::XmlMarkup.new indent: 2
|
59
59
|
xml.tag! transaction_type + 'Req', 'xmlns' => PAYPAL_NAMESPACE do
|
60
60
|
xml.tag! transaction_type + 'Request', 'xmlns:n2' => EBAY_NAMESPACE do
|
61
|
-
xml.tag! 'n2:Version',
|
61
|
+
xml.tag! 'n2:Version', api_version(options)
|
62
62
|
xml.tag! 'n2:' + transaction_type + 'RequestDetails' do
|
63
63
|
xml.tag! 'n2:ReferenceID', reference_id if transaction_type == 'DoReferenceTransaction'
|
64
64
|
xml.tag! 'n2:PaymentAction', action
|
65
|
+
add_descriptors(xml, options)
|
65
66
|
add_payment_details(xml, money, currency_code, options)
|
66
67
|
add_credit_card(xml, credit_card_or_referenced_id, billing_address, options) unless transaction_type == 'DoReferenceTransaction'
|
67
68
|
xml.tag! 'n2:IPAddress', options[:ip]
|
@@ -72,19 +73,19 @@ module ActiveMerchant #:nodoc:
|
|
72
73
|
xml.target!
|
73
74
|
end
|
74
75
|
|
76
|
+
def api_version(options)
|
77
|
+
return API_VERSION_3DS2 if options.dig(:three_d_secure, :version) =~ /^2/
|
78
|
+
|
79
|
+
API_VERSION
|
80
|
+
end
|
81
|
+
|
75
82
|
def add_credit_card(xml, credit_card, address, options)
|
76
83
|
xml.tag! 'n2:CreditCard' do
|
77
84
|
xml.tag! 'n2:CreditCardType', credit_card_type(card_brand(credit_card))
|
78
85
|
xml.tag! 'n2:CreditCardNumber', credit_card.number
|
79
86
|
xml.tag! 'n2:ExpMonth', format(credit_card.month, :two_digits)
|
80
87
|
xml.tag! 'n2:ExpYear', format(credit_card.year, :four_digits)
|
81
|
-
xml.tag! 'n2:CVV2', credit_card.verification_value
|
82
|
-
|
83
|
-
if [ 'switch', 'solo' ].include?(card_brand(credit_card).to_s)
|
84
|
-
xml.tag! 'n2:StartMonth', format(credit_card.start_month, :two_digits) unless credit_card.start_month.blank?
|
85
|
-
xml.tag! 'n2:StartYear', format(credit_card.start_year, :four_digits) unless credit_card.start_year.blank?
|
86
|
-
xml.tag! 'n2:IssueNumber', format(credit_card.issue_number, :two_digits) unless credit_card.issue_number.blank?
|
87
|
-
end
|
88
|
+
xml.tag! 'n2:CVV2', credit_card.verification_value unless credit_card.verification_value.blank?
|
88
89
|
|
89
90
|
xml.tag! 'n2:CardOwner' do
|
90
91
|
xml.tag! 'n2:PayerName' do
|
@@ -95,6 +96,26 @@ module ActiveMerchant #:nodoc:
|
|
95
96
|
xml.tag! 'n2:Payer', options[:email]
|
96
97
|
add_address(xml, 'n2:Address', address)
|
97
98
|
end
|
99
|
+
|
100
|
+
add_three_d_secure(xml, options) if options[:three_d_secure]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_descriptors(xml, options)
|
105
|
+
xml.tag! 'n2:SoftDescriptor', options[:soft_descriptor] unless options[:soft_descriptor].blank?
|
106
|
+
xml.tag! 'n2:SoftDescriptorCity', options[:soft_descriptor_city] unless options[:soft_descriptor_city].blank?
|
107
|
+
end
|
108
|
+
|
109
|
+
def add_three_d_secure(xml, options)
|
110
|
+
three_d_secure = options[:three_d_secure]
|
111
|
+
xml.tag! 'ThreeDSecureRequest' do
|
112
|
+
xml.tag! 'MpiVendor3ds', 'Y'
|
113
|
+
xml.tag! 'AuthStatus3ds', three_d_secure[:authentication_response_status] || three_d_secure[:trans_status] if three_d_secure[:authentication_response_status] || three_d_secure[:trans_status]
|
114
|
+
xml.tag! 'Cavv', three_d_secure[:cavv] unless three_d_secure[:cavv].blank?
|
115
|
+
xml.tag! 'Eci3ds', three_d_secure[:eci] unless three_d_secure[:eci].blank?
|
116
|
+
xml.tag! 'Xid', three_d_secure[:xid] unless three_d_secure[:xid].blank?
|
117
|
+
xml.tag! 'ThreeDSVersion', three_d_secure[:version] unless three_d_secure[:version].blank?
|
118
|
+
xml.tag! 'DSTransactionId', three_d_secure[:ds_transaction_id] unless three_d_secure[:ds_transaction_id].blank?
|
98
119
|
end
|
99
120
|
end
|
100
121
|
|
@@ -104,13 +125,11 @@ module ActiveMerchant #:nodoc:
|
|
104
125
|
when 'master' then 'MasterCard'
|
105
126
|
when 'discover' then 'Discover'
|
106
127
|
when 'american_express' then 'Amex'
|
107
|
-
when 'switch' then 'Switch'
|
108
|
-
when 'solo' then 'Solo'
|
109
128
|
end
|
110
129
|
end
|
111
130
|
|
112
131
|
def build_response(success, message, response, options = {})
|
113
|
-
|
132
|
+
Response.new(success, message, response, options)
|
114
133
|
end
|
115
134
|
end
|
116
135
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/paypal'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
# The PayPal gateway for PayPal Website Payments Pro Canada only supports Visa and MasterCard
|
6
6
|
class PaypalCaGateway < PaypalGateway
|
7
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master]
|
8
8
|
self.supported_countries = ['CA']
|
9
9
|
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
|
10
10
|
self.display_name = 'PayPal Website Payments Pro (CA)'
|