activemerchant 1.38.0 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1344 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +226 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +74 -13
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +27 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
- data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +177 -0
- data/lib/active_merchant/country.rb +334 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +24 -21
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- metadata +161 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -73
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -129
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/migs/migs_codes'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'openssl' # Used in add_secure_hash
|
4
4
|
|
5
5
|
module ActiveMerchant #:nodoc:
|
6
6
|
module Billing #:nodoc:
|
@@ -25,6 +25,7 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
|
26
26
|
|
27
27
|
self.money_format = :cents
|
28
|
+
self.currencies_without_fractions = %w(IDR)
|
28
29
|
|
29
30
|
# The homepage URL of the gateway
|
30
31
|
self.homepage_url = 'http://mastercard.com/mastercardsps'
|
@@ -58,10 +59,12 @@ module ActiveMerchant #:nodoc:
|
|
58
59
|
requires!(options, :order_id)
|
59
60
|
|
60
61
|
post = {}
|
61
|
-
|
62
|
+
|
63
|
+
add_amount(post, money, options)
|
62
64
|
add_invoice(post, options)
|
63
65
|
add_creditcard(post, creditcard)
|
64
66
|
add_standard_parameters('pay', post, options[:unique_id])
|
67
|
+
add_3ds(post, options)
|
65
68
|
|
66
69
|
commit(post)
|
67
70
|
end
|
@@ -78,7 +81,8 @@ module ActiveMerchant #:nodoc:
|
|
78
81
|
requires!(@options, :advanced_login, :advanced_password)
|
79
82
|
|
80
83
|
post = options.merge(:TransNo => authorization)
|
81
|
-
|
84
|
+
|
85
|
+
add_amount(post, money, options)
|
82
86
|
add_advanced_user(post)
|
83
87
|
add_standard_parameters('capture', post, options[:unique_id])
|
84
88
|
|
@@ -93,18 +97,37 @@ module ActiveMerchant #:nodoc:
|
|
93
97
|
requires!(@options, :advanced_login, :advanced_password)
|
94
98
|
|
95
99
|
post = options.merge(:TransNo => authorization)
|
96
|
-
|
100
|
+
|
101
|
+
add_amount(post, money, options)
|
97
102
|
add_advanced_user(post)
|
98
103
|
add_standard_parameters('refund', post, options[:unique_id])
|
99
104
|
|
100
105
|
commit(post)
|
101
106
|
end
|
102
107
|
|
108
|
+
def void(authorization, options = {})
|
109
|
+
requires!(@options, :advanced_login, :advanced_password)
|
110
|
+
|
111
|
+
post = options.merge(:TransNo => authorization)
|
112
|
+
|
113
|
+
add_advanced_user(post)
|
114
|
+
add_standard_parameters('voidAuthorisation', post, options[:unique_id])
|
115
|
+
|
116
|
+
commit(post)
|
117
|
+
end
|
118
|
+
|
103
119
|
def credit(money, authorization, options = {})
|
104
|
-
deprecated CREDIT_DEPRECATION_MESSAGE
|
120
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
105
121
|
refund(money, authorization, options)
|
106
122
|
end
|
107
123
|
|
124
|
+
def verify(credit_card, options={})
|
125
|
+
MultiResponse.run do |r|
|
126
|
+
r.process { authorize(100, credit_card, options) }
|
127
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
108
131
|
# Checks the status of a previous transaction
|
109
132
|
# This can be useful when a response is not received due to network issues
|
110
133
|
#
|
@@ -143,7 +166,8 @@ module ActiveMerchant #:nodoc:
|
|
143
166
|
requires!(@options, :secure_hash)
|
144
167
|
|
145
168
|
post = {}
|
146
|
-
|
169
|
+
|
170
|
+
add_amount(post, money, options)
|
147
171
|
add_invoice(post, options)
|
148
172
|
add_creditcard_type(post, options[:card_type]) if options[:card_type]
|
149
173
|
|
@@ -170,7 +194,7 @@ module ActiveMerchant #:nodoc:
|
|
170
194
|
|
171
195
|
response_hash = parse(data)
|
172
196
|
|
173
|
-
expected_secure_hash = calculate_secure_hash(response_hash
|
197
|
+
expected_secure_hash = calculate_secure_hash(response_hash, @options[:secure_hash])
|
174
198
|
unless response_hash[:SecureHash] == expected_secure_hash
|
175
199
|
raise SecurityError, "Secure Hash mismatch, response may be tampered with"
|
176
200
|
end
|
@@ -182,8 +206,25 @@ module ActiveMerchant #:nodoc:
|
|
182
206
|
@options[:login].start_with?('TEST')
|
183
207
|
end
|
184
208
|
|
209
|
+
def supports_scrubbing?
|
210
|
+
true
|
211
|
+
end
|
212
|
+
|
213
|
+
def scrub(transcript)
|
214
|
+
transcript.
|
215
|
+
gsub(%r((&?CardNum=)\d*(&?)), '\1[FILTERED]\2').
|
216
|
+
gsub(%r((&?CardSecurityCode=)\d*(&?)), '\1[FILTERED]\2').
|
217
|
+
gsub(%r((&?AccessCode=)[^&]*(&?)), '\1[FILTERED]\2').
|
218
|
+
gsub(%r((&?Password=)[^&]*(&?)), '\1[FILTERED]\2')
|
219
|
+
end
|
220
|
+
|
185
221
|
private
|
186
222
|
|
223
|
+
def add_amount(post, money, options)
|
224
|
+
post[:Amount] = localized_amount(money, options[:currency])
|
225
|
+
post[:Currency] = options[:currency] if options[:currency]
|
226
|
+
end
|
227
|
+
|
187
228
|
def add_advanced_user(post)
|
188
229
|
post[:User] = @options[:advanced_login]
|
189
230
|
post[:Password] = @options[:advanced_password]
|
@@ -193,6 +234,15 @@ module ActiveMerchant #:nodoc:
|
|
193
234
|
post[:OrderInfo] = options[:order_id]
|
194
235
|
end
|
195
236
|
|
237
|
+
def add_3ds(post, options)
|
238
|
+
post[:VerType] = options[:ver_type] if options[:ver_type]
|
239
|
+
post[:VerToken] = options[:ver_token] if options[:ver_token]
|
240
|
+
post["3DSXID"] = options[:three_ds_xid] if options[:three_ds_xid]
|
241
|
+
post["3DSECI"] = options[:three_ds_eci] if options[:three_ds_eci]
|
242
|
+
post["3DSenrolled"] = options[:three_ds_enrolled] if options[:three_ds_enrolled]
|
243
|
+
post["3DSstatus"] = options[:three_ds_status] if options[:three_ds_status]
|
244
|
+
end
|
245
|
+
|
196
246
|
def add_creditcard(post, creditcard)
|
197
247
|
post[:CardNum] = creditcard.number
|
198
248
|
post[:CardSecurityCode] = creditcard.verification_value if creditcard.verification_value?
|
@@ -214,18 +264,25 @@ module ActiveMerchant #:nodoc:
|
|
214
264
|
end
|
215
265
|
|
216
266
|
def commit(post)
|
267
|
+
add_secure_hash(post) if @options[:secure_hash]
|
217
268
|
data = ssl_post self.merchant_hosted_url, post_data(post)
|
218
269
|
response_hash = parse(data)
|
219
270
|
response_object(response_hash)
|
220
271
|
end
|
221
272
|
|
222
273
|
def response_object(response)
|
274
|
+
avs_response_code = response[:AVSResultCode]
|
275
|
+
avs_response_code = 'S' if avs_response_code == "Unsupported"
|
276
|
+
|
277
|
+
cvv_result_code = response[:CSCResultCode]
|
278
|
+
cvv_result_code = 'P' if cvv_result_code == "Unsupported"
|
279
|
+
|
223
280
|
Response.new(success?(response), response[:Message], response,
|
224
281
|
:test => test?,
|
225
282
|
:authorization => response[:TransactionNo],
|
226
283
|
:fraud_review => fraud_review?(response),
|
227
|
-
:avs_result => { :code =>
|
228
|
-
:cvv_result =>
|
284
|
+
:avs_result => { :code => avs_response_code },
|
285
|
+
:cvv_result => cvv_result_code
|
229
286
|
)
|
230
287
|
end
|
231
288
|
|
@@ -253,12 +310,16 @@ module ActiveMerchant #:nodoc:
|
|
253
310
|
|
254
311
|
def add_secure_hash(post)
|
255
312
|
post[:SecureHash] = calculate_secure_hash(post, @options[:secure_hash])
|
313
|
+
post[:SecureHashType] = 'SHA256'
|
256
314
|
end
|
257
315
|
|
258
316
|
def calculate_secure_hash(post, secure_hash)
|
259
|
-
|
260
|
-
|
261
|
-
|
317
|
+
input = post
|
318
|
+
.reject { |k| %i[SecureHash SecureHashType].include?(k) }
|
319
|
+
.sort
|
320
|
+
.map { |(k, v)| "vpc_#{k}=#{v}" }
|
321
|
+
.join('&')
|
322
|
+
OpenSSL::HMAC.hexdigest('SHA256', [secure_hash].pack('H*'), input).upcase
|
262
323
|
end
|
263
324
|
end
|
264
325
|
end
|
@@ -87,9 +87,7 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
address = options[:billing_address] || options[:address] || {}
|
88
88
|
|
89
89
|
if name = address[:name]
|
90
|
-
|
91
|
-
post[:lastName] = segments.pop
|
92
|
-
post[:firstName] = segments.join(' ')
|
90
|
+
post[:firstName], post[:lastName] = split_names(name)
|
93
91
|
else
|
94
92
|
post[:firstName] = address[:first_name]
|
95
93
|
post[:lastName] = address[:last_name]
|
@@ -0,0 +1,307 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
#
|
6
|
+
# == Monei gateway
|
7
|
+
# This class implements Monei gateway for Active Merchant. For more information about Monei
|
8
|
+
# gateway please go to http://www.monei.net
|
9
|
+
#
|
10
|
+
# === Setup
|
11
|
+
# In order to set-up the gateway you need four paramaters: sender_id, channel_id, login and pwd.
|
12
|
+
# Request that data to Monei.
|
13
|
+
class MoneiGateway < Gateway
|
14
|
+
self.test_url = 'https://test.monei-api.net/payment/ctpe'
|
15
|
+
self.live_url = 'https://monei-api.net/payment/ctpe'
|
16
|
+
|
17
|
+
self.supported_countries = ['AD', 'AT', 'BE', 'BG', 'CA', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'GB', 'GI', 'GR', 'HU', 'IE', 'IL', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'TR', 'US', 'VA']
|
18
|
+
self.default_currency = 'EUR'
|
19
|
+
self.supported_cardtypes = [:visa, :master, :maestro, :jcb, :american_express]
|
20
|
+
|
21
|
+
self.homepage_url = 'http://www.monei.net/'
|
22
|
+
self.display_name = 'Monei'
|
23
|
+
|
24
|
+
# Constructor
|
25
|
+
#
|
26
|
+
# options - Hash containing the gateway credentials, ALL MANDATORY
|
27
|
+
# :sender_id Sender ID
|
28
|
+
# :channel_id Channel ID
|
29
|
+
# :login User login
|
30
|
+
# :pwd User password
|
31
|
+
#
|
32
|
+
def initialize(options={})
|
33
|
+
requires!(options, :sender_id, :channel_id, :login, :pwd)
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
# Public: Performs purchase operation
|
38
|
+
#
|
39
|
+
# money - Amount of purchase
|
40
|
+
# credit_card - Credit card
|
41
|
+
# options - Hash containing purchase options
|
42
|
+
# :order_id Merchant created id for the purchase
|
43
|
+
# :billing_address Hash with billing address information
|
44
|
+
# :description Merchant created purchase description (optional)
|
45
|
+
# :currency Sale currency to override money object or default (optional)
|
46
|
+
#
|
47
|
+
# Returns Active Merchant response object
|
48
|
+
def purchase(money, credit_card, options={})
|
49
|
+
execute_new_order(:purchase, money, credit_card, options)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Public: Performs authorization operation
|
53
|
+
#
|
54
|
+
# money - Amount to authorize
|
55
|
+
# credit_card - Credit card
|
56
|
+
# options - Hash containing authorization options
|
57
|
+
# :order_id Merchant created id for the authorization
|
58
|
+
# :billing_address Hash with billing address information
|
59
|
+
# :description Merchant created authorization description (optional)
|
60
|
+
# :currency Sale currency to override money object or default (optional)
|
61
|
+
#
|
62
|
+
# Returns Active Merchant response object
|
63
|
+
def authorize(money, credit_card, options={})
|
64
|
+
execute_new_order(:authorize, money, credit_card, options)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Public: Performs capture operation on previous authorization
|
68
|
+
#
|
69
|
+
# money - Amount to capture
|
70
|
+
# authorization - Reference to previous authorization, obtained from response object returned by authorize
|
71
|
+
# options - Hash containing capture options
|
72
|
+
# :order_id Merchant created id for the authorization (optional)
|
73
|
+
# :description Merchant created authorization description (optional)
|
74
|
+
# :currency Sale currency to override money object or default (optional)
|
75
|
+
#
|
76
|
+
# Note: you should pass either order_id or description
|
77
|
+
#
|
78
|
+
# Returns Active Merchant response object
|
79
|
+
def capture(money, authorization, options={})
|
80
|
+
execute_dependant(:capture, money, authorization, options)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Public: Refunds from previous purchase
|
84
|
+
#
|
85
|
+
# money - Amount to refund
|
86
|
+
# authorization - Reference to previous purchase, obtained from response object returned by purchase
|
87
|
+
# options - Hash containing refund options
|
88
|
+
# :order_id Merchant created id for the authorization (optional)
|
89
|
+
# :description Merchant created authorization description (optional)
|
90
|
+
# :currency Sale currency to override money object or default (optional)
|
91
|
+
#
|
92
|
+
# Note: you should pass either order_id or description
|
93
|
+
#
|
94
|
+
# Returns Active Merchant response object
|
95
|
+
def refund(money, authorization, options={})
|
96
|
+
execute_dependant(:refund, money, authorization, options)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Public: Voids previous authorization
|
100
|
+
#
|
101
|
+
# authorization - Reference to previous authorization, obtained from response object returned by authorize
|
102
|
+
# options - Hash containing capture options
|
103
|
+
# :order_id Merchant created id for the authorization (optional)
|
104
|
+
#
|
105
|
+
# Returns Active Merchant response object
|
106
|
+
def void(authorization, options={})
|
107
|
+
execute_dependant(:void, nil, authorization, options)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Public: Verifies credit card. Does this by doing a authorization of 1.00 Euro and then voiding it.
|
111
|
+
#
|
112
|
+
# credit_card - Credit card
|
113
|
+
# options - Hash containing authorization options
|
114
|
+
# :order_id Merchant created id for the authorization
|
115
|
+
# :billing_address Hash with billing address information
|
116
|
+
# :description Merchant created authorization description (optional)
|
117
|
+
# :currency Sale currency to override money object or default (optional)
|
118
|
+
#
|
119
|
+
# Returns Active Merchant response object of Authorization operation
|
120
|
+
def verify(credit_card, options={})
|
121
|
+
MultiResponse.run(:use_first_response) do |r|
|
122
|
+
r.process { authorize(100, credit_card, options) }
|
123
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
# Private: Execute purchase or authorize operation
|
130
|
+
def execute_new_order(action, money, credit_card, options)
|
131
|
+
request = build_request do |xml|
|
132
|
+
add_identification_new_order(xml, options)
|
133
|
+
add_payment(xml, action, money, options)
|
134
|
+
add_account(xml, credit_card)
|
135
|
+
add_customer(xml, credit_card, options)
|
136
|
+
end
|
137
|
+
|
138
|
+
commit(request)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Private: Execute operation that depends on authorization code from previous purchase or authorize operation
|
142
|
+
def execute_dependant(action, money, authorization, options)
|
143
|
+
request = build_request do |xml|
|
144
|
+
add_identification_authorization(xml, authorization, options)
|
145
|
+
add_payment(xml, action, money, options)
|
146
|
+
end
|
147
|
+
|
148
|
+
commit(request)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Private: Build XML wrapping code yielding to code to fill the transaction information
|
152
|
+
def build_request
|
153
|
+
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
|
154
|
+
xml.Request(:version => "1.0") do
|
155
|
+
xml.Header { xml.Security(:sender => @options[:sender_id]) }
|
156
|
+
xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do
|
157
|
+
xml.User(:login => @options[:login], :pwd => @options[:pwd])
|
158
|
+
yield xml
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
builder.to_xml
|
163
|
+
end
|
164
|
+
|
165
|
+
# Private: Add identification part to XML for new orders
|
166
|
+
def add_identification_new_order(xml, options)
|
167
|
+
requires!(options, :order_id)
|
168
|
+
xml.Identification do
|
169
|
+
xml.TransactionID options[:order_id]
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Private: Add identification part to XML for orders that depend on authorization from previous operation
|
174
|
+
def add_identification_authorization(xml, authorization, options)
|
175
|
+
xml.Identification do
|
176
|
+
xml.ReferenceID authorization
|
177
|
+
xml.TransactionID options[:order_id]
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Private: Add payment part to XML
|
182
|
+
def add_payment(xml, action, money, options)
|
183
|
+
code = tanslate_payment_code(action)
|
184
|
+
|
185
|
+
xml.Payment(:code => code) do
|
186
|
+
xml.Presentation do
|
187
|
+
xml.Amount amount(money)
|
188
|
+
xml.Currency options[:currency] || currency(money)
|
189
|
+
xml.Usage options[:description] || options[:order_id]
|
190
|
+
end unless money.nil?
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Private: Add account part to XML
|
195
|
+
def add_account(xml, credit_card)
|
196
|
+
xml.Account do
|
197
|
+
xml.Holder credit_card.name
|
198
|
+
xml.Number credit_card.number
|
199
|
+
xml.Brand credit_card.brand.upcase
|
200
|
+
xml.Expiry(:month => credit_card.month, :year => credit_card.year)
|
201
|
+
xml.Verification credit_card.verification_value
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Private: Add customer part to XML
|
206
|
+
def add_customer(xml, credit_card, options)
|
207
|
+
requires!(options, :billing_address)
|
208
|
+
address = options[:billing_address]
|
209
|
+
xml.Customer do
|
210
|
+
xml.Name do
|
211
|
+
xml.Given credit_card.first_name
|
212
|
+
xml.Family credit_card.last_name
|
213
|
+
end
|
214
|
+
xml.Address do
|
215
|
+
xml.Street address[:address1].to_s
|
216
|
+
xml.Zip address[:zip].to_s
|
217
|
+
xml.City address[:city].to_s
|
218
|
+
xml.State address[:state].to_s if address.has_key? :state
|
219
|
+
xml.Country address[:country].to_s
|
220
|
+
end
|
221
|
+
xml.Contact do
|
222
|
+
xml.Email options[:email] || 'noemail@monei.net'
|
223
|
+
xml.Ip options[:ip] || '0.0.0.0'
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Private: Parse XML response from Monei servers
|
229
|
+
def parse(body)
|
230
|
+
xml = Nokogiri::XML(body)
|
231
|
+
{
|
232
|
+
:unique_id => xml.xpath("//Response/Transaction/Identification/UniqueID").text,
|
233
|
+
:status => translate_status_code(xml.xpath("//Response/Transaction/Processing/Status/@code").text),
|
234
|
+
:reason => translate_status_code(xml.xpath("//Response/Transaction/Processing/Reason/@code").text),
|
235
|
+
:message => xml.xpath("//Response/Transaction/Processing/Return").text
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
# Private: Send XML transaction to Monei servers and create AM response
|
240
|
+
def commit(xml)
|
241
|
+
url = (test? ? test_url : live_url)
|
242
|
+
|
243
|
+
response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))
|
244
|
+
|
245
|
+
Response.new(
|
246
|
+
success_from(response),
|
247
|
+
message_from(response),
|
248
|
+
response,
|
249
|
+
authorization: authorization_from(response),
|
250
|
+
test: test?,
|
251
|
+
error_code: error_code_from(response)
|
252
|
+
)
|
253
|
+
end
|
254
|
+
|
255
|
+
# Private: Decide success from servers response
|
256
|
+
def success_from(response)
|
257
|
+
response[:status] == :success || response[:status] == :new
|
258
|
+
end
|
259
|
+
|
260
|
+
# Private: Get message from servers response
|
261
|
+
def message_from(response)
|
262
|
+
response[:message]
|
263
|
+
end
|
264
|
+
|
265
|
+
# Private: Get error code from servers response
|
266
|
+
def error_code_from(response)
|
267
|
+
success_from(response) ? nil : STANDARD_ERROR_CODE[:card_declined]
|
268
|
+
end
|
269
|
+
|
270
|
+
# Private: Get authorization code from servers response
|
271
|
+
def authorization_from(response)
|
272
|
+
response[:unique_id]
|
273
|
+
end
|
274
|
+
|
275
|
+
# Private: Encode POST parameters
|
276
|
+
def post_data(xml)
|
277
|
+
"load=#{CGI.escape(xml)}"
|
278
|
+
end
|
279
|
+
|
280
|
+
# Private: Translate Monei status code to native ruby symbols
|
281
|
+
def translate_status_code(code)
|
282
|
+
{
|
283
|
+
'00' => :success,
|
284
|
+
'40' => :neutral,
|
285
|
+
'59' => :waiting_bank,
|
286
|
+
'60' => :rejected_bank,
|
287
|
+
'64' => :waiting_risk,
|
288
|
+
'65' => :rejected_risk,
|
289
|
+
'70' => :rejected_validation,
|
290
|
+
'80' => :waiting,
|
291
|
+
'90' => :new
|
292
|
+
}[code]
|
293
|
+
end
|
294
|
+
|
295
|
+
# Private: Translate AM operations to Monei operations codes
|
296
|
+
def tanslate_payment_code(action)
|
297
|
+
{
|
298
|
+
:purchase => 'CC.DB',
|
299
|
+
:authorize => 'CC.PA',
|
300
|
+
:capture => 'CC.CP',
|
301
|
+
:refund => 'CC.RF',
|
302
|
+
:void => 'CC.RV'
|
303
|
+
}[action]
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|