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,304 @@
|
|
|
1
|
+
require 'base64'
|
|
2
|
+
require 'digest'
|
|
3
|
+
|
|
4
|
+
module ActiveMerchant #:nodoc:
|
|
5
|
+
module Billing #:nodoc:
|
|
6
|
+
class PaymentezGateway < Gateway #:nodoc:
|
|
7
|
+
self.test_url = 'https://ccapi-stg.paymentez.com/v2/'
|
|
8
|
+
self.live_url = 'https://ccapi.paymentez.com/v2/'
|
|
9
|
+
|
|
10
|
+
self.supported_countries = %w[MX EC VE CO BR CL]
|
|
11
|
+
self.default_currency = 'USD'
|
|
12
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
|
13
|
+
|
|
14
|
+
self.homepage_url = 'https://secure.paymentez.com/'
|
|
15
|
+
self.display_name = 'Paymentez'
|
|
16
|
+
|
|
17
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
|
18
|
+
1 => :processing_error,
|
|
19
|
+
6 => :card_declined,
|
|
20
|
+
9 => :card_declined,
|
|
21
|
+
10 => :processing_error,
|
|
22
|
+
11 => :card_declined,
|
|
23
|
+
12 => :config_error,
|
|
24
|
+
13 => :config_error,
|
|
25
|
+
19 => :invalid_cvc,
|
|
26
|
+
20 => :config_error,
|
|
27
|
+
21 => :card_declined,
|
|
28
|
+
22 => :card_declined,
|
|
29
|
+
23 => :card_declined,
|
|
30
|
+
24 => :card_declined,
|
|
31
|
+
25 => :card_declined,
|
|
32
|
+
26 => :card_declined,
|
|
33
|
+
27 => :card_declined,
|
|
34
|
+
28 => :card_declined
|
|
35
|
+
}.freeze
|
|
36
|
+
|
|
37
|
+
CARD_MAPPING = {
|
|
38
|
+
'visa' => 'vi',
|
|
39
|
+
'master' => 'mc',
|
|
40
|
+
'american_express' => 'ax',
|
|
41
|
+
'diners_club' => 'di'
|
|
42
|
+
}.freeze
|
|
43
|
+
|
|
44
|
+
def initialize(options = {})
|
|
45
|
+
requires!(options, :application_code, :app_key)
|
|
46
|
+
super
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def purchase(money, payment, options = {})
|
|
50
|
+
post = {}
|
|
51
|
+
|
|
52
|
+
add_invoice(post, money, options)
|
|
53
|
+
add_payment(post, payment)
|
|
54
|
+
add_customer_data(post, options)
|
|
55
|
+
add_extra_params(post, options)
|
|
56
|
+
action = payment.is_a?(String) ? 'debit' : 'debit_cc'
|
|
57
|
+
|
|
58
|
+
commit_transaction(action, post)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def authorize(money, payment, options = {})
|
|
62
|
+
post = {}
|
|
63
|
+
|
|
64
|
+
add_invoice(post, money, options)
|
|
65
|
+
add_payment(post, payment)
|
|
66
|
+
add_customer_data(post, options)
|
|
67
|
+
add_extra_params(post, options)
|
|
68
|
+
|
|
69
|
+
commit_transaction('authorize', post)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def capture(money, authorization, _options = {})
|
|
73
|
+
post = {
|
|
74
|
+
transaction: { id: authorization }
|
|
75
|
+
}
|
|
76
|
+
post[:order] = {amount: amount(money).to_f} if money
|
|
77
|
+
|
|
78
|
+
commit_transaction('capture', post)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def refund(money, authorization, options = {})
|
|
82
|
+
post = {transaction: {id: authorization}}
|
|
83
|
+
post[:order] = {amount: amount(money).to_f} if money
|
|
84
|
+
|
|
85
|
+
commit_transaction('refund', post)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def void(authorization, _options = {})
|
|
89
|
+
post = { transaction: { id: authorization } }
|
|
90
|
+
commit_transaction('refund', post)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def verify(credit_card, options = {})
|
|
94
|
+
MultiResponse.run do |r|
|
|
95
|
+
r.process { authorize(100, credit_card, options) }
|
|
96
|
+
r.process { void(r.authorization, options) }
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def store(credit_card, options = {})
|
|
101
|
+
post = {}
|
|
102
|
+
|
|
103
|
+
add_customer_data(post, options)
|
|
104
|
+
add_payment(post, credit_card)
|
|
105
|
+
|
|
106
|
+
response = commit_card('add', post)
|
|
107
|
+
if !response.success? && !(token = extract_previous_card_token(response)).nil?
|
|
108
|
+
unstore(token, options)
|
|
109
|
+
response = commit_card('add', post)
|
|
110
|
+
end
|
|
111
|
+
response
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def unstore(identification, options = {})
|
|
115
|
+
post = { card: { token: identification }, user: { id: options[:user_id] }}
|
|
116
|
+
commit_card('delete', post)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def supports_scrubbing?
|
|
120
|
+
true
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def scrub(transcript)
|
|
124
|
+
transcript.
|
|
125
|
+
gsub(%r{(\\?"number\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
|
126
|
+
gsub(%r{(\\?"cvc\\?":)(\\?"[^"]+\\?")}, '\1[FILTERED]').
|
|
127
|
+
gsub(%r{(Auth-Token: )([A-Za-z0-9=]+)}, '\1[FILTERED]')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
private
|
|
131
|
+
|
|
132
|
+
def add_customer_data(post, options)
|
|
133
|
+
requires!(options, :user_id, :email)
|
|
134
|
+
post[:user] ||= {}
|
|
135
|
+
post[:user][:id] = options[:user_id]
|
|
136
|
+
post[:user][:email] = options[:email]
|
|
137
|
+
post[:user][:ip_address] = options[:ip] if options[:ip]
|
|
138
|
+
post[:user][:fiscal_number] = options[:fiscal_number] if options[:fiscal_number]
|
|
139
|
+
if phone = options[:phone] || options.dig(:billing_address, :phone)
|
|
140
|
+
post[:user][:phone] = phone
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def add_invoice(post, money, options)
|
|
145
|
+
post[:session_id] = options[:session_id] if options[:session_id]
|
|
146
|
+
|
|
147
|
+
post[:order] ||= {}
|
|
148
|
+
post[:order][:amount] = amount(money).to_f
|
|
149
|
+
post[:order][:vat] = options[:vat] if options[:vat]
|
|
150
|
+
post[:order][:dev_reference] = options[:dev_reference] if options[:dev_reference]
|
|
151
|
+
post[:order][:description] = options[:description] if options[:description]
|
|
152
|
+
post[:order][:discount] = options[:discount] if options[:discount]
|
|
153
|
+
post[:order][:installments] = options[:installments] if options[:installments]
|
|
154
|
+
post[:order][:installments_type] = options[:installments_type] if options[:installments_type]
|
|
155
|
+
post[:order][:taxable_amount] = options[:taxable_amount] if options[:taxable_amount]
|
|
156
|
+
post[:order][:tax_percentage] = options[:tax_percentage] if options[:tax_percentage]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def add_payment(post, payment)
|
|
160
|
+
post[:card] ||= {}
|
|
161
|
+
if payment.is_a?(String)
|
|
162
|
+
post[:card][:token] = payment
|
|
163
|
+
else
|
|
164
|
+
post[:card][:number] = payment.number
|
|
165
|
+
post[:card][:holder_name] = payment.name
|
|
166
|
+
post[:card][:expiry_month] = payment.month
|
|
167
|
+
post[:card][:expiry_year] = payment.year
|
|
168
|
+
post[:card][:cvc] = payment.verification_value
|
|
169
|
+
post[:card][:type] = CARD_MAPPING[payment.brand]
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def add_extra_params(post, options)
|
|
174
|
+
if options[:extra_params]
|
|
175
|
+
items = {}
|
|
176
|
+
options[:extra_params].each do |param|
|
|
177
|
+
param.each do |key, value|
|
|
178
|
+
items[key.to_sym] = value
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
post[:extra_params] = items
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def parse(body)
|
|
186
|
+
JSON.parse(body)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def commit_raw(object, action, parameters)
|
|
190
|
+
url = "#{(test? ? test_url : live_url)}#{object}/#{action}"
|
|
191
|
+
|
|
192
|
+
begin
|
|
193
|
+
raw_response = ssl_post(url, post_data(parameters), headers)
|
|
194
|
+
rescue ResponseError => e
|
|
195
|
+
raw_response = e.response.body
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
begin
|
|
199
|
+
parse(raw_response)
|
|
200
|
+
rescue JSON::ParserError
|
|
201
|
+
{'status' => 'Internal server error'}
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def commit_transaction(action, parameters)
|
|
206
|
+
response = commit_raw('transaction', action, parameters)
|
|
207
|
+
Response.new(
|
|
208
|
+
success_from(response),
|
|
209
|
+
message_from(response),
|
|
210
|
+
response,
|
|
211
|
+
authorization: authorization_from(response),
|
|
212
|
+
test: test?,
|
|
213
|
+
error_code: error_code_from(response)
|
|
214
|
+
)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def commit_card(action, parameters)
|
|
218
|
+
response = commit_raw('card', action, parameters)
|
|
219
|
+
Response.new(
|
|
220
|
+
card_success_from(response),
|
|
221
|
+
card_message_from(response),
|
|
222
|
+
response,
|
|
223
|
+
authorization: card_authorization_from(response),
|
|
224
|
+
test: test?,
|
|
225
|
+
error_code: card_error_code_from(response)
|
|
226
|
+
)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def headers
|
|
230
|
+
{
|
|
231
|
+
'Auth-Token' => authentication_code,
|
|
232
|
+
'Content-Type' => 'application/json'
|
|
233
|
+
}
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def success_from(response)
|
|
237
|
+
!response.include?('error') && (response['status'] || response['transaction']['status']) == 'success'
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def card_success_from(response)
|
|
241
|
+
return false if response.include?('error')
|
|
242
|
+
return true if response['message'] == 'card deleted'
|
|
243
|
+
response['card']['status'] == 'valid'
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def message_from(response)
|
|
247
|
+
if !success_from(response) && response['error']
|
|
248
|
+
response['error'] && response['error']['type']
|
|
249
|
+
else
|
|
250
|
+
response['transaction'] && response['transaction']['message']
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def card_message_from(response)
|
|
255
|
+
if !response.include?('error')
|
|
256
|
+
response['message'] || response['card']['message']
|
|
257
|
+
else
|
|
258
|
+
response['error']['type']
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def authorization_from(response)
|
|
263
|
+
response['transaction'] && response['transaction']['id']
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def card_authorization_from(response)
|
|
267
|
+
response['card'] && response['card']['token']
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def extract_previous_card_token(response)
|
|
271
|
+
match = /Card already added: (\d+)/.match(response.message)
|
|
272
|
+
match && match[1]
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
def post_data(parameters = {})
|
|
276
|
+
JSON.dump(parameters)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def error_code_from(response)
|
|
280
|
+
return if success_from(response)
|
|
281
|
+
if response['transaction']
|
|
282
|
+
detail = response['transaction']['status_detail']
|
|
283
|
+
if STANDARD_ERROR_CODE_MAPPING.include?(detail)
|
|
284
|
+
return STANDARD_ERROR_CODE[STANDARD_ERROR_CODE_MAPPING[detail]]
|
|
285
|
+
end
|
|
286
|
+
elsif response['error']
|
|
287
|
+
return STANDARD_ERROR_CODE[:config_error]
|
|
288
|
+
end
|
|
289
|
+
STANDARD_ERROR_CODE[:processing_error]
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def card_error_code_from(response)
|
|
293
|
+
STANDARD_ERROR_CODE[:processing_error] unless card_success_from(response)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def authentication_code
|
|
297
|
+
timestamp = Time.new.to_i
|
|
298
|
+
unique_token = Digest::SHA256.hexdigest("#{@options[:app_key]}#{timestamp}")
|
|
299
|
+
authentication_string = "#{@options[:application_code]};#{timestamp};#{unique_token}"
|
|
300
|
+
Base64.encode64(authentication_string).delete("\n")
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
end
|
|
@@ -5,18 +5,19 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT
|
|
6
6
|
NL NO PL PT RO SE SI SK TR VA)
|
|
7
7
|
|
|
8
|
-
self.supported_cardtypes = [:visa, :master]
|
|
8
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :union_pay, :jcb]
|
|
9
9
|
self.homepage_url = 'https://paymill.com'
|
|
10
10
|
self.display_name = 'PAYMILL'
|
|
11
11
|
self.money_format = :cents
|
|
12
12
|
self.default_currency = 'EUR'
|
|
13
|
+
self.live_url = 'https://api.paymill.com/v2/'
|
|
13
14
|
|
|
14
15
|
def initialize(options = {})
|
|
15
16
|
requires!(options, :public_key, :private_key)
|
|
16
17
|
super
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
def purchase(money, payment_method, options
|
|
20
|
+
def purchase(money, payment_method, options={})
|
|
20
21
|
action_with_token(:purchase, money, payment_method, options)
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -29,7 +30,8 @@ module ActiveMerchant #:nodoc:
|
|
|
29
30
|
|
|
30
31
|
add_amount(post, money, options)
|
|
31
32
|
post[:preauthorization] = preauth(authorization)
|
|
32
|
-
post[:description] = options[:
|
|
33
|
+
post[:description] = options[:order_id]
|
|
34
|
+
post[:source] = 'active_merchant'
|
|
33
35
|
commit(:post, 'transactions', post)
|
|
34
36
|
end
|
|
35
37
|
|
|
@@ -37,7 +39,7 @@ module ActiveMerchant #:nodoc:
|
|
|
37
39
|
post = {}
|
|
38
40
|
|
|
39
41
|
post[:amount] = amount(money)
|
|
40
|
-
post[:description] = options[:
|
|
42
|
+
post[:description] = options[:order_id]
|
|
41
43
|
commit(:post, "refunds/#{transaction_id(authorization)}", post)
|
|
42
44
|
end
|
|
43
45
|
|
|
@@ -46,27 +48,56 @@ module ActiveMerchant #:nodoc:
|
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def store(credit_card, options={})
|
|
49
|
-
save_card(credit_card)
|
|
51
|
+
save_card(credit_card, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def supports_scrubbing
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def scrub(transcript)
|
|
59
|
+
transcript.
|
|
60
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
|
61
|
+
gsub(/(account.number=)(\d*)/, '\1[FILTERED]').
|
|
62
|
+
gsub(/(account.verification=)(\d*)/, '\1[FILTERED]')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def verify_credentials
|
|
66
|
+
begin
|
|
67
|
+
ssl_get(live_url + 'transactions/nonexistent', headers)
|
|
68
|
+
rescue ResponseError => e
|
|
69
|
+
return false if e.response.code.to_i == 401
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
true
|
|
50
73
|
end
|
|
51
74
|
|
|
52
75
|
private
|
|
53
76
|
|
|
54
|
-
def add_credit_card(post, credit_card)
|
|
77
|
+
def add_credit_card(post, credit_card, options)
|
|
78
|
+
post['account.holder'] = (credit_card.try(:name) || '')
|
|
55
79
|
post['account.number'] = credit_card.number
|
|
56
|
-
post['account.expiry.month'] = sprintf(
|
|
57
|
-
post['account.expiry.year'] = sprintf(
|
|
80
|
+
post['account.expiry.month'] = sprintf('%.2i', credit_card.month)
|
|
81
|
+
post['account.expiry.year'] = sprintf('%.4i', credit_card.year)
|
|
58
82
|
post['account.verification'] = credit_card.verification_value
|
|
83
|
+
post['account.email'] = (options[:email] || nil)
|
|
84
|
+
post['presentation.amount3D'] = (options[:money] || nil)
|
|
85
|
+
post['presentation.currency3D'] = (options[:currency] || currency(options[:money]))
|
|
59
86
|
end
|
|
60
87
|
|
|
61
88
|
def headers
|
|
62
89
|
{ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
|
|
63
90
|
end
|
|
64
91
|
|
|
65
|
-
def commit(method,
|
|
92
|
+
def commit(method, action, parameters=nil)
|
|
66
93
|
begin
|
|
67
|
-
raw_response = ssl_request(method,
|
|
94
|
+
raw_response = ssl_request(method, live_url + action, post_data(parameters), headers)
|
|
68
95
|
rescue ResponseError => e
|
|
69
|
-
|
|
96
|
+
begin
|
|
97
|
+
parsed = JSON.parse(e.response.body)
|
|
98
|
+
rescue JSON::ParserError
|
|
99
|
+
return Response.new(false, "Unable to parse error response: '#{e.response.body}'")
|
|
100
|
+
end
|
|
70
101
|
return Response.new(false, response_message(parsed), parsed, {})
|
|
71
102
|
end
|
|
72
103
|
|
|
@@ -80,7 +111,7 @@ module ActiveMerchant #:nodoc:
|
|
|
80
111
|
:test => (parsed['mode'] == 'test'),
|
|
81
112
|
}
|
|
82
113
|
|
|
83
|
-
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'] == 20000)
|
|
114
|
+
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'].to_i == 20000)
|
|
84
115
|
Response.new(succeeded, response_message(parsed), parsed, options)
|
|
85
116
|
end
|
|
86
117
|
|
|
@@ -91,16 +122,17 @@ module ActiveMerchant #:nodoc:
|
|
|
91
122
|
[
|
|
92
123
|
parsed_data['id'],
|
|
93
124
|
parsed_data['preauthorization'].try(:[], 'id')
|
|
94
|
-
].join(
|
|
125
|
+
].join(';')
|
|
95
126
|
end
|
|
96
127
|
|
|
97
128
|
def action_with_token(action, money, payment_method, options)
|
|
129
|
+
options[:money] = money
|
|
98
130
|
case payment_method
|
|
99
131
|
when String
|
|
100
132
|
self.send("#{action}_with_token", money, payment_method, options)
|
|
101
133
|
else
|
|
102
134
|
MultiResponse.run do |r|
|
|
103
|
-
r.process { save_card(payment_method) }
|
|
135
|
+
r.process { save_card(payment_method, options) }
|
|
104
136
|
r.process { self.send("#{action}_with_token", money, r.authorization, options) }
|
|
105
137
|
end
|
|
106
138
|
end
|
|
@@ -111,7 +143,8 @@ module ActiveMerchant #:nodoc:
|
|
|
111
143
|
|
|
112
144
|
add_amount(post, money, options)
|
|
113
145
|
post[:token] = card_token
|
|
114
|
-
post[:description] = options[:
|
|
146
|
+
post[:description] = options[:order_id]
|
|
147
|
+
post[:source] = 'active_merchant'
|
|
115
148
|
commit(:post, 'transactions', post)
|
|
116
149
|
end
|
|
117
150
|
|
|
@@ -120,13 +153,15 @@ module ActiveMerchant #:nodoc:
|
|
|
120
153
|
|
|
121
154
|
add_amount(post, money, options)
|
|
122
155
|
post[:token] = card_token
|
|
156
|
+
post[:description] = options[:order_id]
|
|
157
|
+
post[:source] = 'active_merchant'
|
|
123
158
|
commit(:post, 'preauthorizations', post)
|
|
124
159
|
end
|
|
125
160
|
|
|
126
|
-
def save_card(credit_card)
|
|
161
|
+
def save_card(credit_card, options)
|
|
127
162
|
post = {}
|
|
128
163
|
|
|
129
|
-
add_credit_card(post, credit_card)
|
|
164
|
+
add_credit_card(post, credit_card, options)
|
|
130
165
|
post['channel.id'] = @options[:public_key]
|
|
131
166
|
post['jsonPFunction'] = 'jsonPFunction'
|
|
132
167
|
post['transaction.mode'] = (test? ? 'CONNECTOR_TEST' : 'LIVE')
|
|
@@ -134,7 +169,7 @@ module ActiveMerchant #:nodoc:
|
|
|
134
169
|
begin
|
|
135
170
|
raw_response = ssl_request(:get, "#{save_card_url}?#{post_data(post)}", nil, {})
|
|
136
171
|
rescue ResponseError => e
|
|
137
|
-
return Response.new(false, e.response.body
|
|
172
|
+
return Response.new(false, e.response.body)
|
|
138
173
|
end
|
|
139
174
|
|
|
140
175
|
response_for_save_from(raw_response)
|
|
@@ -159,7 +194,7 @@ module ActiveMerchant #:nodoc:
|
|
|
159
194
|
return nil unless params
|
|
160
195
|
|
|
161
196
|
no_blanks = params.reject { |key, value| value.blank? }
|
|
162
|
-
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
|
197
|
+
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
163
198
|
end
|
|
164
199
|
|
|
165
200
|
def add_amount(post, money, options)
|
|
@@ -168,7 +203,7 @@ module ActiveMerchant #:nodoc:
|
|
|
168
203
|
end
|
|
169
204
|
|
|
170
205
|
def preauth(authorization)
|
|
171
|
-
authorization.split(
|
|
206
|
+
authorization.split(';').last
|
|
172
207
|
end
|
|
173
208
|
|
|
174
209
|
def transaction_id(authorization)
|
|
@@ -176,59 +211,119 @@ module ActiveMerchant #:nodoc:
|
|
|
176
211
|
end
|
|
177
212
|
|
|
178
213
|
RESPONSE_CODES = {
|
|
179
|
-
10001 =>
|
|
180
|
-
10002 =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
10001 => 'Undefined response',
|
|
215
|
+
10002 => 'Waiting for something',
|
|
216
|
+
11000 => 'Retry request at a later time',
|
|
217
|
+
|
|
218
|
+
20000 => 'Operation successful',
|
|
219
|
+
20100 => 'Funds held by acquirer',
|
|
220
|
+
20101 => 'Funds held by acquirer because merchant is new',
|
|
221
|
+
20200 => 'Transaction reversed',
|
|
222
|
+
20201 => 'Reversed due to chargeback',
|
|
223
|
+
20202 => 'Reversed due to money-back guarantee',
|
|
224
|
+
20203 => 'Reversed due to complaint by buyer',
|
|
225
|
+
20204 => 'Payment has been refunded',
|
|
226
|
+
20300 => 'Reversal has been canceled',
|
|
227
|
+
22000 => 'Initiation of transaction successful',
|
|
228
|
+
|
|
229
|
+
30000 => 'Transaction still in progress',
|
|
230
|
+
30100 => 'Transaction has been accepted',
|
|
231
|
+
31000 => 'Transaction pending',
|
|
232
|
+
31100 => 'Pending due to address',
|
|
233
|
+
31101 => 'Pending due to uncleared eCheck',
|
|
234
|
+
31102 => 'Pending due to risk review',
|
|
235
|
+
31103 => 'Pending due regulatory review',
|
|
236
|
+
31104 => 'Pending due to unregistered/unconfirmed receiver',
|
|
237
|
+
31200 => 'Pending due to unverified account',
|
|
238
|
+
31201 => 'Pending due to non-captured funds',
|
|
239
|
+
31202 => 'Pending due to international account (accept manually)',
|
|
240
|
+
31203 => 'Pending due to currency conflict (accept manually)',
|
|
241
|
+
31204 => 'Pending due to fraud filters (accept manually)',
|
|
242
|
+
|
|
243
|
+
40000 => 'Problem with transaction data',
|
|
244
|
+
40001 => 'Problem with payment data',
|
|
245
|
+
40002 => 'Invalid checksum',
|
|
246
|
+
40100 => 'Problem with credit card data',
|
|
247
|
+
40101 => 'Problem with CVV',
|
|
248
|
+
40102 => 'Card expired or not yet valid',
|
|
249
|
+
40103 => 'Card limit exceeded',
|
|
250
|
+
40104 => 'Card is not valid',
|
|
251
|
+
40105 => 'Expiry date not valid',
|
|
252
|
+
40106 => 'Credit card brand required',
|
|
253
|
+
40200 => 'Problem with bank account data',
|
|
254
|
+
40201 => 'Bank account data combination mismatch',
|
|
255
|
+
40202 => 'User authentication failed',
|
|
256
|
+
40300 => 'Problem with 3-D Secure data',
|
|
257
|
+
40301 => 'Currency/amount mismatch',
|
|
258
|
+
40400 => 'Problem with input data',
|
|
259
|
+
40401 => 'Amount too low or zero',
|
|
260
|
+
40402 => 'Usage field too long',
|
|
261
|
+
40403 => 'Currency not allowed',
|
|
262
|
+
40410 => 'Problem with shopping cart data',
|
|
263
|
+
40420 => 'Problem with address data',
|
|
264
|
+
40500 => 'Permission error with acquirer API',
|
|
265
|
+
40510 => 'Rate limit reached for acquirer API',
|
|
266
|
+
42000 => 'Initiation of transaction failed',
|
|
267
|
+
42410 => 'Initiation of transaction expired',
|
|
268
|
+
|
|
269
|
+
50000 => 'Problem with back end',
|
|
270
|
+
50001 => 'Country blacklisted',
|
|
271
|
+
50002 => 'IP address blacklisted',
|
|
272
|
+
50004 => 'Live mode not allowed',
|
|
273
|
+
50005 => 'Insufficient permissions (API key)',
|
|
274
|
+
50100 => 'Technical error with credit card',
|
|
275
|
+
50101 => 'Error limit exceeded',
|
|
276
|
+
50102 => 'Card declined',
|
|
277
|
+
50103 => 'Manipulation or stolen card',
|
|
278
|
+
50104 => 'Card restricted',
|
|
279
|
+
50105 => 'Invalid configuration data',
|
|
280
|
+
50200 => 'Technical error with bank account',
|
|
281
|
+
50201 => 'Account blacklisted',
|
|
282
|
+
50300 => 'Technical error with 3-D Secure',
|
|
283
|
+
50400 => 'Declined because of risk issues',
|
|
284
|
+
50401 => 'Checksum was wrong',
|
|
285
|
+
50402 => 'Bank account number was invalid (formal check)',
|
|
286
|
+
50403 => 'Technical error with risk check',
|
|
287
|
+
50404 => 'Unknown error with risk check',
|
|
288
|
+
50405 => 'Unknown bank code',
|
|
289
|
+
50406 => 'Open chargeback',
|
|
290
|
+
50407 => 'Historical chargeback',
|
|
291
|
+
50408 => 'Institution / public bank account (NCA)',
|
|
292
|
+
50409 => 'KUNO/Fraud',
|
|
293
|
+
50410 => 'Personal Account Protection (PAP)',
|
|
294
|
+
50420 => 'Rejected due to acquirer fraud settings',
|
|
295
|
+
50430 => 'Rejected due to acquirer risk settings',
|
|
296
|
+
50440 => 'Failed due to restrictions with acquirer account',
|
|
297
|
+
50450 => 'Failed due to restrictions with user account',
|
|
298
|
+
50500 => 'General timeout',
|
|
299
|
+
50501 => 'Timeout on side of the acquirer',
|
|
300
|
+
50502 => 'Risk management transaction timeout',
|
|
301
|
+
50600 => 'Duplicate operation',
|
|
302
|
+
50700 => 'Cancelled by user',
|
|
303
|
+
50710 => 'Failed due to funding source',
|
|
304
|
+
50711 => 'Payment method not usable, use other payment method',
|
|
305
|
+
50712 => 'Limit of funding source was exceeded',
|
|
306
|
+
50713 => 'Means of payment not reusable (canceled by user)',
|
|
307
|
+
50714 => 'Means of payment not reusable (expired)',
|
|
308
|
+
50720 => 'Rejected by acquirer',
|
|
309
|
+
50730 => 'Transaction denied by merchant',
|
|
310
|
+
50800 => 'Preauthorisation failed',
|
|
311
|
+
50810 => 'Authorisation has been voided',
|
|
312
|
+
50820 => 'Authorisation period expired'
|
|
219
313
|
}
|
|
220
314
|
|
|
221
315
|
def response_message(parsed_response)
|
|
222
|
-
return parsed_response[
|
|
223
|
-
return
|
|
316
|
+
return parsed_response['error'] if parsed_response['error']
|
|
317
|
+
return 'Transaction approved.' if parsed_response['data'] == []
|
|
224
318
|
|
|
225
|
-
code = parsed_response[
|
|
319
|
+
code = parsed_response['data']['response_code'].to_i
|
|
226
320
|
RESPONSE_CODES[code] || code.to_s
|
|
227
321
|
end
|
|
228
322
|
|
|
229
|
-
|
|
230
323
|
class ResponseParser
|
|
231
|
-
|
|
324
|
+
attr_reader :raw_response, :parsed, :succeeded, :message, :options
|
|
325
|
+
|
|
326
|
+
def initialize(raw_response='', options={})
|
|
232
327
|
@raw_response = raw_response
|
|
233
328
|
@options = options
|
|
234
329
|
end
|
|
@@ -245,7 +340,6 @@ module ActiveMerchant #:nodoc:
|
|
|
245
340
|
end
|
|
246
341
|
|
|
247
342
|
private
|
|
248
|
-
attr_reader :raw_response, :parsed, :succeeded, :message, :options
|
|
249
343
|
|
|
250
344
|
def parse_response
|
|
251
345
|
@parsed = JSON.parse(raw_response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
|