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,284 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class AdyenGateway < Gateway
|
4
|
+
|
5
|
+
# we recommend setting up merchant-specific endpoints.
|
6
|
+
# https://docs.adyen.com/developers/api-manual#apiendpoints
|
7
|
+
self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/v18'
|
8
|
+
self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/v18'
|
9
|
+
|
10
|
+
self.supported_countries = ['AT','AU','BE','BG','BR','CH','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GI','GR','HK','HU','IE','IS','IT','LI','LT','LU','LV','MC','MT','MX','NL','NO','PL','PT','RO','SE','SG','SK','SI','US']
|
11
|
+
self.default_currency = 'USD'
|
12
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover]
|
13
|
+
|
14
|
+
self.money_format = :cents
|
15
|
+
|
16
|
+
self.homepage_url = 'https://www.adyen.com/'
|
17
|
+
self.display_name = 'Adyen'
|
18
|
+
|
19
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
20
|
+
'101' => STANDARD_ERROR_CODE[:incorrect_number],
|
21
|
+
'103' => STANDARD_ERROR_CODE[:invalid_cvc],
|
22
|
+
'131' => STANDARD_ERROR_CODE[:incorrect_address],
|
23
|
+
'132' => STANDARD_ERROR_CODE[:incorrect_address],
|
24
|
+
'133' => STANDARD_ERROR_CODE[:incorrect_address],
|
25
|
+
'134' => STANDARD_ERROR_CODE[:incorrect_address],
|
26
|
+
'135' => STANDARD_ERROR_CODE[:incorrect_address],
|
27
|
+
}
|
28
|
+
|
29
|
+
def initialize(options={})
|
30
|
+
requires!(options, :username, :password, :merchant_account)
|
31
|
+
@username, @password, @merchant_account = options.values_at(:username, :password, :merchant_account)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def purchase(money, payment, options={})
|
36
|
+
MultiResponse.run do |r|
|
37
|
+
r.process{authorize(money, payment, options)}
|
38
|
+
r.process{capture(money, r.authorization, options)}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def authorize(money, payment, options={})
|
43
|
+
requires!(options, :order_id)
|
44
|
+
post = init_post(options)
|
45
|
+
add_invoice(post, money, options)
|
46
|
+
add_payment(post, payment)
|
47
|
+
add_extra_data(post, options)
|
48
|
+
add_shopper_interaction(post, payment, options)
|
49
|
+
add_address(post, options)
|
50
|
+
commit('authorise', post)
|
51
|
+
end
|
52
|
+
|
53
|
+
def capture(money, authorization, options={})
|
54
|
+
post = init_post(options)
|
55
|
+
add_invoice_for_modification(post, money, options)
|
56
|
+
add_reference(post, authorization, options)
|
57
|
+
commit('capture', post)
|
58
|
+
end
|
59
|
+
|
60
|
+
def refund(money, authorization, options={})
|
61
|
+
post = init_post(options)
|
62
|
+
add_invoice_for_modification(post, money, options)
|
63
|
+
add_original_reference(post, authorization, options)
|
64
|
+
commit('refund', post)
|
65
|
+
end
|
66
|
+
|
67
|
+
def void(authorization, options={})
|
68
|
+
post = init_post(options)
|
69
|
+
add_reference(post, authorization, options)
|
70
|
+
commit('cancel', post)
|
71
|
+
end
|
72
|
+
|
73
|
+
def store(credit_card, options={})
|
74
|
+
requires!(options, :order_id)
|
75
|
+
post = init_post(options)
|
76
|
+
add_invoice(post, 0, options)
|
77
|
+
add_payment(post, credit_card)
|
78
|
+
add_extra_data(post, options)
|
79
|
+
add_recurring_contract(post, options)
|
80
|
+
add_address(post, options)
|
81
|
+
commit('authorise', post)
|
82
|
+
end
|
83
|
+
|
84
|
+
def verify(credit_card, options={})
|
85
|
+
MultiResponse.run(:use_first_response) do |r|
|
86
|
+
r.process { authorize(0, credit_card, options) }
|
87
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def supports_scrubbing?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
def scrub(transcript)
|
96
|
+
transcript.
|
97
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
98
|
+
gsub(%r(("number\\?":\\?")[^"]*)i, '\1[FILTERED]').
|
99
|
+
gsub(%r(("cvc\\?":\\?")[^"]*)i, '\1[FILTERED]')
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def add_extra_data(post, options)
|
105
|
+
post[:shopperEmail] = options[:shopper_email] if options[:shopper_email]
|
106
|
+
post[:shopperIP] = options[:shopper_ip] if options[:shopper_ip]
|
107
|
+
post[:shopperReference] = options[:shopper_reference] if options[:shopper_reference]
|
108
|
+
post[:fraudOffset] = options[:fraud_offset] if options[:fraud_offset]
|
109
|
+
post[:selectedBrand] = options[:selected_brand] if options[:selected_brand]
|
110
|
+
post[:deliveryDate] = options[:delivery_date] if options[:delivery_date]
|
111
|
+
post[:merchantOrderReference] = options[:merchant_order_reference] if options[:merchant_order_reference]
|
112
|
+
end
|
113
|
+
|
114
|
+
def add_shopper_interaction(post, payment, options={})
|
115
|
+
if payment.respond_to?(:verification_value) && payment.verification_value
|
116
|
+
shopper_interaction = "Ecommerce"
|
117
|
+
else
|
118
|
+
shopper_interaction = "ContAuth"
|
119
|
+
end
|
120
|
+
|
121
|
+
post[:shopperInteraction] = options[:shopper_interaction] || shopper_interaction
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_address(post, options)
|
125
|
+
return unless post[:card] && post[:card].kind_of?(Hash)
|
126
|
+
if (address = options[:billing_address] || options[:address]) && address[:country]
|
127
|
+
post[:card][:billingAddress] = {}
|
128
|
+
post[:card][:billingAddress][:street] = address[:address1] || 'N/A'
|
129
|
+
post[:card][:billingAddress][:houseNumberOrName] = address[:address2] || 'N/A'
|
130
|
+
post[:card][:billingAddress][:postalCode] = address[:zip] if address[:zip]
|
131
|
+
post[:card][:billingAddress][:city] = address[:city] || 'N/A'
|
132
|
+
post[:card][:billingAddress][:stateOrProvince] = address[:state] if address[:state]
|
133
|
+
post[:card][:billingAddress][:country] = address[:country] if address[:country]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def add_invoice(post, money, options)
|
138
|
+
amount = {
|
139
|
+
value: amount(money),
|
140
|
+
currency: options[:currency] || currency(money)
|
141
|
+
}
|
142
|
+
post[:amount] = amount
|
143
|
+
end
|
144
|
+
|
145
|
+
def add_invoice_for_modification(post, money, options)
|
146
|
+
amount = {
|
147
|
+
value: amount(money),
|
148
|
+
currency: options[:currency] || currency(money)
|
149
|
+
}
|
150
|
+
post[:modificationAmount] = amount
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_payment(post, payment)
|
154
|
+
if payment.is_a?(String)
|
155
|
+
_, _, recurring_detail_reference = payment.split("#")
|
156
|
+
post[:selectedRecurringDetailReference] = recurring_detail_reference
|
157
|
+
add_recurring_contract(post, options)
|
158
|
+
else
|
159
|
+
add_card(post, payment)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def add_card(post, credit_card)
|
164
|
+
card = {
|
165
|
+
expiryMonth: credit_card.month,
|
166
|
+
expiryYear: credit_card.year,
|
167
|
+
holderName: credit_card.name,
|
168
|
+
number: credit_card.number,
|
169
|
+
cvc: credit_card.verification_value
|
170
|
+
}
|
171
|
+
|
172
|
+
card.delete_if{|k,v| v.blank? }
|
173
|
+
requires!(card, :expiryMonth, :expiryYear, :holderName, :number)
|
174
|
+
post[:card] = card
|
175
|
+
end
|
176
|
+
|
177
|
+
def add_reference(post, authorization, options = {})
|
178
|
+
_, psp_reference, _ = authorization.split("#")
|
179
|
+
post[:originalReference] = single_reference(authorization) || psp_reference
|
180
|
+
end
|
181
|
+
|
182
|
+
def add_original_reference(post, authorization, options = {})
|
183
|
+
original_psp_reference, _, _ = authorization.split("#")
|
184
|
+
post[:originalReference] = single_reference(authorization) || original_psp_reference
|
185
|
+
end
|
186
|
+
|
187
|
+
def single_reference(authorization)
|
188
|
+
authorization if !authorization.include?("#")
|
189
|
+
end
|
190
|
+
|
191
|
+
def add_recurring_contract(post, options = {})
|
192
|
+
recurring = {
|
193
|
+
contract: "RECURRING"
|
194
|
+
}
|
195
|
+
|
196
|
+
post[:recurring] = recurring
|
197
|
+
end
|
198
|
+
|
199
|
+
def parse(body)
|
200
|
+
return {} if body.blank?
|
201
|
+
JSON.parse(body)
|
202
|
+
end
|
203
|
+
|
204
|
+
def commit(action, parameters)
|
205
|
+
url = (test? ? test_url : live_url)
|
206
|
+
|
207
|
+
begin
|
208
|
+
raw_response = ssl_post("#{url}/#{action.to_s}", post_data(action, parameters), request_headers)
|
209
|
+
response = parse(raw_response)
|
210
|
+
rescue ResponseError => e
|
211
|
+
raw_response = e.response.body
|
212
|
+
response = parse(raw_response)
|
213
|
+
end
|
214
|
+
|
215
|
+
success = success_from(action, response)
|
216
|
+
Response.new(
|
217
|
+
success,
|
218
|
+
message_from(action, response),
|
219
|
+
response,
|
220
|
+
authorization: authorization_from(action, parameters, response),
|
221
|
+
test: test?,
|
222
|
+
error_code: success ? nil : error_code_from(response)
|
223
|
+
)
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
def basic_auth
|
228
|
+
Base64.strict_encode64("#{@username}:#{@password}")
|
229
|
+
end
|
230
|
+
|
231
|
+
def request_headers
|
232
|
+
{
|
233
|
+
"Content-Type" => "application/json",
|
234
|
+
"Authorization" => "Basic #{basic_auth}"
|
235
|
+
}
|
236
|
+
end
|
237
|
+
|
238
|
+
def success_from(action, response)
|
239
|
+
case action.to_s
|
240
|
+
when 'authorise'
|
241
|
+
['Authorised', 'Received', 'RedirectShopper'].include?(response['resultCode'])
|
242
|
+
when 'capture', 'refund', 'cancel'
|
243
|
+
response['response'] == "[#{action}-received]"
|
244
|
+
else
|
245
|
+
false
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def message_from(action, response)
|
250
|
+
return authorize_message_from(response) if action.to_s == 'authorise'
|
251
|
+
response['response'] || response['message']
|
252
|
+
end
|
253
|
+
|
254
|
+
def authorize_message_from(response)
|
255
|
+
if response['refusalReason'] && response['additionalData'] && response['additionalData']['refusalReasonRaw']
|
256
|
+
"#{response['refusalReason']} | #{response['additionalData']['refusalReasonRaw']}"
|
257
|
+
else
|
258
|
+
response['refusalReason'] || response['resultCode'] || response['message']
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def authorization_from(action, parameters, response)
|
263
|
+
return nil if response['pspReference'].nil?
|
264
|
+
recurring = response['additionalData']['recurring.recurringDetailReference'] if response['additionalData']
|
265
|
+
"#{parameters[:originalReference]}##{response['pspReference']}##{recurring}"
|
266
|
+
end
|
267
|
+
|
268
|
+
def init_post(options = {})
|
269
|
+
post = {}
|
270
|
+
post[:merchantAccount] = options[:merchant_account] || @merchant_account
|
271
|
+
post[:reference] = options[:order_id] if options[:order_id]
|
272
|
+
post
|
273
|
+
end
|
274
|
+
|
275
|
+
def post_data(action, parameters = {})
|
276
|
+
JSON.generate(parameters)
|
277
|
+
end
|
278
|
+
|
279
|
+
def error_code_from(response)
|
280
|
+
STANDARD_ERROR_CODE_MAPPING[response['errorCode']]
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class AlliedWalletGateway < Gateway
|
4
|
+
self.display_name = "Allied Wallet"
|
5
|
+
self.homepage_url = "https://www.alliedwallet.com"
|
6
|
+
|
7
|
+
self.live_url = "https://api.alliedwallet.com/merchants/"
|
8
|
+
|
9
|
+
self.supported_countries = ["US"]
|
10
|
+
self.default_currency = "USD"
|
11
|
+
self.money_format = :dollars
|
12
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover,
|
13
|
+
:diners_club, :jcb, :maestro]
|
14
|
+
|
15
|
+
def initialize(options={})
|
16
|
+
requires!(options, :site_id, :merchant_id, :token)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def purchase(amount, payment_method, options={})
|
21
|
+
post = {}
|
22
|
+
add_invoice(post, amount, options)
|
23
|
+
add_payment_method(post, payment_method)
|
24
|
+
add_customer_data(post, options)
|
25
|
+
|
26
|
+
commit(:purchase, post)
|
27
|
+
end
|
28
|
+
|
29
|
+
def authorize(amount, payment_method, options={})
|
30
|
+
post = {}
|
31
|
+
add_invoice(post, amount, options)
|
32
|
+
add_payment_method(post, payment_method)
|
33
|
+
add_customer_data(post, options)
|
34
|
+
|
35
|
+
commit(:authorize, post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def capture(amount, authorization, options={})
|
39
|
+
post = {}
|
40
|
+
add_invoice(post, amount, options)
|
41
|
+
add_reference(post, authorization, :capture)
|
42
|
+
add_customer_data(post, options)
|
43
|
+
|
44
|
+
commit(:capture, post)
|
45
|
+
end
|
46
|
+
|
47
|
+
def void(authorization, options={})
|
48
|
+
post = {}
|
49
|
+
add_reference(post, authorization, :void)
|
50
|
+
|
51
|
+
commit(:void, post)
|
52
|
+
end
|
53
|
+
|
54
|
+
def refund(amount, authorization, options={})
|
55
|
+
post = {}
|
56
|
+
add_invoice(post, amount, options)
|
57
|
+
add_reference(post, authorization, :refund)
|
58
|
+
add_amount(post, amount)
|
59
|
+
add_customer_data(post, options)
|
60
|
+
|
61
|
+
commit(:refund, post)
|
62
|
+
end
|
63
|
+
|
64
|
+
def verify(credit_card, options={})
|
65
|
+
MultiResponse.run(:use_first_response) do |r|
|
66
|
+
r.process { authorize(100, credit_card, options) }
|
67
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def supports_scrubbing?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
def scrub(transcript)
|
76
|
+
transcript.
|
77
|
+
gsub(%r((Authorization: Bearer )[a-zA-Z0-9._-]+)i, '\1[FILTERED]').
|
78
|
+
gsub(%r(("cardNumber\\?":\\?")[^"]*)i, '\1[FILTERED]').
|
79
|
+
gsub(%r(("cVVCode\\?":\\?")\d+[^"]*)i, '\1[FILTERED]').
|
80
|
+
gsub(%r(("cVVCode\\?":)null), '\1[BLANK]').
|
81
|
+
gsub(%r(("cVVCode\\?":\\?")\\?"), '\1[BLANK]"').
|
82
|
+
gsub(%r(("cVVCode\\?":\\?")\s+), '\1[BLANK]"')
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def add_amount(post, amount)
|
88
|
+
post[:amount] = amount
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_invoice(post, money, options)
|
92
|
+
post[:siteId] = @options[:site_id]
|
93
|
+
post[:amount] = amount(money)
|
94
|
+
post[:trackingId] = options[:order_id]
|
95
|
+
post[:currency] = options[:currency] || currency(money)
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_payment_method(post, payment_method)
|
99
|
+
post[:nameOnCard] = payment_method.name
|
100
|
+
post[:cardNumber] = payment_method.number
|
101
|
+
post[:cVVCode] = payment_method.verification_value
|
102
|
+
post[:expirationYear] = format(payment_method.year, :four_digits)
|
103
|
+
post[:expirationMonth] = format(payment_method.month, :two_digits)
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_customer_data(post, options)
|
107
|
+
post[:email] = options[:email] || "unspecified@example.com"
|
108
|
+
post[:iPAddress] = options[:ip]
|
109
|
+
if (billing_address = options[:billing_address])
|
110
|
+
post[:firstName], post[:lastName] = split_names(billing_address[:name])
|
111
|
+
post[:addressLine1] = billing_address[:address1]
|
112
|
+
post[:addressLine2] = billing_address[:address2]
|
113
|
+
post[:city] = billing_address[:city]
|
114
|
+
post[:state] = billing_address[:state]
|
115
|
+
post[:countryId] = billing_address[:country]
|
116
|
+
post[:postalCode] = billing_address[:zip]
|
117
|
+
post[:phone] = billing_address[:phone]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def add_reference(post, authorization, action)
|
122
|
+
transactions = {
|
123
|
+
capture: :authorizetransactionid,
|
124
|
+
void: :authorizeTransactionid,
|
125
|
+
refund: :referencetransactionid,
|
126
|
+
recurring: :saleTransactionid
|
127
|
+
}
|
128
|
+
post[transactions[action]] = authorization
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
ACTIONS = {
|
133
|
+
purchase: "SALE",
|
134
|
+
authorize: "AUTHORIZE",
|
135
|
+
capture: "CAPTURE",
|
136
|
+
void: "VOID",
|
137
|
+
refund: "REFUND"
|
138
|
+
}
|
139
|
+
|
140
|
+
def commit(action, post)
|
141
|
+
begin
|
142
|
+
raw_response = ssl_post(url(action), post.to_json, headers)
|
143
|
+
response = parse(raw_response)
|
144
|
+
rescue ResponseError => e
|
145
|
+
raise unless(e.response.code.to_s =~ /4\d\d/)
|
146
|
+
response = parse(e.response.body)
|
147
|
+
end
|
148
|
+
|
149
|
+
succeeded = success_from(response["status"])
|
150
|
+
Response.new(
|
151
|
+
succeeded,
|
152
|
+
message_from(succeeded, response),
|
153
|
+
response,
|
154
|
+
authorization: response["id"],
|
155
|
+
:avs_result => AVSResult.new(code: response["avs_response"]),
|
156
|
+
:cvv_result => CVVResult.new(response["cvv2_response"]),
|
157
|
+
test: test?
|
158
|
+
)
|
159
|
+
rescue JSON::ParserError
|
160
|
+
unparsable_response(raw_response)
|
161
|
+
end
|
162
|
+
|
163
|
+
def unparsable_response(raw_response)
|
164
|
+
message = "Unparsable response received from Allied Wallet. Please contact Allied Wallet if you continue to receive this message."
|
165
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
166
|
+
return Response.new(false, message)
|
167
|
+
end
|
168
|
+
|
169
|
+
def headers
|
170
|
+
{
|
171
|
+
"Content-type" => "application/json",
|
172
|
+
"Authorization" => "Bearer " + @options[:token]
|
173
|
+
}
|
174
|
+
end
|
175
|
+
|
176
|
+
def url(action)
|
177
|
+
live_url + CGI.escape(@options[:merchant_id]) + "/" + ACTIONS[action] + "transactions"
|
178
|
+
end
|
179
|
+
|
180
|
+
def parse(body)
|
181
|
+
JSON.parse(body)
|
182
|
+
end
|
183
|
+
|
184
|
+
def parse_element(response, node)
|
185
|
+
if node.has_elements?
|
186
|
+
node.elements.each{|element| parse_element(response, element) }
|
187
|
+
else
|
188
|
+
response[node.name.underscore.to_sym] = node.text
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def success_from(response)
|
193
|
+
response == "Successful"
|
194
|
+
end
|
195
|
+
|
196
|
+
def message_from(succeeded, response)
|
197
|
+
if succeeded
|
198
|
+
"Succeeded"
|
199
|
+
else
|
200
|
+
response["message"] || "Unable to read error message"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|