activemerchant 1.38.0 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1344 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -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 +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- 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 +226 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -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 +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- 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 +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- 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/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- 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 +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +74 -13
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- 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 +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +27 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
- data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- 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/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -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 +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +177 -0
- data/lib/active_merchant/country.rb +334 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +24 -21
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- metadata +161 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- 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 -73
- 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/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/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/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 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- 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 -129
- 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/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 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- 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 -74
- 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 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- 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/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 -0
@@ -0,0 +1,334 @@
|
|
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://api-sandbox.globalcollect.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)
|
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)
|
91
|
+
post["order"]["amountOfMoney"] = {
|
92
|
+
"amount" => amount(money),
|
93
|
+
"currencyCode" => options[:currency] || currency(money)
|
94
|
+
}
|
95
|
+
post["order"]["references"] = {
|
96
|
+
"merchantReference" => options[:order_id],
|
97
|
+
"descriptor" => options[:description] # Max 256 chars
|
98
|
+
}
|
99
|
+
post["order"]["references"]["invoiceData"] = {
|
100
|
+
"invoiceNumber" => options[:invoice]
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_creator_info(post, options)
|
105
|
+
post['sdkIdentifier'] = options[:sdk_identifier] if options[:sdk_identifier]
|
106
|
+
post['sdkCreator'] = options[:sdk_creator] if options[:sdk_creator]
|
107
|
+
post['integrator'] = options[:integrator] if options[:integrator]
|
108
|
+
post['shoppingCartExtension'] = {}
|
109
|
+
post['shoppingCartExtension']['creator'] = options[:creator] if options[:creator]
|
110
|
+
post['shoppingCartExtension']['name'] = options[:name] if options[:name]
|
111
|
+
post['shoppingCartExtension']['version'] = options[:version] if options[:version]
|
112
|
+
post['shoppingCartExtension']['extensionID'] = options[:extension_ID] if options[:extension_ID]
|
113
|
+
end
|
114
|
+
|
115
|
+
def add_amount(post, money, options={})
|
116
|
+
post["amountOfMoney"] = {
|
117
|
+
"amount" => amount(money),
|
118
|
+
"currencyCode" => options[:currency] || currency(money)
|
119
|
+
}
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_payment(post, payment, options)
|
123
|
+
year = format(payment.year, :two_digits)
|
124
|
+
month = format(payment.month, :two_digits)
|
125
|
+
expirydate = "#{month}#{year}"
|
126
|
+
pre_authorization = options[:pre_authorization] ? 'PRE_AUTHORIZATION' : 'FINAL_AUTHORIZATION'
|
127
|
+
|
128
|
+
post["cardPaymentMethodSpecificInput"] = {
|
129
|
+
"paymentProductId" => BRAND_MAP[payment.brand],
|
130
|
+
"skipAuthentication" => "true", # refers to 3DSecure
|
131
|
+
"skipFraudService" => "true",
|
132
|
+
"authorizationMode" => pre_authorization
|
133
|
+
}
|
134
|
+
post["cardPaymentMethodSpecificInput"]["card"] = {
|
135
|
+
"cvv" => payment.verification_value,
|
136
|
+
"cardNumber" => payment.number,
|
137
|
+
"expiryDate" => expirydate,
|
138
|
+
"cardholderName" => payment.name
|
139
|
+
}
|
140
|
+
end
|
141
|
+
|
142
|
+
def add_customer_data(post, options, payment = nil)
|
143
|
+
post["order"]["customer"] = {
|
144
|
+
"merchantCustomerId" => options[:customer]
|
145
|
+
}
|
146
|
+
if payment
|
147
|
+
post["order"]["customer"]["personalInformation"] = {
|
148
|
+
"name" => {
|
149
|
+
"firstName" => payment.first_name[0..14],
|
150
|
+
"surname" => payment.last_name[0..69]
|
151
|
+
}
|
152
|
+
}
|
153
|
+
end
|
154
|
+
post["order"]["companyInformation"] = {
|
155
|
+
"name" => options[:company]
|
156
|
+
}
|
157
|
+
post["order"]["contactDetails"] = {
|
158
|
+
"emailAddress" => options[:email]
|
159
|
+
}
|
160
|
+
if address = options[:billing_address] || options[:address]
|
161
|
+
post["order"]["contactDetails"] = {
|
162
|
+
"phoneNumber" => address[:phone]
|
163
|
+
}
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def add_refund_customer_data(post, options)
|
168
|
+
if address = options[:billing_address] || options[:address]
|
169
|
+
post["customer"]["address"] = {
|
170
|
+
"countryCode" => address[:country]
|
171
|
+
}
|
172
|
+
post["customer"]["contactDetails"] = {
|
173
|
+
"emailAddress" => options[:email],
|
174
|
+
"phoneNumber" => address[:phone]
|
175
|
+
}
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def add_address(post, creditcard, options)
|
180
|
+
billing_address = options[:billing_address] || options[:address]
|
181
|
+
shipping_address = options[:shipping_address]
|
182
|
+
if billing_address = options[:billing_address] || options[:address]
|
183
|
+
post["order"]["customer"]["billingAddress"] = {
|
184
|
+
"street" => billing_address[:address1],
|
185
|
+
"additionalInfo" => billing_address[:address2],
|
186
|
+
"zip" => billing_address[:zip],
|
187
|
+
"city" => billing_address[:city],
|
188
|
+
"state" => billing_address[:state],
|
189
|
+
"countryCode" => billing_address[:country]
|
190
|
+
}
|
191
|
+
end
|
192
|
+
if shipping_address
|
193
|
+
post["order"]["customer"]["shippingAddress"] = {
|
194
|
+
"street" => shipping_address[:address1],
|
195
|
+
"additionalInfo" => shipping_address[:address2],
|
196
|
+
"zip" => shipping_address[:zip],
|
197
|
+
"city" => shipping_address[:city],
|
198
|
+
"state" => shipping_address[:state],
|
199
|
+
"countryCode" => shipping_address[:country]
|
200
|
+
}
|
201
|
+
post["order"]["customer"]["shippingAddress"]["name"] = {
|
202
|
+
"firstName" => shipping_address[:firstname],
|
203
|
+
"surname" => shipping_address[:lastname]
|
204
|
+
}
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def add_fraud_fields(post, options)
|
209
|
+
fraud_fields = {}
|
210
|
+
fraud_fields.merge!(options[:fraud_fields]) if options[:fraud_fields]
|
211
|
+
fraud_fields.merge!({customerIpAddress: options[:ip]}) if options[:ip]
|
212
|
+
|
213
|
+
post["fraudFields"] = fraud_fields unless fraud_fields.empty?
|
214
|
+
end
|
215
|
+
|
216
|
+
def parse(body)
|
217
|
+
JSON.parse(body)
|
218
|
+
end
|
219
|
+
|
220
|
+
def url(action, authorization)
|
221
|
+
(test? ? test_url : live_url) + uri(action, authorization)
|
222
|
+
end
|
223
|
+
|
224
|
+
def uri(action, authorization)
|
225
|
+
uri = "/v1/#{@options[:merchant_id]}/"
|
226
|
+
case action
|
227
|
+
when :authorize
|
228
|
+
uri + "payments"
|
229
|
+
when :capture
|
230
|
+
uri + "payments/#{authorization}/approve"
|
231
|
+
when :refund
|
232
|
+
uri + "payments/#{authorization}/refund"
|
233
|
+
when :void
|
234
|
+
uri + "payments/#{authorization}/cancel"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def commit(action, post, authorization = nil)
|
239
|
+
begin
|
240
|
+
response = parse(ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization)))
|
241
|
+
rescue ResponseError => e
|
242
|
+
if e.response.code.to_i >= 400
|
243
|
+
response = parse(e.response.body)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
succeeded = success_from(response)
|
248
|
+
Response.new(
|
249
|
+
succeeded,
|
250
|
+
message_from(succeeded, response),
|
251
|
+
response,
|
252
|
+
authorization: authorization_from(succeeded, response),
|
253
|
+
error_code: error_code_from(succeeded, response),
|
254
|
+
test: test?
|
255
|
+
)
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
def headers(action, post, authorization = nil)
|
260
|
+
{
|
261
|
+
"Content-Type" => content_type,
|
262
|
+
"Authorization" => auth_digest(action, post, authorization),
|
263
|
+
"Date" => date
|
264
|
+
}
|
265
|
+
end
|
266
|
+
|
267
|
+
def auth_digest(action, post, authorization = nil)
|
268
|
+
data = <<-EOS
|
269
|
+
POST
|
270
|
+
#{content_type}
|
271
|
+
#{date}
|
272
|
+
#{uri(action, authorization)}
|
273
|
+
EOS
|
274
|
+
digest = OpenSSL::Digest.new('sha256')
|
275
|
+
key = @options[:secret_api_key]
|
276
|
+
"GCS v1HMAC:#{@options[:api_key_id]}:#{Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))}"
|
277
|
+
end
|
278
|
+
|
279
|
+
def date
|
280
|
+
@date ||= Time.now.strftime("%a, %d %b %Y %H:%M:%S %Z") # Must be same in digest and HTTP header
|
281
|
+
end
|
282
|
+
|
283
|
+
def content_type
|
284
|
+
"application/json"
|
285
|
+
end
|
286
|
+
|
287
|
+
def success_from(response)
|
288
|
+
!response["errorId"] && response["status"] != "REJECTED"
|
289
|
+
end
|
290
|
+
|
291
|
+
def message_from(succeeded, response)
|
292
|
+
if succeeded
|
293
|
+
"Succeeded"
|
294
|
+
else
|
295
|
+
if errors = response["errors"]
|
296
|
+
errors.first.try(:[], "message")
|
297
|
+
elsif status = response["status"]
|
298
|
+
"Status: " + status
|
299
|
+
else
|
300
|
+
"No message available"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
def authorization_from(succeeded, response)
|
306
|
+
if succeeded
|
307
|
+
response["id"] || response["payment"]["id"] || response["paymentResult"]["payment"]["id"]
|
308
|
+
else
|
309
|
+
response["errorId"]
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
def error_code_from(succeeded, response)
|
314
|
+
unless succeeded
|
315
|
+
if errors = response["errors"]
|
316
|
+
errors.first.try(:[], "code")
|
317
|
+
elsif status = response.try(:[], "statusOutput").try(:[], "statusCode")
|
318
|
+
status.to_s
|
319
|
+
else
|
320
|
+
"No error code available"
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
def nestable_hash
|
326
|
+
Hash.new {|h,k| h[k] = Hash.new(&h.default_proc) }
|
327
|
+
end
|
328
|
+
|
329
|
+
def capture_requested?(response)
|
330
|
+
response.params.try(:[], "payment").try(:[], "status") == "CAPTURE_REQUESTED"
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
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
|