activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = self.test_url = 'https://secure.payscout.com/api/transact.php'
|
5
5
|
|
6
6
|
self.supported_countries = ['US']
|
7
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
8
8
|
self.default_currency = 'USD'
|
9
9
|
self.homepage_url = 'http://www.payscout.com/'
|
10
10
|
self.display_name = 'Payscout'
|
@@ -41,7 +41,6 @@ module ActiveMerchant #:nodoc:
|
|
41
41
|
commit('capture', money, post)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
44
|
def refund(money, authorization, options = {})
|
46
45
|
post = {}
|
47
46
|
post[:transactionid] = authorization
|
@@ -63,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
63
62
|
post[:address1] = address[:address1].to_s
|
64
63
|
post[:address2] = address[:address2].to_s
|
65
64
|
post[:city] = address[:city].to_s
|
66
|
-
post[:state] = (address[:state].blank?
|
65
|
+
post[:state] = (address[:state].blank? ? 'n/a' : address[:state])
|
67
66
|
post[:zip] = address[:zip].to_s
|
68
67
|
post[:country] = address[:country].to_s
|
69
68
|
post[:phone] = address[:phone].to_s
|
@@ -79,7 +78,7 @@ module ActiveMerchant #:nodoc:
|
|
79
78
|
post[:shipping_address2] = address[:address2].to_s
|
80
79
|
post[:shipping_city] = address[:city].to_s
|
81
80
|
post[:shipping_country] = address[:country].to_s
|
82
|
-
post[:shipping_state] = (address[:state].blank?
|
81
|
+
post[:shipping_state] = (address[:state].blank? ? 'n/a' : address[:state])
|
83
82
|
post[:shipping_zip] = address[:zip].to_s
|
84
83
|
post[:shipping_email] = address[:email].to_s
|
85
84
|
end
|
@@ -103,7 +102,7 @@ module ActiveMerchant #:nodoc:
|
|
103
102
|
end
|
104
103
|
|
105
104
|
def parse(body)
|
106
|
-
Hash[body.split('&').map{|x|x.split('=')}]
|
105
|
+
Hash[body.split('&').map { |x| x.split('=') }]
|
107
106
|
end
|
108
107
|
|
109
108
|
def commit(action, money, parameters)
|
@@ -117,12 +116,11 @@ module ActiveMerchant #:nodoc:
|
|
117
116
|
message = message_from(response)
|
118
117
|
test_mode = (test? || message =~ /TESTMODE/)
|
119
118
|
Response.new(success?(response), message, response,
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
)
|
119
|
+
test: test_mode,
|
120
|
+
authorization: response['transactionid'],
|
121
|
+
fraud_review: fraud_review?(response),
|
122
|
+
avs_result: { code: response['avsresponse'] },
|
123
|
+
cvv_result: response['cvvresponse'])
|
126
124
|
end
|
127
125
|
|
128
126
|
def message_from(response)
|
@@ -153,10 +151,9 @@ module ActiveMerchant #:nodoc:
|
|
153
151
|
post[:password] = @options[:password]
|
154
152
|
post[:type] = action
|
155
153
|
|
156
|
-
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
154
|
+
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
157
155
|
request
|
158
156
|
end
|
159
157
|
end
|
160
158
|
end
|
161
159
|
end
|
162
|
-
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class PaystationGateway < Gateway
|
4
|
-
|
5
|
-
self.live_url = self.test_url = "https://www.paystation.co.nz/direct/paystation.dll"
|
4
|
+
self.live_url = self.test_url = 'https://www.paystation.co.nz/direct/paystation.dll'
|
6
5
|
|
7
6
|
# an "error code" of "0" means "No error - transaction successful"
|
8
7
|
SUCCESSFUL_RESPONSE_CODE = '0'
|
@@ -14,7 +13,7 @@ module ActiveMerchant #:nodoc:
|
|
14
13
|
self.supported_countries = ['NZ']
|
15
14
|
|
16
15
|
# TODO: check this with paystation (amex and diners need to be enabled)
|
17
|
-
self.supported_cardtypes = [
|
16
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
18
17
|
|
19
18
|
self.homepage_url = 'http://paystation.co.nz'
|
20
19
|
self.display_name = 'Paystation'
|
@@ -75,7 +74,7 @@ module ActiveMerchant #:nodoc:
|
|
75
74
|
commit(post)
|
76
75
|
end
|
77
76
|
|
78
|
-
def refund(money, authorization, options={})
|
77
|
+
def refund(money, authorization, options = {})
|
79
78
|
post = new_request
|
80
79
|
add_amount(post, money, options)
|
81
80
|
add_invoice(post, options)
|
@@ -84,7 +83,7 @@ module ActiveMerchant #:nodoc:
|
|
84
83
|
commit(post)
|
85
84
|
end
|
86
85
|
|
87
|
-
def verify(credit_card, options={})
|
86
|
+
def verify(credit_card, options = {})
|
88
87
|
authorize(0, credit_card, options)
|
89
88
|
end
|
90
89
|
|
@@ -100,107 +99,105 @@ module ActiveMerchant #:nodoc:
|
|
100
99
|
|
101
100
|
private
|
102
101
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
def add_customer_data(post, options)
|
114
|
-
post[:mc] = options[:customer]
|
115
|
-
end
|
102
|
+
def new_request
|
103
|
+
{
|
104
|
+
:pi => @options[:paystation_id], # paystation account id
|
105
|
+
:gi => @options[:gateway_id], # paystation gateway id
|
106
|
+
'2p' => 't', # two-party transaction type
|
107
|
+
:nr => 't', # -- redirect??
|
108
|
+
:df => 'yymm' # date format: optional sometimes, required others
|
109
|
+
}
|
110
|
+
end
|
116
111
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
post[:mr] = options[:order_id]
|
121
|
-
end
|
112
|
+
def add_customer_data(post, options)
|
113
|
+
post[:mc] = options[:customer]
|
114
|
+
end
|
122
115
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
116
|
+
def add_invoice(post, options)
|
117
|
+
post[:ms] = generate_unique_id
|
118
|
+
post[:mo] = options[:description]
|
119
|
+
post[:mr] = options[:order_id]
|
120
|
+
end
|
129
121
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
122
|
+
def add_credit_card(post, credit_card)
|
123
|
+
post[:cn] = credit_card.number
|
124
|
+
post[:ct] = credit_card.brand
|
125
|
+
post[:ex] = format_date(credit_card.month, credit_card.year)
|
126
|
+
post[:cc] = credit_card.verification_value if credit_card.verification_value?
|
127
|
+
end
|
134
128
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
end
|
129
|
+
def add_token(post, token)
|
130
|
+
post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
|
131
|
+
post[:ft] = token
|
132
|
+
end
|
140
133
|
|
141
|
-
|
142
|
-
|
143
|
-
|
134
|
+
def store_credit_card(post, options)
|
135
|
+
post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
|
136
|
+
post[:fs] = 't' # tells paystation to store right now, not bill
|
137
|
+
post[:ft] = options[:token] if options[:token] # specify a token to use that, or let Paystation generate one
|
138
|
+
end
|
144
139
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|
140
|
+
def add_authorize_flag(post, options)
|
141
|
+
post[:pa] = 't' # tells Paystation that this is a pre-auth authorisation payment (account must be in pre-auth mode)
|
142
|
+
end
|
149
143
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
end
|
144
|
+
def add_refund_specific_fields(post, authorization)
|
145
|
+
post[:rc] = 't'
|
146
|
+
post[:rt] = authorization
|
147
|
+
end
|
155
148
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
149
|
+
def add_authorization_token(post, auth_token, verification_value = nil)
|
150
|
+
post[:cp] = 't' # Capture Payment flag – tells Paystation this transaction should be treated as a capture payment
|
151
|
+
post[:cx] = auth_token
|
152
|
+
post[:cc] = verification_value
|
153
|
+
end
|
160
154
|
|
161
|
-
|
162
|
-
|
155
|
+
def add_amount(post, money, options)
|
156
|
+
post[:am] = amount(money)
|
157
|
+
post[:cu] = options[:currency] || currency(money)
|
158
|
+
end
|
163
159
|
|
164
|
-
|
160
|
+
def parse(xml_response)
|
161
|
+
response = {}
|
165
162
|
|
166
|
-
|
167
|
-
response[element.name.underscore.to_sym] = element.text
|
168
|
-
end
|
163
|
+
xml = REXML::Document.new(xml_response)
|
169
164
|
|
170
|
-
|
165
|
+
xml.elements.each("#{xml.root.name}/*") do |element|
|
166
|
+
response[element.name.underscore.to_sym] = element.text
|
171
167
|
end
|
172
168
|
|
173
|
-
|
174
|
-
|
175
|
-
pstn_prefix_params = post.collect { |key, value| "pstn_#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
169
|
+
response
|
170
|
+
end
|
176
171
|
|
177
|
-
|
178
|
-
|
179
|
-
|
172
|
+
def commit(post)
|
173
|
+
post[:tm] = 'T' if test?
|
174
|
+
pstn_prefix_params = post.collect { |key, value| "pstn_#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
180
175
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
)
|
185
|
-
end
|
176
|
+
data = ssl_post(self.live_url, "#{pstn_prefix_params}&paystation=_empty")
|
177
|
+
response = parse(data)
|
178
|
+
message = message_from(response)
|
186
179
|
|
187
|
-
|
188
|
-
|
189
|
-
|
180
|
+
PaystationResponse.new(success?(response), message, response,
|
181
|
+
test: (response[:tm]&.casecmp('t')&.zero?),
|
182
|
+
authorization: response[:paystation_transaction_id])
|
183
|
+
end
|
190
184
|
|
191
|
-
|
192
|
-
|
193
|
-
|
185
|
+
def success?(response)
|
186
|
+
(response[:ec] == SUCCESSFUL_RESPONSE_CODE) || (response[:ec] == SUCCESSFUL_FUTURE_PAYMENT)
|
187
|
+
end
|
194
188
|
|
195
|
-
|
196
|
-
|
197
|
-
|
189
|
+
def message_from(response)
|
190
|
+
response[:em]
|
191
|
+
end
|
198
192
|
|
193
|
+
def format_date(month, year)
|
194
|
+
"#{format(year, :two_digits)}#{format(month, :two_digits)}"
|
195
|
+
end
|
199
196
|
end
|
200
197
|
|
201
198
|
class PaystationResponse < Response
|
202
199
|
def token
|
203
|
-
@params[
|
200
|
+
@params['future_payment_token']
|
204
201
|
end
|
205
202
|
end
|
206
203
|
end
|
@@ -3,25 +3,25 @@
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class PayuInGateway < Gateway
|
6
|
-
self.test_url =
|
7
|
-
self.live_url =
|
6
|
+
self.test_url = 'https://test.payu.in/_payment'
|
7
|
+
self.live_url = 'https://secure.payu.in/_payment'
|
8
8
|
|
9
|
-
TEST_INFO_URL =
|
10
|
-
LIVE_INFO_URL =
|
9
|
+
TEST_INFO_URL = 'https://test.payu.in/merchant/postservice.php?form=2'
|
10
|
+
LIVE_INFO_URL = 'https://info.payu.in/merchant/postservice.php?form=2'
|
11
11
|
|
12
12
|
self.supported_countries = ['IN']
|
13
13
|
self.default_currency = 'INR'
|
14
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master american_express diners_club maestro]
|
15
15
|
|
16
16
|
self.homepage_url = 'https://www.payu.in/'
|
17
17
|
self.display_name = 'PayU India'
|
18
18
|
|
19
|
-
def initialize(options={})
|
19
|
+
def initialize(options = {})
|
20
20
|
requires!(options, :key, :salt)
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
def purchase(money, payment, options={})
|
24
|
+
def purchase(money, payment, options = {})
|
25
25
|
requires!(options, :order_id)
|
26
26
|
|
27
27
|
post = {}
|
@@ -32,28 +32,28 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
add_auth(post)
|
33
33
|
|
34
34
|
MultiResponse.run do |r|
|
35
|
-
r.process{commit(url(
|
36
|
-
if
|
37
|
-
r.process{commit(r.params[
|
35
|
+
r.process { commit(url('purchase'), post) }
|
36
|
+
if r.params['enrolled'].to_s == '0'
|
37
|
+
r.process { commit(r.params['post_uri'], r.params['form_post_vars']) }
|
38
38
|
else
|
39
|
-
r.process{handle_3dsecure(r)}
|
39
|
+
r.process { handle_3dsecure(r) }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def refund(money, authorization, options={})
|
45
|
-
raise ArgumentError,
|
44
|
+
def refund(money, authorization, options = {})
|
45
|
+
raise ArgumentError, 'Amount is required' unless money
|
46
46
|
|
47
47
|
post = {}
|
48
48
|
|
49
|
-
post[:command] =
|
49
|
+
post[:command] = 'cancel_refund_transaction'
|
50
50
|
post[:var1] = authorization
|
51
51
|
post[:var2] = generate_unique_id
|
52
52
|
post[:var3] = amount(money)
|
53
53
|
|
54
54
|
add_auth(post, :command, :var1)
|
55
55
|
|
56
|
-
commit(url(
|
56
|
+
commit(url('refund'), post)
|
57
57
|
end
|
58
58
|
|
59
59
|
def supports_scrubbing?
|
@@ -82,17 +82,17 @@ module ActiveMerchant #:nodoc:
|
|
82
82
|
|
83
83
|
digest_keys = PAYMENT_DIGEST_KEYS if digest_keys.empty?
|
84
84
|
digest = Digest::SHA2.new(512)
|
85
|
-
digest << @options[:key] <<
|
85
|
+
digest << @options[:key] << '|'
|
86
86
|
digest_keys.each do |key|
|
87
|
-
digest << (post[key.to_sym] ||
|
87
|
+
digest << (post[key.to_sym] || '') << '|'
|
88
88
|
end
|
89
89
|
digest << @options[:salt]
|
90
90
|
post[:hash] = digest.hexdigest
|
91
91
|
end
|
92
92
|
|
93
93
|
def add_customer_data(post, options)
|
94
|
-
post[:email] = clean(options[:email] ||
|
95
|
-
post[:phone] = clean((options[:billing_address] && options[:billing_address][:phone]) ||
|
94
|
+
post[:email] = clean(options[:email] || 'unknown@example.com', nil, 50)
|
95
|
+
post[:phone] = clean((options[:billing_address] && options[:billing_address][:phone]) || '11111111111', :numeric, 50)
|
96
96
|
end
|
97
97
|
|
98
98
|
def add_addresses(post, options)
|
@@ -109,7 +109,7 @@ module ActiveMerchant #:nodoc:
|
|
109
109
|
if options[:shipping_address][:name]
|
110
110
|
first, *rest = options[:shipping_address][:name].split(/\s+/)
|
111
111
|
post[:shipping_firstname] = clean(first, :name, 60)
|
112
|
-
post[:shipping_lastname] = clean(rest.join(
|
112
|
+
post[:shipping_lastname] = clean(rest.join(' '), :name, 20)
|
113
113
|
end
|
114
114
|
post[:shipping_address1] = clean(options[:shipping_address][:address1], :text, 100)
|
115
115
|
post[:shipping_address2] = clean(options[:shipping_address][:address2], :text, 100)
|
@@ -125,22 +125,22 @@ module ActiveMerchant #:nodoc:
|
|
125
125
|
post[:amount] = amount(money)
|
126
126
|
|
127
127
|
post[:txnid] = clean(options[:order_id], :alphanumeric, 30)
|
128
|
-
post[:productinfo] = clean(options[:description] ||
|
128
|
+
post[:productinfo] = clean(options[:description] || 'Purchase', nil, 100)
|
129
129
|
|
130
|
-
post[:surl] =
|
131
|
-
post[:furl] =
|
130
|
+
post[:surl] = 'http://example.com'
|
131
|
+
post[:furl] = 'http://example.com'
|
132
132
|
end
|
133
133
|
|
134
134
|
BRAND_MAP = {
|
135
|
-
visa:
|
136
|
-
master:
|
137
|
-
american_express:
|
138
|
-
diners_club:
|
139
|
-
maestro:
|
135
|
+
visa: 'VISA',
|
136
|
+
master: 'MAST',
|
137
|
+
american_express: 'AMEX',
|
138
|
+
diners_club: 'DINR',
|
139
|
+
maestro: 'MAES'
|
140
140
|
}
|
141
141
|
|
142
142
|
def add_payment(post, payment)
|
143
|
-
post[:pg] =
|
143
|
+
post[:pg] = 'CC'
|
144
144
|
post[:firstname] = clean(payment.first_name, :name, 60)
|
145
145
|
post[:lastname] = clean(payment.last_name, :name, 20)
|
146
146
|
|
@@ -153,31 +153,32 @@ module ActiveMerchant #:nodoc:
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def clean(value, format, maxlength)
|
156
|
-
value ||=
|
157
|
-
value =
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
156
|
+
value ||= ''
|
157
|
+
value =
|
158
|
+
case format
|
159
|
+
when :alphanumeric
|
160
|
+
value.gsub(/[^A-Za-z0-9]/, '')
|
161
|
+
when :name
|
162
|
+
value.gsub(/[^A-Za-z ]/, '')
|
163
|
+
when :numeric
|
164
|
+
value.gsub(/[^0-9]/, '')
|
165
|
+
when :text
|
166
|
+
value.gsub(/[^A-Za-z0-9@\-_\/\. ]/, '')
|
167
|
+
when nil
|
168
|
+
value
|
169
|
+
else
|
170
|
+
raise "Unknown format #{format} for #{value}"
|
171
|
+
end
|
171
172
|
value[0...maxlength]
|
172
173
|
end
|
173
174
|
|
174
175
|
def parse(body)
|
175
176
|
top = JSON.parse(body)
|
176
177
|
|
177
|
-
if result = top.delete(
|
178
|
-
result.split(
|
179
|
-
key, value = string.split(
|
180
|
-
hash[CGI.unescape(key).downcase] = CGI.unescape(value ||
|
178
|
+
if result = top.delete('result')
|
179
|
+
result.split('&').inject({}) do |hash, string|
|
180
|
+
key, value = string.split('=')
|
181
|
+
hash[CGI.unescape(key).downcase] = CGI.unescape(value || '')
|
181
182
|
hash
|
182
183
|
end.each do |key, value|
|
183
184
|
if top[key]
|
@@ -188,19 +189,19 @@ module ActiveMerchant #:nodoc:
|
|
188
189
|
end
|
189
190
|
end
|
190
191
|
|
191
|
-
if response = top.delete(
|
192
|
+
if response = top.delete('response')
|
192
193
|
top.merge!(response)
|
193
194
|
end
|
194
195
|
|
195
196
|
top
|
196
197
|
rescue JSON::ParserError
|
197
198
|
{
|
198
|
-
|
199
|
+
'error' => "Invalid response received from the PayU API. (The raw response was `#{body}`)."
|
199
200
|
}
|
200
201
|
end
|
201
202
|
|
202
203
|
def commit(url, parameters)
|
203
|
-
response = parse(ssl_post(url, post_data(parameters),
|
204
|
+
response = parse(ssl_post(url, post_data(parameters), 'Accept-Encoding' => 'identity'))
|
204
205
|
|
205
206
|
Response.new(
|
206
207
|
success_from(response),
|
@@ -213,7 +214,7 @@ module ActiveMerchant #:nodoc:
|
|
213
214
|
|
214
215
|
def url(action)
|
215
216
|
case action
|
216
|
-
when
|
217
|
+
when 'purchase'
|
217
218
|
(test? ? test_url : live_url)
|
218
219
|
else
|
219
220
|
(test? ? TEST_INFO_URL : LIVE_INFO_URL)
|
@@ -221,19 +222,19 @@ module ActiveMerchant #:nodoc:
|
|
221
222
|
end
|
222
223
|
|
223
224
|
def success_from(response)
|
224
|
-
if response[
|
225
|
-
(response[
|
225
|
+
if response['result_status']
|
226
|
+
(response['status'] == 'success' && response['result_status'] == 'success')
|
226
227
|
else
|
227
|
-
(response[
|
228
|
+
(response['status'] == 'success' || response['status'].to_s == '1')
|
228
229
|
end
|
229
230
|
end
|
230
231
|
|
231
232
|
def message_from(response)
|
232
|
-
(response[
|
233
|
+
(response['error_message'] || response['error'] || response['msg'])
|
233
234
|
end
|
234
235
|
|
235
236
|
def authorization_from(response)
|
236
|
-
response[
|
237
|
+
response['mihpayid']
|
237
238
|
end
|
238
239
|
|
239
240
|
def post_data(parameters = {})
|
@@ -241,7 +242,7 @@ module ActiveMerchant #:nodoc:
|
|
241
242
|
end
|
242
243
|
|
243
244
|
def handle_3dsecure(response)
|
244
|
-
Response.new(false,
|
245
|
+
Response.new(false, '3D-secure enrolled cards are not supported.')
|
245
246
|
end
|
246
247
|
end
|
247
248
|
end
|