activemerchant 1.42.6 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/CHANGELOG +1420 -2
- data/CONTRIBUTORS +106 -0
- data/README.md +107 -103
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +12 -13
- data/lib/active_merchant/billing/base.rb +13 -16
- data/lib/active_merchant/billing/check.rb +35 -24
- data/lib/active_merchant/billing/compatibility.rb +117 -0
- data/lib/active_merchant/billing/credit_card.rb +196 -81
- data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +171 -39
- data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
- data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
- data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
- data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
- data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
- data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
- data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
- data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
- data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +41 -31
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +79 -78
- data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
- data/lib/active_merchant/billing/gateways/exact.rb +32 -26
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -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 +270 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
- data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
- data/lib/active_merchant/billing/gateways/litle.rb +328 -444
- data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
- data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
- data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
- data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
- data/lib/active_merchant/billing/gateways/migs.rb +81 -22
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
- data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
- data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
- data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
- data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
- data/lib/active_merchant/billing/gateways/opp.rb +369 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
- data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
- data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
- data/lib/active_merchant/billing/gateways/payex.rb +38 -30
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
- data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
- 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 +54 -45
- data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
- data/lib/active_merchant/billing/gateways/payway.rb +8 -8
- data/lib/active_merchant/billing/gateways/pin.rb +74 -18
- data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
- data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
- data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
- data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +78 -48
- data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
- data/lib/active_merchant/billing/gateways/s5.rb +246 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +415 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
- data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
- data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
- data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
- data/lib/active_merchant/billing/gateways/telr.rb +274 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transax.rb +5 -6
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
- data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
- data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
- data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +31 -24
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +195 -0
- data/lib/active_merchant/country.rb +335 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
- data/lib/active_merchant/network_connection_retries.rb +80 -0
- data/lib/active_merchant/post_data.rb +25 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -27
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3988 -0
- data/lib/support/gateway_support.rb +7 -9
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +6 -7
- data/lib/support/ssl_version.rb +87 -0
- metadata +148 -323
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -21
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/app55.rb +0 -185
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
- 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/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
- data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
- data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
- data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
- data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/doku.rb +0 -24
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
- data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
- data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
- data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class GlobalCollectGateway < Gateway
|
|
4
|
+
self.display_name = 'GlobalCollect'
|
|
5
|
+
self.homepage_url = 'http://www.globalcollect.com/'
|
|
6
|
+
|
|
7
|
+
self.test_url = 'https://eu.sandbox.api-ingenico.com'
|
|
8
|
+
self.live_url = 'https://api.globalcollect.com'
|
|
9
|
+
|
|
10
|
+
self.supported_countries = ['AD', 'AE', 'AG', 'AI', 'AL', 'AM', 'AO', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PL', 'PN', 'PS', 'PT', 'PW', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SR', 'ST', 'SV', 'SZ', 'TC', 'TD', 'TG', 'TH', 'TJ', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'US', 'UY', 'UZ', 'VC', 'VE', 'VG', 'VI', 'VN', 'WF', 'WS', 'ZA', 'ZM', 'ZW']
|
|
11
|
+
self.default_currency = 'USD'
|
|
12
|
+
self.money_format = :cents
|
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
|
14
|
+
|
|
15
|
+
def initialize(options={})
|
|
16
|
+
requires!(options, :merchant_id, :api_key_id, :secret_api_key)
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def purchase(money, payment, options={})
|
|
21
|
+
MultiResponse.run do |r|
|
|
22
|
+
r.process { authorize(money, payment, options) }
|
|
23
|
+
r.process { capture(money, r.authorization, options) } unless capture_requested?(r)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def authorize(money, payment, options={})
|
|
28
|
+
post = nestable_hash
|
|
29
|
+
add_order(post, money, options)
|
|
30
|
+
add_payment(post, payment, options)
|
|
31
|
+
add_customer_data(post, options, payment)
|
|
32
|
+
add_address(post, payment, options)
|
|
33
|
+
add_creator_info(post, options)
|
|
34
|
+
add_fraud_fields(post, options)
|
|
35
|
+
|
|
36
|
+
commit(:authorize, post)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def capture(money, authorization, options={})
|
|
40
|
+
post = nestable_hash
|
|
41
|
+
add_order(post, money, options, capture: true)
|
|
42
|
+
add_customer_data(post, options)
|
|
43
|
+
add_creator_info(post, options)
|
|
44
|
+
commit(:capture, post, authorization)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def refund(money, authorization, options={})
|
|
48
|
+
post = nestable_hash
|
|
49
|
+
add_amount(post, money, options)
|
|
50
|
+
add_refund_customer_data(post, options)
|
|
51
|
+
add_creator_info(post, options)
|
|
52
|
+
commit(:refund, post, authorization)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def void(authorization, options={})
|
|
56
|
+
post = nestable_hash
|
|
57
|
+
add_creator_info(post, options)
|
|
58
|
+
commit(:void, post, authorization)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def verify(payment, options={})
|
|
62
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
63
|
+
r.process { authorize(100, payment, options) }
|
|
64
|
+
r.process { void(r.authorization, options) }
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def supports_scrubbing?
|
|
69
|
+
true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def scrub(transcript)
|
|
73
|
+
transcript.
|
|
74
|
+
gsub(%r((Authorization: )[^\\]*)i, '\1[FILTERED]').
|
|
75
|
+
gsub(%r(("cardNumber\\+":\\+")\d+), '\1[FILTERED]').
|
|
76
|
+
gsub(%r(("cvv\\+":\\+")\d+), '\1[FILTERED]')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private
|
|
80
|
+
|
|
81
|
+
BRAND_MAP = {
|
|
82
|
+
'visa' => '1',
|
|
83
|
+
'american_express' => '2',
|
|
84
|
+
'master' => '3',
|
|
85
|
+
'discover' => '128',
|
|
86
|
+
'jcb' => '125',
|
|
87
|
+
'diners_club' => '132'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
def add_order(post, money, options, capture: false)
|
|
91
|
+
if capture
|
|
92
|
+
post['amount'] = amount(money)
|
|
93
|
+
else
|
|
94
|
+
add_amount(post['order'], money, options)
|
|
95
|
+
end
|
|
96
|
+
post['order']['references'] = {
|
|
97
|
+
'merchantReference' => options[:order_id],
|
|
98
|
+
'descriptor' => options[:description] # Max 256 chars
|
|
99
|
+
}
|
|
100
|
+
post['order']['references']['invoiceData'] = {
|
|
101
|
+
'invoiceNumber' => options[:invoice]
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def add_creator_info(post, options)
|
|
106
|
+
post['sdkIdentifier'] = options[:sdk_identifier] if options[:sdk_identifier]
|
|
107
|
+
post['sdkCreator'] = options[:sdk_creator] if options[:sdk_creator]
|
|
108
|
+
post['integrator'] = options[:integrator] if options[:integrator]
|
|
109
|
+
post['shoppingCartExtension'] = {}
|
|
110
|
+
post['shoppingCartExtension']['creator'] = options[:creator] if options[:creator]
|
|
111
|
+
post['shoppingCartExtension']['name'] = options[:name] if options[:name]
|
|
112
|
+
post['shoppingCartExtension']['version'] = options[:version] if options[:version]
|
|
113
|
+
post['shoppingCartExtension']['extensionID'] = options[:extension_ID] if options[:extension_ID]
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def add_amount(post, money, options={})
|
|
117
|
+
post['amountOfMoney'] = {
|
|
118
|
+
'amount' => amount(money),
|
|
119
|
+
'currencyCode' => options[:currency] || currency(money)
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def add_payment(post, payment, options)
|
|
124
|
+
year = format(payment.year, :two_digits)
|
|
125
|
+
month = format(payment.month, :two_digits)
|
|
126
|
+
expirydate = "#{month}#{year}"
|
|
127
|
+
pre_authorization = options[:pre_authorization] ? 'PRE_AUTHORIZATION' : 'FINAL_AUTHORIZATION'
|
|
128
|
+
|
|
129
|
+
post['cardPaymentMethodSpecificInput'] = {
|
|
130
|
+
'paymentProductId' => BRAND_MAP[payment.brand],
|
|
131
|
+
'skipAuthentication' => 'true', # refers to 3DSecure
|
|
132
|
+
'skipFraudService' => 'true',
|
|
133
|
+
'authorizationMode' => pre_authorization
|
|
134
|
+
}
|
|
135
|
+
post['cardPaymentMethodSpecificInput']['card'] = {
|
|
136
|
+
'cvv' => payment.verification_value,
|
|
137
|
+
'cardNumber' => payment.number,
|
|
138
|
+
'expiryDate' => expirydate,
|
|
139
|
+
'cardholderName' => payment.name
|
|
140
|
+
}
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def add_customer_data(post, options, payment = nil)
|
|
144
|
+
if payment
|
|
145
|
+
post['order']['customer']['personalInformation'] = {
|
|
146
|
+
'name' => {
|
|
147
|
+
'firstName' => payment.first_name[0..14],
|
|
148
|
+
'surname' => payment.last_name[0..69]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
end
|
|
152
|
+
post['order']['customer']['merchantCustomerId'] = options[:customer] if options[:customer]
|
|
153
|
+
post['order']['customer']['companyInformation']['name'] = options[:company] if options[:company]
|
|
154
|
+
post['order']['customer']['contactDetails']['emailAddress'] = options[:email] if options[:email]
|
|
155
|
+
if address = options[:billing_address] || options[:address]
|
|
156
|
+
post['order']['customer']['contactDetails']['phoneNumber'] = address[:phone] if address[:phone]
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def add_refund_customer_data(post, options)
|
|
161
|
+
if address = options[:billing_address] || options[:address]
|
|
162
|
+
post['customer']['address'] = {
|
|
163
|
+
'countryCode' => address[:country]
|
|
164
|
+
}
|
|
165
|
+
post['customer']['contactDetails']['emailAddress'] = options[:email] if options[:email]
|
|
166
|
+
if address = options[:billing_address] || options[:address]
|
|
167
|
+
post['customer']['contactDetails']['phoneNumber'] = address[:phone] if address[:phone]
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def add_address(post, creditcard, options)
|
|
173
|
+
shipping_address = options[:shipping_address]
|
|
174
|
+
if billing_address = options[:billing_address] || options[:address]
|
|
175
|
+
post['order']['customer']['billingAddress'] = {
|
|
176
|
+
'street' => billing_address[:address1],
|
|
177
|
+
'additionalInfo' => billing_address[:address2],
|
|
178
|
+
'zip' => billing_address[:zip],
|
|
179
|
+
'city' => billing_address[:city],
|
|
180
|
+
'state' => billing_address[:state],
|
|
181
|
+
'countryCode' => billing_address[:country]
|
|
182
|
+
}
|
|
183
|
+
end
|
|
184
|
+
if shipping_address
|
|
185
|
+
post['order']['customer']['shippingAddress'] = {
|
|
186
|
+
'street' => shipping_address[:address1],
|
|
187
|
+
'additionalInfo' => shipping_address[:address2],
|
|
188
|
+
'zip' => shipping_address[:zip],
|
|
189
|
+
'city' => shipping_address[:city],
|
|
190
|
+
'state' => shipping_address[:state],
|
|
191
|
+
'countryCode' => shipping_address[:country]
|
|
192
|
+
}
|
|
193
|
+
post['order']['customer']['shippingAddress']['name'] = {
|
|
194
|
+
'firstName' => shipping_address[:firstname],
|
|
195
|
+
'surname' => shipping_address[:lastname]
|
|
196
|
+
}
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def add_fraud_fields(post, options)
|
|
201
|
+
fraud_fields = {}
|
|
202
|
+
fraud_fields.merge!(options[:fraud_fields]) if options[:fraud_fields]
|
|
203
|
+
fraud_fields[:customerIpAddress] = options[:ip] if options[:ip]
|
|
204
|
+
|
|
205
|
+
post['fraudFields'] = fraud_fields unless fraud_fields.empty?
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def parse(body)
|
|
209
|
+
JSON.parse(body)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def url(action, authorization)
|
|
213
|
+
(test? ? test_url : live_url) + uri(action, authorization)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def uri(action, authorization)
|
|
217
|
+
uri = "/v1/#{@options[:merchant_id]}/"
|
|
218
|
+
case action
|
|
219
|
+
when :authorize
|
|
220
|
+
uri + 'payments'
|
|
221
|
+
when :capture
|
|
222
|
+
uri + "payments/#{authorization}/approve"
|
|
223
|
+
when :refund
|
|
224
|
+
uri + "payments/#{authorization}/refund"
|
|
225
|
+
when :void
|
|
226
|
+
uri + "payments/#{authorization}/cancel"
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def commit(action, post, authorization = nil)
|
|
231
|
+
begin
|
|
232
|
+
raw_response = ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization))
|
|
233
|
+
response = parse(raw_response)
|
|
234
|
+
rescue ResponseError => e
|
|
235
|
+
if e.response.code.to_i >= 400
|
|
236
|
+
response = parse(e.response.body)
|
|
237
|
+
end
|
|
238
|
+
rescue JSON::ParserError
|
|
239
|
+
response = json_error(raw_response)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
succeeded = success_from(response)
|
|
243
|
+
Response.new(
|
|
244
|
+
succeeded,
|
|
245
|
+
message_from(succeeded, response),
|
|
246
|
+
response,
|
|
247
|
+
authorization: authorization_from(succeeded, response),
|
|
248
|
+
error_code: error_code_from(succeeded, response),
|
|
249
|
+
test: test?
|
|
250
|
+
)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def json_error(raw_response)
|
|
254
|
+
{
|
|
255
|
+
'error_message' => 'Invalid response received from the Ingenico ePayments (formerly GlobalCollect) API. Please contact Ingenico ePayments if you continue to receive this message.' \
|
|
256
|
+
" (The raw response returned by the API was #{raw_response.inspect})",
|
|
257
|
+
'status' => 'REJECTED'
|
|
258
|
+
}
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def headers(action, post, authorization = nil)
|
|
262
|
+
{
|
|
263
|
+
'Content-Type' => content_type,
|
|
264
|
+
'Authorization' => auth_digest(action, post, authorization),
|
|
265
|
+
'Date' => date
|
|
266
|
+
}
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def auth_digest(action, post, authorization = nil)
|
|
270
|
+
data = <<-EOS
|
|
271
|
+
POST
|
|
272
|
+
#{content_type}
|
|
273
|
+
#{date}
|
|
274
|
+
#{uri(action, authorization)}
|
|
275
|
+
EOS
|
|
276
|
+
digest = OpenSSL::Digest.new('sha256')
|
|
277
|
+
key = @options[:secret_api_key]
|
|
278
|
+
"GCS v1HMAC:#{@options[:api_key_id]}:#{Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))}"
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def date
|
|
282
|
+
@date ||= Time.now.strftime('%a, %d %b %Y %H:%M:%S %Z') # Must be same in digest and HTTP header
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def content_type
|
|
286
|
+
'application/json'
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def success_from(response)
|
|
290
|
+
!response['errorId'] && response['status'] != 'REJECTED'
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
def message_from(succeeded, response)
|
|
294
|
+
if succeeded
|
|
295
|
+
'Succeeded'
|
|
296
|
+
else
|
|
297
|
+
if errors = response['errors']
|
|
298
|
+
errors.first.try(:[], 'message')
|
|
299
|
+
elsif response['error_message']
|
|
300
|
+
response['error_message']
|
|
301
|
+
elsif response['status']
|
|
302
|
+
'Status: ' + response['status']
|
|
303
|
+
else
|
|
304
|
+
'No message available'
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def authorization_from(succeeded, response)
|
|
310
|
+
if succeeded
|
|
311
|
+
response['id'] || response['payment']['id'] || response['paymentResult']['payment']['id']
|
|
312
|
+
elsif response['errorId']
|
|
313
|
+
response['errorId']
|
|
314
|
+
else
|
|
315
|
+
'GATEWAY ERROR'
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def error_code_from(succeeded, response)
|
|
320
|
+
unless succeeded
|
|
321
|
+
if errors = response['errors']
|
|
322
|
+
errors.first.try(:[], 'code')
|
|
323
|
+
elsif status = response.try(:[], 'statusOutput').try(:[], 'statusCode')
|
|
324
|
+
status.to_s
|
|
325
|
+
else
|
|
326
|
+
'No error code available'
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def nestable_hash
|
|
332
|
+
Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def capture_requested?(response)
|
|
336
|
+
response.params.try(:[], 'payment').try(:[], 'status') == 'CAPTURE_REQUESTED'
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
end
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
|
|
3
|
+
module ActiveMerchant #:nodoc:
|
|
4
|
+
module Billing #:nodoc:
|
|
5
|
+
class GlobalTransportGateway < Gateway
|
|
6
|
+
self.test_url = 'https://certapia.globalpay.com/GlobalPay/transact.asmx/ProcessCreditCard'
|
|
7
|
+
self.live_url = 'https://api.globalpay.com/GlobalPay/transact.asmx/ProcessCreditCard'
|
|
8
|
+
|
|
9
|
+
self.supported_countries = %w(CA PR US)
|
|
10
|
+
self.default_currency = 'USD'
|
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
|
12
|
+
|
|
13
|
+
self.homepage_url = 'https://www.globalpaymentsinc.com'
|
|
14
|
+
self.display_name = 'Global Transport'
|
|
15
|
+
|
|
16
|
+
# Public: Create a new Global Transport gateway.
|
|
17
|
+
#
|
|
18
|
+
# options - A hash of options:
|
|
19
|
+
# :global_user_name - Your Global user name
|
|
20
|
+
# :global_password - Your Global password
|
|
21
|
+
# :term_type - 3 character field assigned by Global Transport after
|
|
22
|
+
# - your application is certified.
|
|
23
|
+
def initialize(options={})
|
|
24
|
+
requires!(options, :global_user_name, :global_password, :term_type)
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def purchase(money, payment_method, options={})
|
|
29
|
+
post = {}
|
|
30
|
+
add_invoice(post, money, options)
|
|
31
|
+
add_payment_method(post, payment_method)
|
|
32
|
+
add_address(post, options)
|
|
33
|
+
|
|
34
|
+
commit('Sale', post, options)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def authorize(money, payment_method, options={})
|
|
38
|
+
post = {}
|
|
39
|
+
add_invoice(post, money, options)
|
|
40
|
+
add_payment_method(post, payment_method)
|
|
41
|
+
add_address(post, options)
|
|
42
|
+
|
|
43
|
+
commit('Auth', post, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def capture(money, authorization, options={})
|
|
47
|
+
post = {}
|
|
48
|
+
add_invoice(post, money, options)
|
|
49
|
+
add_auth(post, authorization)
|
|
50
|
+
|
|
51
|
+
commit('Force', post, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def refund(money, authorization, options={})
|
|
55
|
+
post = {}
|
|
56
|
+
add_invoice(post, money, options)
|
|
57
|
+
add_auth(post, authorization)
|
|
58
|
+
|
|
59
|
+
commit('Return', post, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def void(authorization, options={})
|
|
63
|
+
post = {}
|
|
64
|
+
add_auth(post, authorization)
|
|
65
|
+
|
|
66
|
+
commit('Void', post, options)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def verify(payment_method, options={})
|
|
70
|
+
post = {}
|
|
71
|
+
add_payment_method(post, payment_method)
|
|
72
|
+
add_address(post, options)
|
|
73
|
+
|
|
74
|
+
commit('CardVerify', post, options)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def supports_scrubbing?
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def scrub(transcript)
|
|
82
|
+
transcript.
|
|
83
|
+
gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
|
|
84
|
+
gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
|
|
85
|
+
gsub(%r((&?GlobalPassword=)[^&]*)i, '\1[FILTERED]')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def add_address(post, options)
|
|
91
|
+
if address = (options[:billing_address] || options[:address])
|
|
92
|
+
post[:Street] = address[:address1]
|
|
93
|
+
post[:Zip] = address[:zip]
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def add_auth(post, authorization)
|
|
98
|
+
post[:PNRef] = authorization
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def add_invoice(post, money, options)
|
|
102
|
+
currency = (options[:currency] || currency(money))
|
|
103
|
+
|
|
104
|
+
post[:Amount] = localized_amount(money, currency)
|
|
105
|
+
post[:InvNum] = truncate(options[:order_id], 16)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def add_payment_method(post, payment_method)
|
|
109
|
+
post[:CardNum] = payment_method.number
|
|
110
|
+
post[:ExpDate] = expdate(payment_method)
|
|
111
|
+
post[:NameOnCard] = payment_method.name
|
|
112
|
+
post[:CVNum] = payment_method.verification_value
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def parse(body)
|
|
116
|
+
response = {}
|
|
117
|
+
|
|
118
|
+
Nokogiri::XML(body).root.xpath('*').each do |node|
|
|
119
|
+
response[node.name.downcase.to_sym] = node.text
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
ext_data = Nokogiri::HTML.parse(response[:extdata])
|
|
123
|
+
response[:approved_amount] = ext_data.xpath('//approvedamount').text
|
|
124
|
+
response[:balance_due] = ext_data.xpath('//balancedue').text
|
|
125
|
+
|
|
126
|
+
response
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def commit(action, parameters, options)
|
|
130
|
+
raw = parse(ssl_post(url, post_data(action, parameters, options)))
|
|
131
|
+
Response.new(
|
|
132
|
+
success_from(raw),
|
|
133
|
+
message_from(raw),
|
|
134
|
+
raw,
|
|
135
|
+
authorization: authorization_from(raw),
|
|
136
|
+
test: test?,
|
|
137
|
+
avs_result: avs_from(raw),
|
|
138
|
+
cvv_result: cvv_from(raw)
|
|
139
|
+
)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def post_data(action, params, options)
|
|
143
|
+
post = default_params
|
|
144
|
+
post[:GlobalUserName] = @options[:global_user_name]
|
|
145
|
+
post[:GlobalPassword] = @options[:global_password]
|
|
146
|
+
post[:TransType] = action
|
|
147
|
+
post[:ExtData] = "<TermType>#{@options[:term_type]}</TermType>"
|
|
148
|
+
|
|
149
|
+
post.merge(params).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def url
|
|
153
|
+
(test? ? test_url : live_url)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def success_from(response)
|
|
157
|
+
response[:result] == '0' || response[:result] == '200'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def message_from(response)
|
|
161
|
+
response[:respmsg]
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def authorization_from(response)
|
|
165
|
+
response[:pnref]
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def avs_from(response)
|
|
169
|
+
{ code: response[:getavsresult] }
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def cvv_from(response)
|
|
173
|
+
response[:getcvresult]
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def default_params
|
|
177
|
+
{
|
|
178
|
+
CardNum: '',
|
|
179
|
+
ExpDate: '',
|
|
180
|
+
NameOnCard: '',
|
|
181
|
+
Amount: '',
|
|
182
|
+
PNRef: '',
|
|
183
|
+
Zip: '',
|
|
184
|
+
Street: '',
|
|
185
|
+
CVNum: '',
|
|
186
|
+
MagData: '',
|
|
187
|
+
InvNum: '',
|
|
188
|
+
ExtData: ''
|
|
189
|
+
}
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|