activemerchant 1.38.0 → 1.79.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1402 -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 +152 -53
- 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 +299 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +904 -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 +326 -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 +221 -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 +387 -139
- 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 +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +225 -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 +237 -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 +110 -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 +26 -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 +33 -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 +73 -14
- 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/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +81 -56
- 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 +276 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -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 +37 -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 +32 -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 +14 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +12 -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 +40 -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 +262 -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 +14 -3
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +74 -14
- data/lib/active_merchant/billing/gateways/stripe.rb +472 -83
- 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 +156 -64
- 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 +171 -45
- 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 +208 -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/net_http_ssl_connection.rb +9 -0
- data/lib/active_merchant/network_connection_retries.rb +81 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +94 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +22 -22
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_version.rb +87 -0
- metadata +164 -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
@@ -1,141 +1,166 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
1
3
|
module ActiveMerchant #:nodoc:
|
2
4
|
module Billing #:nodoc:
|
3
5
|
class LitleGateway < Gateway
|
4
|
-
|
5
|
-
# * <tt>:merchant_id</tt> - Merchant Id assigned by Litle
|
6
|
-
# * <tt>:user</tt> - Username assigned by Litle
|
7
|
-
# * <tt>:password</tt> - Password assigned by Litle
|
8
|
-
# * <tt>:version</tt> - The version of the api you are using (eg, '8.10')
|
9
|
-
# * <tt>:proxy_addr</tt> - Proxy address - nil if not needed
|
10
|
-
# * <tt>:proxy_port</tt> - Proxy port - nil if not needed
|
11
|
-
# * <tt>:url</tt> - URL assigned by Litle (for testing, use the sandbox)
|
12
|
-
#
|
13
|
-
# Standard Active Merchant options
|
14
|
-
# * <tt>:order_id</tt> - The order number
|
15
|
-
# * <tt>:ip</tt> - The IP address of the customer making the purchase
|
16
|
-
# * <tt>:customer</tt> - The name, customer number, or other information that identifies the customer
|
17
|
-
# * <tt>:invoice</tt> - The invoice number
|
18
|
-
# * <tt>:merchant</tt> - The name or description of the merchant offering the product
|
19
|
-
# * <tt>:description</tt> - A description of the transaction
|
20
|
-
# * <tt>:email</tt> - The email address of the customer
|
21
|
-
# * <tt>:currency</tt> - The currency of the transaction. Only important when you are using a currency that is not the default with a gateway that supports multiple currencies.
|
22
|
-
# * <tt>:billing_address</tt> - A hash containing the billing address of the customer.
|
23
|
-
# * <tt>:shipping_address</tt> - A hash containing the shipping address of the customer.
|
24
|
-
#
|
25
|
-
# The <tt>:billing_address</tt>, and <tt>:shipping_address</tt> hashes can have the following keys:
|
26
|
-
#
|
27
|
-
# * <tt>:name</tt> - The full name of the customer.
|
28
|
-
# * <tt>:company</tt> - The company name of the customer.
|
29
|
-
# * <tt>:address1</tt> - The primary street address of the customer.
|
30
|
-
# * <tt>:address2</tt> - Additional line of address information.
|
31
|
-
# * <tt>:city</tt> - The city of the customer.
|
32
|
-
# * <tt>:state</tt> - The state of the customer. The 2 digit code for US and Canadian addresses. The full name of the state or province for foreign addresses.
|
33
|
-
# * <tt>:country</tt> - The [ISO 3166-1-alpha-2 code](http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm) for the customer.
|
34
|
-
# * <tt>:zip</tt> - The zip or postal code of the customer.
|
35
|
-
# * <tt>:phone</tt> - The phone number of the customer.
|
36
|
-
|
37
|
-
self.test_url = 'https://www.testlitle.com/sandbox/communicator/online'
|
38
|
-
self.live_url = 'https://payments.litle.com/vap/communicator/online'
|
39
|
-
|
40
|
-
LITLE_SCHEMA_VERSION = '8.13'
|
41
|
-
|
42
|
-
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
43
|
-
self.supported_countries = ['US']
|
6
|
+
SCHEMA_VERSION = '9.12'
|
44
7
|
|
45
|
-
|
46
|
-
self.
|
8
|
+
self.test_url = 'https://www.testvantivcnp.com/sandbox/communicator/online'
|
9
|
+
self.live_url = 'https://payments.vantivcnp.com/vap/communicator/online'
|
47
10
|
|
48
|
-
|
49
|
-
self.
|
11
|
+
self.supported_countries = ['US']
|
12
|
+
self.default_currency = 'USD'
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
50
14
|
|
51
|
-
|
52
|
-
self.display_name
|
15
|
+
self.homepage_url = 'http://www.vantiv.com/'
|
16
|
+
self.display_name = 'Vantiv eCommerce'
|
53
17
|
|
54
|
-
|
18
|
+
def initialize(options={})
|
19
|
+
requires!(options, :login, :password, :merchant_id)
|
20
|
+
super
|
21
|
+
end
|
55
22
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
23
|
+
def purchase(money, payment_method, options={})
|
24
|
+
request = build_xml_request do |doc|
|
25
|
+
add_authentication(doc)
|
26
|
+
if check?(payment_method)
|
27
|
+
doc.echeckSale(transaction_attributes(options)) do
|
28
|
+
add_echeck_purchase_params(doc, money, payment_method, options)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
doc.sale(transaction_attributes(options)) do
|
32
|
+
add_auth_purchase_params(doc, money, payment_method, options)
|
33
|
+
end
|
34
|
+
end
|
61
35
|
end
|
36
|
+
check?(payment_method) ? commit(:echeckSales, request, money) : commit(:sale, request, money)
|
37
|
+
end
|
62
38
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
39
|
+
def authorize(money, payment_method, options={})
|
40
|
+
request = build_xml_request do |doc|
|
41
|
+
add_authentication(doc)
|
42
|
+
if check?(payment_method)
|
43
|
+
doc.echeckVerification(transaction_attributes(options)) do
|
44
|
+
add_echeck_purchase_params(doc, money, payment_method, options)
|
45
|
+
end
|
46
|
+
else
|
47
|
+
doc.authorization(transaction_attributes(options)) do
|
48
|
+
add_auth_purchase_params(doc, money, payment_method, options)
|
49
|
+
end
|
50
|
+
end
|
69
51
|
end
|
52
|
+
check?(payment_method) ? commit(:echeckVerification, request, money) : commit(:authorization, request, money)
|
53
|
+
end
|
70
54
|
|
71
|
-
|
72
|
-
|
73
|
-
options[:version] ||= LITLE_SCHEMA_VERSION
|
74
|
-
options[:merchant] ||= 'Default Report Group'
|
75
|
-
options[:user] ||= options[:login]
|
55
|
+
def capture(money, authorization, options={})
|
56
|
+
transaction_id, _, _ = split_authorization(authorization)
|
76
57
|
|
77
|
-
|
58
|
+
request = build_xml_request do |doc|
|
59
|
+
add_authentication(doc)
|
60
|
+
add_descriptor(doc, options)
|
61
|
+
doc.capture_(transaction_attributes(options)) do
|
62
|
+
doc.litleTxnId(transaction_id)
|
63
|
+
doc.amount(money) if money
|
64
|
+
end
|
65
|
+
end
|
78
66
|
|
79
|
-
|
67
|
+
commit(:capture, request, money)
|
80
68
|
end
|
81
69
|
|
82
|
-
def
|
83
|
-
|
84
|
-
|
70
|
+
def credit(money, authorization, options = {})
|
71
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
72
|
+
refund(money, authorization, options)
|
85
73
|
end
|
86
74
|
|
87
|
-
def
|
88
|
-
|
89
|
-
|
75
|
+
def refund(money, payment, options={})
|
76
|
+
request = build_xml_request do |doc|
|
77
|
+
add_authentication(doc)
|
78
|
+
add_descriptor(doc, options)
|
79
|
+
doc.send(refund_type(payment), transaction_attributes(options)) do
|
80
|
+
if payment.is_a?(String)
|
81
|
+
transaction_id, kind, _ = split_authorization(payment)
|
82
|
+
doc.litleTxnId(transaction_id)
|
83
|
+
doc.amount(money) if money
|
84
|
+
elsif check?(payment)
|
85
|
+
add_echeck_purchase_params(doc, money, payment, options)
|
86
|
+
else
|
87
|
+
add_auth_purchase_params(doc, money, payment, options)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
commit(refund_type(payment), request)
|
90
93
|
end
|
91
94
|
|
92
|
-
def
|
93
|
-
|
94
|
-
|
95
|
-
|
95
|
+
def verify(creditcard, options = {})
|
96
|
+
MultiResponse.run(:use_first_response) do |r|
|
97
|
+
r.process { authorize(0, creditcard, options) }
|
98
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
99
|
+
end
|
96
100
|
end
|
97
101
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
to_pass = create_auth_reversal_hash(transaction_id, options[:amount], options)
|
108
|
-
build_response(:authReversal, @litle.auth_reversal(to_pass))
|
109
|
-
else
|
110
|
-
to_pass = create_void_hash(transaction_id, options)
|
111
|
-
build_response(:void, @litle.void(to_pass))
|
102
|
+
def void(authorization, options={})
|
103
|
+
transaction_id, kind, money = split_authorization(authorization)
|
104
|
+
|
105
|
+
request = build_xml_request do |doc|
|
106
|
+
add_authentication(doc)
|
107
|
+
doc.send(void_type(kind), transaction_attributes(options)) do
|
108
|
+
doc.litleTxnId(transaction_id)
|
109
|
+
doc.amount(money) if void_type(kind) == :authReversal
|
110
|
+
end
|
112
111
|
end
|
112
|
+
|
113
|
+
commit(void_type(kind), request)
|
113
114
|
end
|
114
115
|
|
115
|
-
def
|
116
|
-
|
117
|
-
|
116
|
+
def store(payment_method, options = {})
|
117
|
+
request = build_xml_request do |doc|
|
118
|
+
add_authentication(doc)
|
119
|
+
doc.registerTokenRequest(transaction_attributes(options)) do
|
120
|
+
doc.orderId(truncate(options[:order_id], 24))
|
121
|
+
if payment_method.is_a?(String)
|
122
|
+
doc.paypageRegistrationId(payment_method)
|
123
|
+
elsif check?(payment_method)
|
124
|
+
doc.echeckForToken do
|
125
|
+
doc.accNum(payment_method.account_number)
|
126
|
+
doc.routingNum(payment_method.routing_number)
|
127
|
+
end
|
128
|
+
else
|
129
|
+
doc.accountNumber(payment_method.number)
|
130
|
+
doc.cardValidationNum(payment_method.verification_value) if payment_method.verification_value
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
commit(:registerToken, request)
|
118
136
|
end
|
119
137
|
|
120
|
-
def
|
121
|
-
|
122
|
-
refund(money, authorization, options)
|
138
|
+
def supports_scrubbing?
|
139
|
+
true
|
123
140
|
end
|
124
141
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
142
|
+
def scrub(transcript)
|
143
|
+
transcript.
|
144
|
+
gsub(%r((<user>).+(</user>)), '\1[FILTERED]\2').
|
145
|
+
gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
|
146
|
+
gsub(%r((<number>).+(</number>)), '\1[FILTERED]\2').
|
147
|
+
gsub(%r((<accNum>).+(</accNum>)), '\1[FILTERED]\2').
|
148
|
+
gsub(%r((<routingNum>).+(</routingNum>)), '\1[FILTERED]\2').
|
149
|
+
gsub(%r((<cardValidationNum>).+(</cardValidationNum>)), '\1[FILTERED]\2').
|
150
|
+
gsub(%r((<accountNumber>).+(</accountNumber>)), '\1[FILTERED]\2').
|
151
|
+
gsub(%r((<paypageRegistrationId>).+(</paypageRegistrationId>)), '\1[FILTERED]\2').
|
152
|
+
gsub(%r((<authenticationValue>).+(</authenticationValue>)), '\1[FILTERED]\2')
|
128
153
|
end
|
129
154
|
|
130
155
|
private
|
131
156
|
|
132
157
|
CARD_TYPE = {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
158
|
+
'visa' => 'VI',
|
159
|
+
'master' => 'MC',
|
160
|
+
'american_express' => 'AX',
|
161
|
+
'discover' => 'DI',
|
162
|
+
'jcb' => 'JC',
|
163
|
+
'diners_club' => 'DC'
|
139
164
|
}
|
140
165
|
|
141
166
|
AVS_RESPONSE_CODE = {
|
@@ -156,403 +181,268 @@ module ActiveMerchant #:nodoc:
|
|
156
181
|
'40' => 'E'
|
157
182
|
}
|
158
183
|
|
159
|
-
def
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
def build_response(kind, litle_response, valid_responses=%w(000))
|
166
|
-
response = Hash.from_xml(litle_response.raw_xml.to_s)['litleOnlineResponse']
|
167
|
-
|
168
|
-
if response['response'] == "0"
|
169
|
-
detail = response["#{kind}Response"]
|
170
|
-
fraud = fraud_result(detail)
|
171
|
-
Response.new(
|
172
|
-
valid_responses.include?(detail['response']),
|
173
|
-
detail['message'],
|
174
|
-
{ :litleOnlineResponse => response },
|
175
|
-
:authorization => authorization_from(detail, kind),
|
176
|
-
:avs_result => { :code => fraud['avs'] },
|
177
|
-
:cvv_result => fraud['cvv'],
|
178
|
-
:test => test?
|
179
|
-
)
|
184
|
+
def void_type(kind)
|
185
|
+
if kind == 'authorization'
|
186
|
+
:authReversal
|
187
|
+
elsif kind == 'echeckSales'
|
188
|
+
:echeckVoid
|
180
189
|
else
|
181
|
-
|
190
|
+
:void
|
182
191
|
end
|
183
192
|
end
|
184
193
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
when :registerToken
|
190
|
-
authorization = litle_response['litleToken']
|
194
|
+
def refund_type(payment)
|
195
|
+
transaction_id, kind, _ = split_authorization(payment)
|
196
|
+
if check?(payment) || kind == 'echeckSales'
|
197
|
+
:echeckCredit
|
191
198
|
else
|
192
|
-
|
199
|
+
:credit
|
193
200
|
end
|
194
201
|
end
|
195
202
|
|
196
|
-
def
|
197
|
-
|
198
|
-
|
203
|
+
def check?(payment_method)
|
204
|
+
return false if payment_method.is_a?(String)
|
205
|
+
card_brand(payment_method) == 'check'
|
199
206
|
end
|
200
207
|
|
201
|
-
def
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
add_creditcard_or_cardtoken_hash(hash, payment_method)
|
207
|
-
|
208
|
-
hash
|
208
|
+
def add_authentication(doc)
|
209
|
+
doc.authentication do
|
210
|
+
doc.user(@options[:login])
|
211
|
+
doc.password(@options[:password])
|
212
|
+
end
|
209
213
|
end
|
210
214
|
|
211
|
-
def
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
def add_auth_purchase_params(doc, money, payment_method, options)
|
216
|
+
doc.orderId(truncate(options[:order_id], 24))
|
217
|
+
doc.amount(money)
|
218
|
+
add_order_source(doc, payment_method, options)
|
219
|
+
add_billing_address(doc, payment_method, options)
|
220
|
+
add_shipping_address(doc, payment_method, options)
|
221
|
+
add_payment_method(doc, payment_method, options)
|
222
|
+
add_pos(doc, payment_method)
|
223
|
+
add_descriptor(doc, options)
|
224
|
+
add_merchant_data(doc, options)
|
225
|
+
add_debt_repayment(doc, options)
|
219
226
|
end
|
220
227
|
|
221
|
-
def
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
unless payment_method.is_a?(LitleCardToken)
|
229
|
-
hash['orderSource'] = nil
|
230
|
-
hash['orderId'] = nil
|
228
|
+
def add_merchant_data(doc, options={})
|
229
|
+
if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
|
230
|
+
doc.merchantData do
|
231
|
+
doc.affiliate(options[:affiliate]) if options[:affiliate]
|
232
|
+
doc.campaign(options[:campaign]) if options[:campaign]
|
233
|
+
doc.merchantGroupingId(options[:merchant_grouping_id]) if options[:merchant_grouping_id]
|
234
|
+
end
|
231
235
|
end
|
232
|
-
|
233
|
-
hash
|
234
236
|
end
|
235
237
|
|
236
|
-
def
|
237
|
-
|
238
|
+
def add_echeck_purchase_params(doc, money, payment_method, options)
|
239
|
+
doc.orderId(truncate(options[:order_id], 24))
|
240
|
+
doc.amount(money)
|
241
|
+
add_order_source(doc, payment_method, options)
|
242
|
+
add_billing_address(doc, payment_method, options)
|
243
|
+
add_payment_method(doc, payment_method, options)
|
244
|
+
add_descriptor(doc, options)
|
245
|
+
end
|
238
246
|
|
239
|
-
|
240
|
-
if
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
result.brand = options[:token][:brand]
|
247
|
+
def add_descriptor(doc, options)
|
248
|
+
if options[:descriptor_name] || options[:descriptor_phone]
|
249
|
+
doc.customBilling do
|
250
|
+
doc.phone(options[:descriptor_phone]) if options[:descriptor_phone]
|
251
|
+
doc.descriptor(options[:descriptor_name]) if options[:descriptor_name]
|
252
|
+
end
|
246
253
|
end
|
247
|
-
|
248
|
-
result
|
249
254
|
end
|
250
255
|
|
251
|
-
def
|
252
|
-
|
253
|
-
add_cardtoken_hash(hash, creditcard_or_cardtoken)
|
254
|
-
else
|
255
|
-
add_creditcard_hash(hash, creditcard_or_cardtoken)
|
256
|
-
end
|
256
|
+
def add_debt_repayment(doc, options)
|
257
|
+
doc.debtRepayment(true) if options[:debt_repayment] == true
|
257
258
|
end
|
258
259
|
|
259
|
-
def
|
260
|
-
if
|
261
|
-
|
260
|
+
def add_payment_method(doc, payment_method, options)
|
261
|
+
if payment_method.is_a?(String)
|
262
|
+
doc.token do
|
263
|
+
doc.litleToken(payment_method)
|
264
|
+
end
|
265
|
+
elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
266
|
+
doc.card do
|
267
|
+
doc.track(payment_method.track_data)
|
268
|
+
end
|
269
|
+
elsif check?(payment_method)
|
270
|
+
doc.echeck do
|
271
|
+
doc.accType(payment_method.account_type)
|
272
|
+
doc.accNum(payment_method.account_number)
|
273
|
+
doc.routingNum(payment_method.routing_number)
|
274
|
+
doc.checkNum(payment_method.number)
|
275
|
+
end
|
262
276
|
else
|
263
|
-
|
264
|
-
|
277
|
+
doc.card do
|
278
|
+
doc.type_(CARD_TYPE[payment_method.brand])
|
279
|
+
doc.number(payment_method.number)
|
280
|
+
doc.expDate(exp_date(payment_method))
|
281
|
+
doc.cardValidationNum(payment_method.verification_value)
|
282
|
+
end
|
283
|
+
if payment_method.is_a?(NetworkTokenizationCreditCard)
|
284
|
+
doc.cardholderAuthentication do
|
285
|
+
doc.authenticationValue(payment_method.payment_cryptogram)
|
286
|
+
end
|
287
|
+
elsif options[:order_source] && options[:order_source].start_with?('3ds')
|
288
|
+
doc.cardholderAuthentication do
|
289
|
+
doc.authenticationValue(options[:cavv]) if options[:cavv]
|
290
|
+
doc.authenticationTransactionId(options[:xid]) if options[:xid]
|
291
|
+
end
|
292
|
+
end
|
265
293
|
end
|
266
294
|
end
|
267
295
|
|
268
|
-
def
|
269
|
-
|
270
|
-
token_info['litleToken'] = cardtoken.token
|
271
|
-
token_info['expDate'] = cardtoken.exp_date if cardtoken.exp_date?
|
272
|
-
token_info['cardValidationNum'] = cardtoken.verification_value unless cardtoken.verification_value.blank?
|
273
|
-
token_info['type'] = cardtoken.type unless cardtoken.type.blank?
|
296
|
+
def add_billing_address(doc, payment_method, options)
|
297
|
+
return if payment_method.is_a?(String)
|
274
298
|
|
275
|
-
|
276
|
-
|
277
|
-
|
299
|
+
doc.billToAddress do
|
300
|
+
if check?(payment_method)
|
301
|
+
doc.name(payment_method.name)
|
302
|
+
doc.firstName(payment_method.first_name)
|
303
|
+
doc.lastName(payment_method.last_name)
|
304
|
+
else
|
305
|
+
doc.name(payment_method.name)
|
306
|
+
end
|
307
|
+
doc.email(options[:email]) if options[:email]
|
278
308
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
exp_date_mo = '%02d' % creditcard.month.to_i
|
283
|
-
exp_date = exp_date_mo + exp_date_yr
|
309
|
+
add_address(doc, options[:billing_address])
|
310
|
+
end
|
311
|
+
end
|
284
312
|
|
285
|
-
|
286
|
-
|
287
|
-
'number' => creditcard.number,
|
288
|
-
'expDate' => exp_date,
|
289
|
-
'cardValidationNum' => creditcard.verification_value
|
290
|
-
}
|
313
|
+
def add_shipping_address(doc, payment_method, options)
|
314
|
+
return if payment_method.is_a?(String)
|
291
315
|
|
292
|
-
|
293
|
-
|
316
|
+
doc.shipToAddress do
|
317
|
+
add_address(doc, options[:shipping_address])
|
318
|
+
end
|
294
319
|
end
|
295
320
|
|
296
|
-
def
|
297
|
-
|
298
|
-
|
299
|
-
|
321
|
+
def add_address(doc, address)
|
322
|
+
return unless address
|
323
|
+
|
324
|
+
doc.companyName(address[:company]) unless address[:company].blank?
|
325
|
+
doc.addressLine1(address[:address1]) unless address[:address1].blank?
|
326
|
+
doc.addressLine2(address[:address2]) unless address[:address2].blank?
|
327
|
+
doc.city(address[:city]) unless address[:city].blank?
|
328
|
+
doc.state(address[:state]) unless address[:state].blank?
|
329
|
+
doc.zip(address[:zip]) unless address[:zip].blank?
|
330
|
+
doc.country(address[:country]) unless address[:country].blank?
|
331
|
+
doc.phone(address[:phone]) unless address[:phone].blank?
|
300
332
|
end
|
301
333
|
|
302
|
-
def
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
334
|
+
def add_order_source(doc, payment_method, options)
|
335
|
+
if options[:order_source]
|
336
|
+
doc.orderSource(options[:order_source])
|
337
|
+
elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
|
338
|
+
doc.orderSource('applepay')
|
339
|
+
elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :android_pay
|
340
|
+
doc.orderSource('androidpay')
|
341
|
+
elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
342
|
+
doc.orderSource('retail')
|
307
343
|
else
|
308
|
-
|
344
|
+
doc.orderSource('ecommerce')
|
309
345
|
end
|
310
|
-
|
311
|
-
hash
|
312
346
|
end
|
313
347
|
|
314
|
-
def
|
315
|
-
|
316
|
-
|
317
|
-
|
348
|
+
def add_pos(doc, payment_method)
|
349
|
+
return unless payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
350
|
+
|
351
|
+
doc.pos do
|
352
|
+
doc.capability('magstripe')
|
353
|
+
doc.entryMode('completeread')
|
354
|
+
doc.cardholderId('signature')
|
355
|
+
end
|
318
356
|
end
|
319
357
|
|
320
|
-
def
|
321
|
-
|
322
|
-
hash['litleTxnId'] = identification
|
323
|
-
hash
|
358
|
+
def exp_date(payment_method)
|
359
|
+
"#{format(payment_method.month, :two_digits)}#{format(payment_method.year, :two_digits)}"
|
324
360
|
end
|
325
361
|
|
326
|
-
def
|
327
|
-
|
328
|
-
|
329
|
-
|
362
|
+
def parse(kind, xml)
|
363
|
+
parsed = {}
|
364
|
+
|
365
|
+
doc = Nokogiri::XML(xml).remove_namespaces!
|
366
|
+
doc.xpath("//litleOnlineResponse/#{kind}Response/*").each do |node|
|
367
|
+
if (node.elements.empty?)
|
368
|
+
parsed[node.name.to_sym] = node.text
|
369
|
+
else
|
370
|
+
node.elements.each do |childnode|
|
371
|
+
name = "#{node.name}_#{childnode.name}"
|
372
|
+
parsed[name.to_sym] = childnode.text
|
373
|
+
end
|
374
|
+
end
|
330
375
|
end
|
331
376
|
|
332
|
-
|
333
|
-
|
334
|
-
|
377
|
+
if parsed.empty?
|
378
|
+
%w(response message).each do |attribute|
|
379
|
+
parsed[attribute.to_sym] = doc.xpath("//litleOnlineResponse").attribute(attribute).value
|
380
|
+
end
|
335
381
|
end
|
336
382
|
|
337
|
-
|
338
|
-
|
339
|
-
end
|
383
|
+
parsed
|
384
|
+
end
|
340
385
|
|
341
|
-
|
342
|
-
|
343
|
-
'name' => options[:billing_address][:name],
|
344
|
-
'companyName' => options[:billing_address][:company],
|
345
|
-
'addressLine1' => options[:billing_address][:address1],
|
346
|
-
'addressLine2' => options[:billing_address][:address2],
|
347
|
-
'city' => options[:billing_address][:city],
|
348
|
-
'state' => options[:billing_address][:state],
|
349
|
-
'zip' => options[:billing_address][:zip],
|
350
|
-
'country' => options[:billing_address][:country],
|
351
|
-
'email' => options[:email],
|
352
|
-
'phone' => options[:billing_address][:phone]
|
353
|
-
}
|
354
|
-
end
|
355
|
-
if options[:shipping_address]
|
356
|
-
ship_to_address = {
|
357
|
-
'name' => options[:shipping_address][:name],
|
358
|
-
'companyName' => options[:shipping_address][:company],
|
359
|
-
'addressLine1' => options[:shipping_address][:address1],
|
360
|
-
'addressLine2' => options[:shipping_address][:address2],
|
361
|
-
'city' => options[:shipping_address][:city],
|
362
|
-
'state' => options[:shipping_address][:state],
|
363
|
-
'zip' => options[:shipping_address][:zip],
|
364
|
-
'country' => options[:shipping_address][:country],
|
365
|
-
'email' => options[:email],
|
366
|
-
'phone' => options[:shipping_address][:phone]
|
367
|
-
}
|
368
|
-
end
|
386
|
+
def commit(kind, request, money=nil)
|
387
|
+
parsed = parse(kind, ssl_post(url, request, headers))
|
369
388
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
'reportGroup' => (options[:merchant] || @options[:merchant]),
|
376
|
-
'merchantId' => (options[:merchant_id] || @options[:merchant_id]),
|
377
|
-
'orderSource' => (options[:order_source] || 'ecommerce'),
|
378
|
-
'enhancedData' => enhanced_data,
|
379
|
-
'fraudCheckType' => fraud_check_type,
|
380
|
-
'user' => (options[:user] || @options[:user]),
|
381
|
-
'password' => (options[:password] || @options[:password]),
|
382
|
-
'version' => (options[:version] || @options[:version]),
|
383
|
-
'url' => (options[:url] || url),
|
384
|
-
'proxy_addr' => (options[:proxy_addr] || @options[:proxy_addr]),
|
385
|
-
'proxy_port' => (options[:proxy_port] || @options[:proxy_port]),
|
386
|
-
'id' => (options[:id] || options[:order_id] || @options[:order_id])
|
389
|
+
options = {
|
390
|
+
authorization: authorization_from(kind, parsed, money),
|
391
|
+
test: test?,
|
392
|
+
:avs_result => { :code => AVS_RESPONSE_CODE[parsed[:fraudResult_avsResult]] },
|
393
|
+
:cvv_result => parsed[:fraudResult_cardValidationResult]
|
387
394
|
}
|
388
395
|
|
389
|
-
|
390
|
-
hash.merge!({ 'amount' => money })
|
391
|
-
end
|
392
|
-
hash
|
396
|
+
Response.new(success_from(kind, parsed), parsed[:message], parsed, options)
|
393
397
|
end
|
394
398
|
|
395
|
-
def
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
end
|
400
|
-
|
401
|
-
avs_to_pass = AVS_RESPONSE_CODE[result['avsResult']] unless result['avsResult'].blank?
|
402
|
-
end
|
403
|
-
{ 'cvv' => cvv_to_pass, 'avs' => avs_to_pass }
|
404
|
-
end
|
405
|
-
|
406
|
-
# A +LitleCardToken+ object represents a tokenized credit card, and is capable of validating the various
|
407
|
-
# data associated with these.
|
408
|
-
#
|
409
|
-
# == Example Usage
|
410
|
-
# token = LitleCardToken.new(
|
411
|
-
# :token => '1234567890123456',
|
412
|
-
# :month => '9',
|
413
|
-
# :year => '2010',
|
414
|
-
# :brand => 'visa',
|
415
|
-
# :verification_value => '123'
|
416
|
-
# )
|
417
|
-
#
|
418
|
-
# token.valid? # => true
|
419
|
-
# cc.exp_date # => 0910
|
420
|
-
#
|
421
|
-
class LitleCardToken
|
422
|
-
include Validateable
|
423
|
-
|
424
|
-
# Returns or sets the token. (required)
|
425
|
-
#
|
426
|
-
# @return [String]
|
427
|
-
attr_accessor :token
|
428
|
-
|
429
|
-
# Returns or sets the expiry month for the card associated with token. (optional)
|
430
|
-
#
|
431
|
-
# @return [Integer]
|
432
|
-
attr_accessor :month
|
433
|
-
|
434
|
-
# Returns or sets the expiry year for the card associated with token. (optional)
|
435
|
-
#
|
436
|
-
# @return [Integer]
|
437
|
-
attr_accessor :year
|
438
|
-
|
439
|
-
# Returns or sets the card verification value. (optional)
|
440
|
-
#
|
441
|
-
# @return [String] the verification value
|
442
|
-
attr_accessor :verification_value
|
443
|
-
|
444
|
-
# Returns or sets the credit card brand. (optional)
|
445
|
-
#
|
446
|
-
# Valid card types are
|
447
|
-
#
|
448
|
-
# * +'visa'+
|
449
|
-
# * +'master'+
|
450
|
-
# * +'discover'+
|
451
|
-
# * +'american_express'+
|
452
|
-
# * +'diners_club'+
|
453
|
-
# * +'jcb'+
|
454
|
-
# * +'switch'+
|
455
|
-
# * +'solo'+
|
456
|
-
# * +'dankort'+
|
457
|
-
# * +'maestro'+
|
458
|
-
# * +'forbrugsforeningen'+
|
459
|
-
# * +'laser'+
|
460
|
-
#
|
461
|
-
# @return (String) the credit card brand
|
462
|
-
attr_accessor :brand
|
463
|
-
|
464
|
-
# Returns the Litle credit card type identifier.
|
465
|
-
#
|
466
|
-
# @return (String) the credit card type identifier
|
467
|
-
def type
|
468
|
-
CARD_TYPE[brand] unless brand.blank?
|
469
|
-
end
|
470
|
-
|
471
|
-
# Returns true if the expiration date is set.
|
472
|
-
#
|
473
|
-
# @return (Boolean)
|
474
|
-
def exp_date?
|
475
|
-
!month.to_i.zero? && !year.to_i.zero?
|
476
|
-
end
|
477
|
-
|
478
|
-
# Returns the card token expiration date in MMYY format.
|
479
|
-
#
|
480
|
-
# @return (String) the expiration date in MMYY format
|
481
|
-
def exp_date
|
482
|
-
result = ''
|
483
|
-
if exp_date?
|
484
|
-
exp_date_yr = year.to_s[2..3]
|
485
|
-
exp_date_mo = '%02d' % month.to_i
|
486
|
-
|
487
|
-
result = exp_date_mo + exp_date_yr
|
488
|
-
end
|
489
|
-
result
|
490
|
-
end
|
399
|
+
def success_from(kind, parsed)
|
400
|
+
return (parsed[:response] == '000') unless kind == :registerToken
|
401
|
+
%w(000 801 802).include?(parsed[:response])
|
402
|
+
end
|
491
403
|
|
492
|
-
|
493
|
-
#
|
494
|
-
|
495
|
-
def validate
|
496
|
-
validate_card_token
|
497
|
-
validate_expiration_date
|
498
|
-
validate_card_brand
|
499
|
-
end
|
404
|
+
def authorization_from(kind, parsed, money)
|
405
|
+
(kind == :registerToken) ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind};#{money}"
|
406
|
+
end
|
500
407
|
|
501
|
-
|
502
|
-
|
503
|
-
|
408
|
+
def split_authorization(authorization)
|
409
|
+
transaction_id, kind, money = authorization.to_s.split(';')
|
410
|
+
[transaction_id, kind, money]
|
411
|
+
end
|
504
412
|
|
505
|
-
|
413
|
+
def transaction_attributes(options)
|
414
|
+
attributes = {}
|
415
|
+
attributes[:id] = truncate(options[:id] || options[:order_id], 24)
|
416
|
+
attributes[:reportGroup] = options[:merchant] || 'Default Report Group'
|
417
|
+
attributes[:customerId] = options[:customer]
|
418
|
+
attributes.delete_if { |key, value| value == nil }
|
419
|
+
attributes
|
420
|
+
end
|
506
421
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
'jcb' => 'DI',
|
513
|
-
'diners_club' => 'DI'
|
422
|
+
def root_attributes
|
423
|
+
{
|
424
|
+
merchantId: @options[:merchant_id],
|
425
|
+
version: SCHEMA_VERSION,
|
426
|
+
xmlns: "http://www.litle.com/schema"
|
514
427
|
}
|
428
|
+
end
|
515
429
|
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
# Litle XML Reference Guide 1.8.2
|
522
|
-
#
|
523
|
-
# The length of the original card number is reflected in the token, so a
|
524
|
-
# submitted 16-digit number results in a 16-digit token. Also, all tokens
|
525
|
-
# use only numeric characters, so you do not have to change your
|
526
|
-
# systems to accept alpha-numeric characters.
|
527
|
-
#
|
528
|
-
# The credit card token numbers themselves have two parts.
|
529
|
-
# The last four digits match the last four digits of the card number.
|
530
|
-
# The remaining digits (length can vary based upon original card number
|
531
|
-
# length) are a randomly generated.
|
532
|
-
def validate_card_token #:nodoc:
|
533
|
-
if token.to_s.length < 12 || token.to_s.match(/\A\d+\Z/).nil?
|
534
|
-
errors.add :token, "is not a valid card token"
|
535
|
-
end
|
536
|
-
end
|
537
|
-
|
538
|
-
def validate_expiration_date #:nodoc:
|
539
|
-
if !month.to_i.zero? || !year.to_i.zero?
|
540
|
-
errors.add :month, "is not a valid month" unless valid_month?(month)
|
541
|
-
errors.add :year, "is not a valid year" unless valid_expiry_year?(year)
|
542
|
-
end
|
543
|
-
end
|
544
|
-
|
545
|
-
def validate_card_brand #:nodoc:
|
546
|
-
errors.add :brand, "is invalid" unless brand.blank? || CreditCard.card_companies.keys.include?(brand)
|
430
|
+
def build_xml_request
|
431
|
+
builder = Nokogiri::XML::Builder.new
|
432
|
+
builder.__send__('litleOnlineRequest', root_attributes) do |doc|
|
433
|
+
yield(doc)
|
547
434
|
end
|
435
|
+
builder.doc.root.to_xml
|
436
|
+
end
|
548
437
|
|
549
|
-
|
550
|
-
|
551
|
-
|
438
|
+
def url
|
439
|
+
test? ? test_url : live_url
|
440
|
+
end
|
552
441
|
|
553
|
-
|
554
|
-
|
555
|
-
|
442
|
+
def headers
|
443
|
+
{
|
444
|
+
'Content-Type' => 'text/xml'
|
445
|
+
}
|
556
446
|
end
|
557
447
|
end
|
558
448
|
end
|