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
|
@@ -6,10 +6,12 @@ module ActiveMerchant #:nodoc:
|
|
|
6
6
|
|
|
7
7
|
self.default_currency = 'GBP'
|
|
8
8
|
self.money_format = :cents
|
|
9
|
-
self.supported_countries = %w(HK
|
|
10
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro
|
|
9
|
+
self.supported_countries = %w(HK GB AU AD AR BE BR CA CH CN CO CR CY CZ DE DK ES FI FR GI GR HU IE IN IT JP LI LU MC MT MY MX NL NO NZ PA PE PL PT SE SG SI SM TR UM VA)
|
|
10
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
|
|
11
|
+
self.currencies_without_fractions = %w(HUF IDR ISK JPY KRW)
|
|
12
|
+
self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
|
|
11
13
|
self.homepage_url = 'http://www.worldpay.com/'
|
|
12
|
-
self.display_name = '
|
|
14
|
+
self.display_name = 'Worldpay Global'
|
|
13
15
|
|
|
14
16
|
CARD_CODES = {
|
|
15
17
|
'visa' => 'VISA-SSL',
|
|
@@ -18,8 +20,7 @@ module ActiveMerchant #:nodoc:
|
|
|
18
20
|
'american_express' => 'AMEX-SSL',
|
|
19
21
|
'jcb' => 'JCB-SSL',
|
|
20
22
|
'maestro' => 'MAESTRO-SSL',
|
|
21
|
-
'
|
|
22
|
-
'diners_club' => 'DINERS-SSL'
|
|
23
|
+
'diners_club' => 'DINERS-SSL',
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
def initialize(options = {})
|
|
@@ -29,8 +30,8 @@ module ActiveMerchant #:nodoc:
|
|
|
29
30
|
|
|
30
31
|
def purchase(money, payment_method, options = {})
|
|
31
32
|
MultiResponse.run do |r|
|
|
32
|
-
r.process{authorize(money, payment_method, options)}
|
|
33
|
-
r.process{capture(money, r.authorization, options.merge(:authorization_validated => true))}
|
|
33
|
+
r.process { authorize(money, payment_method, options) }
|
|
34
|
+
r.process { capture(money, r.authorization, options.merge(:authorization_validated => true)) }
|
|
34
35
|
end
|
|
35
36
|
end
|
|
36
37
|
|
|
@@ -41,56 +42,91 @@ module ActiveMerchant #:nodoc:
|
|
|
41
42
|
|
|
42
43
|
def capture(money, authorization, options = {})
|
|
43
44
|
MultiResponse.run do |r|
|
|
44
|
-
r.process{inquire_request(authorization, options,
|
|
45
|
+
r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
|
|
45
46
|
if r.params
|
|
46
47
|
authorization_currency = r.params['amount_currency_code']
|
|
47
48
|
options = options.merge(:currency => authorization_currency) if authorization_currency.present?
|
|
48
49
|
end
|
|
49
|
-
r.process{capture_request(money, authorization, options)}
|
|
50
|
+
r.process { capture_request(money, authorization, options) }
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def void(authorization, options = {})
|
|
54
55
|
MultiResponse.run do |r|
|
|
55
|
-
r.process{inquire_request(authorization, options,
|
|
56
|
-
r.process{cancel_request(authorization, options)}
|
|
56
|
+
r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
|
|
57
|
+
r.process { cancel_request(authorization, options) }
|
|
57
58
|
end
|
|
58
59
|
end
|
|
59
60
|
|
|
60
61
|
def refund(money, authorization, options = {})
|
|
61
|
-
MultiResponse.run do |r|
|
|
62
|
-
r.process{inquire_request(authorization, options,
|
|
63
|
-
r.process{refund_request(money, authorization, options)}
|
|
62
|
+
response = MultiResponse.run do |r|
|
|
63
|
+
r.process { inquire_request(authorization, options, 'CAPTURED', 'SETTLED', 'SETTLED_BY_MERCHANT') }
|
|
64
|
+
r.process { refund_request(money, authorization, options) }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
return response if response.success?
|
|
68
|
+
return response unless options[:force_full_refund_if_unsettled]
|
|
69
|
+
|
|
70
|
+
void(authorization, options) if response.params['last_event'] == 'AUTHORISED'
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Credits only function on a Merchant ID/login/profile flagged for Payouts
|
|
74
|
+
# aka Credit Fund Transfers (CFT), whereas normal purchases, refunds,
|
|
75
|
+
# and other transactions should be performed on a normal eCom-flagged
|
|
76
|
+
# merchant ID.
|
|
77
|
+
def credit(money, payment_method, options = {})
|
|
78
|
+
credit_request(money, payment_method, options.merge(:credit => true))
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def verify(credit_card, options={})
|
|
82
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
83
|
+
r.process { authorize(100, credit_card, options) }
|
|
84
|
+
r.process(:ignore_result) { void(r.authorization, options.merge(:authorization_validated => true)) }
|
|
64
85
|
end
|
|
65
86
|
end
|
|
66
87
|
|
|
88
|
+
def supports_scrubbing
|
|
89
|
+
true
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def scrub(transcript)
|
|
93
|
+
transcript.
|
|
94
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
|
95
|
+
gsub(%r((<cardNumber>)\d+(</cardNumber>)), '\1[FILTERED]\2').
|
|
96
|
+
gsub(%r((<cvc>)[^<]+(</cvc>)), '\1[FILTERED]\2')
|
|
97
|
+
end
|
|
98
|
+
|
|
67
99
|
private
|
|
68
100
|
|
|
69
101
|
def authorize_request(money, payment_method, options)
|
|
70
|
-
commit('authorize', build_authorization_request(money, payment_method, options),
|
|
102
|
+
commit('authorize', build_authorization_request(money, payment_method, options), 'AUTHORISED', options)
|
|
71
103
|
end
|
|
72
104
|
|
|
73
105
|
def capture_request(money, authorization, options)
|
|
74
|
-
commit('capture', build_capture_request(money, authorization, options), :ok)
|
|
106
|
+
commit('capture', build_capture_request(money, authorization, options), :ok, options)
|
|
75
107
|
end
|
|
76
108
|
|
|
77
109
|
def cancel_request(authorization, options)
|
|
78
|
-
commit('cancel', build_void_request(authorization, options), :ok)
|
|
110
|
+
commit('cancel', build_void_request(authorization, options), :ok, options)
|
|
79
111
|
end
|
|
80
112
|
|
|
81
113
|
def inquire_request(authorization, options, *success_criteria)
|
|
82
|
-
commit('inquiry', build_order_inquiry_request(authorization, options), *success_criteria)
|
|
114
|
+
commit('inquiry', build_order_inquiry_request(authorization, options), *success_criteria, options)
|
|
83
115
|
end
|
|
84
116
|
|
|
85
117
|
def refund_request(money, authorization, options)
|
|
86
|
-
commit('refund', build_refund_request(money, authorization, options), :ok)
|
|
118
|
+
commit('refund', build_refund_request(money, authorization, options), :ok, options)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def credit_request(money, payment_method, options)
|
|
122
|
+
commit('credit', build_authorization_request(money, payment_method, options), :ok, 'SENT_FOR_REFUND', options)
|
|
87
123
|
end
|
|
88
124
|
|
|
89
125
|
def build_request
|
|
90
126
|
xml = Builder::XmlMarkup.new :indent => 2
|
|
91
|
-
xml.instruct! :xml, :encoding => '
|
|
92
|
-
xml.declare! :DOCTYPE, :paymentService, :PUBLIC,
|
|
93
|
-
xml.tag! 'paymentService', 'version' =>
|
|
127
|
+
xml.instruct! :xml, :encoding => 'UTF-8'
|
|
128
|
+
xml.declare! :DOCTYPE, :paymentService, :PUBLIC, '-//WorldPay//DTD WorldPay PaymentService v1//EN', 'http://dtd.worldpay.com/paymentService_v1.dtd'
|
|
129
|
+
xml.tag! 'paymentService', 'version' => '1.4', 'merchantCode' => @options[:login] do
|
|
94
130
|
yield xml
|
|
95
131
|
end
|
|
96
132
|
xml.target!
|
|
@@ -117,8 +153,8 @@ module ActiveMerchant #:nodoc:
|
|
|
117
153
|
def build_authorization_request(money, payment_method, options)
|
|
118
154
|
build_request do |xml|
|
|
119
155
|
xml.tag! 'submit' do
|
|
120
|
-
xml.tag! 'order',
|
|
121
|
-
xml.description(options[:description].blank? ?
|
|
156
|
+
xml.tag! 'order', order_tag_attributes(options) do
|
|
157
|
+
xml.description(options[:description].blank? ? 'Purchase' : options[:description])
|
|
122
158
|
add_amount(xml, money, options)
|
|
123
159
|
if options[:order_content]
|
|
124
160
|
xml.tag! 'orderContent' do
|
|
@@ -126,11 +162,22 @@ module ActiveMerchant #:nodoc:
|
|
|
126
162
|
end
|
|
127
163
|
end
|
|
128
164
|
add_payment_method(xml, money, payment_method, options)
|
|
165
|
+
add_email(xml, options)
|
|
166
|
+
if options[:hcg_additional_data]
|
|
167
|
+
add_hcg_additional_data(xml, options)
|
|
168
|
+
end
|
|
169
|
+
if options[:instalments]
|
|
170
|
+
add_instalments_data(xml, options)
|
|
171
|
+
end
|
|
129
172
|
end
|
|
130
173
|
end
|
|
131
174
|
end
|
|
132
175
|
end
|
|
133
176
|
|
|
177
|
+
def order_tag_attributes(options)
|
|
178
|
+
{ 'orderCode' => options[:order_id], 'installationId' => options[:inst_id] || @options[:inst_id] }.reject { |_, v| !v }
|
|
179
|
+
end
|
|
180
|
+
|
|
134
181
|
def build_capture_request(money, authorization, options)
|
|
135
182
|
build_order_modify_request(authorization) do |xml|
|
|
136
183
|
xml.tag! 'capture' do
|
|
@@ -150,23 +197,22 @@ module ActiveMerchant #:nodoc:
|
|
|
150
197
|
def build_refund_request(money, authorization, options)
|
|
151
198
|
build_order_modify_request(authorization) do |xml|
|
|
152
199
|
xml.tag! 'refund' do
|
|
153
|
-
add_amount(xml, money, options.merge(:debit_credit_indicator =>
|
|
200
|
+
add_amount(xml, money, options.merge(:debit_credit_indicator => 'credit'))
|
|
154
201
|
end
|
|
155
202
|
end
|
|
156
203
|
end
|
|
157
204
|
|
|
158
205
|
def add_amount(xml, money, options)
|
|
159
206
|
currency = options[:currency] || currency(money)
|
|
160
|
-
amount = localized_amount(money, currency)
|
|
161
207
|
|
|
162
208
|
amount_hash = {
|
|
163
|
-
:value =>
|
|
209
|
+
:value => localized_amount(money, currency),
|
|
164
210
|
'currencyCode' => currency,
|
|
165
|
-
'exponent' =>
|
|
211
|
+
'exponent' => currency_exponent(currency)
|
|
166
212
|
}
|
|
167
213
|
|
|
168
214
|
if options[:debit_credit_indicator]
|
|
169
|
-
amount_hash
|
|
215
|
+
amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator]
|
|
170
216
|
end
|
|
171
217
|
|
|
172
218
|
xml.tag! 'amount', amount_hash
|
|
@@ -174,52 +220,113 @@ module ActiveMerchant #:nodoc:
|
|
|
174
220
|
|
|
175
221
|
def add_payment_method(xml, amount, payment_method, options)
|
|
176
222
|
if payment_method.is_a?(String)
|
|
177
|
-
|
|
178
|
-
|
|
223
|
+
if options[:merchant_code]
|
|
224
|
+
xml.tag! 'payAsOrder', 'orderCode' => payment_method, 'merchantCode' => options[:merchant_code] do
|
|
225
|
+
add_amount(xml, amount, options)
|
|
226
|
+
end
|
|
227
|
+
else
|
|
228
|
+
xml.tag! 'payAsOrder', 'orderCode' => payment_method do
|
|
229
|
+
add_amount(xml, amount, options)
|
|
230
|
+
end
|
|
179
231
|
end
|
|
180
232
|
else
|
|
181
|
-
xml.tag! 'paymentDetails' do
|
|
233
|
+
xml.tag! 'paymentDetails', credit_fund_transfer_attribute(options) do
|
|
182
234
|
xml.tag! CARD_CODES[card_brand(payment_method)] do
|
|
183
235
|
xml.tag! 'cardNumber', payment_method.number
|
|
184
236
|
xml.tag! 'expiryDate' do
|
|
185
237
|
xml.tag! 'date', 'month' => format(payment_method.month, :two_digits), 'year' => format(payment_method.year, :four_digits)
|
|
186
238
|
end
|
|
187
239
|
|
|
188
|
-
xml.tag! 'cardHolderName', payment_method.name
|
|
240
|
+
xml.tag! 'cardHolderName', options[:execute_threed] ? '3D' : payment_method.name
|
|
189
241
|
xml.tag! 'cvc', payment_method.verification_value
|
|
190
242
|
|
|
191
|
-
add_address(xml,
|
|
243
|
+
add_address(xml, (options[:billing_address] || options[:address]))
|
|
192
244
|
end
|
|
245
|
+
if options[:ip] && options[:session_id]
|
|
246
|
+
xml.tag! 'session', 'shopperIPAddress' => options[:ip], 'id' => options[:session_id]
|
|
247
|
+
else
|
|
248
|
+
xml.tag! 'session', 'shopperIPAddress' => options[:ip] if options[:ip]
|
|
249
|
+
xml.tag! 'session', 'id' => options[:session_id] if options[:session_id]
|
|
250
|
+
end
|
|
251
|
+
add_stored_credential_options(xml, options) if options[:stored_credential_usage]
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def add_stored_credential_options(xml, options={})
|
|
257
|
+
if options[:stored_credential_initiated_reason]
|
|
258
|
+
xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage], 'merchantInitiatedReason' => options[:stored_credential_initiated_reason] do
|
|
259
|
+
xml.tag! 'schemeTransactionIdentifier', options[:stored_credential_transaction_id] if options[:stored_credential_transaction_id]
|
|
260
|
+
end
|
|
261
|
+
else
|
|
262
|
+
xml.tag! 'storedCredentials', 'usage' => options[:stored_credential_usage]
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def add_email(xml, options)
|
|
267
|
+
return unless options[:execute_threed] || options[:email]
|
|
268
|
+
xml.tag! 'shopper' do
|
|
269
|
+
xml.tag! 'shopperEmailAddress', options[:email] if options[:email]
|
|
270
|
+
xml.tag! 'browser' do
|
|
271
|
+
xml.tag! 'acceptHeader', options[:accept_header]
|
|
272
|
+
xml.tag! 'userAgentHeader', options[:user_agent]
|
|
193
273
|
end
|
|
194
274
|
end
|
|
195
275
|
end
|
|
196
276
|
|
|
197
|
-
def add_address(xml,
|
|
198
|
-
return
|
|
277
|
+
def add_address(xml, address)
|
|
278
|
+
return unless address
|
|
199
279
|
|
|
200
|
-
|
|
280
|
+
address = address_with_defaults(address)
|
|
281
|
+
|
|
282
|
+
xml.tag! 'cardAddress' do
|
|
201
283
|
xml.tag! 'address' do
|
|
202
284
|
if m = /^\s*([^\s]+)\s+(.+)$/.match(address[:name])
|
|
203
285
|
xml.tag! 'firstName', m[1]
|
|
204
286
|
xml.tag! 'lastName', m[2]
|
|
205
287
|
end
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
end
|
|
212
|
-
xml.tag! 'houseName', address[:address2] if address[:address2]
|
|
213
|
-
xml.tag! 'houseNumber', house_number if house_number.present?
|
|
214
|
-
xml.tag! 'postalCode', (address[:zip].present? ? address[:zip] : "0000")
|
|
215
|
-
xml.tag! 'city', address[:city] if address[:city]
|
|
216
|
-
xml.tag! 'state', (address[:state].present? ? address[:state] : 'N/A')
|
|
288
|
+
xml.tag! 'address1', address[:address1]
|
|
289
|
+
xml.tag! 'address2', address[:address2] if address[:address2]
|
|
290
|
+
xml.tag! 'postalCode', address[:zip]
|
|
291
|
+
xml.tag! 'city', address[:city]
|
|
292
|
+
xml.tag! 'state', address[:state]
|
|
217
293
|
xml.tag! 'countryCode', address[:country]
|
|
218
294
|
xml.tag! 'telephoneNumber', address[:phone] if address[:phone]
|
|
219
295
|
end
|
|
220
296
|
end
|
|
221
297
|
end
|
|
222
298
|
|
|
299
|
+
def add_hcg_additional_data(xml, options)
|
|
300
|
+
xml.tag! 'hcgAdditionalData' do
|
|
301
|
+
options[:hcg_additional_data].each do |k, v|
|
|
302
|
+
xml.tag! 'param', {name: k.to_s}, v
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def add_instalments_data(xml, options)
|
|
308
|
+
xml.tag! 'thirdPartyData' do
|
|
309
|
+
xml.tag! 'instalments', options[:instalments]
|
|
310
|
+
xml.tag! 'cpf', options[:cpf] if options[:cpf]
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
def address_with_defaults(address)
|
|
315
|
+
address ||= {}
|
|
316
|
+
address.delete_if { |_, v| v.blank? }
|
|
317
|
+
address.reverse_merge!(default_address)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def default_address
|
|
321
|
+
{
|
|
322
|
+
address1: 'N/A',
|
|
323
|
+
zip: '0000',
|
|
324
|
+
city: 'N/A',
|
|
325
|
+
state: 'N/A',
|
|
326
|
+
country: 'US'
|
|
327
|
+
}
|
|
328
|
+
end
|
|
329
|
+
|
|
223
330
|
def parse(action, xml)
|
|
224
331
|
parse_element({:action => action}, REXML::Document.new(xml))
|
|
225
332
|
end
|
|
@@ -230,16 +337,31 @@ module ActiveMerchant #:nodoc:
|
|
|
230
337
|
end
|
|
231
338
|
if node.has_elements?
|
|
232
339
|
raw[node.name.underscore.to_sym] = true unless node.name.blank?
|
|
233
|
-
node.elements.each{|e| parse_element(raw, e) }
|
|
340
|
+
node.elements.each { |e| parse_element(raw, e) }
|
|
234
341
|
else
|
|
235
342
|
raw[node.name.underscore.to_sym] = node.text unless node.text.nil?
|
|
236
343
|
end
|
|
237
344
|
raw
|
|
238
345
|
end
|
|
239
346
|
|
|
240
|
-
def
|
|
241
|
-
|
|
242
|
-
|
|
347
|
+
def headers(options)
|
|
348
|
+
headers = {
|
|
349
|
+
'Content-Type' => 'text/xml',
|
|
350
|
+
'Authorization' => encoded_credentials
|
|
351
|
+
}
|
|
352
|
+
if options[:cookie]
|
|
353
|
+
headers['Cookie'] = options[:cookie] if options[:cookie]
|
|
354
|
+
end
|
|
355
|
+
headers
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def commit(action, request, *success_criteria, options)
|
|
359
|
+
xml = ssl_post(url, request, headers(options))
|
|
360
|
+
raw = parse(action, xml)
|
|
361
|
+
if options[:execute_threed]
|
|
362
|
+
raw[:cookie] = @cookie
|
|
363
|
+
raw[:session_id] = options[:session_id]
|
|
364
|
+
end
|
|
243
365
|
success, message = success_and_message_from(raw, success_criteria)
|
|
244
366
|
|
|
245
367
|
Response.new(
|
|
@@ -247,11 +369,11 @@ module ActiveMerchant #:nodoc:
|
|
|
247
369
|
message,
|
|
248
370
|
raw,
|
|
249
371
|
:authorization => authorization_from(raw),
|
|
372
|
+
:error_code => error_code_from(success, raw),
|
|
250
373
|
:test => test?)
|
|
251
|
-
|
|
252
374
|
rescue ActiveMerchant::ResponseError => e
|
|
253
|
-
if e.response.code.to_s ==
|
|
254
|
-
return Response.new(false,
|
|
375
|
+
if e.response.code.to_s == '401'
|
|
376
|
+
return Response.new(false, 'Invalid credentials', {}, :test => test?)
|
|
255
377
|
else
|
|
256
378
|
raise e
|
|
257
379
|
end
|
|
@@ -261,6 +383,18 @@ module ActiveMerchant #:nodoc:
|
|
|
261
383
|
test? ? self.test_url : self.live_url
|
|
262
384
|
end
|
|
263
385
|
|
|
386
|
+
# Override the regular handle response so we can access the headers
|
|
387
|
+
# Set-Cookie value is needed for 3DS transactions
|
|
388
|
+
def handle_response(response)
|
|
389
|
+
case response.code.to_i
|
|
390
|
+
when 200...300
|
|
391
|
+
@cookie = response['Set-Cookie']
|
|
392
|
+
response.body
|
|
393
|
+
else
|
|
394
|
+
raise ResponseError.new(response)
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
|
|
264
398
|
# success_criteria can be:
|
|
265
399
|
# - a string or an array of strings (if one of many responses)
|
|
266
400
|
# - An array of strings if one of many responses could be considered a
|
|
@@ -268,7 +402,7 @@ module ActiveMerchant #:nodoc:
|
|
|
268
402
|
def success_and_message_from(raw, success_criteria)
|
|
269
403
|
success = (success_criteria.include?(raw[:last_event]) || raw[:ok].present?)
|
|
270
404
|
if success
|
|
271
|
-
message =
|
|
405
|
+
message = 'SUCCESS'
|
|
272
406
|
else
|
|
273
407
|
message = (raw[:iso8583_return_code_description] || raw[:error] || required_status_message(raw, success_criteria))
|
|
274
408
|
end
|
|
@@ -276,27 +410,37 @@ module ActiveMerchant #:nodoc:
|
|
|
276
410
|
[ success, message ]
|
|
277
411
|
end
|
|
278
412
|
|
|
413
|
+
def error_code_from(success, raw)
|
|
414
|
+
unless success == 'SUCCESS'
|
|
415
|
+
raw[:iso8583_return_code_code] || raw[:error_code] || nil
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
279
419
|
def required_status_message(raw, success_criteria)
|
|
280
420
|
if(!success_criteria.include?(raw[:last_event]))
|
|
281
|
-
"A transaction status of #{success_criteria.collect{|c| "'#{c}'"}.join(" or ")} is required."
|
|
421
|
+
"A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required."
|
|
282
422
|
end
|
|
283
423
|
end
|
|
284
424
|
|
|
285
425
|
def authorization_from(raw)
|
|
286
|
-
pair = raw.detect{|k,v| k.to_s =~ /_order_code$/}
|
|
426
|
+
pair = raw.detect { |k, v| k.to_s =~ /_order_code$/ }
|
|
287
427
|
(pair ? pair.last : nil)
|
|
288
428
|
end
|
|
289
429
|
|
|
430
|
+
def credit_fund_transfer_attribute(options)
|
|
431
|
+
return unless options[:credit]
|
|
432
|
+
{'action' => 'REFUND'}
|
|
433
|
+
end
|
|
434
|
+
|
|
290
435
|
def encoded_credentials
|
|
291
436
|
credentials = "#{@options[:login]}:#{@options[:password]}"
|
|
292
437
|
"Basic #{[credentials].pack('m').strip}"
|
|
293
438
|
end
|
|
294
439
|
|
|
295
|
-
def
|
|
296
|
-
|
|
297
|
-
return
|
|
298
|
-
|
|
299
|
-
amount.to_i / 100 * 100
|
|
440
|
+
def currency_exponent(currency)
|
|
441
|
+
return 0 if non_fractional_currency?(currency)
|
|
442
|
+
return 3 if three_decimal_currency?(currency)
|
|
443
|
+
return 2
|
|
300
444
|
end
|
|
301
445
|
end
|
|
302
446
|
end
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class WorldpayOnlinePaymentsGateway < Gateway
|
|
4
|
+
self.live_url = 'https://api.worldpay.com/v1/'
|
|
5
|
+
|
|
6
|
+
self.default_currency = 'GBP'
|
|
7
|
+
|
|
8
|
+
self.money_format = :cents
|
|
9
|
+
|
|
10
|
+
self.supported_countries = %w(HK US GB BE CH CZ DE DK ES FI FR GR HU IE IT LU MT NL NO PL PT SE SG TR)
|
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
|
|
12
|
+
|
|
13
|
+
self.homepage_url = 'http://online.worldpay.com'
|
|
14
|
+
self.display_name = 'Worldpay Online Payments'
|
|
15
|
+
|
|
16
|
+
def initialize(options={})
|
|
17
|
+
requires!(options, :client_key, :service_key)
|
|
18
|
+
@client_key = options[:client_key]
|
|
19
|
+
@service_key = options[:service_key]
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def authorize(money, credit_card, options={})
|
|
24
|
+
response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
|
25
|
+
if response.success?
|
|
26
|
+
options[:authorizeOnly] = true
|
|
27
|
+
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
|
28
|
+
response = commit(:post, 'orders', post, {}, 'authorize')
|
|
29
|
+
end
|
|
30
|
+
response
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def capture(money, authorization, options={})
|
|
34
|
+
if authorization
|
|
35
|
+
commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount'=>money}, options, 'capture')
|
|
36
|
+
else
|
|
37
|
+
Response.new(false,
|
|
38
|
+
'FAILED',
|
|
39
|
+
'FAILED',
|
|
40
|
+
:test => test?,
|
|
41
|
+
:authorization => false,
|
|
42
|
+
:avs_result => {},
|
|
43
|
+
:cvv_result => {},
|
|
44
|
+
:error_code => false
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def purchase(money, credit_card, options={})
|
|
50
|
+
response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
|
|
51
|
+
if response.success?
|
|
52
|
+
post = create_post_for_auth_or_purchase(response.authorization, money, options)
|
|
53
|
+
response = commit(:post, 'orders', post, options, 'purchase')
|
|
54
|
+
end
|
|
55
|
+
response
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def refund(money, orderCode, options={})
|
|
59
|
+
obj = money ? {'refundAmount' => money} : {}
|
|
60
|
+
commit(:post, "orders/#{CGI.escape(orderCode)}/refund", obj, options, 'refund')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def void(orderCode, options={})
|
|
64
|
+
response = commit(:delete, "orders/#{CGI.escape(orderCode)}", nil, options, 'void')
|
|
65
|
+
if !response.success? && (response.params && response.params['customCode'] != 'ORDER_NOT_FOUND')
|
|
66
|
+
response = refund(nil, orderCode)
|
|
67
|
+
end
|
|
68
|
+
response
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def verify(credit_card, options={})
|
|
72
|
+
authorize(0, credit_card, options)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def create_token(reusable, name, exp_month, exp_year, number, cvc)
|
|
78
|
+
obj = {
|
|
79
|
+
'reusable'=> reusable,
|
|
80
|
+
'paymentMethod'=> {
|
|
81
|
+
'type'=> 'Card',
|
|
82
|
+
'name'=> name,
|
|
83
|
+
'expiryMonth'=> exp_month,
|
|
84
|
+
'expiryYear'=> exp_year,
|
|
85
|
+
'cardNumber'=> number,
|
|
86
|
+
'cvc'=> cvc
|
|
87
|
+
},
|
|
88
|
+
'clientKey'=> @client_key
|
|
89
|
+
}
|
|
90
|
+
token_response = commit(:post, 'tokens', obj, {'Authorization' => @service_key}, 'token')
|
|
91
|
+
token_response
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def create_post_for_auth_or_purchase(token, money, options)
|
|
95
|
+
{
|
|
96
|
+
'token' => token,
|
|
97
|
+
'orderDescription' => options[:description] || 'Worldpay Order',
|
|
98
|
+
'amount' => money,
|
|
99
|
+
'currencyCode' => options[:currency] || default_currency,
|
|
100
|
+
'name' => options[:billing_address]&&options[:billing_address][:name] ? options[:billing_address][:name] : '',
|
|
101
|
+
'billingAddress' => {
|
|
102
|
+
'address1'=>options[:billing_address]&&options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
|
|
103
|
+
'address2'=>options[:billing_address]&&options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
|
|
104
|
+
'address3'=>'',
|
|
105
|
+
'postalCode'=>options[:billing_address]&&options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
|
|
106
|
+
'city'=>options[:billing_address]&&options[:billing_address][:city] ? options[:billing_address][:city] : '',
|
|
107
|
+
'state'=>options[:billing_address]&&options[:billing_address][:state] ? options[:billing_address][:state] : '',
|
|
108
|
+
'countryCode'=>options[:billing_address]&&options[:billing_address][:country] ? options[:billing_address][:country] : ''
|
|
109
|
+
},
|
|
110
|
+
'customerOrderCode' => options[:order_id],
|
|
111
|
+
'orderType' => 'ECOM',
|
|
112
|
+
'authorizeOnly' => options[:authorizeOnly] ? true : false
|
|
113
|
+
}
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def parse(body)
|
|
117
|
+
body ? JSON.parse(body) : {}
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def headers(options = {})
|
|
121
|
+
headers = {
|
|
122
|
+
'Authorization' => @service_key,
|
|
123
|
+
'Content-Type' => 'application/json',
|
|
124
|
+
'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
|
125
|
+
'X-Worldpay-Client-User-Agent' => user_agent,
|
|
126
|
+
'X-Worldpay-Client-User-Metadata' => {:ip => options[:ip]}.to_json
|
|
127
|
+
}
|
|
128
|
+
if options['Authorization']
|
|
129
|
+
headers['Authorization'] = options['Authorization']
|
|
130
|
+
end
|
|
131
|
+
headers
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def commit(method, url, parameters=nil, options = {}, type = false)
|
|
135
|
+
raw_response = response = nil
|
|
136
|
+
success = false
|
|
137
|
+
begin
|
|
138
|
+
json = parameters ? parameters.to_json : nil
|
|
139
|
+
|
|
140
|
+
raw_response = ssl_request(method, self.live_url + url, json, headers(options))
|
|
141
|
+
|
|
142
|
+
if raw_response != ''
|
|
143
|
+
response = parse(raw_response)
|
|
144
|
+
if type == 'token'
|
|
145
|
+
success = response.key?('token')
|
|
146
|
+
else
|
|
147
|
+
if response.key?('httpStatusCode')
|
|
148
|
+
success = false
|
|
149
|
+
else
|
|
150
|
+
if type == 'authorize' && response['paymentStatus'] == 'AUTHORIZED'
|
|
151
|
+
success = true
|
|
152
|
+
elsif type == 'purchase' && response['paymentStatus'] == 'SUCCESS'
|
|
153
|
+
success = true
|
|
154
|
+
elsif type == 'capture' || type=='refund' || type=='void'
|
|
155
|
+
success = true
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
else
|
|
160
|
+
success = true
|
|
161
|
+
response = {}
|
|
162
|
+
end
|
|
163
|
+
rescue ResponseError => e
|
|
164
|
+
raw_response = e.response.body
|
|
165
|
+
response = response_error(raw_response)
|
|
166
|
+
rescue JSON::ParserError
|
|
167
|
+
response = json_error(raw_response)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if response['orderCode']
|
|
171
|
+
authorization = response['orderCode']
|
|
172
|
+
elsif response['token']
|
|
173
|
+
authorization = response['token']
|
|
174
|
+
else
|
|
175
|
+
authorization = response['message']
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
Response.new(success,
|
|
179
|
+
success ? 'SUCCESS' : response['message'],
|
|
180
|
+
response,
|
|
181
|
+
:test => test?,
|
|
182
|
+
:authorization => authorization,
|
|
183
|
+
:avs_result => {},
|
|
184
|
+
:cvv_result => {},
|
|
185
|
+
:error_code => success ? nil : response['customCode']
|
|
186
|
+
)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def test?
|
|
190
|
+
@service_key[0] == 'T'
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def response_error(raw_response)
|
|
194
|
+
parse(raw_response)
|
|
195
|
+
rescue JSON::ParserError
|
|
196
|
+
json_error(raw_response)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def json_error(raw_response)
|
|
200
|
+
msg = 'Invalid response received from the Worldpay Online Payments API. Please contact techsupport.online@worldpay.com if you continue to receive this message.'
|
|
201
|
+
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
|
202
|
+
{
|
|
203
|
+
'error' => {
|
|
204
|
+
'message' => msg
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def handle_response(response)
|
|
210
|
+
response.body
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|