activemerchant 1.79.2 → 1.80.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -122,7 +122,7 @@ module ActiveMerchant #:nodoc:
|
|
122
122
|
post[:state] = (address[:state].blank? ? 'NA' : address[:state].to_s)
|
123
123
|
post[:zip] = address[:zip].to_s
|
124
124
|
post[:country] = address[:country].to_s
|
125
|
-
post[:phone] = (address[:phone].to_s.gsub(/[^0-9]/, '') ||
|
125
|
+
post[:phone] = (address[:phone].to_s.gsub(/[^0-9]/, '') || '0000000')
|
126
126
|
end
|
127
127
|
|
128
128
|
if address = options[:shipping_address]
|
@@ -153,8 +153,8 @@ module ActiveMerchant #:nodoc:
|
|
153
153
|
def add_payment_cc(post, credit_card)
|
154
154
|
post[:cc] = credit_card.number
|
155
155
|
post[:cvv] = credit_card.verification_value if credit_card.verification_value?
|
156
|
-
year = sprintf(
|
157
|
-
month = sprintf(
|
156
|
+
year = sprintf('%.4i', credit_card.year)
|
157
|
+
month = sprintf('%.2i', credit_card.month)
|
158
158
|
post[:expire] = "#{month}/#{year[2..3]}"
|
159
159
|
end
|
160
160
|
|
@@ -166,10 +166,10 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
def parse(body)
|
167
167
|
if body =~ /^ID:/
|
168
168
|
body.split('~').reduce(Hash.new) { |h,v|
|
169
|
-
m = v.match(
|
169
|
+
m = v.match('(.*?):(.*)')
|
170
170
|
h.merge!(m[1].underscore.to_sym => m[2])
|
171
171
|
}
|
172
|
-
elsif (m = body.match(
|
172
|
+
elsif (m = body.match('(.*?):(.*)'))
|
173
173
|
m[1] == 'OK' ?
|
174
174
|
{ status: 'success', id: m[2] } :
|
175
175
|
{ status: 'failure', message: m[2] }
|
@@ -195,12 +195,12 @@ module ActiveMerchant #:nodoc:
|
|
195
195
|
identifier = (response[:id] || parameters[:init_transaction_id])
|
196
196
|
authorization = [identifier]
|
197
197
|
authorization << amount if amount
|
198
|
-
authorization.join(
|
198
|
+
authorization.join('|')
|
199
199
|
end
|
200
200
|
|
201
201
|
def split_authorization(authorization)
|
202
202
|
if authorization =~ /|/
|
203
|
-
identifier, amount = authorization.split(
|
203
|
+
identifier, amount = authorization.split('|')
|
204
204
|
[identifier, amount.to_i]
|
205
205
|
else
|
206
206
|
authorization
|
@@ -120,7 +120,7 @@ module ActiveMerchant #:nodoc:
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def add_invoice(post, options)
|
123
|
-
post[:description] = options[:description] ||
|
123
|
+
post[:description] = options[:description] || 'Active Merchant Purchase'
|
124
124
|
end
|
125
125
|
|
126
126
|
def add_creditcard(post, creditcard)
|
@@ -145,8 +145,8 @@ module ActiveMerchant #:nodoc:
|
|
145
145
|
|
146
146
|
def headers(params = {})
|
147
147
|
result = {
|
148
|
-
|
149
|
-
|
148
|
+
'Content-Type' => 'application/json',
|
149
|
+
'Authorization' => "Basic #{Base64.strict_encode64(options[:api_key] + ':').strip}"
|
150
150
|
}
|
151
151
|
|
152
152
|
result['X-Partner-Key'] = params[:partner_key] if params[:partner_key]
|
@@ -190,13 +190,13 @@ module ActiveMerchant #:nodoc:
|
|
190
190
|
end
|
191
191
|
|
192
192
|
def unparsable_response(raw_response)
|
193
|
-
message =
|
193
|
+
message = 'Invalid JSON response received from Trexle. Please contact support@trexle.com if you continue to receive this message.'
|
194
194
|
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
195
195
|
return Response.new(false, message)
|
196
196
|
end
|
197
197
|
|
198
198
|
def invalid_response
|
199
|
-
message =
|
199
|
+
message = 'Invalid response.'
|
200
200
|
return Response.new(false, message)
|
201
201
|
end
|
202
202
|
|
@@ -67,38 +67,38 @@ module ActiveMerchant #:nodoc:
|
|
67
67
|
class TrustCommerceGateway < Gateway
|
68
68
|
self.live_url = self.test_url = 'https://vault.trustcommerce.com/trans/'
|
69
69
|
|
70
|
-
SUCCESS_TYPES = [
|
70
|
+
SUCCESS_TYPES = ['approved', 'accepted']
|
71
71
|
|
72
72
|
DECLINE_CODES = {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
73
|
+
'decline' => 'The credit card was declined',
|
74
|
+
'avs' => 'AVS failed; the address entered does not match the billing address on file at the bank',
|
75
|
+
'cvv' => 'CVV failed; the number provided is not the correct verification number for the card',
|
76
|
+
'call' => 'The card must be authorized manually over the phone',
|
77
|
+
'expiredcard' => 'Issuer was not certified for card verification',
|
78
|
+
'carderror' => 'Card number is invalid',
|
79
|
+
'authexpired' => 'Attempt to postauth an expired (more than 14 days old) preauth',
|
80
|
+
'fraud' => 'CrediGuard fraud score was below requested threshold',
|
81
|
+
'blacklist' => 'CrediGuard blacklist value was triggered',
|
82
|
+
'velocity' => 'CrediGuard velocity control value was triggered',
|
83
|
+
'dailylimit' => 'Daily limit in transaction count or amount as been reached',
|
84
|
+
'weeklylimit' => 'Weekly limit in transaction count or amount as been reached',
|
85
|
+
'monthlylimit' => 'Monthly limit in transaction count or amount as been reached'
|
86
86
|
}
|
87
87
|
|
88
88
|
BADDATA_CODES = {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
'missingfields' => 'One or more parameters required for this transaction type were not sent',
|
90
|
+
'extrafields' => 'Parameters not allowed for this transaction type were sent',
|
91
|
+
'badformat' => 'A field was improperly formatted, such as non-digit characters in a number field',
|
92
|
+
'badlength' => 'A field was longer or shorter than the server allows',
|
93
|
+
'merchantcantaccept' => "The merchant can't accept data passed in this field",
|
94
|
+
'mismatch' => 'Data in one of the offending fields did not cross-check with the other offending field'
|
95
95
|
}
|
96
96
|
|
97
97
|
ERROR_CODES = {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
98
|
+
'cantconnect' => "Couldn't connect to the TrustCommerce gateway",
|
99
|
+
'dnsfailure' => 'The TCLink software was unable to resolve DNS hostnames',
|
100
|
+
'linkfailure' => 'The connection was established, but was severed before the transaction could complete',
|
101
|
+
'failtoprocess' => 'The bank servers are offline and unable to authorize transactions'
|
102
102
|
}
|
103
103
|
|
104
104
|
TEST_LOGIN = 'TestMerchant'
|
@@ -313,7 +313,7 @@ module ActiveMerchant #:nodoc:
|
|
313
313
|
end
|
314
314
|
|
315
315
|
def add_creditcard(params, creditcard)
|
316
|
-
params[:media] =
|
316
|
+
params[:media] = 'cc'
|
317
317
|
params[:name] = creditcard.name
|
318
318
|
params[:cc] = creditcard.number
|
319
319
|
params[:exp] = expdate(creditcard)
|
@@ -370,7 +370,7 @@ module ActiveMerchant #:nodoc:
|
|
370
370
|
end
|
371
371
|
|
372
372
|
def post_data(parameters)
|
373
|
-
parameters.collect { |key, value| "#{key}=#{ CGI.escape(value.to_s)}" }.join(
|
373
|
+
parameters.collect { |key, value| "#{key}=#{ CGI.escape(value.to_s)}" }.join('&')
|
374
374
|
end
|
375
375
|
|
376
376
|
def commit(action, parameters)
|
@@ -388,13 +388,13 @@ module ActiveMerchant #:nodoc:
|
|
388
388
|
end
|
389
389
|
|
390
390
|
# to be considered successful, transaction status must be either "approved" or "accepted"
|
391
|
-
success = SUCCESS_TYPES.include?(data[
|
391
|
+
success = SUCCESS_TYPES.include?(data['status'])
|
392
392
|
message = message_from(data)
|
393
393
|
Response.new(success, message, data,
|
394
394
|
:test => test?,
|
395
|
-
:authorization => data[
|
396
|
-
:cvv_result => data[
|
397
|
-
:avs_result => { :code => data[
|
395
|
+
:authorization => data['transid'],
|
396
|
+
:cvv_result => data['cvv'],
|
397
|
+
:avs_result => { :code => data['avs'] }
|
398
398
|
)
|
399
399
|
end
|
400
400
|
|
@@ -410,15 +410,15 @@ module ActiveMerchant #:nodoc:
|
|
410
410
|
end
|
411
411
|
|
412
412
|
def message_from(data)
|
413
|
-
case data[
|
414
|
-
when
|
415
|
-
return DECLINE_CODES[data[
|
416
|
-
when
|
417
|
-
return BADDATA_CODES[data[
|
418
|
-
when
|
419
|
-
return ERROR_CODES[data[
|
413
|
+
case data['status']
|
414
|
+
when 'decline'
|
415
|
+
return DECLINE_CODES[data['declinetype']]
|
416
|
+
when 'baddata'
|
417
|
+
return BADDATA_CODES[data['error']]
|
418
|
+
when 'error'
|
419
|
+
return ERROR_CODES[data['errortype']]
|
420
420
|
else
|
421
|
-
return
|
421
|
+
return 'The transaction was successful'
|
422
422
|
end
|
423
423
|
end
|
424
424
|
|
@@ -14,10 +14,10 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
# create an instance of UsaEpayAdvancedGateway.
|
15
15
|
#
|
16
16
|
def self.new(options={})
|
17
|
-
|
18
|
-
UsaEpayTransactionGateway.new(options)
|
19
|
-
else
|
17
|
+
if options.has_key?(:software_id) || options.has_key?(:live_url)
|
20
18
|
UsaEpayAdvancedGateway.new(options)
|
19
|
+
else
|
20
|
+
UsaEpayTransactionGateway.new(options)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
62
62
|
# * {USA ePay Developer Login}[https://www.usaepay.com/developer/login]
|
63
63
|
#
|
64
64
|
class UsaEpayAdvancedGateway < Gateway
|
65
|
-
API_VERSION =
|
65
|
+
API_VERSION = '1.4'
|
66
66
|
|
67
67
|
TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
|
68
68
|
LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
|
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
|
|
70
70
|
self.test_url = TEST_URL_BASE
|
71
71
|
self.live_url = LIVE_URL_BASE
|
72
72
|
|
73
|
-
FAILURE_MESSAGE =
|
73
|
+
FAILURE_MESSAGE = 'Default Failure' #:nodoc:
|
74
74
|
|
75
75
|
self.supported_countries = ['US']
|
76
76
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
@@ -1032,14 +1032,14 @@ module ActiveMerchant #:nodoc:
|
|
1032
1032
|
def build_request(action, options = {})
|
1033
1033
|
soap = Builder::XmlMarkup.new
|
1034
1034
|
soap.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
|
1035
|
-
soap.tag!
|
1035
|
+
soap.tag! 'SOAP-ENV:Envelope',
|
1036
1036
|
'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
1037
1037
|
'xmlns:ns1' => 'urn:usaepay',
|
1038
1038
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
1039
1039
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
1040
1040
|
'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
1041
1041
|
'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' do
|
1042
|
-
soap.tag!
|
1042
|
+
soap.tag! 'SOAP-ENV:Body' do
|
1043
1043
|
send("build_#{action}", soap, options)
|
1044
1044
|
end
|
1045
1045
|
end
|
@@ -1058,9 +1058,9 @@ module ActiveMerchant #:nodoc:
|
|
1058
1058
|
soap.Token 'xsi:type' => 'ns1:ueSecurityToken' do
|
1059
1059
|
build_tag soap, :string, 'ClientIP', options[:client_ip]
|
1060
1060
|
soap.PinHash 'xsi:type' => 'ns1:ueHash' do
|
1061
|
-
build_tag soap, :string,
|
1062
|
-
build_tag soap, :string,
|
1063
|
-
build_tag soap, :string,
|
1061
|
+
build_tag soap, :string, 'HashValue', hash
|
1062
|
+
build_tag soap, :string, 'Seed', seed
|
1063
|
+
build_tag soap, :string, 'Type', 'sha1'
|
1064
1064
|
end
|
1065
1065
|
build_tag soap, :string, 'SourceKey', @options[:login]
|
1066
1066
|
end
|
@@ -1069,12 +1069,12 @@ module ActiveMerchant #:nodoc:
|
|
1069
1069
|
# Customer ======================================================
|
1070
1070
|
|
1071
1071
|
def build_add_customer(soap, options)
|
1072
|
-
soap.tag!
|
1072
|
+
soap.tag! 'ns1:addCustomer' do
|
1073
1073
|
build_token soap, options
|
1074
1074
|
build_customer_data soap, options
|
1075
1075
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
1076
1076
|
build_tag soap, :double, 'Tax', amount(options[:tax])
|
1077
|
-
build_tag soap, :string, 'Next', options[:next].strftime(
|
1077
|
+
build_tag soap, :string, 'Next', options[:next].strftime('%Y-%m-%d') if options[:next]
|
1078
1078
|
end
|
1079
1079
|
end
|
1080
1080
|
|
@@ -1103,15 +1103,15 @@ module ActiveMerchant #:nodoc:
|
|
1103
1103
|
end
|
1104
1104
|
|
1105
1105
|
def build_quick_update_customer(soap, options)
|
1106
|
-
soap.tag!
|
1106
|
+
soap.tag! 'ns1:quickUpdateCustomer' do
|
1107
1107
|
build_token soap, options
|
1108
1108
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1109
|
-
build_field_value_array soap,
|
1109
|
+
build_field_value_array soap, 'UpdateData', 'FieldValue', options[:update_data], CUSTOMER_UPDATE_DATA_FIELDS
|
1110
1110
|
end
|
1111
1111
|
end
|
1112
1112
|
|
1113
1113
|
def build_add_customer_payment_method(soap, options)
|
1114
|
-
soap.tag!
|
1114
|
+
soap.tag! 'ns1:addCustomerPaymentMethod' do
|
1115
1115
|
build_token soap, options
|
1116
1116
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1117
1117
|
build_customer_payment_methods soap, options
|
@@ -1141,7 +1141,7 @@ module ActiveMerchant #:nodoc:
|
|
1141
1141
|
end
|
1142
1142
|
|
1143
1143
|
def build_delete_customer_payment_method(soap, options)
|
1144
|
-
soap.tag!
|
1144
|
+
soap.tag! 'ns1:deleteCustomerPaymentMethod' do
|
1145
1145
|
build_token soap, options
|
1146
1146
|
build_tag soap, :integer, 'Custnum', options[:customer_number]
|
1147
1147
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id]
|
@@ -1149,7 +1149,7 @@ module ActiveMerchant #:nodoc:
|
|
1149
1149
|
end
|
1150
1150
|
|
1151
1151
|
def build_run_customer_transaction(soap, options)
|
1152
|
-
soap.tag!
|
1152
|
+
soap.tag! 'ns1:runCustomerTransaction' do
|
1153
1153
|
build_token soap, options
|
1154
1154
|
build_tag soap, :integer, 'CustNum', options[:customer_number]
|
1155
1155
|
build_tag soap, :integer, 'PaymentMethodID', options[:method_id] || 0
|
@@ -1226,21 +1226,21 @@ module ActiveMerchant #:nodoc:
|
|
1226
1226
|
end
|
1227
1227
|
|
1228
1228
|
def build_get_transaction(soap, options)
|
1229
|
-
soap.tag!
|
1229
|
+
soap.tag! 'ns1:getTransaction' do
|
1230
1230
|
build_token soap, options
|
1231
1231
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1232
1232
|
end
|
1233
1233
|
end
|
1234
1234
|
|
1235
1235
|
def build_get_transaction_status(soap, options)
|
1236
|
-
soap.tag!
|
1236
|
+
soap.tag! 'ns1:getTransactionStatus' do
|
1237
1237
|
build_token soap, options
|
1238
1238
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1239
1239
|
end
|
1240
1240
|
end
|
1241
1241
|
|
1242
1242
|
def build_get_transaction_custom(soap, options)
|
1243
|
-
soap.tag!
|
1243
|
+
soap.tag! 'ns1:getTransactionCustom' do
|
1244
1244
|
build_token soap, options
|
1245
1245
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1246
1246
|
build_transaction_field_array soap, options
|
@@ -1248,14 +1248,14 @@ module ActiveMerchant #:nodoc:
|
|
1248
1248
|
end
|
1249
1249
|
|
1250
1250
|
def build_get_check_trace(soap, options)
|
1251
|
-
soap.tag!
|
1251
|
+
soap.tag! 'ns1:getCheckTrace' do
|
1252
1252
|
build_token soap, options
|
1253
1253
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1254
1254
|
end
|
1255
1255
|
end
|
1256
1256
|
|
1257
1257
|
def build_capture_transaction(soap, options)
|
1258
|
-
soap.tag!
|
1258
|
+
soap.tag! 'ns1:captureTransaction' do
|
1259
1259
|
build_token soap, options
|
1260
1260
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1261
1261
|
build_tag soap, :double, 'Amount', amount(options[:amount])
|
@@ -1263,14 +1263,14 @@ module ActiveMerchant #:nodoc:
|
|
1263
1263
|
end
|
1264
1264
|
|
1265
1265
|
def build_void_transaction(soap, options)
|
1266
|
-
soap.tag!
|
1266
|
+
soap.tag! 'ns1:voidTransaction' do
|
1267
1267
|
build_token soap, options
|
1268
1268
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1269
1269
|
end
|
1270
1270
|
end
|
1271
1271
|
|
1272
1272
|
def build_refund_transaction(soap, options)
|
1273
|
-
soap.tag!
|
1273
|
+
soap.tag! 'ns1:refundTransaction' do
|
1274
1274
|
build_token soap, options
|
1275
1275
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1276
1276
|
build_tag soap, :integer, 'Amount', amount(options[:amount])
|
@@ -1278,7 +1278,7 @@ module ActiveMerchant #:nodoc:
|
|
1278
1278
|
end
|
1279
1279
|
|
1280
1280
|
def build_override_transaction(soap, options)
|
1281
|
-
soap.tag!
|
1281
|
+
soap.tag! 'ns1:overrideTransaction' do
|
1282
1282
|
build_token soap, options
|
1283
1283
|
build_tag soap, :integer, 'RefNum', options[:reference_number]
|
1284
1284
|
build_tag soap, :string, 'Reason', options[:reason]
|
@@ -1288,7 +1288,7 @@ module ActiveMerchant #:nodoc:
|
|
1288
1288
|
# Account =======================================================
|
1289
1289
|
|
1290
1290
|
def build_get_account_details(soap, options)
|
1291
|
-
soap.tag!
|
1291
|
+
soap.tag! 'ns1:getAccountDetails' do
|
1292
1292
|
build_token soap, options
|
1293
1293
|
end
|
1294
1294
|
end
|
@@ -1310,7 +1310,7 @@ module ActiveMerchant #:nodoc:
|
|
1310
1310
|
if options[:payment_methods]
|
1311
1311
|
length = options[:payment_methods].length
|
1312
1312
|
soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
|
1313
|
-
'xsi:type' =>
|
1313
|
+
'xsi:type' =>'ns1:PaymentMethodArray' do
|
1314
1314
|
build_customer_payment_methods soap, options
|
1315
1315
|
end
|
1316
1316
|
end
|
@@ -1357,7 +1357,7 @@ module ActiveMerchant #:nodoc:
|
|
1357
1357
|
def build_customer_payment_methods(soap, options)
|
1358
1358
|
payment_methods, tag_name = extract_methods_and_tag(options)
|
1359
1359
|
payment_methods.each do |payment_method|
|
1360
|
-
soap.tag! tag_name, 'xsi:type' =>
|
1360
|
+
soap.tag! tag_name, 'xsi:type' => 'ns1:PaymentMethod' do
|
1361
1361
|
build_tag soap, :integer, 'MethodID', payment_method[:method_id]
|
1362
1362
|
build_tag soap, :string, 'MethodType', payment_method[:type]
|
1363
1363
|
build_tag soap, :string, 'MethodName', payment_method[:name]
|
@@ -1368,7 +1368,7 @@ module ActiveMerchant #:nodoc:
|
|
1368
1368
|
end
|
1369
1369
|
|
1370
1370
|
def build_customer_transaction(soap, options)
|
1371
|
-
soap.Parameters 'xsi:type' =>
|
1371
|
+
soap.Parameters 'xsi:type' => 'ns1:CustomerTransactionRequest' do
|
1372
1372
|
build_transaction_detail soap, options
|
1373
1373
|
CUSTOMER_TRANSACTION_REQUEST_OPTIONS.each do |k,v|
|
1374
1374
|
build_tag soap, v[0], v[1], options[k]
|
@@ -1381,7 +1381,7 @@ module ActiveMerchant #:nodoc:
|
|
1381
1381
|
# Transaction Helpers ===========================================
|
1382
1382
|
|
1383
1383
|
def build_transaction_request_object(soap, options, name='Params')
|
1384
|
-
soap.tag! name, 'xsi:type' =>
|
1384
|
+
soap.tag! name, 'xsi:type' => 'ns1:TransactionRequestObject' do
|
1385
1385
|
TRANSACTION_REQUEST_OBJECT_OPTIONS.each do |k,v|
|
1386
1386
|
build_tag soap, v[0], v[1], options[k]
|
1387
1387
|
end
|
@@ -1404,7 +1404,7 @@ module ActiveMerchant #:nodoc:
|
|
1404
1404
|
end
|
1405
1405
|
|
1406
1406
|
def build_transaction_detail(soap, options)
|
1407
|
-
soap.Details 'xsi:type' =>
|
1407
|
+
soap.Details 'xsi:type' => 'ns1:TransactionDetail' do
|
1408
1408
|
TRANSACTION_DETAIL_OPTIONS.each do |k,v|
|
1409
1409
|
build_tag soap, v[0], v[1], options[k]
|
1410
1410
|
end
|
@@ -1415,7 +1415,7 @@ module ActiveMerchant #:nodoc:
|
|
1415
1415
|
end
|
1416
1416
|
|
1417
1417
|
def build_credit_card_data(soap, options)
|
1418
|
-
soap.CreditCardData 'xsi:type' =>
|
1418
|
+
soap.CreditCardData 'xsi:type' => 'ns1:CreditCardData' do
|
1419
1419
|
build_tag soap, :string, 'CardNumber', options[:payment_method].number
|
1420
1420
|
build_tag soap, :string, 'CardExpiration', build_card_expiration(options)
|
1421
1421
|
if options[:billing_address]
|
@@ -1439,7 +1439,7 @@ module ActiveMerchant #:nodoc:
|
|
1439
1439
|
end
|
1440
1440
|
|
1441
1441
|
def build_check_data(soap, options)
|
1442
|
-
soap.CheckData 'xsi:type' =>
|
1442
|
+
soap.CheckData 'xsi:type' => 'ns1:CheckData' do
|
1443
1443
|
build_tag soap, :integer, 'CheckNumber', options[:payment_method].number
|
1444
1444
|
build_tag soap, :string, 'Account', options[:payment_method].account_number
|
1445
1445
|
build_tag soap, :string, 'Routing', options[:payment_method].routing_number
|
@@ -1452,10 +1452,10 @@ module ActiveMerchant #:nodoc:
|
|
1452
1452
|
|
1453
1453
|
def build_recurring_billing(soap, options)
|
1454
1454
|
if options[:recurring]
|
1455
|
-
soap.RecurringBilling 'xsi:type' =>
|
1455
|
+
soap.RecurringBilling 'xsi:type' => 'ns1:RecurringBilling' do
|
1456
1456
|
build_tag soap, :double, 'Amount', amount(options[:recurring][:amount])
|
1457
|
-
build_tag soap, :string, 'Next', options[:recurring][:next].strftime(
|
1458
|
-
build_tag soap, :string, 'Expire', options[:recurring][:expire].strftime(
|
1457
|
+
build_tag soap, :string, 'Next', options[:recurring][:next].strftime('%Y-%m-%d') if options[:recurring][:next]
|
1458
|
+
build_tag soap, :string, 'Expire', options[:recurring][:expire].strftime('%Y-%m-%d') if options[:recurring][:expire]
|
1459
1459
|
RECURRING_BILLING_OPTIONS.each do |k,v|
|
1460
1460
|
build_tag soap, v[0], v[1], options[:recurring][k]
|
1461
1461
|
end
|
@@ -1478,7 +1478,7 @@ module ActiveMerchant #:nodoc:
|
|
1478
1478
|
if options[:billing_address][:name]
|
1479
1479
|
options[:billing_address][:first_name], options[:billing_address][:last_name] = split_names(options[:billing_address][:name])
|
1480
1480
|
end
|
1481
|
-
soap.BillingAddress 'xsi:type' =>
|
1481
|
+
soap.BillingAddress 'xsi:type' => 'ns1:Address' do
|
1482
1482
|
ADDRESS_OPTIONS.each do |k,v|
|
1483
1483
|
build_tag soap, v[0], v[1], options[:billing_address][k]
|
1484
1484
|
end
|
@@ -1491,7 +1491,7 @@ module ActiveMerchant #:nodoc:
|
|
1491
1491
|
if options[:shipping_address][:name]
|
1492
1492
|
options[:shipping_address][:first_name], options[:shipping_address][:last_name] = split_names(options[:shipping_address][:name])
|
1493
1493
|
end
|
1494
|
-
soap.ShippingAddress 'xsi:type' =>
|
1494
|
+
soap.ShippingAddress 'xsi:type' => 'ns1:Address' do
|
1495
1495
|
ADDRESS_OPTIONS.each do |k,v|
|
1496
1496
|
build_tag soap, v[0], v[1], options[:shipping_address][k]
|
1497
1497
|
end
|
@@ -1526,7 +1526,7 @@ module ActiveMerchant #:nodoc:
|
|
1526
1526
|
url = test? ? test_url : live_url
|
1527
1527
|
|
1528
1528
|
begin
|
1529
|
-
soap = ssl_post(url, request,
|
1529
|
+
soap = ssl_post(url, request, 'Content-Type' => 'text/xml')
|
1530
1530
|
rescue ActiveMerchant::ResponseError => error
|
1531
1531
|
soap = error.response.body
|
1532
1532
|
end
|
@@ -1558,7 +1558,7 @@ module ActiveMerchant #:nodoc:
|
|
1558
1558
|
|
1559
1559
|
def parse(action, soap)
|
1560
1560
|
xml = REXML::Document.new(soap)
|
1561
|
-
root = REXML::XPath.first(xml,
|
1561
|
+
root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
|
1562
1562
|
response = root ? parse_element(root[0]) : { :response => soap }
|
1563
1563
|
|
1564
1564
|
success, message, authorization, avs, cvv = false, FAILURE_MESSAGE, nil, nil, nil
|