activemerchant 1.38.0 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1344 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +226 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +74 -13
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +27 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
- data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +177 -0
- data/lib/active_merchant/country.rb +334 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +24 -21
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- metadata +161 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -73
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -129
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,328 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CardknoxGateway < Gateway
|
4
|
+
self.live_url = 'https://x1.cardknox.com/gateway'
|
5
|
+
|
6
|
+
self.supported_countries = ['US','CA','GB']
|
7
|
+
self.default_currency = 'USD'
|
8
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
9
|
+
|
10
|
+
self.homepage_url = 'https://www.cardknox.com/'
|
11
|
+
self.display_name = 'Cardknox'
|
12
|
+
|
13
|
+
COMMANDS = {
|
14
|
+
credit_card: {
|
15
|
+
purchase: 'cc:sale',
|
16
|
+
authorization: 'cc:authonly',
|
17
|
+
capture: 'cc:capture',
|
18
|
+
refund: 'cc:refund',
|
19
|
+
void: 'cc:void',
|
20
|
+
save: 'cc:save'
|
21
|
+
},
|
22
|
+
check: {
|
23
|
+
purchase: 'check:sale',
|
24
|
+
refund: 'check:refund',
|
25
|
+
void: 'check:void',
|
26
|
+
save: 'check:save'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
def initialize(options={})
|
31
|
+
requires!(options, :api_key)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
# There are three sources for doing a purchase transation:
|
36
|
+
# - credit card
|
37
|
+
# - check
|
38
|
+
# - cardknox token, which is returned in the the authorization string "ref_num;token;command"
|
39
|
+
|
40
|
+
def purchase(amount, source, options={})
|
41
|
+
post = {}
|
42
|
+
add_amount(post, amount, options)
|
43
|
+
add_invoice(post, options)
|
44
|
+
add_source(post, source)
|
45
|
+
add_address(post, source, options)
|
46
|
+
add_customer_data(post, options)
|
47
|
+
add_custom_fields(post, options)
|
48
|
+
commit(:purchase, source_type(source), post)
|
49
|
+
end
|
50
|
+
|
51
|
+
def authorize(amount, source, options={})
|
52
|
+
post = {}
|
53
|
+
add_amount(post, amount)
|
54
|
+
add_invoice(post, options)
|
55
|
+
add_source(post, source)
|
56
|
+
add_address(post, source, options)
|
57
|
+
add_customer_data(post, options)
|
58
|
+
add_custom_fields(post, options)
|
59
|
+
commit(:authorization, source_type(source), post)
|
60
|
+
end
|
61
|
+
|
62
|
+
def capture(amount, authorization, options = {})
|
63
|
+
post = {}
|
64
|
+
add_reference(post, authorization)
|
65
|
+
add_amount(post, amount)
|
66
|
+
commit(:capture, source_type(authorization), post)
|
67
|
+
end
|
68
|
+
|
69
|
+
def refund(amount, authorization, options={})
|
70
|
+
post = {}
|
71
|
+
add_reference(post, authorization)
|
72
|
+
add_amount(post, amount)
|
73
|
+
commit(:refund, source_type(authorization), post)
|
74
|
+
end
|
75
|
+
|
76
|
+
def void(authorization, options = {})
|
77
|
+
post = {}
|
78
|
+
add_reference(post, authorization)
|
79
|
+
commit(:void, source_type(authorization), post)
|
80
|
+
end
|
81
|
+
|
82
|
+
def verify(credit_card, options={})
|
83
|
+
MultiResponse.run(:use_first_response) do |r|
|
84
|
+
r.process { authorize(100, credit_card, options) }
|
85
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def store(source, options = {})
|
90
|
+
post = {}
|
91
|
+
add_source(post, source)
|
92
|
+
add_address(post, source, options)
|
93
|
+
add_invoice(post, options)
|
94
|
+
add_customer_data(post, options)
|
95
|
+
add_custom_fields(post, options)
|
96
|
+
commit(:save, source_type(source), post)
|
97
|
+
end
|
98
|
+
|
99
|
+
def supports_scrubbing?
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
def scrub(transcript)
|
104
|
+
transcript.
|
105
|
+
gsub(%r((xCardNum=)\d+), '\1[FILTERED]').
|
106
|
+
gsub(%r((xCVV=)\d+), '\1[FILTERED]').
|
107
|
+
gsub(%r((xAccount=)\d+), '\1[FILTERED]').
|
108
|
+
gsub(%r((xRouting=)\d+), '\1[FILTERED]').
|
109
|
+
gsub(%r((xKey=)\w+), '\1[FILTERED]')
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
def split_authorization(authorization)
|
115
|
+
authorization.split(";")
|
116
|
+
end
|
117
|
+
|
118
|
+
def add_reference(post, reference)
|
119
|
+
reference, _, _ = split_authorization(reference)
|
120
|
+
post[:Refnum] = reference
|
121
|
+
end
|
122
|
+
|
123
|
+
def source_type(source)
|
124
|
+
if source.respond_to?(:brand)
|
125
|
+
:credit_card
|
126
|
+
elsif source.respond_to?(:routing_number)
|
127
|
+
:check
|
128
|
+
elsif source.kind_of?(String)
|
129
|
+
source_type_from(source)
|
130
|
+
else
|
131
|
+
raise ArgumentError, "Unknown source #{source.inspect}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def source_type_from(authorization)
|
136
|
+
_, _, source_type = split_authorization(authorization)
|
137
|
+
(source_type || "credit_card").to_sym
|
138
|
+
end
|
139
|
+
|
140
|
+
def add_source(post, source)
|
141
|
+
if source.respond_to?(:brand)
|
142
|
+
add_credit_card(post, source)
|
143
|
+
elsif source.respond_to?(:routing_number)
|
144
|
+
add_check(post, source)
|
145
|
+
elsif source.kind_of?(String)
|
146
|
+
add_cardknox_token(post, source)
|
147
|
+
else
|
148
|
+
raise ArgumentError, "Invalid payment source #{source.inspect}"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Subtotal + Tax + Tip = Amount.
|
153
|
+
|
154
|
+
def add_amount(post, money, options = {})
|
155
|
+
post[:Tip] = amount(options[:tip])
|
156
|
+
post[:Amount] = amount(money)
|
157
|
+
end
|
158
|
+
|
159
|
+
def expdate(credit_card)
|
160
|
+
year = format(credit_card.year, :two_digits)
|
161
|
+
month = format(credit_card.month, :two_digits)
|
162
|
+
"#{month}#{year}"
|
163
|
+
end
|
164
|
+
|
165
|
+
def add_customer_data(post, options)
|
166
|
+
address = options[:billing_address] || {}
|
167
|
+
post[:Street] = address[:address1]
|
168
|
+
post[:Zip] = address[:zip]
|
169
|
+
post[:PONum] = options[:po_number]
|
170
|
+
post[:Fax] = options[:fax]
|
171
|
+
post[:Email] = options[:email]
|
172
|
+
post[:IP] = options[:ip]
|
173
|
+
end
|
174
|
+
|
175
|
+
def add_address(post, source, options)
|
176
|
+
add_address_for_type(:billing, post, source, options[:billing_address]) if options[:billing_address]
|
177
|
+
add_address_for_type(:shipping, post, source, options[:shipping_address]) if options[:shipping_address]
|
178
|
+
end
|
179
|
+
|
180
|
+
def add_address_for_type(type, post, source, address)
|
181
|
+
prefix = address_key_prefix(type)
|
182
|
+
if source.respond_to?(:first_name)
|
183
|
+
post[address_key(prefix, 'FirstName')] = source.first_name
|
184
|
+
post[address_key(prefix, 'LastName')] = source.last_name
|
185
|
+
else
|
186
|
+
post[address_key(prefix, 'FirstName')] = address[:first_name]
|
187
|
+
post[address_key(prefix, 'LastName')] = address[:last_name]
|
188
|
+
end
|
189
|
+
post[address_key(prefix, 'MiddleName')] = address[:middle_name]
|
190
|
+
|
191
|
+
post[address_key(prefix, 'Company')] = address[:company]
|
192
|
+
post[address_key(prefix, 'Street')] = address[:address1]
|
193
|
+
post[address_key(prefix, 'Street2')] = address[:address2]
|
194
|
+
post[address_key(prefix, 'City')] = address[:city]
|
195
|
+
post[address_key(prefix, 'State')] = address[:state]
|
196
|
+
post[address_key(prefix, 'Zip')] = address[:zip]
|
197
|
+
post[address_key(prefix, 'Country')] = address[:country]
|
198
|
+
post[address_key(prefix, 'Phone')] = address[:phone]
|
199
|
+
post[address_key(prefix, 'Mobile')] = address[:mobile]
|
200
|
+
end
|
201
|
+
|
202
|
+
def address_key_prefix(type)
|
203
|
+
case type
|
204
|
+
when :shipping then 'Ship'
|
205
|
+
when :billing then 'Bill'
|
206
|
+
else
|
207
|
+
raise ArgumentError, "Unknown address key prefix: #{type}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def address_key(prefix, key)
|
212
|
+
"#{prefix}#{key}".to_sym
|
213
|
+
end
|
214
|
+
|
215
|
+
def add_invoice(post, options)
|
216
|
+
post[:Invoice] = options[:invoice]
|
217
|
+
post[:OrderID] = options[:order_id]
|
218
|
+
post[:Comments] = options[:comments]
|
219
|
+
post[:Description] = options[:description]
|
220
|
+
post[:Tax] = amount(options[:tax])
|
221
|
+
end
|
222
|
+
|
223
|
+
def add_custom_fields(post, options)
|
224
|
+
options.keys.grep(/^custom(?:[01]\d|20)$/) do |key|
|
225
|
+
post[key.to_s.capitalize] = options[key]
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def add_credit_card(post, credit_card)
|
230
|
+
if credit_card.track_data.present?
|
231
|
+
post[:Magstripe] = credit_card.track_data
|
232
|
+
post[:Cardpresent] = true
|
233
|
+
else
|
234
|
+
post[:CardNum] = credit_card.number
|
235
|
+
post[:CVV] = credit_card.verification_value
|
236
|
+
post[:Exp] = expdate(credit_card)
|
237
|
+
post[:Name] = credit_card.name
|
238
|
+
post[:CardPresent] = true if credit_card.manual_entry
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def add_check(post, check)
|
243
|
+
post[:Routing] = check.routing_number
|
244
|
+
post[:Account] = check.account_number
|
245
|
+
post[:Name] = check.name
|
246
|
+
post[:CheckNum] = check.number
|
247
|
+
end
|
248
|
+
|
249
|
+
def add_cardknox_token(post, authorization)
|
250
|
+
_, token, _ = split_authorization(authorization)
|
251
|
+
|
252
|
+
post[:Token] = token
|
253
|
+
end
|
254
|
+
|
255
|
+
def parse(body)
|
256
|
+
fields = {}
|
257
|
+
for line in body.split('&')
|
258
|
+
key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
|
259
|
+
fields[key] = CGI.unescape(value.to_s)
|
260
|
+
end
|
261
|
+
|
262
|
+
{
|
263
|
+
result: fields['xResult'],
|
264
|
+
status: fields['xStatus'],
|
265
|
+
error: fields['xError'],
|
266
|
+
auth_code: fields['xAuthCode'],
|
267
|
+
ref_num: fields['xRefNum'],
|
268
|
+
current_ref_num: fields['xRefNumCurrent'],
|
269
|
+
token: fields['xToken'],
|
270
|
+
batch: fields['xBatch'],
|
271
|
+
avs_result: fields['xAvsResult'],
|
272
|
+
avs_result_code: fields['xAvsResultCode'],
|
273
|
+
cvv_result: fields['xCvvResult'],
|
274
|
+
cvv_result_code: fields['xCvvResultCode'],
|
275
|
+
remaining_balance: fields['xRemainingBalance'],
|
276
|
+
amount: fields['xAuthAmount'],
|
277
|
+
masked_card_num: fields['xMaskedCardNumber'],
|
278
|
+
masked_account_number: fields['MaskedAccountNumber']
|
279
|
+
}.delete_if{|k, v| v.nil?}
|
280
|
+
end
|
281
|
+
|
282
|
+
|
283
|
+
def commit(action, source_type, parameters)
|
284
|
+
response = parse(ssl_post(live_url, post_data(COMMANDS[source_type][action], parameters)))
|
285
|
+
|
286
|
+
Response.new(
|
287
|
+
(response[:status] == 'Approved'),
|
288
|
+
message_from(response),
|
289
|
+
response,
|
290
|
+
authorization: authorization_from(response, source_type),
|
291
|
+
avs_result: { code: response[:avs_result_code] },
|
292
|
+
cvv_result: response[:cvv_result_code]
|
293
|
+
)
|
294
|
+
end
|
295
|
+
|
296
|
+
def message_from(response)
|
297
|
+
if response[:status] == "Approved"
|
298
|
+
"Success"
|
299
|
+
elsif response[:error].blank?
|
300
|
+
"Unspecified error"
|
301
|
+
else
|
302
|
+
response[:error]
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
def authorization_from(response, source_type)
|
307
|
+
"#{response[:ref_num]};#{response[:token]};#{source_type}"
|
308
|
+
end
|
309
|
+
|
310
|
+
def post_data(command, parameters = {})
|
311
|
+
initial_parameters = {
|
312
|
+
Key: @options[:api_key],
|
313
|
+
Version: "4.5.4",
|
314
|
+
SoftwareName: 'Active Merchant',
|
315
|
+
SoftwareVersion: "#{ActiveMerchant::VERSION}",
|
316
|
+
Command: command,
|
317
|
+
}
|
318
|
+
|
319
|
+
seed = SecureRandom.hex(32).upcase
|
320
|
+
hash = Digest::SHA1.hexdigest("#{initial_parameters[:command]}:#{@options[:pin]}:#{parameters[:amount]}:#{parameters[:invoice]}:#{seed}")
|
321
|
+
initial_parameters[:Hash] = "s/#{seed}/#{hash}/n" unless @options[:pin].blank?
|
322
|
+
parameters = initial_parameters.merge(parameters)
|
323
|
+
|
324
|
+
parameters.reject{|k, v| v.blank?}.collect{ |key, value| "x#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CardprocessGateway < Gateway
|
4
|
+
self.test_url = 'https://test.vr-pay-ecommerce.de/v1/payments'
|
5
|
+
self.live_url = 'https://vr-pay-ecommerce.de/v1/payments'
|
6
|
+
|
7
|
+
self.supported_countries = %w[ BE BG CZ DK DE EE IE ES FR HR IT CY LV LT LU
|
8
|
+
MT HU NL AT PL PT RO SI SK FI SE GB IS LI NO
|
9
|
+
CH ME MK AL RS TR BA ]
|
10
|
+
self.default_currency = 'EUR'
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
|
12
|
+
|
13
|
+
self.homepage_url = 'https://vr-pay-ecommerce.docs.oppwa.com/'
|
14
|
+
self.display_name = 'CardProcess VR-Pay'
|
15
|
+
self.money_format = :dollars
|
16
|
+
|
17
|
+
STANDARD_ERROR_CODE_MAPPING = {}
|
18
|
+
|
19
|
+
# Creates a new CardProcess Gateway
|
20
|
+
#
|
21
|
+
# The gateway requires a valid login, password, and entity ID
|
22
|
+
# to be passed in the +options+ hash.
|
23
|
+
#
|
24
|
+
# === Options
|
25
|
+
#
|
26
|
+
# * <tt>:user_id</tt> -- The CardProcess user ID
|
27
|
+
# * <tt>:password</tt> -- The CardProcess password
|
28
|
+
# * <tt>:entity_id</tt> -- The CardProcess channel or entity ID for any transactions
|
29
|
+
def initialize(options={})
|
30
|
+
requires!(options, :user_id, :password, :entity_id)
|
31
|
+
super
|
32
|
+
# This variable exists purely to allow remote tests to force error codes;
|
33
|
+
# the lack of a setter despite its usage is intentional.
|
34
|
+
@test_options = {}
|
35
|
+
end
|
36
|
+
|
37
|
+
def purchase(money, payment, options = {})
|
38
|
+
post = {}
|
39
|
+
add_invoice(post, money, options)
|
40
|
+
add_payment(post, payment)
|
41
|
+
add_address(post, payment, options)
|
42
|
+
add_customer_data(post, options)
|
43
|
+
|
44
|
+
commit('DB', post)
|
45
|
+
end
|
46
|
+
|
47
|
+
def authorize(money, payment, options = {})
|
48
|
+
post = {}
|
49
|
+
add_invoice(post, money, options)
|
50
|
+
add_payment(post, payment)
|
51
|
+
add_address(post, payment, options)
|
52
|
+
add_customer_data(post, options)
|
53
|
+
|
54
|
+
commit('PA', post)
|
55
|
+
end
|
56
|
+
|
57
|
+
def capture(money, authorization, options = {})
|
58
|
+
post = {
|
59
|
+
id: authorization
|
60
|
+
}
|
61
|
+
add_invoice(post, money, options)
|
62
|
+
commit('CP', post)
|
63
|
+
end
|
64
|
+
|
65
|
+
def refund(money, authorization, options = {})
|
66
|
+
post = {
|
67
|
+
id: authorization
|
68
|
+
}
|
69
|
+
add_invoice(post, money, options)
|
70
|
+
commit('RF', post)
|
71
|
+
end
|
72
|
+
|
73
|
+
def credit(money, payment, options = {})
|
74
|
+
post = {}
|
75
|
+
add_invoice(post, money, options)
|
76
|
+
add_payment(post, payment)
|
77
|
+
add_address(post, payment, options)
|
78
|
+
add_customer_data(post, options)
|
79
|
+
|
80
|
+
commit('CD', post)
|
81
|
+
end
|
82
|
+
|
83
|
+
def void(authorization, _options = {})
|
84
|
+
post = {
|
85
|
+
id: authorization
|
86
|
+
}
|
87
|
+
commit('RV', post)
|
88
|
+
end
|
89
|
+
|
90
|
+
def verify(credit_card, options = {})
|
91
|
+
MultiResponse.run do |r|
|
92
|
+
r.process { authorize(100, credit_card, options) }
|
93
|
+
r.process { void(r.authorization, options) }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def supports_scrubbing?
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def scrub(transcript)
|
102
|
+
transcript
|
103
|
+
.gsub(%r{(authentication\.[^=]+=)[^&]+}, '\1[FILTERED]')
|
104
|
+
.gsub(%r{(card\.number=)\d+}, '\1[FILTERED]')
|
105
|
+
.gsub(%r{(cvv=)\d{3,4}}, '\1[FILTERED]\2')
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def add_customer_data(post, options)
|
111
|
+
post['customer.ip'] = options[:ip] if options[:ip]
|
112
|
+
end
|
113
|
+
|
114
|
+
def add_address(post, _card, options)
|
115
|
+
if (address = options[:billing_address] || options[:address])
|
116
|
+
post[:billing] = hashify_address(address)
|
117
|
+
end
|
118
|
+
|
119
|
+
if (shipping = options[:shipping_address])
|
120
|
+
post[:shipping] = hashify_address(shipping)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_invoice(post, money, options)
|
125
|
+
return if money.nil?
|
126
|
+
post[:amount] = amount(money)
|
127
|
+
post[:currency] = (options[:currency] || currency(money))
|
128
|
+
post[:merchantInvoiceId] = options[:merchant_invoice_id] if options[:merchant_invoice_id]
|
129
|
+
post[:merchantTransactionId] = options[:merchant_transaction_id] if options[:merchant_transaction_id]
|
130
|
+
post[:transactionCategory] = options[:transaction_category] if options[:transaction_category]
|
131
|
+
end
|
132
|
+
|
133
|
+
def add_payment(post, payment)
|
134
|
+
return if payment.is_a?(String)
|
135
|
+
post[:paymentBrand] = payment.brand.upcase if payment.brand
|
136
|
+
post[:card] ||= {}
|
137
|
+
post[:card][:number] = payment.number
|
138
|
+
post[:card][:holder] = payment.name
|
139
|
+
post[:card][:expiryMonth] = sprintf('%02d', payment.month)
|
140
|
+
post[:card][:expiryYear] = sprintf('%02d', payment.year)
|
141
|
+
post[:card][:cvv] = payment.verification_value
|
142
|
+
end
|
143
|
+
|
144
|
+
def parse(body)
|
145
|
+
JSON.parse(body)
|
146
|
+
end
|
147
|
+
|
148
|
+
def commit(action, parameters)
|
149
|
+
url = (test? ? test_url : live_url)
|
150
|
+
if (id = parameters.delete(:id))
|
151
|
+
url += "/#{id}"
|
152
|
+
end
|
153
|
+
|
154
|
+
begin
|
155
|
+
raw_response = ssl_post(url, post_data(action, parameters.merge(@test_options)))
|
156
|
+
rescue ResponseError => e
|
157
|
+
raw_response = e.response.body
|
158
|
+
end
|
159
|
+
response = parse(raw_response)
|
160
|
+
|
161
|
+
Response.new(
|
162
|
+
success_from(response),
|
163
|
+
message_from(response),
|
164
|
+
response,
|
165
|
+
authorization: authorization_from(response),
|
166
|
+
avs_result: AVSResult.new(code: response['result']['avsResponse']),
|
167
|
+
cvv_result: CVVResult.new(response['result']['cvvResponse']),
|
168
|
+
test: test?,
|
169
|
+
error_code: error_code_from(response)
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
def success_from(response)
|
174
|
+
!(response['result']['code'] =~ /^(000\.000\.|000\.100\.1|000\.[36])/).nil?
|
175
|
+
end
|
176
|
+
|
177
|
+
def message_from(response)
|
178
|
+
response['result']['description']
|
179
|
+
end
|
180
|
+
|
181
|
+
def authorization_from(response)
|
182
|
+
response['id']
|
183
|
+
end
|
184
|
+
|
185
|
+
def post_data(action, parameters = {})
|
186
|
+
post = parameters.clone
|
187
|
+
post[:authentication] ||= {}
|
188
|
+
post[:authentication][:userId] = @options[:user_id]
|
189
|
+
post[:authentication][:password] = @options[:password]
|
190
|
+
post[:authentication][:entityId] = @options[:entity_id]
|
191
|
+
post[:paymentType] = action
|
192
|
+
dot_flatten_hash(post).map {|key, value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
|
193
|
+
end
|
194
|
+
|
195
|
+
def error_code_from(response)
|
196
|
+
unless success_from(response)
|
197
|
+
case response['result']['code']
|
198
|
+
when '100.100.101'
|
199
|
+
STANDARD_ERROR_CODE[:incorrect_number]
|
200
|
+
when '100.100.303'
|
201
|
+
STANDARD_ERROR_CODE[:expired_card]
|
202
|
+
when /100\.100\.(201|301|305)/
|
203
|
+
STANDARD_ERROR_CODE[:invalid_expiry_date]
|
204
|
+
when /100.100.60[01]/
|
205
|
+
STANDARD_ERROR_CODE[:invalid_cvc]
|
206
|
+
when '800.100.151'
|
207
|
+
STANDARD_ERROR_CODE[:invalid_number]
|
208
|
+
when '800.100.153'
|
209
|
+
STANDARD_ERROR_CODE[:incorrect_cvc]
|
210
|
+
when /800.800.(102|302)/
|
211
|
+
STANDARD_ERROR_CODE[:incorrect_address]
|
212
|
+
when '800.800.202'
|
213
|
+
STANDARD_ERROR_CODE[:invalid_zip]
|
214
|
+
when '800.100.166'
|
215
|
+
STANDARD_ERROR_CODE[:incorrect_pin]
|
216
|
+
when '800.100.171'
|
217
|
+
STANDARD_ERROR_CODE[:pickup_card]
|
218
|
+
when /^(200|700)\./
|
219
|
+
STANDARD_ERROR_CODE[:config_error]
|
220
|
+
when /^(800\.[17]00|800\.800\.[123])/
|
221
|
+
STANDARD_ERROR_CODE[:card_declined]
|
222
|
+
when /^(900\.[1234]00)/
|
223
|
+
STANDARD_ERROR_CODE[:processing_error]
|
224
|
+
else
|
225
|
+
STANDARD_ERROR_CODE[:processing_error]
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def hashify_address(address)
|
231
|
+
hash = {}
|
232
|
+
hash[:street1] = address[:address1] if address[:address1]
|
233
|
+
hash[:street2] = address[:address2] if address[:address2]
|
234
|
+
hash[:city] = address[:city] if address[:city]
|
235
|
+
hash[:state] = address[:state] if address[:state]
|
236
|
+
hash[:postcode] = address[:zip] if address[:zip]
|
237
|
+
hash[:country] = address[:country] if address[:country]
|
238
|
+
hash
|
239
|
+
end
|
240
|
+
|
241
|
+
def dot_flatten_hash(hash, prefix = '')
|
242
|
+
h = {}
|
243
|
+
hash.each_pair do |k, v|
|
244
|
+
if v.is_a?(Hash)
|
245
|
+
h.merge!(dot_flatten_hash(v, prefix + k.to_s + '.'))
|
246
|
+
else
|
247
|
+
h[prefix + k.to_s] = v
|
248
|
+
end
|
249
|
+
end
|
250
|
+
h
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|