activemerchant 1.42.6 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/CHANGELOG +1420 -2
- data/CONTRIBUTORS +106 -0
- data/README.md +107 -103
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +12 -13
- data/lib/active_merchant/billing/base.rb +13 -16
- data/lib/active_merchant/billing/check.rb +35 -24
- data/lib/active_merchant/billing/compatibility.rb +117 -0
- data/lib/active_merchant/billing/credit_card.rb +196 -81
- data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +171 -39
- data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
- data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
- data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
- data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
- data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
- data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
- data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
- data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
- data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +41 -31
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +79 -78
- data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
- data/lib/active_merchant/billing/gateways/exact.rb +32 -26
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +270 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
- data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
- data/lib/active_merchant/billing/gateways/litle.rb +328 -444
- data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
- data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
- data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
- data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
- data/lib/active_merchant/billing/gateways/migs.rb +81 -22
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
- data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
- data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
- data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
- data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
- data/lib/active_merchant/billing/gateways/opp.rb +369 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
- data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
- data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
- data/lib/active_merchant/billing/gateways/payex.rb +38 -30
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
- data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +54 -45
- data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
- data/lib/active_merchant/billing/gateways/payway.rb +8 -8
- data/lib/active_merchant/billing/gateways/pin.rb +74 -18
- data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
- data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
- data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
- data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +78 -48
- data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
- data/lib/active_merchant/billing/gateways/s5.rb +246 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +415 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
- data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
- data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
- data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
- data/lib/active_merchant/billing/gateways/telr.rb +274 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transax.rb +5 -6
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
- data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
- data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
- data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +31 -24
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +195 -0
- data/lib/active_merchant/country.rb +335 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
- data/lib/active_merchant/network_connection_retries.rb +80 -0
- data/lib/active_merchant/post_data.rb +25 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -27
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3988 -0
- data/lib/support/gateway_support.rb +7 -9
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +6 -7
- data/lib/support/ssl_version.rb +87 -0
- metadata +148 -323
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -21
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/app55.rb +0 -185
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
- data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
- data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
- data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
- data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/doku.rb +0 -24
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
- data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
- data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
- data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class KushkiGateway < Gateway
|
|
4
|
+
self.display_name = 'Kushki'
|
|
5
|
+
self.homepage_url = 'https://www.kushkipagos.com'
|
|
6
|
+
|
|
7
|
+
self.test_url = 'https://api-uat.kushkipagos.com/v1/'
|
|
8
|
+
self.live_url = 'https://api.kushkipagos.com/v1/'
|
|
9
|
+
|
|
10
|
+
self.supported_countries = ['CO', 'EC']
|
|
11
|
+
self.default_currency = 'USD'
|
|
12
|
+
self.money_format = :dollars
|
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
|
|
14
|
+
|
|
15
|
+
def initialize(options={})
|
|
16
|
+
requires!(options, :public_merchant_id, :private_merchant_id)
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def purchase(amount, payment_method, options={})
|
|
21
|
+
MultiResponse.run() do |r|
|
|
22
|
+
r.process { tokenize(amount, payment_method, options) }
|
|
23
|
+
r.process { charge(amount, r.authorization, options) }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def refund(amount, authorization, options={})
|
|
28
|
+
action = 'refund'
|
|
29
|
+
|
|
30
|
+
post = {}
|
|
31
|
+
post[:ticketNumber] = authorization
|
|
32
|
+
|
|
33
|
+
commit(action, post)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def void(authorization, options={})
|
|
37
|
+
action = 'void'
|
|
38
|
+
|
|
39
|
+
post = {}
|
|
40
|
+
post[:ticketNumber] = authorization
|
|
41
|
+
|
|
42
|
+
commit(action, post)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def supports_scrubbing?
|
|
46
|
+
true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def scrub(transcript)
|
|
50
|
+
transcript.
|
|
51
|
+
gsub(%r((Private-Merchant-Id: )\d+), '\1[FILTERED]').
|
|
52
|
+
gsub(%r((\"card\\\":{\\\"number\\\":\\\")\d+), '\1[FILTERED]').
|
|
53
|
+
gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def tokenize(amount, payment_method, options)
|
|
59
|
+
action = 'tokenize'
|
|
60
|
+
|
|
61
|
+
post = {}
|
|
62
|
+
add_invoice(action, post, amount, options)
|
|
63
|
+
add_payment_method(post, payment_method, options)
|
|
64
|
+
|
|
65
|
+
commit(action, post)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def charge(amount, authorization, options)
|
|
69
|
+
action = 'charge'
|
|
70
|
+
|
|
71
|
+
post = {}
|
|
72
|
+
add_reference(post, authorization, options)
|
|
73
|
+
add_invoice(action, post, amount, options)
|
|
74
|
+
|
|
75
|
+
commit(action, post)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def add_invoice(action, post, money, options)
|
|
79
|
+
if action == 'tokenize'
|
|
80
|
+
post[:totalAmount] = amount(money).to_f
|
|
81
|
+
post[:currency] = options[:currency] || currency(money)
|
|
82
|
+
post[:isDeferred] = false
|
|
83
|
+
else
|
|
84
|
+
sum = {}
|
|
85
|
+
sum[:currency] = options[:currency] || currency(money)
|
|
86
|
+
add_amount_defaults(sum, money, options)
|
|
87
|
+
add_amount_by_country(sum, options)
|
|
88
|
+
post[:amount] = sum
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def add_amount_defaults(sum, money, options)
|
|
93
|
+
sum[:subtotalIva] = amount(money).to_f
|
|
94
|
+
sum[:iva] = 0
|
|
95
|
+
sum[:subtotalIva0] = 0
|
|
96
|
+
|
|
97
|
+
if sum[:currency] != 'COP'
|
|
98
|
+
sum[:ice] = 0
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def add_amount_by_country(sum, options)
|
|
103
|
+
if amount = options[:amount]
|
|
104
|
+
sum[:subtotalIva] = amount[:subtotal_iva].to_f if amount[:subtotal_iva]
|
|
105
|
+
sum[:iva] = amount[:iva].to_f if amount[:iva]
|
|
106
|
+
sum[:subtotalIva0] = amount[:subtotal_iva_0].to_f if amount[:subtotal_iva_0]
|
|
107
|
+
sum[:ice] = amount[:ice].to_f if amount[:ice]
|
|
108
|
+
if (extra_taxes = amount[:extra_taxes]) && sum[:currency] == 'COP'
|
|
109
|
+
sum[:extraTaxes] ||= Hash.new
|
|
110
|
+
sum[:extraTaxes][:propina] = extra_taxes[:propina].to_f if extra_taxes[:propina]
|
|
111
|
+
sum[:extraTaxes][:tasaAeroportuaria] = extra_taxes[:tasa_aeroportuaria].to_f if extra_taxes[:tasa_aeroportuaria]
|
|
112
|
+
sum[:extraTaxes][:agenciaDeViaje] = extra_taxes[:agencia_de_viaje].to_f if extra_taxes[:agencia_de_viaje]
|
|
113
|
+
sum[:extraTaxes][:iac] = extra_taxes[:iac].to_f if extra_taxes[:iac]
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def add_payment_method(post, payment_method, options)
|
|
119
|
+
card = {}
|
|
120
|
+
card[:number] = payment_method.number
|
|
121
|
+
card[:cvv] = payment_method.verification_value
|
|
122
|
+
card[:expiryMonth] = format(payment_method.month, :two_digits)
|
|
123
|
+
card[:expiryYear] = format(payment_method.year, :two_digits)
|
|
124
|
+
card[:name] = payment_method.name
|
|
125
|
+
post[:card] = card
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def add_reference(post, authorization, options)
|
|
129
|
+
post[:token] = authorization
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
ENDPOINT = {
|
|
133
|
+
'tokenize' => 'tokens',
|
|
134
|
+
'charge' => 'charges',
|
|
135
|
+
'void' => 'charges',
|
|
136
|
+
'refund' => 'refund'
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
def commit(action, params)
|
|
140
|
+
response = begin
|
|
141
|
+
parse(ssl_invoke(action, params))
|
|
142
|
+
rescue ResponseError => e
|
|
143
|
+
parse(e.response.body)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
success = success_from(response)
|
|
147
|
+
|
|
148
|
+
Response.new(
|
|
149
|
+
success,
|
|
150
|
+
message_from(success, response),
|
|
151
|
+
response,
|
|
152
|
+
authorization: success ? authorization_from(response) : nil,
|
|
153
|
+
error_code: success ? nil : error_from(response),
|
|
154
|
+
test: test?
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def ssl_invoke(action, params)
|
|
159
|
+
if ['void', 'refund'].include?(action)
|
|
160
|
+
ssl_request(:delete, url(action, params), nil, headers(action))
|
|
161
|
+
else
|
|
162
|
+
ssl_post(url(action, params), post_data(params), headers(action))
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def headers(action)
|
|
167
|
+
hfields = {}
|
|
168
|
+
hfields['Public-Merchant-Id'] = @options[:public_merchant_id] if action == 'tokenize'
|
|
169
|
+
hfields['Private-Merchant-Id'] = @options[:private_merchant_id] unless action == 'tokenize'
|
|
170
|
+
hfields['Content-Type'] = 'application/json'
|
|
171
|
+
hfields
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def post_data(params)
|
|
175
|
+
params.to_json
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def url(action, params)
|
|
179
|
+
base_url = test? ? test_url : live_url
|
|
180
|
+
|
|
181
|
+
if ['void', 'refund'].include?(action)
|
|
182
|
+
base_url + ENDPOINT[action] + '/' + params[:ticketNumber].to_s
|
|
183
|
+
else
|
|
184
|
+
base_url + ENDPOINT[action]
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def parse(body)
|
|
189
|
+
JSON.parse(body)
|
|
190
|
+
rescue JSON::ParserError
|
|
191
|
+
message = 'Invalid JSON response received from KushkiGateway. Please contact KushkiGateway if you continue to receive this message.'
|
|
192
|
+
message += " (The raw response returned by the API was #{body.inspect})"
|
|
193
|
+
{
|
|
194
|
+
'message' => message
|
|
195
|
+
}
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def success_from(response)
|
|
199
|
+
return true if response['token'] || response['ticketNumber'] || response['code'] == 'K000'
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def message_from(succeeded, response)
|
|
203
|
+
if succeeded
|
|
204
|
+
'Succeeded'
|
|
205
|
+
else
|
|
206
|
+
response['message']
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def authorization_from(response)
|
|
211
|
+
response['token'] || response['ticketNumber']
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def error_from(response)
|
|
215
|
+
response['code']
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class Latitude19Gateway < Gateway
|
|
4
|
+
self.display_name = 'Latitude19 Gateway'
|
|
5
|
+
self.homepage_url = 'http://www.l19tech.com'
|
|
6
|
+
|
|
7
|
+
self.live_url = 'https://gateway.l19tech.com/payments/'
|
|
8
|
+
self.test_url = 'https://gateway-sb.l19tech.com/payments/'
|
|
9
|
+
|
|
10
|
+
self.supported_countries = ['US', 'CA']
|
|
11
|
+
self.default_currency = 'USD'
|
|
12
|
+
self.money_format = :cents
|
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
|
14
|
+
|
|
15
|
+
RESPONSE_CODE_MAPPING = {
|
|
16
|
+
'100' => 'Approved',
|
|
17
|
+
'101' => 'Local duplicate detected',
|
|
18
|
+
'102' => 'Accepted local capture with no match',
|
|
19
|
+
'103' => 'Auth succeeded but capture failed',
|
|
20
|
+
'104' => 'Auth succeeded but failed to save info',
|
|
21
|
+
'200' => STANDARD_ERROR_CODE[:card_declined],
|
|
22
|
+
'300' => 'Processor reject',
|
|
23
|
+
'301' => 'Local reject on user/password',
|
|
24
|
+
'302' => 'Local reject',
|
|
25
|
+
'303' => 'Processor unknown response',
|
|
26
|
+
'304' => 'Error parsing processor response',
|
|
27
|
+
'305' => 'Processor auth succeeded but settle failed',
|
|
28
|
+
'306' => 'Processor auth succeeded settle status unknown',
|
|
29
|
+
'307' => 'Processor settle status unknown',
|
|
30
|
+
'308' => 'Processor duplicate',
|
|
31
|
+
'400' => 'Not submitted',
|
|
32
|
+
'401' => 'Terminated before request submitted',
|
|
33
|
+
'402' => 'Local server busy',
|
|
34
|
+
'500' => 'Submitted not returned',
|
|
35
|
+
'501' => 'Terminated before response returned',
|
|
36
|
+
'502' => 'Processor returned timeout status',
|
|
37
|
+
'600' => 'Failed local capture with no match',
|
|
38
|
+
'601' => 'Failed local capture',
|
|
39
|
+
'700' => 'Failed local void (not in capture file)',
|
|
40
|
+
'701' => 'Failed local void',
|
|
41
|
+
'800' => 'Failed local refund (not authorized)',
|
|
42
|
+
'801' => 'Failed local refund'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
BRAND_MAP = {
|
|
46
|
+
'master' => 'MC',
|
|
47
|
+
'visa' => 'VI',
|
|
48
|
+
'american_express' => 'AX',
|
|
49
|
+
'discover' => 'DS',
|
|
50
|
+
'diners_club' => 'DC',
|
|
51
|
+
'jcb' => 'JC'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
def initialize(options={})
|
|
55
|
+
requires!(options, :account_number, :configuration_id, :secret)
|
|
56
|
+
super
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def purchase(amount, payment_method, options={})
|
|
60
|
+
if payment_method.is_a?(String)
|
|
61
|
+
auth_or_sale('sale', payment_method, amount, nil, options)
|
|
62
|
+
else
|
|
63
|
+
MultiResponse.run() do |r|
|
|
64
|
+
r.process { get_session(options) }
|
|
65
|
+
r.process { get_token(r.authorization, payment_method, options) }
|
|
66
|
+
r.process { auth_or_sale('sale', r.authorization, amount, payment_method, options) }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def authorize(amount, payment_method, options={})
|
|
72
|
+
if payment_method.is_a?(String)
|
|
73
|
+
auth_or_sale('auth', payment_method, amount, nil, options)
|
|
74
|
+
else
|
|
75
|
+
MultiResponse.run() do |r|
|
|
76
|
+
r.process { get_session(options) }
|
|
77
|
+
r.process { get_token(r.authorization, payment_method, options) }
|
|
78
|
+
r.process { auth_or_sale('auth', r.authorization, amount, payment_method, options) }
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def capture(amount, authorization, options={})
|
|
84
|
+
post = {}
|
|
85
|
+
post[:method] = 'deposit'
|
|
86
|
+
add_request_id(post)
|
|
87
|
+
|
|
88
|
+
params = {}
|
|
89
|
+
|
|
90
|
+
_, params[:pgwTID] = split_authorization(authorization)
|
|
91
|
+
|
|
92
|
+
add_invoice(params, amount, options)
|
|
93
|
+
add_credentials(params, post[:method])
|
|
94
|
+
|
|
95
|
+
post[:params] = [params]
|
|
96
|
+
commit('v1/', post)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def void(authorization, options={})
|
|
100
|
+
method, pgwTID = split_authorization(authorization)
|
|
101
|
+
case method
|
|
102
|
+
when 'auth'
|
|
103
|
+
reverse_or_void('reversal', pgwTID, options)
|
|
104
|
+
when 'deposit', 'sale'
|
|
105
|
+
reverse_or_void('void', pgwTID, options)
|
|
106
|
+
else
|
|
107
|
+
message = 'Unsupported operation: successful Purchase, Authorize and unsettled Capture transactions can only be voided.'
|
|
108
|
+
return Response.new(false, message)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def credit(amount, payment_method, options={})
|
|
113
|
+
if payment_method.is_a?(String)
|
|
114
|
+
refundWithCard(payment_method, amount, nil, options)
|
|
115
|
+
else
|
|
116
|
+
MultiResponse.run() do |r|
|
|
117
|
+
r.process { get_session(options) }
|
|
118
|
+
r.process { get_token(r.authorization, payment_method, options) }
|
|
119
|
+
r.process { refundWithCard(r.authorization, amount, payment_method, options) }
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def verify(payment_method, options={}, action=nil)
|
|
125
|
+
if payment_method.is_a?(String)
|
|
126
|
+
verifyOnly(action, payment_method, nil, options)
|
|
127
|
+
else
|
|
128
|
+
MultiResponse.run() do |r|
|
|
129
|
+
r.process { get_session(options) }
|
|
130
|
+
r.process { get_token(r.authorization, payment_method, options) }
|
|
131
|
+
r.process { verifyOnly(action, r.authorization, payment_method, options) }
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def store(payment_method, options={})
|
|
137
|
+
verify(payment_method, options, 'store')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def supports_scrubbing?
|
|
141
|
+
true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def scrub(transcript)
|
|
145
|
+
transcript.
|
|
146
|
+
gsub(%r((\"cardNumber\\\":\\\")\d+), '\1[FILTERED]').
|
|
147
|
+
gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
private
|
|
151
|
+
|
|
152
|
+
def add_request_id(post)
|
|
153
|
+
post[:id] = SecureRandom.hex(16)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def add_timestamp
|
|
157
|
+
Time.now.getutc.strftime('%Y%m%d%H%M%S')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def add_hmac(params, method)
|
|
161
|
+
if method == 'getSession'
|
|
162
|
+
hmac_message = params[:pgwAccountNumber] + '|' + params[:pgwConfigurationId] + '|' + params[:requestTimeStamp] + '|' + method
|
|
163
|
+
else
|
|
164
|
+
hmac_message = params[:pgwAccountNumber] + '|' + params[:pgwConfigurationId] + '|' + (params[:orderNumber] || '') + '|' + method + '|' + (params[:amount] || '') + '|' + (params[:sessionToken] || '') + '|' + (params[:accountToken] || '')
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
OpenSSL::HMAC.hexdigest('sha512', @options[:secret], hmac_message)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def add_credentials(params, method)
|
|
171
|
+
params[:pgwAccountNumber] = @options[:account_number]
|
|
172
|
+
params[:pgwConfigurationId] = @options[:configuration_id]
|
|
173
|
+
|
|
174
|
+
params[:requestTimeStamp] = add_timestamp() if method == 'getSession'
|
|
175
|
+
|
|
176
|
+
params[:pgwHMAC] = add_hmac(params, method)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def add_invoice(params, money, options)
|
|
180
|
+
params[:amount] = amount(money)
|
|
181
|
+
params[:orderNumber] = options[:order_id]
|
|
182
|
+
params[:transactionClass] = options[:transaction_class] || 'eCommerce'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def add_payment_method(params, credit_card)
|
|
186
|
+
params[:cardExp] = format(credit_card.month, :two_digits).to_s + '/' + format(credit_card.year, :two_digits).to_s
|
|
187
|
+
params[:cardType] = BRAND_MAP[credit_card.brand.to_s]
|
|
188
|
+
params[:cvv] = credit_card.verification_value
|
|
189
|
+
params[:firstName] = credit_card.first_name
|
|
190
|
+
params[:lastName] = credit_card.last_name
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def add_customer_data(params, options)
|
|
194
|
+
if (billing_address = options[:billing_address] || options[:address])
|
|
195
|
+
params[:address1] = billing_address[:address1]
|
|
196
|
+
params[:address2] = billing_address[:address2]
|
|
197
|
+
params[:city] = billing_address[:city]
|
|
198
|
+
params[:stateProvince] = billing_address[:state]
|
|
199
|
+
params[:zipPostalCode] = billing_address[:zip]
|
|
200
|
+
params[:countryCode] = billing_address[:country]
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def get_session(options={})
|
|
205
|
+
post = {}
|
|
206
|
+
post[:method] = 'getSession'
|
|
207
|
+
add_request_id(post)
|
|
208
|
+
|
|
209
|
+
params = {}
|
|
210
|
+
add_credentials(params, post[:method])
|
|
211
|
+
|
|
212
|
+
post[:params] = [params]
|
|
213
|
+
commit('session', post)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def get_token(authorization, payment_method, options={})
|
|
217
|
+
post = {}
|
|
218
|
+
post[:method] = 'tokenize'
|
|
219
|
+
add_request_id(post)
|
|
220
|
+
|
|
221
|
+
params = {}
|
|
222
|
+
_, params[:sessionId] = split_authorization(authorization)
|
|
223
|
+
params[:cardNumber] = payment_method.number
|
|
224
|
+
|
|
225
|
+
post[:params] = [params]
|
|
226
|
+
commit('token', post)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def auth_or_sale(method, authorization, amount, credit_card, options={})
|
|
230
|
+
post = {}
|
|
231
|
+
post[:method] = method
|
|
232
|
+
add_request_id(post)
|
|
233
|
+
|
|
234
|
+
params = {}
|
|
235
|
+
if credit_card
|
|
236
|
+
_, params[:sessionToken] = split_authorization(authorization)
|
|
237
|
+
add_payment_method(params, credit_card)
|
|
238
|
+
add_customer_data(params, options)
|
|
239
|
+
else
|
|
240
|
+
_, params[:accountToken] = split_authorization(authorization)
|
|
241
|
+
end
|
|
242
|
+
add_invoice(params, amount, options)
|
|
243
|
+
add_credentials(params, post[:method])
|
|
244
|
+
|
|
245
|
+
post[:params] = [params]
|
|
246
|
+
commit('v1/', post)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
def verifyOnly(action, authorization, credit_card, options={})
|
|
250
|
+
post = {}
|
|
251
|
+
post[:method] = 'verifyOnly'
|
|
252
|
+
add_request_id(post)
|
|
253
|
+
|
|
254
|
+
params = {}
|
|
255
|
+
if credit_card
|
|
256
|
+
_, params[:sessionToken] = split_authorization(authorization)
|
|
257
|
+
add_payment_method(params, credit_card)
|
|
258
|
+
add_customer_data(params, options)
|
|
259
|
+
else
|
|
260
|
+
_, params[:accountToken] = split_authorization(authorization)
|
|
261
|
+
end
|
|
262
|
+
params[:requestAccountToken] = '1' if action == 'store'
|
|
263
|
+
add_invoice(params, 0, options)
|
|
264
|
+
add_credentials(params, post[:method])
|
|
265
|
+
|
|
266
|
+
post[:params] = [params]
|
|
267
|
+
commit('v1/', post)
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def refundWithCard(authorization, amount, credit_card, options={})
|
|
271
|
+
post = {}
|
|
272
|
+
post[:method] = 'refundWithCard'
|
|
273
|
+
add_request_id(post)
|
|
274
|
+
|
|
275
|
+
params = {}
|
|
276
|
+
if credit_card
|
|
277
|
+
_, params[:sessionToken] = split_authorization(authorization)
|
|
278
|
+
add_payment_method(params, credit_card)
|
|
279
|
+
else
|
|
280
|
+
_, params[:accountToken] = split_authorization(authorization)
|
|
281
|
+
end
|
|
282
|
+
add_invoice(params, amount, options)
|
|
283
|
+
add_credentials(params, post[:method])
|
|
284
|
+
|
|
285
|
+
post[:params] = [params]
|
|
286
|
+
commit('v1/', post)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def reverse_or_void(method, pgwTID, options={})
|
|
290
|
+
post = {}
|
|
291
|
+
post[:method] = method
|
|
292
|
+
add_request_id(post)
|
|
293
|
+
|
|
294
|
+
params = {}
|
|
295
|
+
params[:orderNumber] = options[:order_id]
|
|
296
|
+
params[:pgwTID] = pgwTID
|
|
297
|
+
add_credentials(params, post[:method])
|
|
298
|
+
|
|
299
|
+
post[:params] = [params]
|
|
300
|
+
commit('v1/', post)
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def commit(endpoint, post)
|
|
304
|
+
raw_response = ssl_post(url() + endpoint, post_data(post), headers)
|
|
305
|
+
response = parse(raw_response)
|
|
306
|
+
rescue ResponseError => e
|
|
307
|
+
raw_response = e.response.body
|
|
308
|
+
response_error(raw_response)
|
|
309
|
+
rescue JSON::ParserError
|
|
310
|
+
unparsable_response(raw_response)
|
|
311
|
+
else
|
|
312
|
+
success = success_from(response)
|
|
313
|
+
Response.new(
|
|
314
|
+
success,
|
|
315
|
+
message_from(response),
|
|
316
|
+
response,
|
|
317
|
+
authorization: success ? authorization_from(response, post[:method]) : nil,
|
|
318
|
+
avs_result: success ? avs_from(response) : nil,
|
|
319
|
+
cvv_result: success ? cvv_from(response) : nil,
|
|
320
|
+
error_code: success ? nil : error_from(response),
|
|
321
|
+
test: test?
|
|
322
|
+
)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def headers
|
|
326
|
+
{
|
|
327
|
+
'Content-Type' => 'application/json'
|
|
328
|
+
}
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def post_data(params)
|
|
332
|
+
params.to_json
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def url
|
|
336
|
+
test? ? test_url : live_url
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def parse(body)
|
|
340
|
+
JSON.parse(body)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def success_from(response)
|
|
344
|
+
return false if response['result'].nil? || response['error']
|
|
345
|
+
|
|
346
|
+
if response['result'].key?('pgwResponseCode')
|
|
347
|
+
response['error'].nil? && response['result']['lastActionSucceeded'] == 1 && response['result']['pgwResponseCode'] == '100'
|
|
348
|
+
else
|
|
349
|
+
response['error'].nil? && response['result']['lastActionSucceeded'] == 1
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def message_from(response)
|
|
354
|
+
return response['error'] if response['error']
|
|
355
|
+
return 'Failed' unless response.key?('result')
|
|
356
|
+
|
|
357
|
+
if response['result'].key?('pgwResponseCode')
|
|
358
|
+
RESPONSE_CODE_MAPPING[response['result']['pgwResponseCode']] || response['result']['responseText']
|
|
359
|
+
else
|
|
360
|
+
response['result']['lastActionSucceeded'] == 1 ? 'Succeeded' : 'Failed'
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
def error_from(response)
|
|
365
|
+
return response['error'] if response['error']
|
|
366
|
+
return 'Failed' unless response.key?('result')
|
|
367
|
+
return response['result']['pgwResponseCode'] || response['result']['processor']['responseCode'] || 'Failed'
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def authorization_from(response, method)
|
|
371
|
+
method + '|' + (
|
|
372
|
+
response['result']['sessionId'] ||
|
|
373
|
+
response['result']['sessionToken'] ||
|
|
374
|
+
response['result']['pgwTID'] ||
|
|
375
|
+
response['result']['accountToken']
|
|
376
|
+
)
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
def split_authorization(authorization)
|
|
380
|
+
authorization.split('|')
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def avs_from(response)
|
|
384
|
+
response['result'].key?('avsResponse') ? AVSResult.new(code: response['result']['avsResponse']) : nil
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def cvv_from(response)
|
|
388
|
+
response['result'].key?('cvvResponse') ? CVVResult.new(response['result']['cvvResponse']) : nil
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def response_error(raw_response)
|
|
392
|
+
response = parse(raw_response)
|
|
393
|
+
rescue JSON::ParserError
|
|
394
|
+
unparsable_response(raw_response)
|
|
395
|
+
else
|
|
396
|
+
return Response.new(
|
|
397
|
+
false,
|
|
398
|
+
message_from(response),
|
|
399
|
+
response,
|
|
400
|
+
:test => test?
|
|
401
|
+
)
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def unparsable_response(raw_response)
|
|
405
|
+
message = 'Invalid JSON response received from Latitude19Gateway. Please contact Latitude19Gateway if you continue to receive this message.'
|
|
406
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
|
407
|
+
return Response.new(false, message)
|
|
408
|
+
end
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
end
|