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
@@ -13,40 +13,64 @@ module ActiveMerchant #:nodoc:
|
|
13
13
|
APPROVED = 'OK'
|
14
14
|
|
15
15
|
TRANSACTIONS = {
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
16
|
+
purchase: 'PAYMENT',
|
17
|
+
credit: 'REFUND',
|
18
|
+
authorization: 'DEFERRED',
|
19
|
+
capture: 'RELEASE',
|
20
|
+
void: 'VOID',
|
21
|
+
abort: 'ABORT',
|
22
|
+
store: 'TOKEN',
|
23
|
+
unstore: 'REMOVETOKEN',
|
24
|
+
repeat: 'REPEAT'
|
24
25
|
}
|
25
26
|
|
26
27
|
CREDIT_CARDS = {
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:diners_club => "DC",
|
36
|
-
:jcb => "JCB"
|
28
|
+
visa: 'VISA',
|
29
|
+
master: 'MC',
|
30
|
+
delta: 'DELTA',
|
31
|
+
maestro: 'MAESTRO',
|
32
|
+
american_express: 'AMEX',
|
33
|
+
electron: 'UKE',
|
34
|
+
diners_club: 'DC',
|
35
|
+
jcb: 'JCB'
|
37
36
|
}
|
38
37
|
|
39
|
-
|
38
|
+
AVS_CODE = {
|
39
|
+
'NOTPROVIDED' => nil,
|
40
|
+
'NOTCHECKED' => 'X',
|
41
|
+
'MATCHED' => 'Y',
|
42
|
+
'NOTMATCHED' => 'N'
|
43
|
+
}
|
44
|
+
|
45
|
+
CVV_CODE = {
|
46
|
+
'NOTPROVIDED' => 'S',
|
47
|
+
'NOTCHECKED' => 'X',
|
48
|
+
'MATCHED' => 'M',
|
49
|
+
'NOTMATCHED' => 'N'
|
50
|
+
}
|
40
51
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
OPTIONAL_REQUEST_FIELDS = {
|
53
|
+
paypal_callback_url: :PayPalCallbackURL,
|
54
|
+
basket: :Basket,
|
55
|
+
gift_aid_payment: :GiftAidPayment,
|
56
|
+
apply_avscv2: :ApplyAVSCV2,
|
57
|
+
apply_3d_secure: :Apply3DSecure,
|
58
|
+
account_type: :AccountType,
|
59
|
+
billing_agreement: :BillingAgreement,
|
60
|
+
basket_xml: :BasketXML,
|
61
|
+
customer_xml: :CustomerXML,
|
62
|
+
surcharge_xml: :SurchargeXML,
|
63
|
+
vendor_data: :VendorData,
|
64
|
+
language: :Language,
|
65
|
+
website: :Website,
|
66
|
+
recipient_account_number: :FIRecipientAcctNumber,
|
67
|
+
recipient_surname: :FIRecipientSurname,
|
68
|
+
recipient_postcode: :FIRecipientPostcode,
|
69
|
+
recipient_dob: :FIRecipientDoB
|
46
70
|
}
|
47
71
|
|
48
|
-
self.
|
49
|
-
self.
|
72
|
+
self.supported_countries = %w[GB IE]
|
73
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb maestro diners_club]
|
50
74
|
self.default_currency = 'GBP'
|
51
75
|
|
52
76
|
self.homepage_url = 'http://www.sagepay.com'
|
@@ -69,7 +93,7 @@ module ActiveMerchant #:nodoc:
|
|
69
93
|
add_customer_data(post, options)
|
70
94
|
add_optional_data(post, options)
|
71
95
|
|
72
|
-
commit(:purchase, post)
|
96
|
+
commit((past_purchase_reference?(payment_method) ? :repeat : :purchase), post)
|
73
97
|
end
|
74
98
|
|
75
99
|
def authorize(money, payment_method, options = {})
|
@@ -112,7 +136,7 @@ module ActiveMerchant #:nodoc:
|
|
112
136
|
|
113
137
|
post = {}
|
114
138
|
|
115
|
-
|
139
|
+
add_related_reference(post, identification)
|
116
140
|
add_amount(post, money, options)
|
117
141
|
add_invoice(post, options)
|
118
142
|
|
@@ -138,7 +162,37 @@ module ActiveMerchant #:nodoc:
|
|
138
162
|
commit(:unstore, post)
|
139
163
|
end
|
140
164
|
|
165
|
+
def verify(credit_card, options = {})
|
166
|
+
MultiResponse.run(:use_first_response) do |r|
|
167
|
+
r.process { authorize(100, credit_card, options) }
|
168
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def supports_scrubbing
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
def scrub(transcript)
|
177
|
+
transcript.
|
178
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
179
|
+
gsub(%r((&?CardNumber=)\d+(&?)), '\1[FILTERED]\2').
|
180
|
+
gsub(%r((&?CV2=)\d+(&?)), '\1[FILTERED]\2')
|
181
|
+
end
|
182
|
+
|
141
183
|
private
|
184
|
+
|
185
|
+
def truncate(value, max_size)
|
186
|
+
return nil unless value
|
187
|
+
return value.to_s if CGI.escape(value.to_s).length <= max_size
|
188
|
+
|
189
|
+
if value.size > max_size
|
190
|
+
truncate(super(value, max_size), max_size)
|
191
|
+
else
|
192
|
+
truncate(value.to_s.chop, max_size)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
142
196
|
def add_reference(post, identification)
|
143
197
|
order_id, transaction_id, authorization, security_key = identification.split(';')
|
144
198
|
|
@@ -148,7 +202,7 @@ module ActiveMerchant #:nodoc:
|
|
148
202
|
add_pair(post, :SecurityKey, security_key)
|
149
203
|
end
|
150
204
|
|
151
|
-
def
|
205
|
+
def add_related_reference(post, identification)
|
152
206
|
order_id, transaction_id, authorization, security_key = identification.split(';')
|
153
207
|
|
154
208
|
add_pair(post, :RelatedVendorTxCode, order_id)
|
@@ -159,18 +213,18 @@ module ActiveMerchant #:nodoc:
|
|
159
213
|
|
160
214
|
def add_amount(post, money, options)
|
161
215
|
currency = options[:currency] || currency(money)
|
162
|
-
add_pair(post, :Amount, localized_amount(money, currency), :
|
163
|
-
add_pair(post, :Currency, currency, :
|
216
|
+
add_pair(post, :Amount, localized_amount(money, currency), required: true)
|
217
|
+
add_pair(post, :Currency, currency, required: true)
|
164
218
|
end
|
165
219
|
|
166
220
|
def add_currency(post, money, options)
|
167
221
|
currency = options[:currency] || currency(money)
|
168
|
-
add_pair(post, :Currency, currency, :
|
222
|
+
add_pair(post, :Currency, currency, required: true)
|
169
223
|
end
|
170
224
|
|
171
225
|
# doesn't actually use the currency -- dodgy!
|
172
226
|
def add_release_amount(post, money, options)
|
173
|
-
add_pair(post, :ReleaseAmount, amount(money), :
|
227
|
+
add_pair(post, :ReleaseAmount, amount(money), required: true)
|
174
228
|
end
|
175
229
|
|
176
230
|
def add_customer_data(post, options)
|
@@ -179,37 +233,35 @@ module ActiveMerchant #:nodoc:
|
|
179
233
|
end
|
180
234
|
|
181
235
|
def add_optional_data(post, options)
|
182
|
-
add_pair(post, :GiftAidPayment, options[:gift_aid_payment]) unless options[:gift_aid_payment].blank?
|
183
|
-
add_pair(post, :Apply3DSecure, options[:apply_3d_secure]) unless options[:apply_3d_secure].blank?
|
184
236
|
add_pair(post, :CreateToken, 1) unless options[:store].blank?
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
237
|
+
|
238
|
+
OPTIONAL_REQUEST_FIELDS.each do |gateway_option, sagepay_field|
|
239
|
+
add_pair(post, sagepay_field, options[gateway_option])
|
240
|
+
end
|
189
241
|
end
|
190
242
|
|
191
243
|
def add_address(post, options)
|
192
244
|
if billing_address = options[:billing_address] || options[:address]
|
193
|
-
first_name, last_name =
|
194
|
-
add_pair(post, :BillingSurname, last_name)
|
195
|
-
add_pair(post, :BillingFirstnames, first_name)
|
245
|
+
first_name, last_name = split_names(billing_address[:name])
|
246
|
+
add_pair(post, :BillingSurname, truncate(last_name, 20))
|
247
|
+
add_pair(post, :BillingFirstnames, truncate(first_name, 20))
|
196
248
|
add_pair(post, :BillingAddress1, truncate(billing_address[:address1], 100))
|
197
249
|
add_pair(post, :BillingAddress2, truncate(billing_address[:address2], 100))
|
198
250
|
add_pair(post, :BillingCity, truncate(billing_address[:city], 40))
|
199
|
-
add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if
|
251
|
+
add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if usa?(billing_address[:country])
|
200
252
|
add_pair(post, :BillingCountry, truncate(billing_address[:country], 2))
|
201
253
|
add_pair(post, :BillingPhone, sanitize_phone(billing_address[:phone]))
|
202
254
|
add_pair(post, :BillingPostCode, truncate(billing_address[:zip], 10))
|
203
255
|
end
|
204
256
|
|
205
257
|
if shipping_address = options[:shipping_address] || billing_address
|
206
|
-
first_name, last_name =
|
207
|
-
add_pair(post, :DeliverySurname, last_name)
|
208
|
-
add_pair(post, :DeliveryFirstnames, first_name)
|
258
|
+
first_name, last_name = split_names(shipping_address[:name])
|
259
|
+
add_pair(post, :DeliverySurname, truncate(last_name, 20))
|
260
|
+
add_pair(post, :DeliveryFirstnames, truncate(first_name, 20))
|
209
261
|
add_pair(post, :DeliveryAddress1, truncate(shipping_address[:address1], 100))
|
210
262
|
add_pair(post, :DeliveryAddress2, truncate(shipping_address[:address2], 100))
|
211
263
|
add_pair(post, :DeliveryCity, truncate(shipping_address[:city], 40))
|
212
|
-
add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if
|
264
|
+
add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if usa?(shipping_address[:country])
|
213
265
|
add_pair(post, :DeliveryCountry, truncate(shipping_address[:country], 2))
|
214
266
|
add_pair(post, :DeliveryPhone, sanitize_phone(shipping_address[:phone]))
|
215
267
|
add_pair(post, :DeliveryPostCode, truncate(shipping_address[:zip], 10))
|
@@ -217,28 +269,27 @@ module ActiveMerchant #:nodoc:
|
|
217
269
|
end
|
218
270
|
|
219
271
|
def add_invoice(post, options)
|
220
|
-
add_pair(post, :VendorTxCode, sanitize_order_id(options[:order_id]), :
|
272
|
+
add_pair(post, :VendorTxCode, sanitize_order_id(options[:order_id]), required: true)
|
221
273
|
add_pair(post, :Description, truncate(options[:description] || options[:order_id], 100))
|
222
274
|
end
|
223
275
|
|
224
276
|
def add_payment_method(post, payment_method, options)
|
225
|
-
if payment_method.
|
226
|
-
|
277
|
+
if payment_method.is_a?(String)
|
278
|
+
if past_purchase_reference?(payment_method)
|
279
|
+
add_related_reference(post, payment_method)
|
280
|
+
else
|
281
|
+
add_token_details(post, payment_method, options)
|
282
|
+
end
|
227
283
|
else
|
228
|
-
|
284
|
+
add_credit_card(post, payment_method)
|
229
285
|
end
|
230
286
|
end
|
231
287
|
|
232
288
|
def add_credit_card(post, credit_card)
|
233
|
-
add_pair(post, :CardHolder, truncate(credit_card.name, 50), :
|
234
|
-
add_pair(post, :CardNumber, credit_card.number, :
|
235
|
-
|
236
|
-
add_pair(post, :ExpiryDate, format_date(credit_card.month, credit_card.year), :required => true)
|
289
|
+
add_pair(post, :CardHolder, truncate(credit_card.name, 50), required: true)
|
290
|
+
add_pair(post, :CardNumber, credit_card.number, required: true)
|
237
291
|
|
238
|
-
|
239
|
-
add_pair(post, :StartDate, format_date(credit_card.start_month, credit_card.start_year))
|
240
|
-
add_pair(post, :IssueNumber, credit_card.issue_number)
|
241
|
-
end
|
292
|
+
add_pair(post, :ExpiryDate, format_date(credit_card.month, credit_card.year), required: true)
|
242
293
|
add_pair(post, :CardType, map_card_type(credit_card))
|
243
294
|
|
244
295
|
add_pair(post, :CV2, credit_card.verification_value)
|
@@ -247,6 +298,7 @@ module ActiveMerchant #:nodoc:
|
|
247
298
|
def add_token_details(post, token, options)
|
248
299
|
add_token(post, token)
|
249
300
|
add_pair(post, :StoreToken, options[:customer])
|
301
|
+
add_pair(post, :CV2, options[:verification_value])
|
250
302
|
end
|
251
303
|
|
252
304
|
def add_token(post, token)
|
@@ -260,26 +312,21 @@ module ActiveMerchant #:nodoc:
|
|
260
312
|
|
261
313
|
def sanitize_phone(phone)
|
262
314
|
return nil unless phone
|
315
|
+
|
263
316
|
cleansed = phone.to_s.gsub(/[^0-9+]/, '')
|
264
317
|
truncate(cleansed, 20)
|
265
318
|
end
|
266
319
|
|
267
|
-
def
|
268
|
-
return nil unless value
|
269
|
-
value[0, max_size]
|
270
|
-
end
|
271
|
-
|
272
|
-
def is_usa(country)
|
320
|
+
def usa?(country)
|
273
321
|
truncate(country, 2) == 'US'
|
274
322
|
end
|
275
323
|
|
276
324
|
def map_card_type(credit_card)
|
277
|
-
raise ArgumentError,
|
325
|
+
raise ArgumentError, 'The credit card type must be provided' if card_brand(credit_card).blank?
|
278
326
|
|
279
327
|
card_type = card_brand(credit_card).to_sym
|
280
328
|
|
281
|
-
|
282
|
-
if card_type == :visa && credit_card.number =~ ELECTRON
|
329
|
+
if card_type == :visa && credit_card.electron?
|
283
330
|
CREDIT_CARDS[:electron]
|
284
331
|
else
|
285
332
|
CREDIT_CARDS[card_type]
|
@@ -290,24 +337,23 @@ module ActiveMerchant #:nodoc:
|
|
290
337
|
def format_date(month, year)
|
291
338
|
return nil if year.blank? || month.blank?
|
292
339
|
|
293
|
-
year = sprintf(
|
294
|
-
month = sprintf(
|
340
|
+
year = sprintf('%.4i', year)
|
341
|
+
month = sprintf('%.2i', month)
|
295
342
|
|
296
343
|
"#{month}#{year[-2..-1]}"
|
297
344
|
end
|
298
345
|
|
299
346
|
def commit(action, parameters)
|
300
|
-
response = parse(
|
301
|
-
|
302
|
-
Response.new(response[
|
303
|
-
:
|
304
|
-
:
|
305
|
-
:
|
306
|
-
:
|
307
|
-
:
|
347
|
+
response = parse(ssl_post(url_for(action), post_data(action, parameters)))
|
348
|
+
|
349
|
+
Response.new(response['Status'] == APPROVED, message_from(response), response,
|
350
|
+
test: test?,
|
351
|
+
authorization: authorization_from(response, parameters, action),
|
352
|
+
avs_result: {
|
353
|
+
street_match: AVS_CODE[response['AddressResult']],
|
354
|
+
postal_match: AVS_CODE[response['PostCodeResult']]
|
308
355
|
},
|
309
|
-
:
|
310
|
-
)
|
356
|
+
cvv_result: CVV_CODE[response['CV2Result']])
|
311
357
|
end
|
312
358
|
|
313
359
|
def authorization_from(response, params, action)
|
@@ -315,11 +361,11 @@ module ActiveMerchant #:nodoc:
|
|
315
361
|
when :store
|
316
362
|
response['Token']
|
317
363
|
else
|
318
|
-
|
319
|
-
response[
|
320
|
-
response[
|
321
|
-
response[
|
322
|
-
action
|
364
|
+
[params[:VendorTxCode],
|
365
|
+
response['VPSTxId'] || params[:VPSTxId],
|
366
|
+
response['TxAuthNo'],
|
367
|
+
response['SecurityKey'] || params[:SecurityKey],
|
368
|
+
action].join(';')
|
323
369
|
end
|
324
370
|
end
|
325
371
|
|
@@ -333,35 +379,34 @@ module ActiveMerchant #:nodoc:
|
|
333
379
|
end
|
334
380
|
|
335
381
|
def build_url(action)
|
336
|
-
endpoint =
|
337
|
-
|
382
|
+
endpoint =
|
383
|
+
case action
|
384
|
+
when :purchase, :authorization then 'vspdirect-register'
|
338
385
|
when :store then 'directtoken'
|
339
386
|
else TRANSACTIONS[action].downcase
|
340
|
-
|
387
|
+
end
|
341
388
|
"#{test? ? self.test_url : self.live_url}/#{endpoint}.vsp"
|
342
389
|
end
|
343
390
|
|
344
391
|
def build_simulator_url(action)
|
345
|
-
endpoint = [
|
392
|
+
endpoint = %i[purchase authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
|
346
393
|
"#{self.simulator_url}/#{endpoint}"
|
347
394
|
end
|
348
395
|
|
349
396
|
def message_from(response)
|
350
|
-
response['Status'] == APPROVED ? 'Success' : (response['StatusDetail'] || 'Unspecified error')
|
397
|
+
response['Status'] == APPROVED ? 'Success' : (response['StatusDetail'] || 'Unspecified error') # simonr 20080207 can't actually get non-nil blanks, so this is shorter
|
351
398
|
end
|
352
399
|
|
353
400
|
def post_data(action, parameters = {})
|
354
401
|
parameters.update(
|
355
|
-
:
|
356
|
-
:
|
357
|
-
:
|
402
|
+
Vendor: @options[:login],
|
403
|
+
TxType: TRANSACTIONS[action],
|
404
|
+
VPSProtocol: @options.fetch(:protocol_version, '3.00')
|
358
405
|
)
|
359
406
|
|
360
|
-
|
361
|
-
parameters.update(:ReferrerID => application_id)
|
362
|
-
end
|
407
|
+
parameters.update(ReferrerID: application_id) if application_id && (application_id != Gateway.application_id)
|
363
408
|
|
364
|
-
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
409
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
365
410
|
end
|
366
411
|
|
367
412
|
# SagePay returns data in the following format
|
@@ -379,20 +424,11 @@ module ActiveMerchant #:nodoc:
|
|
379
424
|
post[key] = value if !value.blank? || options[:required]
|
380
425
|
end
|
381
426
|
|
382
|
-
def
|
383
|
-
|
427
|
+
def past_purchase_reference?(payment_method)
|
428
|
+
return false unless payment_method.is_a?(String)
|
384
429
|
|
385
|
-
|
386
|
-
first_name = name.join(' ')
|
387
|
-
[ truncate(first_name, 20), truncate(last_name, 20) ]
|
388
|
-
end
|
389
|
-
|
390
|
-
def localized_amount(money, currency)
|
391
|
-
amount = amount(money)
|
392
|
-
CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s) ? amount.split('.').first : amount
|
430
|
+
payment_method.split(';').last == 'purchase'
|
393
431
|
end
|
394
432
|
end
|
395
|
-
|
396
433
|
end
|
397
434
|
end
|
398
|
-
|
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.supported_countries = ['US']
|
8
8
|
|
9
9
|
# The card types supported by the payment gateway
|
10
|
-
self.supported_cardtypes = [
|
10
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
11
11
|
|
12
12
|
# The homepage URL of the gateway
|
13
13
|
self.homepage_url = 'http://www.salliemae.com/'
|
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test?
|
24
|
-
@options[:login] ==
|
24
|
+
@options[:login] == 'TEST0'
|
25
25
|
end
|
26
26
|
|
27
27
|
def authorize(money, creditcard, options = {})
|
@@ -94,11 +94,11 @@ module ActiveMerchant #:nodoc:
|
|
94
94
|
|
95
95
|
def parse(body)
|
96
96
|
h = {}
|
97
|
-
body.gsub!(
|
97
|
+
body.gsub!('<html><body><plaintext>', '')
|
98
98
|
body.
|
99
99
|
split("\r\n").
|
100
100
|
map do |i|
|
101
|
-
a = i.split(
|
101
|
+
a = i.split('=')
|
102
102
|
h[a.first] = a.last unless a.first.nil?
|
103
103
|
end
|
104
104
|
h
|
@@ -111,33 +111,31 @@ module ActiveMerchant #:nodoc:
|
|
111
111
|
|
112
112
|
case action
|
113
113
|
when :sale
|
114
|
-
parameters[:action] =
|
114
|
+
parameters[:action] = 'ns_quicksale_cc'
|
115
115
|
when :authonly
|
116
|
-
parameters[:action] =
|
116
|
+
parameters[:action] = 'ns_quicksale_cc'
|
117
117
|
parameters[:authonly] = 1
|
118
118
|
when :capture
|
119
|
-
parameters[:action] =
|
119
|
+
parameters[:action] = 'ns_quicksale_cc'
|
120
120
|
end
|
121
121
|
|
122
|
-
response = parse(ssl_post(self.live_url, parameters.to_post_data) ||
|
122
|
+
response = parse(ssl_post(self.live_url, parameters.to_post_data) || '')
|
123
123
|
Response.new(successful?(response), message_from(response), response,
|
124
|
-
:
|
125
|
-
:
|
126
|
-
)
|
124
|
+
test: test?,
|
125
|
+
authorization: response['refcode'])
|
127
126
|
end
|
128
127
|
|
129
128
|
def successful?(response)
|
130
|
-
response[
|
129
|
+
response['Status'] == 'Accepted'
|
131
130
|
end
|
132
131
|
|
133
132
|
def message_from(response)
|
134
133
|
if successful?(response)
|
135
|
-
|
134
|
+
'Accepted'
|
136
135
|
else
|
137
|
-
response[
|
136
|
+
response['Reason'].split(':')[2].capitalize unless response['Reason'].nil?
|
138
137
|
end
|
139
138
|
end
|
140
139
|
end
|
141
140
|
end
|
142
141
|
end
|
143
|
-
|