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,295 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'active_merchant/billing/gateways/quickpay/quickpay_common'
|
|
3
|
+
|
|
4
|
+
module ActiveMerchant
|
|
5
|
+
module Billing
|
|
6
|
+
class QuickpayV10Gateway < Gateway
|
|
7
|
+
include QuickpayCommon
|
|
8
|
+
API_VERSION = 10
|
|
9
|
+
|
|
10
|
+
self.live_url = self.test_url = 'https://api.quickpay.net'
|
|
11
|
+
|
|
12
|
+
def initialize(options = {})
|
|
13
|
+
requires!(options, :api_key)
|
|
14
|
+
super
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def purchase(money, credit_card_or_reference, options = {})
|
|
18
|
+
MultiResponse.run do |r|
|
|
19
|
+
if credit_card_or_reference.is_a?(String)
|
|
20
|
+
r.process { create_token(credit_card_or_reference, options) }
|
|
21
|
+
credit_card_or_reference = r.authorization
|
|
22
|
+
end
|
|
23
|
+
r.process { create_payment(money, options) }
|
|
24
|
+
r.process {
|
|
25
|
+
post = authorization_params(money, credit_card_or_reference, options)
|
|
26
|
+
add_autocapture(post, false)
|
|
27
|
+
commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
|
|
28
|
+
}
|
|
29
|
+
r.process {
|
|
30
|
+
post = capture_params(money, credit_card_or_reference, options)
|
|
31
|
+
commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/capture"), post)
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def authorize(money, credit_card_or_reference, options = {})
|
|
37
|
+
MultiResponse.run do |r|
|
|
38
|
+
if credit_card_or_reference.is_a?(String)
|
|
39
|
+
r.process { create_token(credit_card_or_reference, options) }
|
|
40
|
+
credit_card_or_reference = r.authorization
|
|
41
|
+
end
|
|
42
|
+
r.process { create_payment(money, options) }
|
|
43
|
+
r.process {
|
|
44
|
+
post = authorization_params(money, credit_card_or_reference, options)
|
|
45
|
+
commit(synchronized_path("/payments/#{r.responses.last.params["id"]}/authorize"), post)
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def void(identification, _options = {})
|
|
51
|
+
commit(synchronized_path "/payments/#{identification}/cancel")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def credit(money, identification, options = {})
|
|
55
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
|
56
|
+
refund(money, identification, options)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def capture(money, identification, options = {})
|
|
60
|
+
post = capture_params(money, identification, options)
|
|
61
|
+
commit(synchronized_path("/payments/#{identification}/capture"), post)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def refund(money, identification, options = {})
|
|
65
|
+
post = {}
|
|
66
|
+
add_amount(post, money, options)
|
|
67
|
+
add_additional_params(:refund, post, options)
|
|
68
|
+
commit(synchronized_path("/payments/#{identification}/refund"), post)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def verify(credit_card, options={})
|
|
72
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
73
|
+
r.process { authorize(100, credit_card, options) }
|
|
74
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def store(credit_card, options = {})
|
|
79
|
+
MultiResponse.run do |r|
|
|
80
|
+
r.process { create_store(options) }
|
|
81
|
+
r.process { authorize_store(r.authorization, credit_card, options) }
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def unstore(identification)
|
|
86
|
+
commit(synchronized_path "/cards/#{identification}/cancel")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def supports_scrubbing?
|
|
90
|
+
true
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def scrub(transcript)
|
|
94
|
+
transcript.
|
|
95
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
|
96
|
+
gsub(%r(("card\\?":{\\?"number\\?":\\?")\d+), '\1[FILTERED]').
|
|
97
|
+
gsub(%r(("cvd\\?":\\?")\d+), '\1[FILTERED]')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
private
|
|
101
|
+
|
|
102
|
+
def authorization_params(money, credit_card_or_reference, options = {})
|
|
103
|
+
post = {}
|
|
104
|
+
|
|
105
|
+
add_amount(post, money, options)
|
|
106
|
+
add_credit_card_or_reference(post, credit_card_or_reference)
|
|
107
|
+
add_additional_params(:authorize, post, options)
|
|
108
|
+
|
|
109
|
+
post
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def capture_params(money, credit_card, options = {})
|
|
113
|
+
post = {}
|
|
114
|
+
|
|
115
|
+
add_amount(post, money, options)
|
|
116
|
+
add_additional_params(:capture, post, options)
|
|
117
|
+
|
|
118
|
+
post
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def create_store(options = {})
|
|
122
|
+
post = {}
|
|
123
|
+
commit('/cards', post)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def authorize_store(identification, credit_card, options = {})
|
|
127
|
+
post = {}
|
|
128
|
+
|
|
129
|
+
add_credit_card_or_reference(post, credit_card, options)
|
|
130
|
+
commit(synchronized_path("/cards/#{identification}/authorize"), post)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def create_token(identification, options)
|
|
134
|
+
post = {}
|
|
135
|
+
commit(synchronized_path("/cards/#{identification}/tokens"), post)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def create_payment(money, options = {})
|
|
139
|
+
post = {}
|
|
140
|
+
add_currency(post, money, options)
|
|
141
|
+
add_invoice(post, options)
|
|
142
|
+
commit('/payments', post)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def commit(action, params = {})
|
|
146
|
+
success = false
|
|
147
|
+
begin
|
|
148
|
+
response = parse(ssl_post(self.live_url + action, params.to_json, headers))
|
|
149
|
+
success = successful?(response)
|
|
150
|
+
rescue ResponseError => e
|
|
151
|
+
response = response_error(e.response.body)
|
|
152
|
+
rescue JSON::ParserError
|
|
153
|
+
response = json_error(response)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
Response.new(success, message_from(success, response), response,
|
|
157
|
+
:test => test?,
|
|
158
|
+
:authorization => authorization_from(response)
|
|
159
|
+
)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def authorization_from(response)
|
|
163
|
+
if response['token']
|
|
164
|
+
response['token'].to_s
|
|
165
|
+
else
|
|
166
|
+
response['id'].to_s
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def add_currency(post, money, options)
|
|
171
|
+
post[:currency] = options[:currency] || currency(money)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def add_amount(post, money, options)
|
|
175
|
+
post[:amount] = options[:amount] || amount(money)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def add_autocapture(post, value)
|
|
179
|
+
post[:auto_capture] = value
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def add_order_id(post, options)
|
|
183
|
+
requires!(options, :order_id)
|
|
184
|
+
post[:order_id] = format_order_id(options[:order_id])
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def add_invoice(post, options)
|
|
188
|
+
add_order_id(post, options)
|
|
189
|
+
|
|
190
|
+
if options[:billing_address]
|
|
191
|
+
post[:invoice_address] = map_address(options[:billing_address])
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if options[:shipping_address]
|
|
195
|
+
post[:shipping_address] = map_address(options[:shipping_address])
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
[:metadata, :branding_id, :variables].each do |field|
|
|
199
|
+
post[field] = options[field] if options[field]
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def add_additional_params(action, post, options = {})
|
|
204
|
+
MD5_CHECK_FIELDS[API_VERSION][action].each do |key|
|
|
205
|
+
key = key.to_sym
|
|
206
|
+
post[key] = options[key] if options[key]
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def add_credit_card_or_reference(post, credit_card_or_reference, options = {})
|
|
211
|
+
post[:card] ||= {}
|
|
212
|
+
if credit_card_or_reference.is_a?(String)
|
|
213
|
+
post[:card][:token] = credit_card_or_reference
|
|
214
|
+
else
|
|
215
|
+
post[:card][:number] = credit_card_or_reference.number
|
|
216
|
+
post[:card][:cvd] = credit_card_or_reference.verification_value
|
|
217
|
+
post[:card][:expiration] = expdate(credit_card_or_reference)
|
|
218
|
+
post[:card][:issued_to] = credit_card_or_reference.name
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def parse(body)
|
|
223
|
+
JSON.parse(body)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def successful?(response)
|
|
227
|
+
has_error = response['errors']
|
|
228
|
+
invalid_code = invalid_operation_code?(response)
|
|
229
|
+
|
|
230
|
+
!(has_error || invalid_code)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def message_from(success, response)
|
|
234
|
+
success ? 'OK' : (response['message'] || invalid_operation_message(response) || 'Unknown error - please contact QuickPay')
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def invalid_operation_code?(response)
|
|
238
|
+
if response['operations']
|
|
239
|
+
operation = response['operations'].last
|
|
240
|
+
operation && operation['qp_status_code'] != '20000'
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def invalid_operation_message(response)
|
|
245
|
+
response['operations'] && response['operations'].last['qp_status_msg']
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def map_address(address)
|
|
249
|
+
return {} if address.nil?
|
|
250
|
+
requires!(address, :name, :address1, :city, :zip, :country)
|
|
251
|
+
country = Country.find(address[:country])
|
|
252
|
+
mapped = {
|
|
253
|
+
:name => address[:name],
|
|
254
|
+
:street => address[:address1],
|
|
255
|
+
:city => address[:city],
|
|
256
|
+
:region => address[:address2],
|
|
257
|
+
:zip_code => address[:zip],
|
|
258
|
+
:country_code => country.code(:alpha3).value
|
|
259
|
+
}
|
|
260
|
+
mapped
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def format_order_id(order_id)
|
|
264
|
+
truncate(order_id.to_s.gsub(/#/, ''), 20)
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def headers
|
|
268
|
+
auth = Base64.strict_encode64(":#{@options[:api_key]}")
|
|
269
|
+
{
|
|
270
|
+
'Authorization' => 'Basic ' + auth,
|
|
271
|
+
'User-Agent' => "Quickpay-v#{API_VERSION} ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
|
272
|
+
'Accept' => 'application/json',
|
|
273
|
+
'Accept-Version' => "v#{API_VERSION}",
|
|
274
|
+
'Content-Type' => 'application/json'
|
|
275
|
+
}
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def response_error(raw_response)
|
|
279
|
+
parse(raw_response)
|
|
280
|
+
rescue JSON::ParserError
|
|
281
|
+
json_error(raw_response)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def json_error(raw_response)
|
|
285
|
+
msg = 'Invalid response received from the Quickpay API.'
|
|
286
|
+
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
|
287
|
+
{ 'message' => msg }
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def synchronized_path(path)
|
|
291
|
+
"#{path}?synchronized"
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
end
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
require 'rexml/document'
|
|
2
|
+
require 'digest/md5'
|
|
3
|
+
require 'active_merchant/billing/gateways/quickpay/quickpay_common'
|
|
4
|
+
|
|
5
|
+
module ActiveMerchant #:nodoc:
|
|
6
|
+
module Billing #:nodoc:
|
|
7
|
+
class QuickpayV4to7Gateway < Gateway
|
|
8
|
+
include QuickpayCommon
|
|
9
|
+
self.live_url = self.test_url = 'https://secure.quickpay.dk/api'
|
|
10
|
+
APPROVED = '000'
|
|
11
|
+
|
|
12
|
+
# The login is the QuickpayId
|
|
13
|
+
# The password is the md5checkword from the Quickpay manager
|
|
14
|
+
# To use the API-key from the Quickpay manager, specify :api-key
|
|
15
|
+
# Using the API-key, requires that you use version 4+. Specify :version => 4/5/6/7 in options.
|
|
16
|
+
def initialize(options = {})
|
|
17
|
+
requires!(options, :login, :password)
|
|
18
|
+
@protocol = options.delete(:version) || 7 # default to protocol version 7
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def authorize(money, credit_card_or_reference, options = {})
|
|
23
|
+
post = {}
|
|
24
|
+
|
|
25
|
+
action = recurring_or_authorize(credit_card_or_reference)
|
|
26
|
+
|
|
27
|
+
add_amount(post, money, options)
|
|
28
|
+
add_invoice(post, options)
|
|
29
|
+
add_creditcard_or_reference(post, credit_card_or_reference, options)
|
|
30
|
+
add_autocapture(post, false)
|
|
31
|
+
add_fraud_parameters(post, options) if action.eql?(:authorize)
|
|
32
|
+
add_testmode(post)
|
|
33
|
+
|
|
34
|
+
commit(action, post)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def purchase(money, credit_card_or_reference, options = {})
|
|
38
|
+
post = {}
|
|
39
|
+
|
|
40
|
+
action = recurring_or_authorize(credit_card_or_reference)
|
|
41
|
+
|
|
42
|
+
add_amount(post, money, options)
|
|
43
|
+
add_creditcard_or_reference(post, credit_card_or_reference, options)
|
|
44
|
+
add_invoice(post, options)
|
|
45
|
+
add_fraud_parameters(post, options) if action.eql?(:authorize)
|
|
46
|
+
add_autocapture(post, true)
|
|
47
|
+
|
|
48
|
+
commit(action, post)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def capture(money, authorization, options = {})
|
|
52
|
+
post = {}
|
|
53
|
+
|
|
54
|
+
add_finalize(post, options)
|
|
55
|
+
add_reference(post, authorization)
|
|
56
|
+
add_amount_without_currency(post, money)
|
|
57
|
+
commit(:capture, post)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def void(identification, options = {})
|
|
61
|
+
post = {}
|
|
62
|
+
|
|
63
|
+
add_reference(post, identification)
|
|
64
|
+
|
|
65
|
+
commit(:cancel, post)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def refund(money, identification, options = {})
|
|
69
|
+
post = {}
|
|
70
|
+
|
|
71
|
+
add_amount_without_currency(post, money)
|
|
72
|
+
add_reference(post, identification)
|
|
73
|
+
|
|
74
|
+
commit(:refund, post)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def credit(money, identification, options = {})
|
|
78
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
|
79
|
+
refund(money, identification, options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def store(creditcard, options = {})
|
|
83
|
+
post = {}
|
|
84
|
+
|
|
85
|
+
add_creditcard(post, creditcard, options)
|
|
86
|
+
add_amount(post, 0, options) if @protocol >= 7
|
|
87
|
+
add_invoice(post, options)
|
|
88
|
+
add_description(post, options)
|
|
89
|
+
add_fraud_parameters(post, options)
|
|
90
|
+
add_testmode(post)
|
|
91
|
+
|
|
92
|
+
commit(:subscribe, post)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
private
|
|
96
|
+
|
|
97
|
+
def add_amount(post, money, options = {})
|
|
98
|
+
post[:amount] = amount(money)
|
|
99
|
+
post[:currency] = options[:currency] || currency(money)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def add_amount_without_currency(post, money, options = {})
|
|
103
|
+
post[:amount] = amount(money)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def add_invoice(post, options)
|
|
107
|
+
post[:ordernumber] = format_order_number(options[:order_id])
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def add_creditcard(post, credit_card, options)
|
|
111
|
+
post[:cardnumber] = credit_card.number
|
|
112
|
+
post[:cvd] = credit_card.verification_value
|
|
113
|
+
post[:expirationdate] = expdate(credit_card)
|
|
114
|
+
post[:cardtypelock] = options[:cardtypelock] unless options[:cardtypelock].blank?
|
|
115
|
+
post[:acquirers] = options[:acquirers] unless options[:acquirers].blank?
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def add_reference(post, identification)
|
|
119
|
+
post[:transaction] = identification
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def add_creditcard_or_reference(post, credit_card_or_reference, options)
|
|
123
|
+
if credit_card_or_reference.is_a?(String)
|
|
124
|
+
add_reference(post, credit_card_or_reference)
|
|
125
|
+
else
|
|
126
|
+
add_creditcard(post, credit_card_or_reference, options)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def add_autocapture(post, autocapture)
|
|
131
|
+
post[:autocapture] = autocapture ? 1 : 0
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def recurring_or_authorize(credit_card_or_reference)
|
|
135
|
+
credit_card_or_reference.is_a?(String) ? :recurring : :authorize
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def add_description(post, options)
|
|
139
|
+
post[:description] = options[:description] || 'Description'
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def add_testmode(post)
|
|
143
|
+
return if post[:transaction].present?
|
|
144
|
+
post[:testmode] = test? ? '1' : '0'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def add_fraud_parameters(post, options)
|
|
148
|
+
if @protocol >= 4
|
|
149
|
+
post[:fraud_remote_addr] = options[:ip] if options[:ip]
|
|
150
|
+
post[:fraud_http_accept] = options[:fraud_http_accept] if options[:fraud_http_accept]
|
|
151
|
+
post[:fraud_http_accept_language] = options[:fraud_http_accept_language] if options[:fraud_http_accept_language]
|
|
152
|
+
post[:fraud_http_accept_encoding] = options[:fraud_http_accept_encoding] if options[:fraud_http_accept_encoding]
|
|
153
|
+
post[:fraud_http_accept_charset] = options[:fraud_http_accept_charset] if options[:fraud_http_accept_charset]
|
|
154
|
+
post[:fraud_http_referer] = options[:fraud_http_referer] if options[:fraud_http_referer]
|
|
155
|
+
post[:fraud_http_user_agent] = options[:fraud_http_user_agent] if options[:fraud_http_user_agent]
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def add_finalize(post, options)
|
|
160
|
+
post[:finalize] = options[:finalize] ? '1' : '0'
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def commit(action, params)
|
|
164
|
+
response = parse(ssl_post(self.live_url, post_data(action, params)))
|
|
165
|
+
|
|
166
|
+
Response.new(successful?(response), message_from(response), response,
|
|
167
|
+
:test => test?,
|
|
168
|
+
:authorization => response[:transaction]
|
|
169
|
+
)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def successful?(response)
|
|
173
|
+
response[:qpstat] == APPROVED
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def parse(data)
|
|
177
|
+
response = {}
|
|
178
|
+
|
|
179
|
+
doc = REXML::Document.new(data)
|
|
180
|
+
|
|
181
|
+
doc.root.elements.each do |element|
|
|
182
|
+
response[element.name.to_sym] = element.text
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
response
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def message_from(response)
|
|
189
|
+
response[:qpstatmsg].to_s
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def post_data(action, params = {})
|
|
193
|
+
params[:protocol] = @protocol
|
|
194
|
+
params[:msgtype] = action.to_s
|
|
195
|
+
params[:merchant] = @options[:login]
|
|
196
|
+
params[:apikey] = @options[:apikey] if @options[:apikey]
|
|
197
|
+
params[:md5check] = generate_check_hash(action, params)
|
|
198
|
+
|
|
199
|
+
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def generate_check_hash(action, params)
|
|
203
|
+
string = MD5_CHECK_FIELDS[@protocol][action].collect do |key|
|
|
204
|
+
params[key.to_sym]
|
|
205
|
+
end.join('')
|
|
206
|
+
|
|
207
|
+
# Add the md5checkword
|
|
208
|
+
string << @options[:password].to_s
|
|
209
|
+
|
|
210
|
+
Digest::MD5.hexdigest(string)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def expdate(credit_card)
|
|
214
|
+
year = format(credit_card.year, :two_digits)
|
|
215
|
+
month = format(credit_card.month, :two_digits)
|
|
216
|
+
|
|
217
|
+
"#{year}#{month}"
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Limited to 20 digits max
|
|
221
|
+
def format_order_number(number)
|
|
222
|
+
number.to_s.gsub(/[^\w]/, '').rjust(4, '0')[0...20]
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|