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,369 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class OppGateway < Gateway
|
|
4
|
+
# = Open Payment Platform
|
|
5
|
+
#
|
|
6
|
+
# The Open Payment Platform includes a powerful omni-channel transaction processing API,
|
|
7
|
+
# enabling you to quickly and flexibly build new applications and services on the platform.
|
|
8
|
+
#
|
|
9
|
+
# This plugin enables connectivity to the Open Payment Platform for activemerchant.
|
|
10
|
+
#
|
|
11
|
+
# For any questions or comments please contact support@payon.com
|
|
12
|
+
#
|
|
13
|
+
# == Usage
|
|
14
|
+
#
|
|
15
|
+
# gateway = ActiveMerchant::Billing::OppGateway.new(
|
|
16
|
+
# user_id: 'merchant user id',
|
|
17
|
+
# password: 'password',
|
|
18
|
+
# entity_id: 'entity id',
|
|
19
|
+
# )
|
|
20
|
+
#
|
|
21
|
+
# # set up credit card object as in main ActiveMerchant example
|
|
22
|
+
# creditcard = ActiveMerchant::Billing::CreditCard.new(
|
|
23
|
+
# :type => 'visa',
|
|
24
|
+
# :number => '4242424242424242',
|
|
25
|
+
# :month => 8,
|
|
26
|
+
# :year => 2009,
|
|
27
|
+
# :first_name => 'Bob',
|
|
28
|
+
# :last_name => 'Bobsen'
|
|
29
|
+
# :verification_value: '123')
|
|
30
|
+
#
|
|
31
|
+
# # Request: complete example, including address, billing address, shipping address
|
|
32
|
+
# complete_request_options = {
|
|
33
|
+
# order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
|
|
34
|
+
# merchant_transaction_id: "your merchant/shop transaction id",
|
|
35
|
+
# address: address,
|
|
36
|
+
# description: 'Store Purchase - Books',
|
|
37
|
+
# risk_workflow: false,
|
|
38
|
+
# test_mode: 'EXTERNAL' # or 'INTERNAL', valid only for test system
|
|
39
|
+
# create_registration: false, # payment details will be stored on the server an latter can be referenced
|
|
40
|
+
#
|
|
41
|
+
# billing_address: {
|
|
42
|
+
# address1: '123 Test Street',
|
|
43
|
+
# city: 'Test',
|
|
44
|
+
# state: 'TE',
|
|
45
|
+
# zip: 'AB12CD',
|
|
46
|
+
# country: 'GB',
|
|
47
|
+
# },
|
|
48
|
+
# shipping_address: {
|
|
49
|
+
# name: 'Muton DeMicelis',
|
|
50
|
+
# address1: 'My Street On Upiter, Apt 3.14/2.78',
|
|
51
|
+
# city: 'Munich',
|
|
52
|
+
# state: 'Bov',
|
|
53
|
+
# zip: '81675',
|
|
54
|
+
# country: 'DE',
|
|
55
|
+
# },
|
|
56
|
+
# customer: {
|
|
57
|
+
# merchant_customer_id: "your merchant/customer id",
|
|
58
|
+
# givenname: 'Jane',
|
|
59
|
+
# surname: 'Jones',
|
|
60
|
+
# birth_date: '1965-05-01',
|
|
61
|
+
# phone: '(?!?)555-5555',
|
|
62
|
+
# mobile: '(?!?)234-23423',
|
|
63
|
+
# email: 'jane@jones.com',
|
|
64
|
+
# company_name: 'JJ Ltd.',
|
|
65
|
+
# identification_doctype: 'PASSPORT',
|
|
66
|
+
# identification_docid: 'FakeID2342431234123',
|
|
67
|
+
# ip: 101.102.103.104,
|
|
68
|
+
# },
|
|
69
|
+
# }
|
|
70
|
+
#
|
|
71
|
+
# # Request: minimal example
|
|
72
|
+
# minimal_request_options = {
|
|
73
|
+
# order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
|
|
74
|
+
# description: 'Store Purchase - Books',
|
|
75
|
+
# }
|
|
76
|
+
#
|
|
77
|
+
# options =
|
|
78
|
+
# # run request
|
|
79
|
+
# response = gateway.purchase(754, creditcard, options) # charge 7,54 EUR
|
|
80
|
+
#
|
|
81
|
+
# response.success? # Check whether the transaction was successful
|
|
82
|
+
# response.error_code # Retrieve the error message - it's mapped to Gateway::STANDARD_ERROR_CODE
|
|
83
|
+
# response.message # Retrieve the message returned by opp
|
|
84
|
+
# response.authorization # Retrieve the unique transaction ID returned by opp
|
|
85
|
+
# response.params['result']['code'] # Retrieve original return code returned by opp server
|
|
86
|
+
#
|
|
87
|
+
# == Errors
|
|
88
|
+
# If transaction is not successful, response.error_code contains mapped to Gateway::STANDARD_ERROR_CODE error message.
|
|
89
|
+
# Complete list of opp error codes can be viewed on https://docs.oppwa.com/
|
|
90
|
+
# Because this list is much bigger than Gateway::STANDARD_ERROR_CODE, only fraction is mapped to Gateway::STANDARD_ERROR_CODE.
|
|
91
|
+
# All other codes are mapped as Gateway::STANDARD_ERROR_CODE[:processing_error], so if this is the case,
|
|
92
|
+
# you may check the original result code from OPP that can be found in response.params['result']['code']
|
|
93
|
+
#
|
|
94
|
+
# == Special features
|
|
95
|
+
# For purchase method risk check can be forced when options[:risk_workflow] = true
|
|
96
|
+
# This will split (on OPP server side) the transaction into two separate transactions: authorize and capture,
|
|
97
|
+
# but capture will be executed only if risk checks are successful.
|
|
98
|
+
#
|
|
99
|
+
# For testing you may use the test account details listed fixtures.yml under opp. It is important to note that there are two test modes available:
|
|
100
|
+
# options[:test_mode]='EXTERNAL' causes test transactions to be forwarded to the processor's test system for 'end-to-end' testing
|
|
101
|
+
# options[:test_mode]='INTERNAL' causes transactions to be sent to opp simulators, which is useful when switching to the live endpoint for connectivity testing.
|
|
102
|
+
# If no test_mode parameter is sent, test_mode=INTERNAL is the default behaviour.
|
|
103
|
+
#
|
|
104
|
+
# Billing Address, Shipping Address, Custom Parameters are supported as described under https://docs.oppwa.com/parameters
|
|
105
|
+
# See complete example above for details.
|
|
106
|
+
#
|
|
107
|
+
# == Tokenization
|
|
108
|
+
# When create_registration is set to true, the payment details will be stored and a token will be returned in registrationId response field,
|
|
109
|
+
# which can subsequently be used to reference the stored payment.
|
|
110
|
+
|
|
111
|
+
self.test_url = 'https://test.oppwa.com/v1/payments'
|
|
112
|
+
self.live_url = 'https://oppwa.com/v1/payments'
|
|
113
|
+
|
|
114
|
+
self.supported_countries = %w(AD AI AG AR AU AT BS BB BE BZ BM BR BN BG CA HR CY CZ DK DM EE FI FR DE GR GD GY HK HU IS IN IL IT JP LV LI LT LU MY MT MX MC MS NL PA PL PT KN LC MF VC SM SG SK SI ZA ES SR SE CH TR GB US UY)
|
|
115
|
+
self.default_currency = 'EUR'
|
|
116
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro, :dankort]
|
|
117
|
+
|
|
118
|
+
self.homepage_url = 'https://docs.oppwa.com'
|
|
119
|
+
self.display_name = 'Open Payment Platform'
|
|
120
|
+
|
|
121
|
+
def initialize(options={})
|
|
122
|
+
requires!(options, :user_id, :password, :entity_id)
|
|
123
|
+
super
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def purchase(money, payment, options={})
|
|
127
|
+
# debit
|
|
128
|
+
execute_dbpa(options[:risk_workflow] ? 'PA.CP': 'DB',
|
|
129
|
+
money, payment, options)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def authorize(money, payment, options={})
|
|
133
|
+
# preauthorization PA
|
|
134
|
+
execute_dbpa('PA', money, payment, options)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def capture(money, authorization, options={})
|
|
138
|
+
# capture CP
|
|
139
|
+
execute_referencing('CP', money, authorization, options)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def refund(money, authorization, options={})
|
|
143
|
+
# refund RF
|
|
144
|
+
execute_referencing('RF', money, authorization, options)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def void(authorization, options={})
|
|
148
|
+
# reversal RV
|
|
149
|
+
execute_referencing('RV', nil, authorization, options)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def verify(credit_card, options={})
|
|
153
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
154
|
+
r.process { authorize(100, credit_card, options) }
|
|
155
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def supports_scrubbing?
|
|
160
|
+
true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def scrub(transcript)
|
|
164
|
+
transcript.
|
|
165
|
+
gsub(%r((authentication\.password=)\w+), '\1[FILTERED]').
|
|
166
|
+
gsub(%r((card\.number=)\d+), '\1[FILTERED]').
|
|
167
|
+
gsub(%r((card\.cvv=)\d+), '\1[FILTERED]')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
private
|
|
171
|
+
|
|
172
|
+
def execute_dbpa(txtype, money, payment, options)
|
|
173
|
+
post = {}
|
|
174
|
+
post[:paymentType] = txtype
|
|
175
|
+
add_invoice(post, money, options)
|
|
176
|
+
add_payment_method(post, payment, options)
|
|
177
|
+
add_address(post, options)
|
|
178
|
+
add_customer_data(post, payment, options)
|
|
179
|
+
add_options(post, options)
|
|
180
|
+
add_3d_secure(post, options)
|
|
181
|
+
commit(post, nil, options)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def execute_referencing(txtype, money, authorization, options)
|
|
185
|
+
post = {}
|
|
186
|
+
post[:paymentType] = txtype
|
|
187
|
+
add_invoice(post, money, options)
|
|
188
|
+
commit(post, authorization, options)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def add_authentication(post)
|
|
192
|
+
post[:authentication] = { entityId: @options[:entity_id], password: @options[:password], userId: @options[:user_id]}
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def add_customer_data(post, payment, options)
|
|
196
|
+
if options[:customer]
|
|
197
|
+
post[:customer] = {
|
|
198
|
+
merchantCustomerId: options[:customer][:merchant_customer_id],
|
|
199
|
+
givenName: options[:customer][:givenname] || payment.first_name,
|
|
200
|
+
surname: options[:customer][:surname] || payment.last_name,
|
|
201
|
+
birthDate: options[:customer][:birth_date],
|
|
202
|
+
phone: options[:customer][:phone],
|
|
203
|
+
mobile: options[:customer][:mobile],
|
|
204
|
+
email: options[:customer][:email] || options[:email],
|
|
205
|
+
companyName: options[:customer][:company_name],
|
|
206
|
+
identificationDocType: options[:customer][:identification_doctype],
|
|
207
|
+
identificationDocId: options[:customer][:identification_docid],
|
|
208
|
+
ip: options[:customer][:ip] || options[:ip]
|
|
209
|
+
}
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def add_address(post, options)
|
|
214
|
+
if billing_address = options[:billing_address] || options[:address]
|
|
215
|
+
address(post, billing_address, 'billing')
|
|
216
|
+
end
|
|
217
|
+
if shipping_address = options[:shipping_address]
|
|
218
|
+
address(post, shipping_address, 'shipping')
|
|
219
|
+
if shipping_address[:name]
|
|
220
|
+
firstname, lastname = shipping_address[:name].split(' ')
|
|
221
|
+
post[:shipping] = { givenName: firstname, surname: lastname }
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def address(post, address, prefix)
|
|
227
|
+
post[prefix] = {
|
|
228
|
+
street1: address[:address1],
|
|
229
|
+
street2: address[:address2],
|
|
230
|
+
city: address[:city],
|
|
231
|
+
state: address[:state],
|
|
232
|
+
postcode: address[:zip],
|
|
233
|
+
country: address[:country],
|
|
234
|
+
}
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def add_invoice(post, money, options)
|
|
238
|
+
post[:amount] = amount(money)
|
|
239
|
+
post[:currency] = options[:currency] || currency(money) unless post[:paymentType] == 'RV'
|
|
240
|
+
post[:descriptor] = options[:description] || options[:descriptor]
|
|
241
|
+
post[:merchantInvoiceId] = options[:merchantInvoiceId] || options[:order_id]
|
|
242
|
+
post[:merchantTransactionId] = options[:merchant_transaction_id] || generate_unique_id
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def add_payment_method(post, payment, options)
|
|
246
|
+
if options[:registrationId]
|
|
247
|
+
post[:card] = {
|
|
248
|
+
cvv: payment.verification_value,
|
|
249
|
+
}
|
|
250
|
+
else
|
|
251
|
+
post[:paymentBrand] = payment.brand.upcase
|
|
252
|
+
post[:card] = {
|
|
253
|
+
holder: payment.name,
|
|
254
|
+
number: payment.number,
|
|
255
|
+
expiryMonth: '%02d' % payment.month,
|
|
256
|
+
expiryYear: payment.year,
|
|
257
|
+
cvv: payment.verification_value,
|
|
258
|
+
}
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def add_3d_secure(post, options)
|
|
263
|
+
return unless options[:eci] && options[:cavv] && options[:xid]
|
|
264
|
+
|
|
265
|
+
post[:threeDSecure] = {
|
|
266
|
+
eci: options[:eci],
|
|
267
|
+
verificationId: options[:cavv],
|
|
268
|
+
xid: options[:xid]
|
|
269
|
+
}
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def add_options(post, options)
|
|
273
|
+
post[:createRegistration] = options[:create_registration] if options[:create_registration] && !options[:registrationId]
|
|
274
|
+
post[:testMode] = options[:test_mode] if test? && options[:test_mode]
|
|
275
|
+
options.each { |key, value| post[key] = value if key.to_s.match('customParameters\[[a-zA-Z0-9\._]{3,64}\]') }
|
|
276
|
+
post['customParameters[SHOPPER_pluginId]'] = 'activemerchant'
|
|
277
|
+
post['customParameters[custom_disable3DSecure]'] = options[:disable_3d_secure] if options[:disable_3d_secure]
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def build_url(url, authorization, options)
|
|
281
|
+
if options[:registrationId]
|
|
282
|
+
"#{url.gsub(/payments/, 'registrations')}/#{options[:registrationId]}/payments"
|
|
283
|
+
elsif authorization
|
|
284
|
+
"#{url}/#{authorization}"
|
|
285
|
+
else
|
|
286
|
+
url
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def commit(post, authorization, options)
|
|
291
|
+
url = build_url(test? ? test_url : live_url, authorization, options)
|
|
292
|
+
add_authentication(post)
|
|
293
|
+
post = flatten_hash(post)
|
|
294
|
+
|
|
295
|
+
response = begin
|
|
296
|
+
parse(
|
|
297
|
+
ssl_post(
|
|
298
|
+
url,
|
|
299
|
+
post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&'),
|
|
300
|
+
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
301
|
+
)
|
|
302
|
+
)
|
|
303
|
+
rescue ResponseError => e
|
|
304
|
+
parse(e.response.body)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
success = success_from(response)
|
|
308
|
+
|
|
309
|
+
Response.new(
|
|
310
|
+
success,
|
|
311
|
+
message_from(response),
|
|
312
|
+
response,
|
|
313
|
+
authorization: authorization_from(response),
|
|
314
|
+
test: test?,
|
|
315
|
+
error_code: success ? nil : error_code_from(response)
|
|
316
|
+
)
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def parse(body)
|
|
320
|
+
JSON.parse(body)
|
|
321
|
+
rescue JSON::ParserError
|
|
322
|
+
json_error(body)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def json_error(body)
|
|
326
|
+
message = "Invalid response received #{body.inspect}"
|
|
327
|
+
{ 'result' => {'description' => message, 'code' => 'unknown' } }
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def success_from(response)
|
|
331
|
+
return false unless response['result']
|
|
332
|
+
|
|
333
|
+
success_regex = /^(000\.000\.|000\.100\.1|000\.[36])/
|
|
334
|
+
|
|
335
|
+
if success_regex =~ response['result']['code']
|
|
336
|
+
true
|
|
337
|
+
else
|
|
338
|
+
false
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def message_from(response)
|
|
343
|
+
return 'Failed' unless response['result']
|
|
344
|
+
|
|
345
|
+
response['result']['description']
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def authorization_from(response)
|
|
349
|
+
response['id']
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def error_code_from(response)
|
|
353
|
+
response['result']['code']
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def flatten_hash(hash)
|
|
357
|
+
hash.each_with_object({}) do |(k, v), h|
|
|
358
|
+
if v.is_a? Hash
|
|
359
|
+
flatten_hash(v).map do |h_k, h_v|
|
|
360
|
+
h["#{k}.#{h_k}".to_sym] = h_v
|
|
361
|
+
end
|
|
362
|
+
else
|
|
363
|
+
h[k] = v
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
end
|
|
@@ -5,10 +5,12 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
self.live_url = 'https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1'
|
|
6
6
|
|
|
7
7
|
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
|
8
|
-
self.supported_countries = ['CA', 'US', 'GB'
|
|
8
|
+
self.supported_countries = ['CA', 'US', 'GB', 'AU', 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK',
|
|
9
|
+
'EE', 'FI', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT',
|
|
10
|
+
'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'CH']
|
|
9
11
|
|
|
10
12
|
# The card types supported by the payment gateway
|
|
11
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club
|
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
|
|
12
14
|
|
|
13
15
|
# The homepage URL of the gateway
|
|
14
16
|
self.homepage_url = 'http://www.optimalpayments.com/'
|
|
@@ -17,7 +19,17 @@ module ActiveMerchant #:nodoc:
|
|
|
17
19
|
self.display_name = 'Optimal Payments'
|
|
18
20
|
|
|
19
21
|
def initialize(options = {})
|
|
20
|
-
|
|
22
|
+
if(options[:login])
|
|
23
|
+
ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'store_id' and will be removed in a future version.")
|
|
24
|
+
options[:store_id] = options[:login]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if(options[:account])
|
|
28
|
+
ActiveMerchant.deprecated("The 'account' option is deprecated in favor of 'account_number' and will be removed in a future version.")
|
|
29
|
+
options[:account_number] = options[:account]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
requires!(options, :account_number, :store_id, :password)
|
|
21
33
|
super
|
|
22
34
|
end
|
|
23
35
|
|
|
@@ -48,15 +60,31 @@ module ActiveMerchant #:nodoc:
|
|
|
48
60
|
commit('ccSettlement', money, options)
|
|
49
61
|
end
|
|
50
62
|
|
|
63
|
+
def verify(credit_card, options = {})
|
|
64
|
+
parse_card_or_auth(credit_card, options)
|
|
65
|
+
commit('ccVerification', 0, options)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def supports_scrubbing?
|
|
69
|
+
true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def scrub(transcript)
|
|
73
|
+
transcript.
|
|
74
|
+
gsub(%r((%3CstorePwd%3E).*(%3C(%2F|/)storePwd%3E))i, '\1[FILTERED]\2').
|
|
75
|
+
gsub(%r((%3CcardNum%3E)\d*(%3C(%2F|/)cardNum%3E))i, '\1[FILTERED]\2').
|
|
76
|
+
gsub(%r((%3Ccvd%3E)\d*(%3C(%2F|/)cvd%3E))i, '\1[FILTERED]\2')
|
|
77
|
+
end
|
|
78
|
+
|
|
51
79
|
private
|
|
52
80
|
|
|
53
81
|
def parse_card_or_auth(card_or_auth, options)
|
|
54
82
|
if card_or_auth.respond_to?(:number)
|
|
55
83
|
@credit_card = card_or_auth
|
|
56
|
-
@stored_data =
|
|
84
|
+
@stored_data = ''
|
|
57
85
|
else
|
|
58
86
|
options[:confirmationNumber] = card_or_auth
|
|
59
|
-
@stored_data =
|
|
87
|
+
@stored_data = 'StoredData'
|
|
60
88
|
end
|
|
61
89
|
end
|
|
62
90
|
|
|
@@ -76,16 +104,16 @@ module ActiveMerchant #:nodoc:
|
|
|
76
104
|
cc_stored_data_request(money, post)
|
|
77
105
|
when 'ccAuthorizeReversal'
|
|
78
106
|
cc_auth_reversal_request(post)
|
|
79
|
-
#when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
|
|
107
|
+
# when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
|
|
80
108
|
# cc_cancel_request(money, post)
|
|
81
|
-
#when 'ccPayment'
|
|
109
|
+
# when 'ccPayment'
|
|
82
110
|
# cc_payment_request(money, post)
|
|
83
|
-
#when 'ccAuthenticate'
|
|
111
|
+
# when 'ccAuthenticate'
|
|
84
112
|
# cc_authenticate_request(money, post)
|
|
85
113
|
else
|
|
86
114
|
raise 'Unknown Action'
|
|
87
115
|
end
|
|
88
|
-
txnRequest =
|
|
116
|
+
txnRequest = escape_uri(xml)
|
|
89
117
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, "txnMode=#{action}&txnRequest=#{txnRequest}"))
|
|
90
118
|
|
|
91
119
|
Response.new(successful?(response), message_from(response), hash_from_xml(response),
|
|
@@ -96,6 +124,11 @@ module ActiveMerchant #:nodoc:
|
|
|
96
124
|
)
|
|
97
125
|
end
|
|
98
126
|
|
|
127
|
+
# The upstream is picky and so we can't use CGI.escape like we want to
|
|
128
|
+
def escape_uri(uri)
|
|
129
|
+
URI::DEFAULT_PARSER.escape(uri)
|
|
130
|
+
end
|
|
131
|
+
|
|
99
132
|
def successful?(response)
|
|
100
133
|
REXML::XPath.first(response, '//decision').text == 'ACCEPTED' rescue false
|
|
101
134
|
end
|
|
@@ -150,23 +183,24 @@ module ActiveMerchant #:nodoc:
|
|
|
150
183
|
|
|
151
184
|
def get_text_from_document(document, node)
|
|
152
185
|
node = REXML::XPath.first(document, node)
|
|
153
|
-
node
|
|
186
|
+
node&.text
|
|
154
187
|
end
|
|
155
188
|
|
|
156
189
|
def cc_auth_request(money, opts)
|
|
157
190
|
xml_document('ccAuthRequestV1') do |xml|
|
|
158
|
-
build_merchant_account(xml
|
|
191
|
+
build_merchant_account(xml)
|
|
159
192
|
xml.merchantRefNum opts[:order_id]
|
|
160
193
|
xml.amount(money/100.0)
|
|
161
194
|
build_card(xml, opts)
|
|
162
195
|
build_billing_details(xml, opts)
|
|
163
196
|
build_shipping_details(xml, opts)
|
|
197
|
+
xml.customerIP opts[:ip] if opts[:ip]
|
|
164
198
|
end
|
|
165
199
|
end
|
|
166
200
|
|
|
167
201
|
def cc_auth_reversal_request(opts)
|
|
168
202
|
xml_document('ccAuthReversalRequestV1') do |xml|
|
|
169
|
-
build_merchant_account(xml
|
|
203
|
+
build_merchant_account(xml)
|
|
170
204
|
xml.confirmationNumber opts[:confirmationNumber]
|
|
171
205
|
xml.merchantRefNum opts[:order_id]
|
|
172
206
|
end
|
|
@@ -174,7 +208,7 @@ module ActiveMerchant #:nodoc:
|
|
|
174
208
|
|
|
175
209
|
def cc_post_auth_request(money, opts)
|
|
176
210
|
xml_document('ccPostAuthRequestV1') do |xml|
|
|
177
|
-
build_merchant_account(xml
|
|
211
|
+
build_merchant_account(xml)
|
|
178
212
|
xml.confirmationNumber opts[:confirmationNumber]
|
|
179
213
|
xml.merchantRefNum opts[:order_id]
|
|
180
214
|
xml.amount(money/100.0)
|
|
@@ -183,7 +217,7 @@ module ActiveMerchant #:nodoc:
|
|
|
183
217
|
|
|
184
218
|
def cc_stored_data_request(money, opts)
|
|
185
219
|
xml_document('ccStoredDataRequestV1') do |xml|
|
|
186
|
-
build_merchant_account(xml
|
|
220
|
+
build_merchant_account(xml)
|
|
187
221
|
xml.merchantRefNum opts[:order_id]
|
|
188
222
|
xml.confirmationNumber opts[:confirmationNumber]
|
|
189
223
|
xml.amount(money/100.0)
|
|
@@ -194,14 +228,14 @@ module ActiveMerchant #:nodoc:
|
|
|
194
228
|
#
|
|
195
229
|
# def cc_cancel_request(opts)
|
|
196
230
|
# xml_document('ccCancelRequestV1') do |xml|
|
|
197
|
-
# build_merchant_account(xml
|
|
231
|
+
# build_merchant_account(xml)
|
|
198
232
|
# xml.confirmationNumber opts[:confirmationNumber]
|
|
199
233
|
# end
|
|
200
234
|
# end
|
|
201
235
|
#
|
|
202
236
|
# def cc_payment_request(money, opts)
|
|
203
237
|
# xml_document('ccPaymentRequestV1') do |xml|
|
|
204
|
-
# build_merchant_account(xml
|
|
238
|
+
# build_merchant_account(xml)
|
|
205
239
|
# xml.merchantRefNum opts[:order_id]
|
|
206
240
|
# xml.amount(money/100.0)
|
|
207
241
|
# build_card(xml, opts)
|
|
@@ -211,7 +245,7 @@ module ActiveMerchant #:nodoc:
|
|
|
211
245
|
#
|
|
212
246
|
# def cc_authenticate_request(opts)
|
|
213
247
|
# xml_document('ccAuthenticateRequestV1') do |xml|
|
|
214
|
-
# build_merchant_account(xml
|
|
248
|
+
# build_merchant_account(xml)
|
|
215
249
|
# xml.confirmationNumber opts[:confirmationNumber]
|
|
216
250
|
# xml.paymentResponse 'myPaymentResponse'
|
|
217
251
|
# end
|
|
@@ -224,27 +258,29 @@ module ActiveMerchant #:nodoc:
|
|
|
224
258
|
}
|
|
225
259
|
end
|
|
226
260
|
|
|
227
|
-
def build_merchant_account(xml
|
|
261
|
+
def build_merchant_account(xml)
|
|
228
262
|
xml.tag! 'merchantAccount' do
|
|
229
|
-
xml.tag! 'accountNum'
|
|
230
|
-
xml.tag! 'storeID'
|
|
231
|
-
xml.tag! 'storePwd'
|
|
263
|
+
xml.tag! 'accountNum', @options[:account_number]
|
|
264
|
+
xml.tag! 'storeID', @options[:store_id]
|
|
265
|
+
xml.tag! 'storePwd', @options[:password]
|
|
232
266
|
end
|
|
233
267
|
end
|
|
234
268
|
|
|
235
269
|
def build_card(xml, opts)
|
|
236
270
|
xml.tag! 'card' do
|
|
237
|
-
xml.tag! 'cardNum'
|
|
271
|
+
xml.tag! 'cardNum', @credit_card.number
|
|
238
272
|
xml.tag! 'cardExpiry' do
|
|
239
|
-
xml.tag! 'month'
|
|
240
|
-
xml.tag! 'year'
|
|
273
|
+
xml.tag! 'month', @credit_card.month
|
|
274
|
+
xml.tag! 'year', @credit_card.year
|
|
241
275
|
end
|
|
242
276
|
if brand = card_type(@credit_card.brand)
|
|
243
|
-
xml.tag! 'cardType'
|
|
277
|
+
xml.tag! 'cardType', brand
|
|
244
278
|
end
|
|
245
|
-
if @credit_card.verification_value
|
|
246
|
-
xml.tag! 'cvdIndicator'
|
|
247
|
-
xml.tag! 'cvd'
|
|
279
|
+
if @credit_card.verification_value?
|
|
280
|
+
xml.tag! 'cvdIndicator', '1' # Value Provided
|
|
281
|
+
xml.tag! 'cvd', @credit_card.verification_value
|
|
282
|
+
else
|
|
283
|
+
xml.tag! 'cvdIndicator', '0'
|
|
248
284
|
end
|
|
249
285
|
end
|
|
250
286
|
end
|
|
@@ -252,32 +288,34 @@ module ActiveMerchant #:nodoc:
|
|
|
252
288
|
def build_billing_details(xml, opts)
|
|
253
289
|
xml.tag! 'billingDetails' do
|
|
254
290
|
xml.tag! 'cardPayMethod', 'WEB'
|
|
255
|
-
build_address(xml, opts[:billing_address]
|
|
291
|
+
build_address(xml, opts[:billing_address]) if opts[:billing_address]
|
|
292
|
+
xml.tag! 'email', opts[:email] if opts[:email]
|
|
256
293
|
end
|
|
257
294
|
end
|
|
258
295
|
|
|
259
296
|
def build_shipping_details(xml, opts)
|
|
260
297
|
xml.tag! 'shippingDetails' do
|
|
261
|
-
build_address(xml, opts[:shipping_address]
|
|
298
|
+
build_address(xml, opts[:shipping_address])
|
|
299
|
+
xml.tag! 'email', opts[:email] if opts[:email]
|
|
262
300
|
end if opts[:shipping_address].present?
|
|
263
301
|
end
|
|
264
302
|
|
|
265
|
-
def build_address(xml, addr
|
|
303
|
+
def build_address(xml, addr)
|
|
266
304
|
if addr[:name]
|
|
267
|
-
|
|
268
|
-
xml.tag! '
|
|
305
|
+
first_name, last_name = split_names(addr[:name])
|
|
306
|
+
xml.tag! 'firstName', first_name
|
|
307
|
+
xml.tag! 'lastName', last_name
|
|
269
308
|
end
|
|
270
|
-
xml.tag! 'street'
|
|
271
|
-
xml.tag! 'street2',
|
|
272
|
-
xml.tag! 'city'
|
|
309
|
+
xml.tag! 'street', addr[:address1] if addr[:address1].present?
|
|
310
|
+
xml.tag! 'street2', addr[:address2] if addr[:address2].present?
|
|
311
|
+
xml.tag! 'city', addr[:city] if addr[:city].present?
|
|
273
312
|
if addr[:state].present?
|
|
274
313
|
state_tag = %w(US CA).include?(addr[:country]) ? 'state' : 'region'
|
|
275
|
-
xml.tag! state_tag,
|
|
314
|
+
xml.tag! state_tag, addr[:state]
|
|
276
315
|
end
|
|
277
|
-
xml.tag! 'country',
|
|
278
|
-
xml.tag! 'zip'
|
|
279
|
-
xml.tag! 'phone'
|
|
280
|
-
xml.tag! 'email', CGI.escape(email) if email
|
|
316
|
+
xml.tag! 'country', addr[:country] if addr[:country].present?
|
|
317
|
+
xml.tag! 'zip', addr[:zip] if addr[:zip].present?
|
|
318
|
+
xml.tag! 'phone', addr[:phone] if addr[:phone].present?
|
|
281
319
|
end
|
|
282
320
|
|
|
283
321
|
def card_type(key)
|
|
@@ -286,12 +324,9 @@ module ActiveMerchant #:nodoc:
|
|
|
286
324
|
'american_express'=> 'AM',
|
|
287
325
|
'discover' => 'DI',
|
|
288
326
|
'diners_club' => 'DC',
|
|
289
|
-
#'switch' => '',
|
|
290
|
-
'solo' => 'SO'
|
|
291
327
|
}[key]
|
|
292
328
|
end
|
|
293
329
|
|
|
294
330
|
end
|
|
295
331
|
end
|
|
296
332
|
end
|
|
297
|
-
|