activemerchant 1.38.0 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1344 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +226 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +74 -13
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +27 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
- data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +177 -0
- data/lib/active_merchant/country.rb +334 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +24 -21
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- metadata +161 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -73
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -129
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,283 @@
|
|
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
|
+
action = payment.is_a?(String) ? 'debit' : 'debit_cc'
|
56
|
+
|
57
|
+
commit_transaction(action, post)
|
58
|
+
end
|
59
|
+
|
60
|
+
def authorize(money, payment, options = {})
|
61
|
+
post = {}
|
62
|
+
|
63
|
+
add_invoice(post, money, options)
|
64
|
+
add_customer_data(post, options)
|
65
|
+
|
66
|
+
if payment.is_a?(String)
|
67
|
+
post[:card] = { token: payment }
|
68
|
+
commit_transaction('authorize', post)
|
69
|
+
else
|
70
|
+
MultiResponse.run do |r|
|
71
|
+
r.process { store(payment, options) }
|
72
|
+
post[:card] = { token: r.authorization }
|
73
|
+
r.process { commit_transaction('authorize', post) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def capture(_money, authorization, _options = {})
|
79
|
+
post = { transaction: { id: authorization } }
|
80
|
+
|
81
|
+
commit_transaction('capture', post)
|
82
|
+
end
|
83
|
+
|
84
|
+
def refund(_money, authorization, options = {})
|
85
|
+
void(authorization, options)
|
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
|
+
end
|
140
|
+
|
141
|
+
def add_invoice(post, money, options)
|
142
|
+
post[:session_id] = options[:session_id] if options[:session_id]
|
143
|
+
|
144
|
+
post[:order] ||= {}
|
145
|
+
post[:order][:amount] = amount(money).to_f
|
146
|
+
post[:order][:vat] = options[:vat] if options[:vat]
|
147
|
+
post[:order][:dev_reference] = options[:dev_reference] if options[:dev_reference]
|
148
|
+
post[:order][:description] = options[:description] if options[:description]
|
149
|
+
post[:order][:discount] = options[:discount] if options[:discount]
|
150
|
+
post[:order][:installments] = options[:installments] if options[:installments]
|
151
|
+
post[:order][:installments_type] = options[:installments_type] if options[:installments_type]
|
152
|
+
post[:order][:taxable_amount] = options[:taxable_amount] if options[:taxable_amount]
|
153
|
+
end
|
154
|
+
|
155
|
+
def add_payment(post, payment)
|
156
|
+
post[:card] ||= {}
|
157
|
+
if payment.is_a?(String)
|
158
|
+
post[:card][:token] = payment
|
159
|
+
else
|
160
|
+
post[:card][:number] = payment.number
|
161
|
+
post[:card][:holder_name] = payment.name
|
162
|
+
post[:card][:expiry_month] = payment.month
|
163
|
+
post[:card][:expiry_year] = payment.year
|
164
|
+
post[:card][:cvc] = payment.verification_value
|
165
|
+
post[:card][:type] = CARD_MAPPING[payment.brand]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def parse(body)
|
170
|
+
JSON.parse(body)
|
171
|
+
end
|
172
|
+
|
173
|
+
def commit_raw(object, action, parameters)
|
174
|
+
url = "#{(test? ? test_url : live_url)}#{object}/#{action}"
|
175
|
+
|
176
|
+
begin
|
177
|
+
raw_response = ssl_post(url, post_data(parameters), headers)
|
178
|
+
rescue ResponseError => e
|
179
|
+
raw_response = e.response.body
|
180
|
+
end
|
181
|
+
parse(raw_response)
|
182
|
+
end
|
183
|
+
|
184
|
+
def commit_transaction(action, parameters)
|
185
|
+
response = commit_raw('transaction', action, parameters)
|
186
|
+
Response.new(
|
187
|
+
success_from(response),
|
188
|
+
message_from(response),
|
189
|
+
response,
|
190
|
+
authorization: authorization_from(response),
|
191
|
+
test: test?,
|
192
|
+
error_code: error_code_from(response)
|
193
|
+
)
|
194
|
+
end
|
195
|
+
|
196
|
+
def commit_card(action, parameters)
|
197
|
+
response = commit_raw('card', action, parameters)
|
198
|
+
Response.new(
|
199
|
+
card_success_from(response),
|
200
|
+
card_message_from(response),
|
201
|
+
response,
|
202
|
+
authorization: card_authorization_from(response),
|
203
|
+
test: test?,
|
204
|
+
error_code: card_error_code_from(response)
|
205
|
+
)
|
206
|
+
end
|
207
|
+
|
208
|
+
def headers
|
209
|
+
{
|
210
|
+
'Auth-Token' => authentication_code,
|
211
|
+
'Content-Type' => 'application/json'
|
212
|
+
}
|
213
|
+
end
|
214
|
+
|
215
|
+
def success_from(response)
|
216
|
+
!response.include?('error') && (response['status'] || response['transaction']['status']) == 'success'
|
217
|
+
end
|
218
|
+
|
219
|
+
def card_success_from(response)
|
220
|
+
return false if response.include?('error')
|
221
|
+
return true if response['message'] == 'card deleted'
|
222
|
+
response['card']['status'] == 'valid'
|
223
|
+
end
|
224
|
+
|
225
|
+
def message_from(response)
|
226
|
+
if success_from(response)
|
227
|
+
response['transaction'] && response['transaction']['message']
|
228
|
+
else
|
229
|
+
response['error'] && response['error']['type']
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def card_message_from(response)
|
234
|
+
if !response.include?('error')
|
235
|
+
response['message'] || response['card']['message']
|
236
|
+
else
|
237
|
+
response['error']['type']
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def authorization_from(response)
|
242
|
+
response['transaction'] && response['transaction']['id']
|
243
|
+
end
|
244
|
+
|
245
|
+
def card_authorization_from(response)
|
246
|
+
response['card'] && response['card']['token']
|
247
|
+
end
|
248
|
+
|
249
|
+
def extract_previous_card_token(response)
|
250
|
+
match = /Card already added: (\d+)/.match(response.message)
|
251
|
+
match && match[1]
|
252
|
+
end
|
253
|
+
|
254
|
+
def post_data(parameters = {})
|
255
|
+
JSON.dump(parameters)
|
256
|
+
end
|
257
|
+
|
258
|
+
def error_code_from(response)
|
259
|
+
return if success_from(response)
|
260
|
+
if response['transaction']
|
261
|
+
detail = response['transaction']['status_detail']
|
262
|
+
if STANDARD_ERROR_CODE_MAPPING.include?(detail)
|
263
|
+
return STANDARD_ERROR_CODE[STANDARD_ERROR_CODE_MAPPING[detail]]
|
264
|
+
end
|
265
|
+
elsif response['error']
|
266
|
+
return STANDARD_ERROR_CODE[:config_error]
|
267
|
+
end
|
268
|
+
STANDARD_ERROR_CODE[:processing_error]
|
269
|
+
end
|
270
|
+
|
271
|
+
def card_error_code_from(response)
|
272
|
+
STANDARD_ERROR_CODE[:processing_error] unless card_success_from(response)
|
273
|
+
end
|
274
|
+
|
275
|
+
def authentication_code
|
276
|
+
timestamp = Time.new.to_i
|
277
|
+
unique_token = Digest::SHA256.hexdigest("#{@options[:app_key]}#{timestamp}")
|
278
|
+
authentication_string = "#{@options[:application_code]};#{timestamp};#{unique_token}"
|
279
|
+
Base64.encode64(authentication_string).delete("\n")
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
@@ -2,42 +2,27 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class PaymillGateway < Gateway
|
4
4
|
self.supported_countries = %w(AD AT BE BG CH CY CZ DE DK EE ES FI FO FR GB
|
5
|
-
GI GR HU IE IL IS IT LI LT LU LV MT
|
6
|
-
PT RO SE SI SK TR VA)
|
5
|
+
GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT
|
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
|
-
|
21
|
-
when String
|
22
|
-
purchase_with_token(money, payment_method, options)
|
23
|
-
else
|
24
|
-
MultiResponse.run do |r|
|
25
|
-
r.process { save_card(payment_method) }
|
26
|
-
r.process { purchase_with_token(money, r.authorization, options) }
|
27
|
-
end
|
28
|
-
end
|
20
|
+
def purchase(money, payment_method, options={})
|
21
|
+
action_with_token(:purchase, money, payment_method, options)
|
29
22
|
end
|
30
23
|
|
31
24
|
def authorize(money, payment_method, options = {})
|
32
|
-
|
33
|
-
when String
|
34
|
-
authorize_with_token(money, payment_method, options)
|
35
|
-
else
|
36
|
-
MultiResponse.run do |r|
|
37
|
-
r.process { save_card(payment_method) }
|
38
|
-
r.process { authorize_with_token(money, r.authorization, options) }
|
39
|
-
end
|
40
|
-
end
|
25
|
+
action_with_token(:authorize, money, payment_method, options)
|
41
26
|
end
|
42
27
|
|
43
28
|
def capture(money, authorization, options = {})
|
@@ -45,7 +30,8 @@ module ActiveMerchant #:nodoc:
|
|
45
30
|
|
46
31
|
add_amount(post, money, options)
|
47
32
|
post[:preauthorization] = preauth(authorization)
|
48
|
-
post[:description] = options[:
|
33
|
+
post[:description] = options[:order_id]
|
34
|
+
post[:source] = 'active_merchant'
|
49
35
|
commit(:post, 'transactions', post)
|
50
36
|
end
|
51
37
|
|
@@ -53,33 +39,66 @@ module ActiveMerchant #:nodoc:
|
|
53
39
|
post = {}
|
54
40
|
|
55
41
|
post[:amount] = amount(money)
|
56
|
-
post[:description] = options[:
|
42
|
+
post[:description] = options[:order_id]
|
57
43
|
commit(:post, "refunds/#{transaction_id(authorization)}", post)
|
58
44
|
end
|
59
45
|
|
46
|
+
def void(authorization, options={})
|
47
|
+
commit(:delete, "preauthorizations/#{preauth(authorization)}")
|
48
|
+
end
|
49
|
+
|
60
50
|
def store(credit_card, options={})
|
61
|
-
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
|
62
73
|
end
|
63
74
|
|
64
75
|
private
|
65
76
|
|
66
|
-
def add_credit_card(post, credit_card)
|
77
|
+
def add_credit_card(post, credit_card, options)
|
78
|
+
post['account.holder'] = (credit_card.try(:name) || "")
|
67
79
|
post['account.number'] = credit_card.number
|
68
80
|
post['account.expiry.month'] = sprintf("%.2i", credit_card.month)
|
69
81
|
post['account.expiry.year'] = sprintf("%.4i", credit_card.year)
|
70
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]))
|
71
86
|
end
|
72
87
|
|
73
88
|
def headers
|
74
89
|
{ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
|
75
90
|
end
|
76
91
|
|
77
|
-
def commit(method,
|
92
|
+
def commit(method, action, parameters=nil)
|
78
93
|
begin
|
79
|
-
raw_response = ssl_request(method,
|
94
|
+
raw_response = ssl_request(method, live_url + action, post_data(parameters), headers)
|
80
95
|
rescue ResponseError => e
|
81
|
-
|
82
|
-
|
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
|
101
|
+
return Response.new(false, response_message(parsed), parsed, {})
|
83
102
|
end
|
84
103
|
|
85
104
|
response_from(raw_response)
|
@@ -87,28 +106,45 @@ module ActiveMerchant #:nodoc:
|
|
87
106
|
|
88
107
|
def response_from(raw_response)
|
89
108
|
parsed = JSON.parse(raw_response)
|
90
|
-
|
91
109
|
options = {
|
92
110
|
:authorization => authorization_from(parsed),
|
93
111
|
:test => (parsed['mode'] == 'test'),
|
94
112
|
}
|
95
113
|
|
96
|
-
|
114
|
+
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'].to_i == 20000)
|
115
|
+
Response.new(succeeded, response_message(parsed), parsed, options)
|
97
116
|
end
|
98
117
|
|
99
118
|
def authorization_from(parsed_response)
|
119
|
+
parsed_data = parsed_response['data']
|
120
|
+
return '' unless parsed_data.kind_of?(Hash)
|
121
|
+
|
100
122
|
[
|
101
|
-
|
102
|
-
|
123
|
+
parsed_data['id'],
|
124
|
+
parsed_data['preauthorization'].try(:[], 'id')
|
103
125
|
].join(";")
|
104
126
|
end
|
105
127
|
|
128
|
+
def action_with_token(action, money, payment_method, options)
|
129
|
+
options[:money] = money
|
130
|
+
case payment_method
|
131
|
+
when String
|
132
|
+
self.send("#{action}_with_token", money, payment_method, options)
|
133
|
+
else
|
134
|
+
MultiResponse.run do |r|
|
135
|
+
r.process { save_card(payment_method, options) }
|
136
|
+
r.process { self.send("#{action}_with_token", money, r.authorization, options) }
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
106
141
|
def purchase_with_token(money, card_token, options)
|
107
142
|
post = {}
|
108
143
|
|
109
144
|
add_amount(post, money, options)
|
110
145
|
post[:token] = card_token
|
111
|
-
post[:description] = options[:
|
146
|
+
post[:description] = options[:order_id]
|
147
|
+
post[:source] = 'active_merchant'
|
112
148
|
commit(:post, 'transactions', post)
|
113
149
|
end
|
114
150
|
|
@@ -117,13 +153,15 @@ module ActiveMerchant #:nodoc:
|
|
117
153
|
|
118
154
|
add_amount(post, money, options)
|
119
155
|
post[:token] = card_token
|
156
|
+
post[:description] = options[:order_id]
|
157
|
+
post[:source] = 'active_merchant'
|
120
158
|
commit(:post, 'preauthorizations', post)
|
121
159
|
end
|
122
160
|
|
123
|
-
def save_card(credit_card)
|
161
|
+
def save_card(credit_card, options)
|
124
162
|
post = {}
|
125
163
|
|
126
|
-
add_credit_card(post, credit_card)
|
164
|
+
add_credit_card(post, credit_card, options)
|
127
165
|
post['channel.id'] = @options[:public_key]
|
128
166
|
post['jsonPFunction'] = 'jsonPFunction'
|
129
167
|
post['transaction.mode'] = (test? ? 'CONNECTOR_TEST' : 'LIVE')
|
@@ -131,7 +169,7 @@ module ActiveMerchant #:nodoc:
|
|
131
169
|
begin
|
132
170
|
raw_response = ssl_request(:get, "#{save_card_url}?#{post_data(post)}", nil, {})
|
133
171
|
rescue ResponseError => e
|
134
|
-
return Response.new(false, e.response.body
|
172
|
+
return Response.new(false, e.response.body)
|
135
173
|
end
|
136
174
|
|
137
175
|
response_for_save_from(raw_response)
|
@@ -140,17 +178,12 @@ module ActiveMerchant #:nodoc:
|
|
140
178
|
def response_for_save_from(raw_response)
|
141
179
|
options = { :test => test? }
|
142
180
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
message = parsed['error']['message']
|
147
|
-
else
|
148
|
-
succeeded = parsed['transaction']['processing']['result'] == 'ACK'
|
149
|
-
message = parsed['transaction']['processing']['return']['message']
|
150
|
-
options[:authorization] = parsed['transaction']['identification']['uniqueId'] if succeeded
|
151
|
-
end
|
181
|
+
parser = ResponseParser.new(raw_response, options)
|
182
|
+
parser.generate_response
|
183
|
+
end
|
152
184
|
|
153
|
-
|
185
|
+
def parse_reponse(response)
|
186
|
+
JSON.parse(response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
|
154
187
|
end
|
155
188
|
|
156
189
|
def save_card_url
|
@@ -158,6 +191,8 @@ module ActiveMerchant #:nodoc:
|
|
158
191
|
end
|
159
192
|
|
160
193
|
def post_data(params)
|
194
|
+
return nil unless params
|
195
|
+
|
161
196
|
no_blanks = params.reject { |key, value| value.blank? }
|
162
197
|
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
163
198
|
end
|
@@ -174,6 +209,160 @@ module ActiveMerchant #:nodoc:
|
|
174
209
|
def transaction_id(authorization)
|
175
210
|
authorization.split(';').first
|
176
211
|
end
|
212
|
+
|
213
|
+
RESPONSE_CODES = {
|
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
|
+
|
244
|
+
40000 => "Problem with transaction data",
|
245
|
+
40001 => "Problem with payment data",
|
246
|
+
40002 => "Invalid checksum",
|
247
|
+
40100 => "Problem with credit card data",
|
248
|
+
40101 => "Problem with CVV",
|
249
|
+
40102 => "Card expired or not yet valid",
|
250
|
+
40103 => "Card limit exceeded",
|
251
|
+
40104 => "Card is not valid",
|
252
|
+
40105 => "Expiry date not valid",
|
253
|
+
40106 => "Credit card brand required",
|
254
|
+
40200 => "Problem with bank account data",
|
255
|
+
40201 => "Bank account data combination mismatch",
|
256
|
+
40202 => "User authentication failed",
|
257
|
+
40300 => "Problem with 3-D Secure data",
|
258
|
+
40301 => "Currency/amount mismatch",
|
259
|
+
40400 => "Problem with input data",
|
260
|
+
40401 => "Amount too low or zero",
|
261
|
+
40402 => "Usage field too long",
|
262
|
+
40403 => "Currency not allowed",
|
263
|
+
40410 => "Problem with shopping cart data",
|
264
|
+
40420 => "Problem with address data",
|
265
|
+
40500 => "Permission error with acquirer API",
|
266
|
+
40510 => "Rate limit reached for acquirer API",
|
267
|
+
42000 => "Initiation of transaction failed",
|
268
|
+
42410 => "Initiation of transaction expired",
|
269
|
+
|
270
|
+
50000 => "Problem with back end",
|
271
|
+
50001 => "Country blacklisted",
|
272
|
+
50002 => "IP address blacklisted",
|
273
|
+
50004 => "Live mode not allowed",
|
274
|
+
50005 => "Insufficient permissions (API key)",
|
275
|
+
50100 => "Technical error with credit card",
|
276
|
+
50101 => "Error limit exceeded",
|
277
|
+
50102 => "Card declined",
|
278
|
+
50103 => "Manipulation or stolen card",
|
279
|
+
50104 => "Card restricted",
|
280
|
+
50105 => "Invalid configuration data",
|
281
|
+
50200 => "Technical error with bank account",
|
282
|
+
50201 => "Account blacklisted",
|
283
|
+
50300 => "Technical error with 3-D Secure",
|
284
|
+
50400 => "Declined because of risk issues",
|
285
|
+
50401 => "Checksum was wrong",
|
286
|
+
50402 => "Bank account number was invalid (formal check)",
|
287
|
+
50403 => "Technical error with risk check",
|
288
|
+
50404 => "Unknown error with risk check",
|
289
|
+
50405 => "Unknown bank code",
|
290
|
+
50406 => "Open chargeback",
|
291
|
+
50407 => "Historical chargeback",
|
292
|
+
50408 => "Institution / public bank account (NCA)",
|
293
|
+
50409 => "KUNO/Fraud",
|
294
|
+
50410 => "Personal Account Protection (PAP)",
|
295
|
+
50420 => "Rejected due to acquirer fraud settings",
|
296
|
+
50430 => "Rejected due to acquirer risk settings",
|
297
|
+
50440 => "Failed due to restrictions with acquirer account",
|
298
|
+
50450 => "Failed due to restrictions with user account",
|
299
|
+
50500 => "General timeout",
|
300
|
+
50501 => "Timeout on side of the acquirer",
|
301
|
+
50502 => "Risk management transaction timeout",
|
302
|
+
50600 => "Duplicate operation",
|
303
|
+
50700 => "Cancelled by user",
|
304
|
+
50710 => "Failed due to funding source",
|
305
|
+
50711 => "Payment method not usable, use other payment method",
|
306
|
+
50712 => "Limit of funding source was exceeded",
|
307
|
+
50713 => "Means of payment not reusable (canceled by user)",
|
308
|
+
50714 => "Means of payment not reusable (expired)",
|
309
|
+
50720 => "Rejected by acquirer",
|
310
|
+
50730 => "Transaction denied by merchant",
|
311
|
+
50800 => "Preauthorisation failed",
|
312
|
+
50810 => "Authorisation has been voided",
|
313
|
+
50820 => "Authorisation period expired"
|
314
|
+
}
|
315
|
+
|
316
|
+
def response_message(parsed_response)
|
317
|
+
return parsed_response["error"] if parsed_response["error"]
|
318
|
+
return "Transaction approved." if (parsed_response['data'] == [])
|
319
|
+
|
320
|
+
code = parsed_response["data"]["response_code"].to_i
|
321
|
+
RESPONSE_CODES[code] || code.to_s
|
322
|
+
end
|
323
|
+
|
324
|
+
|
325
|
+
class ResponseParser
|
326
|
+
attr_reader :raw_response, :parsed, :succeeded, :message, :options
|
327
|
+
|
328
|
+
def initialize(raw_response="", options={})
|
329
|
+
@raw_response = raw_response
|
330
|
+
@options = options
|
331
|
+
end
|
332
|
+
|
333
|
+
def generate_response
|
334
|
+
parse_response
|
335
|
+
if parsed['error']
|
336
|
+
handle_response_parse_error
|
337
|
+
else
|
338
|
+
handle_response_correct_parsing
|
339
|
+
end
|
340
|
+
|
341
|
+
Response.new(succeeded, message, parsed, options)
|
342
|
+
end
|
343
|
+
|
344
|
+
private
|
345
|
+
|
346
|
+
def parse_response
|
347
|
+
@parsed = JSON.parse(raw_response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
|
348
|
+
end
|
349
|
+
|
350
|
+
def handle_response_parse_error
|
351
|
+
@succeeded = false
|
352
|
+
@message = parsed['error']['message']
|
353
|
+
end
|
354
|
+
|
355
|
+
def handle_response_correct_parsing
|
356
|
+
@message = parsed['transaction']['processing']['return']['message']
|
357
|
+
if @succeeded = is_ack?
|
358
|
+
@options[:authorization] = parsed['transaction']['identification']['uniqueId']
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
def is_ack?
|
363
|
+
parsed['transaction']['processing']['result'] == 'ACK'
|
364
|
+
end
|
365
|
+
end
|
177
366
|
end
|
178
367
|
end
|
179
368
|
end
|