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
@@ -0,0 +1,440 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class PayuLatamGateway < Gateway
|
6
|
+
self.display_name = "PayU Latam"
|
7
|
+
self.homepage_url = "http://www.payulatam.com"
|
8
|
+
|
9
|
+
self.test_url = "https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi"
|
10
|
+
self.live_url = "https://api.payulatam.com/payments-api/4.0/service.cgi"
|
11
|
+
|
12
|
+
self.supported_countries = ["AR", "BR", "CL", "CO", "MX", "PA", "PE"]
|
13
|
+
self.default_currency = "USD"
|
14
|
+
self.money_format = :dollars
|
15
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
|
16
|
+
|
17
|
+
BRAND_MAP = {
|
18
|
+
"visa" => "VISA",
|
19
|
+
"master" => "MASTERCARD",
|
20
|
+
"american_express" => "AMEX",
|
21
|
+
"diners_club" => "DINERS"
|
22
|
+
}
|
23
|
+
|
24
|
+
MINIMUMS = {
|
25
|
+
"ARS" => 1700,
|
26
|
+
"BRL" => 600,
|
27
|
+
"MXN" => 3900,
|
28
|
+
"PEN" => 500
|
29
|
+
}
|
30
|
+
|
31
|
+
def initialize(options={})
|
32
|
+
requires!(options, :merchant_id, :account_id, :api_login, :api_key, :payment_country)
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def purchase(amount, payment_method, options={})
|
37
|
+
post = {}
|
38
|
+
auth_or_sale(post, 'AUTHORIZATION_AND_CAPTURE', amount, payment_method, options)
|
39
|
+
commit('purchase', post)
|
40
|
+
end
|
41
|
+
|
42
|
+
def authorize(amount, payment_method, options={})
|
43
|
+
post = {}
|
44
|
+
auth_or_sale(post, 'AUTHORIZATION', amount, payment_method, options)
|
45
|
+
commit('auth', post)
|
46
|
+
end
|
47
|
+
|
48
|
+
def capture(amount, authorization, options={})
|
49
|
+
post = {}
|
50
|
+
|
51
|
+
add_credentials(post, 'SUBMIT_TRANSACTION', options)
|
52
|
+
add_transaction_elements(post, 'CAPTURE', options)
|
53
|
+
add_reference(post, authorization)
|
54
|
+
|
55
|
+
commit('capture', post)
|
56
|
+
end
|
57
|
+
|
58
|
+
def void(authorization, options={})
|
59
|
+
post = {}
|
60
|
+
|
61
|
+
add_credentials(post, 'SUBMIT_TRANSACTION', options)
|
62
|
+
add_transaction_elements(post, 'VOID', options)
|
63
|
+
add_reference(post, authorization)
|
64
|
+
|
65
|
+
commit('void', post)
|
66
|
+
end
|
67
|
+
|
68
|
+
def refund(amount, authorization, options={})
|
69
|
+
post = {}
|
70
|
+
|
71
|
+
add_credentials(post, 'SUBMIT_TRANSACTION', options)
|
72
|
+
add_transaction_elements(post, 'REFUND', options)
|
73
|
+
add_reference(post, authorization)
|
74
|
+
|
75
|
+
commit('refund', post)
|
76
|
+
end
|
77
|
+
|
78
|
+
def verify(credit_card, options={})
|
79
|
+
minimum = MINIMUMS[options[:currency].upcase] if options[:currency]
|
80
|
+
amount = options[:verify_amount] || minimum || 100
|
81
|
+
|
82
|
+
MultiResponse.run(:use_first_response) do |r|
|
83
|
+
r.process { authorize(amount, credit_card, options) }
|
84
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def store(payment_method, options = {})
|
89
|
+
post = {}
|
90
|
+
|
91
|
+
add_credentials(post, 'CREATE_TOKEN')
|
92
|
+
add_payment_method_to_be_tokenized(post, payment_method)
|
93
|
+
|
94
|
+
commit('store', post)
|
95
|
+
end
|
96
|
+
|
97
|
+
def verify_credentials
|
98
|
+
post = {}
|
99
|
+
add_credentials(post, 'GET_PAYMENT_METHODS')
|
100
|
+
response = commit('verify_credentials', post)
|
101
|
+
response.success?
|
102
|
+
end
|
103
|
+
|
104
|
+
def supports_scrubbing?
|
105
|
+
true
|
106
|
+
end
|
107
|
+
|
108
|
+
def scrub(transcript)
|
109
|
+
transcript.
|
110
|
+
gsub(%r((\"creditCard\\\":{\\\"number\\\":\\\")\d+), '\1[FILTERED]').
|
111
|
+
gsub(%r((\"securityCode\\\":\\\")\d+), '\1[FILTERED]').
|
112
|
+
gsub(%r((\"apiKey\\\":\\\")\w+), '\1[FILTERED]')
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def auth_or_sale(post, transaction_type, amount, payment_method, options)
|
118
|
+
add_credentials(post, 'SUBMIT_TRANSACTION', options)
|
119
|
+
add_transaction_elements(post, transaction_type, options)
|
120
|
+
add_order(post, options)
|
121
|
+
add_buyer(post, payment_method, options)
|
122
|
+
add_invoice(post, amount, options)
|
123
|
+
add_signature(post)
|
124
|
+
add_payment_method(post, payment_method, options)
|
125
|
+
add_payer(post, payment_method, options)
|
126
|
+
add_extra_parameters(post, options)
|
127
|
+
end
|
128
|
+
|
129
|
+
def add_credentials(post, command, options={})
|
130
|
+
post[:test] = test? unless command == 'CREATE_TOKEN'
|
131
|
+
post[:language] = options[:language] || 'en'
|
132
|
+
post[:command] = command
|
133
|
+
merchant = {}
|
134
|
+
merchant[:apiLogin] = @options[:api_login]
|
135
|
+
merchant[:apiKey] = @options[:api_key]
|
136
|
+
post[:merchant] = merchant
|
137
|
+
end
|
138
|
+
|
139
|
+
def add_transaction_elements(post, type, options)
|
140
|
+
transaction = {}
|
141
|
+
transaction[:paymentCountry] = @options[:payment_country]
|
142
|
+
transaction[:type] = type
|
143
|
+
transaction[:ipAddress] = options[:ip] || ''
|
144
|
+
transaction[:userAgent] = options[:user_agent] if options[:user_agent]
|
145
|
+
transaction[:cookie] = options[:cookie] if options[:cookie]
|
146
|
+
transaction[:deviceSessionId] = options[:device_session_id] if options[:device_session_id]
|
147
|
+
post[:transaction] = transaction
|
148
|
+
end
|
149
|
+
|
150
|
+
def add_order(post, options)
|
151
|
+
order = {}
|
152
|
+
order[:accountId] = @options[:account_id]
|
153
|
+
order[:partnerId] = options[:partner_id] if options[:partner_id]
|
154
|
+
order[:referenceCode] = options[:order_id] || generate_unique_id
|
155
|
+
order[:description] = options[:description] || 'Compra en ' + @options[:merchant_id]
|
156
|
+
order[:language] = options[:language] || 'en'
|
157
|
+
order[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
|
158
|
+
post[:transaction][:order] = order
|
159
|
+
end
|
160
|
+
|
161
|
+
def add_payer(post, payment_method, options)
|
162
|
+
address = options[:billing_address]
|
163
|
+
payer = {}
|
164
|
+
payer[:fullName] = payment_method.name.strip
|
165
|
+
payer[:contactPhone] = address[:phone] if (address && address[:phone])
|
166
|
+
payer[:dniNumber] = options[:dni_number] if options[:dni_number]
|
167
|
+
payer[:dniType] = options[:dni_type] if options[:dni_type]
|
168
|
+
payer[:emailAddress] = options[:email] if options[:email]
|
169
|
+
payer[:birthdate] = options[:birth_date] if options[:birth_date] && @options[:payment_country] == 'MX'
|
170
|
+
payer[:billingAddress] = billing_address_fields(options)
|
171
|
+
post[:transaction][:payer] = payer
|
172
|
+
end
|
173
|
+
|
174
|
+
def billing_address_fields(options)
|
175
|
+
return unless address = options[:billing_address]
|
176
|
+
billing_address = {}
|
177
|
+
billing_address[:street1] = address[:address1]
|
178
|
+
billing_address[:street2] = address[:address2]
|
179
|
+
billing_address[:city] = address[:city]
|
180
|
+
billing_address[:state] = address[:state]
|
181
|
+
billing_address[:country] = address[:country]
|
182
|
+
billing_address[:postalCode] = address[:zip] if @options[:payment_country] == 'MX'
|
183
|
+
billing_address[:phone] = address[:phone]
|
184
|
+
billing_address
|
185
|
+
end
|
186
|
+
|
187
|
+
def add_buyer(post, payment_method, options)
|
188
|
+
buyer = {}
|
189
|
+
if buyer_hash = options[:buyer]
|
190
|
+
buyer[:fullName] = buyer_hash[:name]
|
191
|
+
buyer[:dniNumber] = buyer_hash[:dni_number]
|
192
|
+
buyer[:dniType] = buyer_hash[:dni_type]
|
193
|
+
buyer[:cnpj] = buyer_hash[:cnpj] if @options[:payment_country] == 'BR'
|
194
|
+
buyer[:emailAddress] = buyer_hash[:email]
|
195
|
+
buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
|
196
|
+
buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
|
197
|
+
else
|
198
|
+
buyer[:fullName] = payment_method.name.strip
|
199
|
+
buyer[:dniNumber] = options[:dni_number]
|
200
|
+
buyer[:dniType] = options[:dni_type]
|
201
|
+
buyer[:cnpj] = options[:cnpj] if @options[:payment_country] == 'BR'
|
202
|
+
buyer[:emailAddress] = options[:email]
|
203
|
+
buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
|
204
|
+
buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
|
205
|
+
end
|
206
|
+
post[:transaction][:order][:buyer] = buyer
|
207
|
+
end
|
208
|
+
|
209
|
+
def shipping_address_fields(options)
|
210
|
+
return unless address = options[:shipping_address]
|
211
|
+
shipping_address = {}
|
212
|
+
shipping_address[:street1] = address[:address1]
|
213
|
+
shipping_address[:street2] = address[:address2]
|
214
|
+
shipping_address[:city] = address[:city]
|
215
|
+
shipping_address[:state] = address[:state]
|
216
|
+
shipping_address[:country] = address[:country]
|
217
|
+
shipping_address[:postalCode] = address[:zip]
|
218
|
+
shipping_address[:phone] = address[:phone]
|
219
|
+
shipping_address
|
220
|
+
end
|
221
|
+
|
222
|
+
def add_invoice(post, money, options)
|
223
|
+
tx_value = {}
|
224
|
+
tx_value[:value] = amount(money)
|
225
|
+
tx_value[:currency] = options[:currency] || currency(money)
|
226
|
+
|
227
|
+
tx_tax = {}
|
228
|
+
tx_tax[:value] = options[:tax] || '0'
|
229
|
+
tx_tax[:currency] = options[:currency] || currency(money)
|
230
|
+
|
231
|
+
tx_tax_return_base = {}
|
232
|
+
tx_tax_return_base[:value] = options[:tax_return_base] || '0'
|
233
|
+
tx_tax_return_base[:currency] = options[:currency] || currency(money)
|
234
|
+
|
235
|
+
additional_values = {}
|
236
|
+
additional_values[:TX_VALUE] = tx_value
|
237
|
+
additional_values[:TX_TAX] = tx_tax if @options[:payment_country] == 'CO'
|
238
|
+
additional_values[:TX_TAX_RETURN_BASE] = tx_tax_return_base if @options[:payment_country] == 'CO'
|
239
|
+
|
240
|
+
post[:transaction][:order][:additionalValues] = additional_values
|
241
|
+
end
|
242
|
+
|
243
|
+
def add_signature(post)
|
244
|
+
post[:transaction][:order][:signature] = signature_from(post)
|
245
|
+
end
|
246
|
+
|
247
|
+
def signature_from(post)
|
248
|
+
signature_string = [
|
249
|
+
@options[:api_key],
|
250
|
+
@options[:merchant_id],
|
251
|
+
post[:transaction][:order][:referenceCode],
|
252
|
+
post[:transaction][:order][:additionalValues][:TX_VALUE][:value],
|
253
|
+
post[:transaction][:order][:additionalValues][:TX_VALUE][:currency]
|
254
|
+
].compact.join("~")
|
255
|
+
|
256
|
+
Digest::MD5.hexdigest(signature_string)
|
257
|
+
end
|
258
|
+
|
259
|
+
def add_payment_method(post, payment_method, options)
|
260
|
+
if payment_method.is_a?(String)
|
261
|
+
brand, token = split_authorization(payment_method)
|
262
|
+
credit_card = {}
|
263
|
+
credit_card[:securityCode] = options[:cvv] if options[:cvv]
|
264
|
+
credit_card[:processWithoutCvv2] = true if options[:cvv].blank?
|
265
|
+
post[:transaction][:creditCard] = credit_card
|
266
|
+
post[:transaction][:creditCardTokenId] = token
|
267
|
+
post[:transaction][:paymentMethod] = brand.upcase
|
268
|
+
else
|
269
|
+
credit_card = {}
|
270
|
+
credit_card[:number] = payment_method.number
|
271
|
+
credit_card[:securityCode] = payment_method.verification_value || options[:cvv]
|
272
|
+
credit_card[:expirationDate] = format(payment_method.year, :four_digits).to_s + '/' + format(payment_method.month, :two_digits).to_s
|
273
|
+
credit_card[:name] = payment_method.name.strip
|
274
|
+
credit_card[:processWithoutCvv2] = true if add_process_without_cvv2(payment_method, options)
|
275
|
+
post[:transaction][:creditCard] = credit_card
|
276
|
+
post[:transaction][:paymentMethod] = BRAND_MAP[payment_method.brand.to_s]
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
def add_process_without_cvv2(payment_method, options)
|
281
|
+
return true if payment_method.verification_value.blank? && options[:cvv].blank?
|
282
|
+
false
|
283
|
+
end
|
284
|
+
|
285
|
+
def add_extra_parameters(post, options)
|
286
|
+
extra_parameters = {}
|
287
|
+
extra_parameters[:INSTALLMENTS_NUMBER] = options[:installments_number] || 1
|
288
|
+
post[:transaction][:extraParameters] = extra_parameters
|
289
|
+
end
|
290
|
+
|
291
|
+
def add_reference(post, authorization)
|
292
|
+
order_id, transaction_id = split_authorization(authorization)
|
293
|
+
order = {}
|
294
|
+
order[:id] = order_id
|
295
|
+
post[:transaction][:order] = order
|
296
|
+
post[:transaction][:parentTransactionId] = transaction_id
|
297
|
+
post[:transaction][:reason] = 'n/a'
|
298
|
+
end
|
299
|
+
|
300
|
+
def add_payment_method_to_be_tokenized(post, payment_method)
|
301
|
+
credit_card_token = {}
|
302
|
+
credit_card_token[:payerId] = generate_unique_id
|
303
|
+
credit_card_token[:name] = payment_method.name.strip
|
304
|
+
credit_card_token[:identificationNumber] = generate_unique_id
|
305
|
+
credit_card_token[:paymentMethod] = BRAND_MAP[payment_method.brand.to_s]
|
306
|
+
credit_card_token[:number] = payment_method.number
|
307
|
+
credit_card_token[:expirationDate] = format(payment_method.year, :four_digits).to_s + '/' + format(payment_method.month, :two_digits).to_s
|
308
|
+
credit_card_token[:securityCode] = payment_method.verification_value
|
309
|
+
post[:creditCardToken] = credit_card_token
|
310
|
+
end
|
311
|
+
|
312
|
+
def commit(action, params)
|
313
|
+
begin
|
314
|
+
raw_response = ssl_post(url, post_data(params), headers)
|
315
|
+
response = parse(raw_response)
|
316
|
+
rescue ResponseError => e
|
317
|
+
raw_response = e.response.body
|
318
|
+
response_error(raw_response)
|
319
|
+
rescue JSON::ParserError
|
320
|
+
unparsable_response(raw_response)
|
321
|
+
else
|
322
|
+
success = success_from(action, response)
|
323
|
+
Response.new(
|
324
|
+
success,
|
325
|
+
message_from(action, success, response),
|
326
|
+
response,
|
327
|
+
authorization: success ? authorization_from(action, response) : nil,
|
328
|
+
error_code: success ? nil : error_from(action, response),
|
329
|
+
test: test?
|
330
|
+
)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
def headers
|
335
|
+
{
|
336
|
+
"Content-Type" => "application/json",
|
337
|
+
"Accept" => "application/json"
|
338
|
+
}
|
339
|
+
end
|
340
|
+
|
341
|
+
def post_data(params)
|
342
|
+
params.merge(test: test?)
|
343
|
+
params.to_json
|
344
|
+
end
|
345
|
+
|
346
|
+
def url
|
347
|
+
test? ? test_url : live_url
|
348
|
+
end
|
349
|
+
|
350
|
+
def parse(body)
|
351
|
+
JSON.parse(body)
|
352
|
+
end
|
353
|
+
|
354
|
+
def success_from(action, response)
|
355
|
+
case action
|
356
|
+
when 'store'
|
357
|
+
response["code"] == "SUCCESS" && response["creditCardToken"] && response["creditCardToken"]["creditCardTokenId"].present?
|
358
|
+
when 'verify_credentials'
|
359
|
+
response["code"] == "SUCCESS"
|
360
|
+
when 'refund', 'void'
|
361
|
+
response["code"] == "SUCCESS" && response["transactionResponse"] && (response["transactionResponse"]["state"] == "PENDING" || response["transactionResponse"]["state"] == "APPROVED")
|
362
|
+
else
|
363
|
+
response["code"] == "SUCCESS" && response["transactionResponse"] && (response["transactionResponse"]["state"] == "APPROVED")
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
def message_from(action, success, response)
|
368
|
+
case action
|
369
|
+
when 'store'
|
370
|
+
return response["code"] if success
|
371
|
+
error_description = response["creditCardToken"]["errorDescription"] if response["creditCardToken"]
|
372
|
+
response["error"] || error_description || "FAILED"
|
373
|
+
when 'verify_credentials'
|
374
|
+
return "VERIFIED" if success
|
375
|
+
"FAILED"
|
376
|
+
else
|
377
|
+
if response["transactionResponse"]
|
378
|
+
response_message = response["transactionResponse"]["responseMessage"]
|
379
|
+
response_code = response["transactionResponse"]["responseCode"] || response["transactionResponse"]["pendingReason"]
|
380
|
+
end
|
381
|
+
return response_code if success
|
382
|
+
response["error"] || response_message || response_code || "FAILED"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def authorization_from(action, response)
|
387
|
+
case action
|
388
|
+
when 'store'
|
389
|
+
[
|
390
|
+
response["creditCardToken"]["paymentMethod"],
|
391
|
+
response["creditCardToken"]["creditCardTokenId"]
|
392
|
+
].compact.join("|")
|
393
|
+
when 'verify_credentials'
|
394
|
+
nil
|
395
|
+
else
|
396
|
+
[
|
397
|
+
response["transactionResponse"]["orderId"],
|
398
|
+
response["transactionResponse"]["transactionId"]
|
399
|
+
].compact.join("|")
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def split_authorization(authorization)
|
404
|
+
authorization.split("|")
|
405
|
+
end
|
406
|
+
|
407
|
+
def error_from(action, response)
|
408
|
+
case action
|
409
|
+
when 'store'
|
410
|
+
response["creditCardToken"]["errorDescription"] if response["creditCardToken"]
|
411
|
+
when 'verify_credentials'
|
412
|
+
response["error"] || "FAILED"
|
413
|
+
else
|
414
|
+
response["transactionResponse"]["errorCode"] || response["transactionResponse"]["responseCode"] if response["transactionResponse"]
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
def response_error(raw_response)
|
419
|
+
begin
|
420
|
+
response = parse(raw_response)
|
421
|
+
rescue JSON::ParserError
|
422
|
+
unparsable_response(raw_response)
|
423
|
+
else
|
424
|
+
return Response.new(
|
425
|
+
false,
|
426
|
+
message_from('', false, response),
|
427
|
+
response,
|
428
|
+
:test => test?
|
429
|
+
)
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
def unparsable_response(raw_response)
|
434
|
+
message = "Invalid JSON response received from PayuLatamGateway. Please contact PayuLatamGateway if you continue to receive this message."
|
435
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
436
|
+
return Response.new(false, message)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
@@ -7,9 +7,9 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.default_currency = 'AUD'
|
8
8
|
self.money_format = :cents
|
9
9
|
self.supported_countries = ['AU']
|
10
|
-
self.supported_cardtypes = [:visa, :master]
|
10
|
+
self.supported_cardtypes = [:visa, :master, :american_express]
|
11
11
|
self.homepage_url = 'http://www.pin.net.au/'
|
12
|
-
self.display_name = 'Pin'
|
12
|
+
self.display_name = 'Pin Payments'
|
13
13
|
|
14
14
|
def initialize(options = {})
|
15
15
|
requires!(options, :api_key)
|
@@ -28,8 +28,10 @@ module ActiveMerchant #:nodoc:
|
|
28
28
|
add_invoice(post, options)
|
29
29
|
add_creditcard(post, creditcard)
|
30
30
|
add_address(post, creditcard, options)
|
31
|
+
add_capture(post, options)
|
32
|
+
add_metadata(post, options)
|
31
33
|
|
32
|
-
commit('charges', post, options)
|
34
|
+
commit(:post, 'charges', post, options)
|
33
35
|
end
|
34
36
|
|
35
37
|
# Create a customer and associated credit card. The token that is returned
|
@@ -40,17 +42,50 @@ module ActiveMerchant #:nodoc:
|
|
40
42
|
add_creditcard(post, creditcard)
|
41
43
|
add_customer_data(post, options)
|
42
44
|
add_address(post, creditcard, options)
|
43
|
-
commit('customers', post, options)
|
45
|
+
commit(:post, 'customers', post, options)
|
44
46
|
end
|
45
47
|
|
46
|
-
# Refund a transaction
|
47
|
-
# moment as the API does not support partial refunds. The parameter is
|
48
|
-
# kept for compatibility reasons
|
48
|
+
# Refund a transaction
|
49
49
|
def refund(money, token, options = {})
|
50
|
-
commit("charges/#{CGI.escape(token)}/refunds", { :amount => amount(money) }, options)
|
50
|
+
commit(:post, "charges/#{CGI.escape(token)}/refunds", { :amount => amount(money) }, options)
|
51
51
|
end
|
52
52
|
|
53
|
+
# Authorize an amount on a credit card. Once authorized, you can later
|
54
|
+
# capture this charge using the charge token that is returned.
|
55
|
+
def authorize(money, creditcard, options = {})
|
56
|
+
options[:capture] = false
|
57
|
+
|
58
|
+
purchase(money, creditcard, options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Captures a previously authorized charge. Capturing only part of the original
|
62
|
+
# authorization is currently not supported.
|
63
|
+
def capture(money, token, options = {})
|
64
|
+
commit(:put, "charges/#{CGI.escape(token)}/capture", { :amount => amount(money) }, options)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Updates the credit card for the customer.
|
68
|
+
def update(token, creditcard, options = {})
|
69
|
+
post = {}
|
70
|
+
|
71
|
+
add_creditcard(post, creditcard)
|
72
|
+
add_customer_data(post, options)
|
73
|
+
add_address(post, creditcard, options)
|
74
|
+
commit(:put, "customers/#{CGI.escape(token)}", post, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
def supports_scrubbing
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
def scrub(transcript)
|
82
|
+
transcript.
|
83
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
84
|
+
gsub(/(number\\?":\\?")(\d*)/, '\1[FILTERED]').
|
85
|
+
gsub(/(cvc\\?":\\?")(\d*)/, '\1[FILTERED]')
|
86
|
+
end
|
53
87
|
private
|
88
|
+
|
54
89
|
def add_amount(post, money, options)
|
55
90
|
post[:amount] = amount(money)
|
56
91
|
post[:currency] = (options[:currency] || currency(money))
|
@@ -58,8 +93,8 @@ module ActiveMerchant #:nodoc:
|
|
58
93
|
end
|
59
94
|
|
60
95
|
def add_customer_data(post, options)
|
61
|
-
post[:email] = options[:email]
|
62
|
-
post[:ip_address] = options[:ip]
|
96
|
+
post[:email] = options[:email] if options[:email]
|
97
|
+
post[:ip_address] = options[:ip] if options[:ip]
|
63
98
|
end
|
64
99
|
|
65
100
|
def add_address(post, creditcard, options)
|
@@ -81,6 +116,12 @@ module ActiveMerchant #:nodoc:
|
|
81
116
|
post[:description] = options[:description] || "Active Merchant Purchase"
|
82
117
|
end
|
83
118
|
|
119
|
+
def add_capture(post, options)
|
120
|
+
capture = options[:capture]
|
121
|
+
|
122
|
+
post[:capture] = capture == false ? false : true
|
123
|
+
end
|
124
|
+
|
84
125
|
def add_creditcard(post, creditcard)
|
85
126
|
if creditcard.respond_to?(:number)
|
86
127
|
post[:card] ||= {}
|
@@ -90,7 +131,7 @@ module ActiveMerchant #:nodoc:
|
|
90
131
|
:expiry_month => creditcard.month,
|
91
132
|
:expiry_year => creditcard.year,
|
92
133
|
:cvc => creditcard.verification_value,
|
93
|
-
:name =>
|
134
|
+
:name => creditcard.name
|
94
135
|
)
|
95
136
|
elsif creditcard.kind_of?(String)
|
96
137
|
if creditcard =~ /^card_/
|
@@ -101,6 +142,10 @@ module ActiveMerchant #:nodoc:
|
|
101
142
|
end
|
102
143
|
end
|
103
144
|
|
145
|
+
def add_metadata(post, options)
|
146
|
+
post[:metadata] = options[:metadata] if options[:metadata]
|
147
|
+
end
|
148
|
+
|
104
149
|
def headers(params = {})
|
105
150
|
result = {
|
106
151
|
"Content-Type" => "application/json",
|
@@ -112,11 +157,12 @@ module ActiveMerchant #:nodoc:
|
|
112
157
|
result
|
113
158
|
end
|
114
159
|
|
115
|
-
def commit(action, params, options)
|
160
|
+
def commit(method, action, params, options)
|
116
161
|
url = "#{test? ? test_url : live_url}/#{action}"
|
117
162
|
|
118
163
|
begin
|
119
|
-
|
164
|
+
raw_response = ssl_request(method, url, post_data(params), headers(options))
|
165
|
+
body = parse(raw_response)
|
120
166
|
rescue ResponseError => e
|
121
167
|
body = parse(e.response.body)
|
122
168
|
end
|
@@ -126,6 +172,9 @@ module ActiveMerchant #:nodoc:
|
|
126
172
|
elsif body["error"]
|
127
173
|
error_response(body)
|
128
174
|
end
|
175
|
+
|
176
|
+
rescue JSON::ParserError
|
177
|
+
return unparsable_response(raw_response)
|
129
178
|
end
|
130
179
|
|
131
180
|
def success_response(body)
|
@@ -149,6 +198,12 @@ module ActiveMerchant #:nodoc:
|
|
149
198
|
)
|
150
199
|
end
|
151
200
|
|
201
|
+
def unparsable_response(raw_response)
|
202
|
+
message = "Invalid JSON response received from Pin Payments. Please contact support@pin.net.au if you continue to receive this message."
|
203
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
204
|
+
return Response.new(false, message)
|
205
|
+
end
|
206
|
+
|
152
207
|
def token(response)
|
153
208
|
response['token']
|
154
209
|
end
|
@@ -153,7 +153,7 @@ module ActiveMerchant
|
|
153
153
|
add_amount(post, money, options)
|
154
154
|
|
155
155
|
if identification_or_creditcard.is_a?(String)
|
156
|
-
deprecated CREDIT_DEPRECATION_MESSAGE
|
156
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
157
157
|
refund(money, identification_or_creditcard, options)
|
158
158
|
else
|
159
159
|
add_creditcard(post, identification_or_creditcard)
|
@@ -268,17 +268,6 @@ module ActiveMerchant
|
|
268
268
|
post[:currency] = options[:currency] || currency(money)
|
269
269
|
end
|
270
270
|
|
271
|
-
# Make a ruby type out of the response string
|
272
|
-
def normalize(field)
|
273
|
-
case field
|
274
|
-
when "true" then true
|
275
|
-
when "false" then false
|
276
|
-
when "" then nil
|
277
|
-
when "null" then nil
|
278
|
-
else field
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
271
|
def message_from(results)
|
283
272
|
PAYMENT_GATEWAY_RESPONSES[results[:resp_code]]
|
284
273
|
end
|