activemerchant 1.79.2 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +33 -0
- data/README.md +10 -2
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/check.rb +4 -4
- data/lib/active_merchant/billing/compatibility.rb +1 -1
- data/lib/active_merchant/billing/credit_card.rb +21 -21
- data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
- data/lib/active_merchant/billing/gateway.rb +13 -13
- data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
- data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
- data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
- data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
- data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
- data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
- data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
- data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
- data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
- data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
- data/lib/active_merchant/billing/gateways/cams.rb +12 -12
- data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
- data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
- data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
- data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
- data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
- data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
- data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
- data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
- data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
- data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
- data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
- data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
- data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
- data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
- data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
- data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
- data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
- data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
- data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
- data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
- data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
- data/lib/active_merchant/billing/gateways/element.rb +35 -35
- data/lib/active_merchant/billing/gateways/epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +65 -65
- data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
- data/lib/active_merchant/billing/gateways/exact.rb +12 -12
- data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
- data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
- data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +26 -16
- data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
- data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
- data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
- data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
- data/lib/active_merchant/billing/gateways/hps.rb +28 -28
- data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
- data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
- data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
- data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
- data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
- data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
- data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
- data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
- data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
- data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
- data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
- data/lib/active_merchant/billing/gateways/litle.rb +4 -4
- data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
- data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
- data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
- data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
- data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
- data/lib/active_merchant/billing/gateways/migs.rb +11 -9
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
- data/lib/active_merchant/billing/gateways/monei.rb +5 -5
- data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
- data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
- data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
- data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
- data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
- data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
- data/lib/active_merchant/billing/gateways/omise.rb +3 -3
- data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
- data/lib/active_merchant/billing/gateways/opp.rb +4 -4
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
- data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
- data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
- data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
- data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
- data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
- data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
- data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
- data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
- data/lib/active_merchant/billing/gateways/payex.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
- data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
- data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
- data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
- data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
- data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
- data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
- data/lib/active_merchant/billing/gateways/payway.rb +6 -6
- data/lib/active_merchant/billing/gateways/pin.rb +7 -7
- data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
- data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
- data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
- data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
- data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
- data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
- data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
- data/lib/active_merchant/billing/gateways/realex.rb +16 -15
- data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
- data/lib/active_merchant/billing/gateways/s5.rb +5 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
- data/lib/active_merchant/billing/gateways/sage.rb +20 -20
- data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
- data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
- data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
- data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
- data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
- data/lib/active_merchant/billing/gateways/telr.rb +26 -26
- data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
- data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
- data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
- data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
- data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
- data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
- data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
- data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
- data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
- data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/connection.rb +10 -8
- data/lib/active_merchant/country.rb +1 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +12 -12
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +37 -0
- data/lib/support/gateway_support.rb +2 -2
- data/lib/support/ssl_verify.rb +5 -5
- data/lib/support/ssl_version.rb +7 -7
- metadata +3 -7
- 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
|
@@ -50,7 +50,7 @@ module ActiveMerchant #:nodoc:
|
|
|
50
50
|
|
|
51
51
|
def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
|
|
52
52
|
transaction_type = define_transaction_type(credit_card_or_referenced_id)
|
|
53
|
-
reference_id = credit_card_or_referenced_id if transaction_type ==
|
|
53
|
+
reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'
|
|
54
54
|
|
|
55
55
|
billing_address = options[:billing_address] || options[:address]
|
|
56
56
|
currency_code = options[:currency] || currency(money)
|
|
@@ -30,7 +30,7 @@ module ActiveMerchant #:nodoc:
|
|
|
30
30
|
# :category => "Digital" } ] )
|
|
31
31
|
def build_setup_request(action, money, options)
|
|
32
32
|
requires!(options, :items)
|
|
33
|
-
raise ArgumentError,
|
|
33
|
+
raise ArgumentError, 'Must include at least 1 Item' unless options[:items].length > 0
|
|
34
34
|
options[:items].each do |item|
|
|
35
35
|
requires!(item, :name, :number, :quantity, :amount, :description, :category)
|
|
36
36
|
raise ArgumentError, "Each of the items must have the category 'Digital'" unless item[:category] == 'Digital'
|
|
@@ -153,7 +153,7 @@ module ActiveMerchant #:nodoc:
|
|
|
153
153
|
post[:password] = @options[:password]
|
|
154
154
|
post[:type] = action
|
|
155
155
|
|
|
156
|
-
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
|
156
|
+
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
157
157
|
request
|
|
158
158
|
end
|
|
159
159
|
end
|
|
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
|
|
|
2
2
|
module Billing #:nodoc:
|
|
3
3
|
class PaystationGateway < Gateway
|
|
4
4
|
|
|
5
|
-
self.live_url = self.test_url =
|
|
5
|
+
self.live_url = self.test_url = 'https://www.paystation.co.nz/direct/paystation.dll'
|
|
6
6
|
|
|
7
7
|
# an "error code" of "0" means "No error - transaction successful"
|
|
8
8
|
SUCCESSFUL_RESPONSE_CODE = '0'
|
|
@@ -104,9 +104,9 @@ module ActiveMerchant #:nodoc:
|
|
|
104
104
|
{
|
|
105
105
|
:pi => @options[:paystation_id], # paystation account id
|
|
106
106
|
:gi => @options[:gateway_id], # paystation gateway id
|
|
107
|
-
|
|
108
|
-
:nr =>
|
|
109
|
-
:df =>
|
|
107
|
+
'2p' => 't', # two-party transaction type
|
|
108
|
+
:nr => 't', # -- redirect??
|
|
109
|
+
:df => 'yymm' # date format: optional sometimes, required others
|
|
110
110
|
}
|
|
111
111
|
end
|
|
112
112
|
|
|
@@ -128,27 +128,27 @@ module ActiveMerchant #:nodoc:
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def add_token(post, token)
|
|
131
|
-
post[:fp] =
|
|
131
|
+
post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
|
|
132
132
|
post[:ft] = token
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def store_credit_card(post, options)
|
|
136
|
-
post[:fp] =
|
|
137
|
-
post[:fs] =
|
|
136
|
+
post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
|
|
137
|
+
post[:fs] = 't' # tells paystation to store right now, not bill
|
|
138
138
|
post[:ft] = options[:token] if options[:token] # specify a token to use that, or let Paystation generate one
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
def add_authorize_flag(post, options)
|
|
142
|
-
post[:pa] =
|
|
142
|
+
post[:pa] = 't' # tells Paystation that this is a pre-auth authorisation payment (account must be in pre-auth mode)
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
def add_refund_specific_fields(post, authorization)
|
|
146
|
-
post[:rc] =
|
|
146
|
+
post[:rc] = 't'
|
|
147
147
|
post[:rt] = authorization
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
def add_authorization_token(post, auth_token, verification_value = nil)
|
|
151
|
-
post[:cp] =
|
|
151
|
+
post[:cp] = 't' # Capture Payment flag – tells Paystation this transaction should be treated as a capture payment
|
|
152
152
|
post[:cx] = auth_token
|
|
153
153
|
post[:cc] = verification_value
|
|
154
154
|
end
|
|
@@ -171,15 +171,15 @@ module ActiveMerchant #:nodoc:
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
def commit(post)
|
|
174
|
-
post[:tm] =
|
|
175
|
-
pstn_prefix_params = post.collect { |key, value| "pstn_#{key}=#{CGI.escape(value.to_s)}" }.join(
|
|
174
|
+
post[:tm] = 'T' if test?
|
|
175
|
+
pstn_prefix_params = post.collect { |key, value| "pstn_#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
|
176
176
|
|
|
177
177
|
data = ssl_post(self.live_url, "#{pstn_prefix_params}&paystation=_empty")
|
|
178
178
|
response = parse(data)
|
|
179
179
|
message = message_from(response)
|
|
180
180
|
|
|
181
181
|
PaystationResponse.new(success?(response), message, response,
|
|
182
|
-
:test => (response[:tm] && response[:tm].downcase ==
|
|
182
|
+
:test => (response[:tm] && response[:tm].downcase == 't'),
|
|
183
183
|
:authorization => response[:paystation_transaction_id]
|
|
184
184
|
)
|
|
185
185
|
end
|
|
@@ -200,7 +200,7 @@ module ActiveMerchant #:nodoc:
|
|
|
200
200
|
|
|
201
201
|
class PaystationResponse < Response
|
|
202
202
|
def token
|
|
203
|
-
@params[
|
|
203
|
+
@params['future_payment_token']
|
|
204
204
|
end
|
|
205
205
|
end
|
|
206
206
|
end
|
|
@@ -3,11 +3,11 @@
|
|
|
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'
|
|
@@ -32,9 +32,9 @@ module ActiveMerchant #:nodoc:
|
|
|
32
32
|
add_auth(post)
|
|
33
33
|
|
|
34
34
|
MultiResponse.run do |r|
|
|
35
|
-
r.process{commit(url(
|
|
36
|
-
if(r.params[
|
|
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
39
|
r.process{handle_3dsecure(r)}
|
|
40
40
|
end
|
|
@@ -42,18 +42,18 @@ module ActiveMerchant #:nodoc:
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def refund(money, authorization, options={})
|
|
45
|
-
raise ArgumentError,
|
|
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,16 +153,16 @@ module ActiveMerchant #:nodoc:
|
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
def clean(value, format, maxlength)
|
|
156
|
-
value ||=
|
|
156
|
+
value ||= ''
|
|
157
157
|
value = case format
|
|
158
158
|
when :alphanumeric
|
|
159
|
-
value.gsub(/[^A-Za-z0-9]/,
|
|
159
|
+
value.gsub(/[^A-Za-z0-9]/, '')
|
|
160
160
|
when :name
|
|
161
|
-
value.gsub(/[^A-Za-z ]/,
|
|
161
|
+
value.gsub(/[^A-Za-z ]/, '')
|
|
162
162
|
when :numeric
|
|
163
|
-
value.gsub(/[^0-9]/,
|
|
163
|
+
value.gsub(/[^0-9]/, '')
|
|
164
164
|
when :text
|
|
165
|
-
value.gsub(/[^A-Za-z0-9@\-_\/\. ]/,
|
|
165
|
+
value.gsub(/[^A-Za-z0-9@\-_\/\. ]/, '')
|
|
166
166
|
when nil
|
|
167
167
|
value
|
|
168
168
|
else
|
|
@@ -174,10 +174,10 @@ module ActiveMerchant #:nodoc:
|
|
|
174
174
|
def parse(body)
|
|
175
175
|
top = JSON.parse(body)
|
|
176
176
|
|
|
177
|
-
if result = top.delete(
|
|
178
|
-
result.split(
|
|
179
|
-
key, value = string.split(
|
|
180
|
-
hash[CGI.unescape(key).downcase] = CGI.unescape(value ||
|
|
177
|
+
if result = top.delete('result')
|
|
178
|
+
result.split('&').inject({}) do |hash, string|
|
|
179
|
+
key, value = string.split('=')
|
|
180
|
+
hash[CGI.unescape(key).downcase] = CGI.unescape(value || '')
|
|
181
181
|
hash
|
|
182
182
|
end.each do |key, value|
|
|
183
183
|
if top[key]
|
|
@@ -188,19 +188,19 @@ module ActiveMerchant #:nodoc:
|
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
|
-
if response = top.delete(
|
|
191
|
+
if response = top.delete('response')
|
|
192
192
|
top.merge!(response)
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
top
|
|
196
196
|
rescue JSON::ParserError
|
|
197
197
|
{
|
|
198
|
-
|
|
198
|
+
'error' => "Invalid response received from the PayU API. (The raw response was `#{body}`)."
|
|
199
199
|
}
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
def commit(url, parameters)
|
|
203
|
-
response = parse(ssl_post(url, post_data(parameters),
|
|
203
|
+
response = parse(ssl_post(url, post_data(parameters), 'Accept-Encoding' => 'identity'))
|
|
204
204
|
|
|
205
205
|
Response.new(
|
|
206
206
|
success_from(response),
|
|
@@ -213,7 +213,7 @@ module ActiveMerchant #:nodoc:
|
|
|
213
213
|
|
|
214
214
|
def url(action)
|
|
215
215
|
case action
|
|
216
|
-
when
|
|
216
|
+
when 'purchase'
|
|
217
217
|
(test? ? test_url : live_url)
|
|
218
218
|
else
|
|
219
219
|
(test? ? TEST_INFO_URL : LIVE_INFO_URL)
|
|
@@ -221,19 +221,19 @@ module ActiveMerchant #:nodoc:
|
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
def success_from(response)
|
|
224
|
-
if response[
|
|
225
|
-
(response[
|
|
224
|
+
if response['result_status']
|
|
225
|
+
(response['status'] == 'success' && response['result_status'] == 'success')
|
|
226
226
|
else
|
|
227
|
-
(response[
|
|
227
|
+
(response['status'] == 'success' || response['status'].to_s == '1')
|
|
228
228
|
end
|
|
229
229
|
end
|
|
230
230
|
|
|
231
231
|
def message_from(response)
|
|
232
|
-
(response[
|
|
232
|
+
(response['error_message'] || response['error'] || response['msg'])
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
def authorization_from(response)
|
|
236
|
-
response[
|
|
236
|
+
response['mihpayid']
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
def post_data(parameters = {})
|
|
@@ -241,7 +241,7 @@ module ActiveMerchant #:nodoc:
|
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
def handle_3dsecure(response)
|
|
244
|
-
Response.new(false,
|
|
244
|
+
Response.new(false, '3D-secure enrolled cards are not supported.')
|
|
245
245
|
end
|
|
246
246
|
end
|
|
247
247
|
end
|
|
@@ -3,29 +3,29 @@ require 'digest/md5'
|
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
|
4
4
|
module Billing #:nodoc:
|
|
5
5
|
class PayuLatamGateway < Gateway
|
|
6
|
-
self.display_name =
|
|
7
|
-
self.homepage_url =
|
|
6
|
+
self.display_name = 'PayU Latam'
|
|
7
|
+
self.homepage_url = 'http://www.payulatam.com'
|
|
8
8
|
|
|
9
|
-
self.test_url =
|
|
10
|
-
self.live_url =
|
|
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
11
|
|
|
12
|
-
self.supported_countries = [
|
|
13
|
-
self.default_currency =
|
|
12
|
+
self.supported_countries = ['AR', 'BR', 'CL', 'CO', 'MX', 'PA', 'PE']
|
|
13
|
+
self.default_currency = 'USD'
|
|
14
14
|
self.money_format = :dollars
|
|
15
15
|
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
|
|
16
16
|
|
|
17
17
|
BRAND_MAP = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
'visa' => 'VISA',
|
|
19
|
+
'master' => 'MASTERCARD',
|
|
20
|
+
'american_express' => 'AMEX',
|
|
21
|
+
'diners_club' => 'DINERS'
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
MINIMUMS = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
'ARS' => 1700,
|
|
26
|
+
'BRL' => 600,
|
|
27
|
+
'MXN' => 3900,
|
|
28
|
+
'PEN' => 500
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
def initialize(options={})
|
|
@@ -251,7 +251,7 @@ module ActiveMerchant #:nodoc:
|
|
|
251
251
|
post[:transaction][:order][:referenceCode],
|
|
252
252
|
post[:transaction][:order][:additionalValues][:TX_VALUE][:value],
|
|
253
253
|
post[:transaction][:order][:additionalValues][:TX_VALUE][:currency]
|
|
254
|
-
].compact.join(
|
|
254
|
+
].compact.join('~')
|
|
255
255
|
|
|
256
256
|
Digest::MD5.hexdigest(signature_string)
|
|
257
257
|
end
|
|
@@ -333,8 +333,8 @@ module ActiveMerchant #:nodoc:
|
|
|
333
333
|
|
|
334
334
|
def headers
|
|
335
335
|
{
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
'Content-Type' => 'application/json',
|
|
337
|
+
'Accept' => 'application/json'
|
|
338
338
|
}
|
|
339
339
|
end
|
|
340
340
|
|
|
@@ -354,32 +354,32 @@ module ActiveMerchant #:nodoc:
|
|
|
354
354
|
def success_from(action, response)
|
|
355
355
|
case action
|
|
356
356
|
when 'store'
|
|
357
|
-
response[
|
|
357
|
+
response['code'] == 'SUCCESS' && response['creditCardToken'] && response['creditCardToken']['creditCardTokenId'].present?
|
|
358
358
|
when 'verify_credentials'
|
|
359
|
-
response[
|
|
359
|
+
response['code'] == 'SUCCESS'
|
|
360
360
|
when 'refund', 'void'
|
|
361
|
-
response[
|
|
361
|
+
response['code'] == 'SUCCESS' && response['transactionResponse'] && (response['transactionResponse']['state'] == 'PENDING' || response['transactionResponse']['state'] == 'APPROVED')
|
|
362
362
|
else
|
|
363
|
-
response[
|
|
363
|
+
response['code'] == 'SUCCESS' && response['transactionResponse'] && (response['transactionResponse']['state'] == 'APPROVED')
|
|
364
364
|
end
|
|
365
365
|
end
|
|
366
366
|
|
|
367
367
|
def message_from(action, success, response)
|
|
368
368
|
case action
|
|
369
369
|
when 'store'
|
|
370
|
-
return response[
|
|
371
|
-
error_description = response[
|
|
372
|
-
response[
|
|
370
|
+
return response['code'] if success
|
|
371
|
+
error_description = response['creditCardToken']['errorDescription'] if response['creditCardToken']
|
|
372
|
+
response['error'] || error_description || 'FAILED'
|
|
373
373
|
when 'verify_credentials'
|
|
374
|
-
return
|
|
375
|
-
|
|
374
|
+
return 'VERIFIED' if success
|
|
375
|
+
'FAILED'
|
|
376
376
|
else
|
|
377
|
-
if response[
|
|
378
|
-
response_message = response[
|
|
379
|
-
response_code = response[
|
|
377
|
+
if response['transactionResponse']
|
|
378
|
+
response_message = response['transactionResponse']['responseMessage']
|
|
379
|
+
response_code = response['transactionResponse']['responseCode'] || response['transactionResponse']['pendingReason']
|
|
380
380
|
end
|
|
381
381
|
return response_code if success
|
|
382
|
-
response[
|
|
382
|
+
response['error'] || response_message || response_code || 'FAILED'
|
|
383
383
|
end
|
|
384
384
|
end
|
|
385
385
|
|
|
@@ -387,31 +387,31 @@ module ActiveMerchant #:nodoc:
|
|
|
387
387
|
case action
|
|
388
388
|
when 'store'
|
|
389
389
|
[
|
|
390
|
-
response[
|
|
391
|
-
response[
|
|
392
|
-
].compact.join(
|
|
390
|
+
response['creditCardToken']['paymentMethod'],
|
|
391
|
+
response['creditCardToken']['creditCardTokenId']
|
|
392
|
+
].compact.join('|')
|
|
393
393
|
when 'verify_credentials'
|
|
394
394
|
nil
|
|
395
395
|
else
|
|
396
396
|
[
|
|
397
|
-
response[
|
|
398
|
-
response[
|
|
399
|
-
].compact.join(
|
|
397
|
+
response['transactionResponse']['orderId'],
|
|
398
|
+
response['transactionResponse']['transactionId']
|
|
399
|
+
].compact.join('|')
|
|
400
400
|
end
|
|
401
401
|
end
|
|
402
402
|
|
|
403
403
|
def split_authorization(authorization)
|
|
404
|
-
authorization.split(
|
|
404
|
+
authorization.split('|')
|
|
405
405
|
end
|
|
406
406
|
|
|
407
407
|
def error_from(action, response)
|
|
408
408
|
case action
|
|
409
409
|
when 'store'
|
|
410
|
-
response[
|
|
410
|
+
response['creditCardToken']['errorDescription'] if response['creditCardToken']
|
|
411
411
|
when 'verify_credentials'
|
|
412
|
-
response[
|
|
412
|
+
response['error'] || 'FAILED'
|
|
413
413
|
else
|
|
414
|
-
response[
|
|
414
|
+
response['transactionResponse']['errorCode'] || response['transactionResponse']['responseCode'] if response['transactionResponse']
|
|
415
415
|
end
|
|
416
416
|
end
|
|
417
417
|
|
|
@@ -431,7 +431,7 @@ module ActiveMerchant #:nodoc:
|
|
|
431
431
|
end
|
|
432
432
|
|
|
433
433
|
def unparsable_response(raw_response)
|
|
434
|
-
message =
|
|
434
|
+
message = 'Invalid JSON response received from PayuLatamGateway. Please contact PayuLatamGateway if you continue to receive this message.'
|
|
435
435
|
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
|
436
436
|
return Response.new(false, message)
|
|
437
437
|
end
|