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
@@ -11,25 +11,25 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
self.homepage_url = 'http://merchantwarehouse.com/merchantware'
|
12
12
|
self.display_name = 'MerchantWARE'
|
13
13
|
|
14
|
-
ENV_NAMESPACES = {
|
15
|
-
|
16
|
-
|
14
|
+
ENV_NAMESPACES = { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
15
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
16
|
+
'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/'
|
17
17
|
}
|
18
|
-
ENV_NAMESPACES_V4 = {
|
19
|
-
|
20
|
-
|
18
|
+
ENV_NAMESPACES_V4 = { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
19
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
20
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
|
21
21
|
}
|
22
22
|
|
23
|
-
TX_NAMESPACE =
|
24
|
-
TX_NAMESPACE_V4 =
|
23
|
+
TX_NAMESPACE = 'http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail'
|
24
|
+
TX_NAMESPACE_V4 = 'http://schemas.merchantwarehouse.com/merchantware/40/Credit/'
|
25
25
|
|
26
26
|
ACTIONS = {
|
27
|
-
:purchase =>
|
28
|
-
:authorize =>
|
29
|
-
:capture =>
|
30
|
-
:void =>
|
31
|
-
:credit =>
|
32
|
-
:reference_credit =>
|
27
|
+
:purchase => 'IssueKeyedSale',
|
28
|
+
:authorize => 'IssueKeyedPreAuth',
|
29
|
+
:capture => 'IssuePostAuth',
|
30
|
+
:void => 'VoidPreAuthorization',
|
31
|
+
:credit => 'IssueKeyedRefund',
|
32
|
+
:reference_credit => 'IssueRefundByReference'
|
33
33
|
}
|
34
34
|
|
35
35
|
# Creates a new MerchantWareGateway
|
@@ -121,9 +121,9 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
def soap_request(action)
|
122
122
|
xml = Builder::XmlMarkup.new :indent => 2
|
123
123
|
xml.instruct!
|
124
|
-
xml.tag!
|
125
|
-
xml.tag!
|
126
|
-
xml.tag! ACTIONS[action],
|
124
|
+
xml.tag! 'env:Envelope', ENV_NAMESPACES do
|
125
|
+
xml.tag! 'env:Body' do
|
126
|
+
xml.tag! ACTIONS[action], 'xmlns' => TX_NAMESPACE do
|
127
127
|
add_credentials(xml)
|
128
128
|
yield xml
|
129
129
|
end
|
@@ -135,12 +135,12 @@ module ActiveMerchant #:nodoc:
|
|
135
135
|
def v4_soap_request(action)
|
136
136
|
xml = Builder::XmlMarkup.new :indent => 2
|
137
137
|
xml.instruct!
|
138
|
-
xml.tag!
|
139
|
-
xml.tag!
|
140
|
-
xml.tag! ACTIONS[:void],
|
141
|
-
xml.tag!
|
142
|
-
xml.tag!
|
143
|
-
xml.tag!
|
138
|
+
xml.tag! 'soap:Envelope', ENV_NAMESPACES_V4 do
|
139
|
+
xml.tag! 'soap:Body' do
|
140
|
+
xml.tag! ACTIONS[:void], 'xmlns' => TX_NAMESPACE_V4 do
|
141
|
+
xml.tag! 'merchantName', @options[:name]
|
142
|
+
xml.tag! 'merchantSiteId', @options[:login]
|
143
|
+
xml.tag! 'merchantKey', @options[:password]
|
144
144
|
yield xml
|
145
145
|
end
|
146
146
|
end
|
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
|
|
175
175
|
request = soap_request(:reference_credit) do |xml|
|
176
176
|
add_reference(xml, reference)
|
177
177
|
add_invoice(xml, options)
|
178
|
-
add_amount(xml, money,
|
178
|
+
add_amount(xml, money, 'strOverrideAmount')
|
179
179
|
end
|
180
180
|
|
181
181
|
commit(:reference_credit, request)
|
@@ -194,47 +194,47 @@ module ActiveMerchant #:nodoc:
|
|
194
194
|
end
|
195
195
|
|
196
196
|
def add_credentials(xml)
|
197
|
-
xml.tag!
|
198
|
-
xml.tag!
|
199
|
-
xml.tag!
|
197
|
+
xml.tag! 'strSiteId', @options[:login]
|
198
|
+
xml.tag! 'strKey', @options[:password]
|
199
|
+
xml.tag! 'strName', @options[:name]
|
200
200
|
end
|
201
201
|
|
202
202
|
def add_invoice(xml, options)
|
203
|
-
xml.tag!
|
203
|
+
xml.tag! 'strOrderNumber', options[:order_id].to_s.gsub(/[^\w]/, '').slice(0, 25)
|
204
204
|
end
|
205
205
|
|
206
|
-
def add_amount(xml, money, tag =
|
206
|
+
def add_amount(xml, money, tag = 'strAmount')
|
207
207
|
xml.tag! tag, amount(money)
|
208
208
|
end
|
209
209
|
|
210
210
|
def add_reference(xml, reference)
|
211
|
-
xml.tag!
|
211
|
+
xml.tag! 'strReferenceCode', reference
|
212
212
|
end
|
213
213
|
|
214
214
|
def add_reference_token(xml, reference)
|
215
|
-
xml.tag!
|
215
|
+
xml.tag! 'token', reference
|
216
216
|
end
|
217
217
|
|
218
218
|
def add_address(xml, options)
|
219
219
|
if address = options[:billing_address] || options[:address]
|
220
|
-
xml.tag!
|
221
|
-
xml.tag!
|
220
|
+
xml.tag! 'strAVSStreetAddress', address[:address1]
|
221
|
+
xml.tag! 'strAVSZipCode', address[:zip]
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
225
|
def add_credit_card(xml, credit_card)
|
226
226
|
if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
|
227
|
-
xml.tag!
|
227
|
+
xml.tag! 'trackData', credit_card.track_data
|
228
228
|
else
|
229
|
-
xml.tag!
|
230
|
-
xml.tag!
|
231
|
-
xml.tag!
|
232
|
-
xml.tag!
|
229
|
+
xml.tag! 'strPAN', credit_card.number
|
230
|
+
xml.tag! 'strExpDate', expdate(credit_card)
|
231
|
+
xml.tag! 'strCardHolder', credit_card.name
|
232
|
+
xml.tag! 'strCVCode', credit_card.verification_value if credit_card.verification_value?
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
236
236
|
def split_reference(reference)
|
237
|
-
reference.to_s.split(
|
237
|
+
reference.to_s.split(';')
|
238
238
|
end
|
239
239
|
|
240
240
|
def parse(action, data)
|
@@ -247,10 +247,10 @@ module ActiveMerchant #:nodoc:
|
|
247
247
|
response[element.name] = element.text
|
248
248
|
end
|
249
249
|
|
250
|
-
status, code, message = response[
|
250
|
+
status, code, message = response['ApprovalStatus'].split(';')
|
251
251
|
response[:status] = status
|
252
252
|
|
253
|
-
if response[:success] = status ==
|
253
|
+
if response[:success] = status == 'APPROVED'
|
254
254
|
response[:message] = status
|
255
255
|
else
|
256
256
|
response[:message] = message
|
@@ -268,17 +268,17 @@ module ActiveMerchant #:nodoc:
|
|
268
268
|
|
269
269
|
document = REXML::Document.new(http_response.body)
|
270
270
|
|
271
|
-
node = REXML::XPath.first(document,
|
271
|
+
node = REXML::XPath.first(document, '//soap:Fault')
|
272
272
|
|
273
273
|
node.elements.each do |element|
|
274
274
|
response[element.name] = element.text
|
275
275
|
end
|
276
276
|
|
277
|
-
response[:message] = response[
|
277
|
+
response[:message] = response['faultstring'].to_s.gsub("\n", ' ')
|
278
278
|
response
|
279
279
|
rescue REXML::ParseException
|
280
280
|
response[:http_body] = http_response.body
|
281
|
-
response[:message] =
|
281
|
+
response[:message] = 'Failed to parse the failed response'
|
282
282
|
response
|
283
283
|
end
|
284
284
|
|
@@ -293,8 +293,8 @@ module ActiveMerchant #:nodoc:
|
|
293
293
|
def commit(action, request, v4 = false)
|
294
294
|
begin
|
295
295
|
data = ssl_post(url(v4), request,
|
296
|
-
|
297
|
-
|
296
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
297
|
+
'SOAPAction' => soap_action(action, v4)
|
298
298
|
)
|
299
299
|
response = parse(action, data)
|
300
300
|
rescue ActiveMerchant::ResponseError => e
|
@@ -304,14 +304,14 @@ module ActiveMerchant #:nodoc:
|
|
304
304
|
Response.new(response[:success], response[:message], response,
|
305
305
|
:test => test?,
|
306
306
|
:authorization => authorization_from(response),
|
307
|
-
:avs_result => { :code => response[
|
308
|
-
:cvv_result => response[
|
307
|
+
:avs_result => { :code => response['AVSResponse'] },
|
308
|
+
:cvv_result => response['CVResponse']
|
309
309
|
)
|
310
310
|
end
|
311
311
|
|
312
312
|
def authorization_from(response)
|
313
313
|
if response[:success]
|
314
|
-
[ response[
|
314
|
+
[ response['ReferenceID'], response['OrderNumber'] ].join(';')
|
315
315
|
end
|
316
316
|
end
|
317
317
|
end
|
@@ -9,19 +9,19 @@ module ActiveMerchant #:nodoc:
|
|
9
9
|
self.homepage_url = 'http://merchantwarehouse.com/merchantware'
|
10
10
|
self.display_name = 'MerchantWARE'
|
11
11
|
|
12
|
-
ENV_NAMESPACES = {
|
13
|
-
|
14
|
-
|
12
|
+
ENV_NAMESPACES = { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
13
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
14
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' }
|
15
15
|
|
16
|
-
TX_NAMESPACE =
|
16
|
+
TX_NAMESPACE = 'http://schemas.merchantwarehouse.com/merchantware/40/Credit/'
|
17
17
|
|
18
18
|
ACTIONS = {
|
19
|
-
:purchase =>
|
19
|
+
:purchase => 'SaleKeyed',
|
20
20
|
:reference_purchase => 'RepeatSale',
|
21
|
-
:authorize =>
|
22
|
-
:capture =>
|
23
|
-
:void =>
|
24
|
-
:refund =>
|
21
|
+
:authorize => 'PreAuthorizationKeyed',
|
22
|
+
:capture => 'PostAuthorization',
|
23
|
+
:void => 'Void',
|
24
|
+
:refund => 'Refund'
|
25
25
|
}
|
26
26
|
|
27
27
|
# Creates a new MerchantWareVersionFourGateway
|
@@ -102,7 +102,7 @@ module ActiveMerchant #:nodoc:
|
|
102
102
|
request = soap_request(:refund) do |xml|
|
103
103
|
add_reference_token(xml, reference)
|
104
104
|
add_invoice(xml, options)
|
105
|
-
add_amount(xml, money,
|
105
|
+
add_amount(xml, money, 'overrideAmount')
|
106
106
|
end
|
107
107
|
|
108
108
|
commit(:refund, request)
|
@@ -131,12 +131,12 @@ module ActiveMerchant #:nodoc:
|
|
131
131
|
def soap_request(action)
|
132
132
|
xml = Builder::XmlMarkup.new :indent => 2
|
133
133
|
xml.instruct!
|
134
|
-
xml.tag!
|
135
|
-
xml.tag!
|
136
|
-
xml.tag! ACTIONS[action],
|
137
|
-
xml.tag!
|
138
|
-
xml.tag!
|
139
|
-
xml.tag!
|
134
|
+
xml.tag! 'soap:Envelope', ENV_NAMESPACES do
|
135
|
+
xml.tag! 'soap:Body' do
|
136
|
+
xml.tag! ACTIONS[action], 'xmlns' => TX_NAMESPACE do
|
137
|
+
xml.tag! 'merchantName', @options[:name]
|
138
|
+
xml.tag! 'merchantSiteId', @options[:login]
|
139
|
+
xml.tag! 'merchantKey', @options[:password]
|
140
140
|
yield xml
|
141
141
|
end
|
142
142
|
end
|
@@ -166,21 +166,21 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def add_invoice(xml, options)
|
169
|
-
xml.tag!
|
169
|
+
xml.tag! 'invoiceNumber', truncate(options[:order_id].to_s.gsub(/[^\w]/, ''), 8)
|
170
170
|
end
|
171
171
|
|
172
|
-
def add_amount(xml, money, tag =
|
172
|
+
def add_amount(xml, money, tag = 'amount')
|
173
173
|
xml.tag! tag, amount(money)
|
174
174
|
end
|
175
175
|
|
176
176
|
def add_reference_token(xml, reference)
|
177
|
-
xml.tag!
|
177
|
+
xml.tag! 'token', reference
|
178
178
|
end
|
179
179
|
|
180
180
|
def add_address(xml, options)
|
181
181
|
address = options[:billing_address] || options[:address] || {}
|
182
|
-
xml.tag!
|
183
|
-
xml.tag!
|
182
|
+
xml.tag! 'avsStreetAddress', address[:address1]
|
183
|
+
xml.tag! 'avsStreetZipCode', address[:zip]
|
184
184
|
end
|
185
185
|
|
186
186
|
def add_payment_source(xml, source)
|
@@ -192,14 +192,14 @@ module ActiveMerchant #:nodoc:
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def add_credit_card(xml, credit_card)
|
195
|
-
xml.tag!
|
196
|
-
xml.tag!
|
197
|
-
xml.tag!
|
198
|
-
xml.tag!
|
195
|
+
xml.tag! 'cardNumber', credit_card.number
|
196
|
+
xml.tag! 'expirationDate', expdate(credit_card)
|
197
|
+
xml.tag! 'cardholder', credit_card.name
|
198
|
+
xml.tag! 'cardSecurityCode', credit_card.verification_value if credit_card.verification_value?
|
199
199
|
end
|
200
200
|
|
201
201
|
def split_reference(reference)
|
202
|
-
reference.to_s.split(
|
202
|
+
reference.to_s.split(';')
|
203
203
|
end
|
204
204
|
|
205
205
|
def parse(action, data)
|
@@ -212,14 +212,14 @@ module ActiveMerchant #:nodoc:
|
|
212
212
|
response[element.name] = element.text
|
213
213
|
end
|
214
214
|
|
215
|
-
if response[
|
216
|
-
response[:message] = response[
|
215
|
+
if response['ErrorMessage'].present?
|
216
|
+
response[:message] = response['ErrorMessage']
|
217
217
|
response[:success] = false
|
218
218
|
else
|
219
|
-
status, code, message = response[
|
219
|
+
status, code, message = response['ApprovalStatus'].split(';')
|
220
220
|
response[:status] = status
|
221
221
|
|
222
|
-
if response[:success] = status ==
|
222
|
+
if response[:success] = status == 'APPROVED'
|
223
223
|
response[:message] = status
|
224
224
|
else
|
225
225
|
response[:message] = message
|
@@ -243,11 +243,11 @@ module ActiveMerchant #:nodoc:
|
|
243
243
|
response[element.name] = element.text
|
244
244
|
end
|
245
245
|
|
246
|
-
response[:message] = response[
|
246
|
+
response[:message] = response['ErrorMessage'].to_s.gsub("\n", ' ')
|
247
247
|
response
|
248
248
|
rescue REXML::ParseException
|
249
249
|
response[:http_body] = http_response.body
|
250
|
-
response[:message] =
|
250
|
+
response[:message] = 'Failed to parse the failed response'
|
251
251
|
response
|
252
252
|
end
|
253
253
|
|
@@ -262,8 +262,8 @@ module ActiveMerchant #:nodoc:
|
|
262
262
|
def commit(action, request)
|
263
263
|
begin
|
264
264
|
data = ssl_post(url, request,
|
265
|
-
|
266
|
-
|
265
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
266
|
+
'SOAPAction' => soap_action(action)
|
267
267
|
)
|
268
268
|
response = parse(action, data)
|
269
269
|
rescue ActiveMerchant::ResponseError => e
|
@@ -273,8 +273,8 @@ module ActiveMerchant #:nodoc:
|
|
273
273
|
Response.new(response[:success], response[:message], response,
|
274
274
|
:test => test?,
|
275
275
|
:authorization => authorization_from(response),
|
276
|
-
:avs_result => { :code => response[
|
277
|
-
:cvv_result => response[
|
276
|
+
:avs_result => { :code => response['AvsResponse'] },
|
277
|
+
:cvv_result => response['CvResponse']
|
278
278
|
)
|
279
279
|
end
|
280
280
|
|
@@ -119,7 +119,7 @@ module ActiveMerchant #:nodoc:
|
|
119
119
|
def add_creditcard(post, creditcard)
|
120
120
|
post['paymentCardNumber'] = creditcard.number
|
121
121
|
post['paymentCardName'] = scrub_name(creditcard.name)
|
122
|
-
post['paymentCardExpiry'] = creditcard.expiry_date.expiration.strftime(
|
122
|
+
post['paymentCardExpiry'] = creditcard.expiry_date.expiration.strftime('%m%y')
|
123
123
|
post['paymentCardCSC'] = creditcard.verification_value if creditcard.verification_value?
|
124
124
|
end
|
125
125
|
|
@@ -188,14 +188,14 @@ module ActiveMerchant #:nodoc:
|
|
188
188
|
|
189
189
|
def url_for(action, post)
|
190
190
|
if token?(post)
|
191
|
-
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join(
|
191
|
+
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join('/')
|
192
192
|
else
|
193
193
|
(test? ? POST_TEST_URL : POST_LIVE_URL)
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
197
|
def token?(post)
|
198
|
-
(post[
|
198
|
+
(post['cardID'] || post['cardName'])
|
199
199
|
end
|
200
200
|
|
201
201
|
def success?(response)
|
@@ -203,7 +203,7 @@ module ActiveMerchant #:nodoc:
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def post_data(post)
|
206
|
-
post.collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join(
|
206
|
+
post.collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
@@ -87,8 +87,8 @@ module ActiveMerchant #:nodoc:
|
|
87
87
|
|
88
88
|
def scrub(transcript)
|
89
89
|
transcript.
|
90
|
-
gsub(%r(<),
|
91
|
-
gsub(%r(>),
|
90
|
+
gsub(%r(<), '<').
|
91
|
+
gsub(%r(>), '>').
|
92
92
|
gsub(%r((<pw>).*(</pw>))i, '\1[FILTERED]\2').
|
93
93
|
gsub(%r((<AcctNo>)(\d|x)*(</AcctNo>))i, '\1[FILTERED]\3').
|
94
94
|
gsub(%r((<CVVData>)\d*(</CVVData>))i, '\1[FILTERED]\2')
|
@@ -99,15 +99,15 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
def build_non_authorized_request(action, money, credit_card, options)
|
100
100
|
xml = Builder::XmlMarkup.new
|
101
101
|
|
102
|
-
xml.tag!
|
103
|
-
xml.tag!
|
102
|
+
xml.tag! 'TStream' do
|
103
|
+
xml.tag! 'Transaction' do
|
104
104
|
xml.tag! 'TranType', 'Credit'
|
105
105
|
xml.tag! 'TranCode', action
|
106
106
|
if options[:allow_partial_auth] && (action == 'PreAuth' || action == 'Sale')
|
107
|
-
xml.tag!
|
107
|
+
xml.tag! 'PartialAuth', 'Allow'
|
108
108
|
end
|
109
109
|
add_invoice(xml, options[:order_id], nil, options)
|
110
|
-
add_reference(xml,
|
110
|
+
add_reference(xml, 'RecordNumberRequested')
|
111
111
|
add_customer_data(xml, options)
|
112
112
|
add_amount(xml, money, options)
|
113
113
|
add_credit_card(xml, credit_card, action)
|
@@ -121,15 +121,15 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
xml = Builder::XmlMarkup.new
|
122
122
|
|
123
123
|
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
|
124
|
-
ref_no =
|
124
|
+
ref_no = '1' if ref_no.blank?
|
125
125
|
|
126
|
-
xml.tag!
|
127
|
-
xml.tag!
|
126
|
+
xml.tag! 'TStream' do
|
127
|
+
xml.tag! 'Transaction' do
|
128
128
|
xml.tag! 'TranType', 'Credit'
|
129
129
|
if options[:allow_partial_auth] && (action == 'PreAuthCapture')
|
130
|
-
xml.tag!
|
130
|
+
xml.tag! 'PartialAuth', 'Allow'
|
131
131
|
end
|
132
|
-
xml.tag! 'TranCode', (@use_tokenization ? (action +
|
132
|
+
xml.tag! 'TranCode', (@use_tokenization ? (action + 'ByRecordNo') : action)
|
133
133
|
add_invoice(xml, invoice_no, ref_no, options)
|
134
134
|
add_reference(xml, record_no)
|
135
135
|
add_customer_data(xml, options)
|
@@ -137,9 +137,9 @@ module ActiveMerchant #:nodoc:
|
|
137
137
|
add_credit_card(xml, credit_card, action) if credit_card
|
138
138
|
add_address(xml, options)
|
139
139
|
xml.tag! 'TranInfo' do
|
140
|
-
xml.tag!
|
141
|
-
xml.tag!
|
142
|
-
xml.tag!
|
140
|
+
xml.tag! 'AuthCode', auth_code
|
141
|
+
xml.tag! 'AcqRefData', acq_ref_data
|
142
|
+
xml.tag! 'ProcessData', process_data
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
@@ -149,8 +149,8 @@ module ActiveMerchant #:nodoc:
|
|
149
149
|
def build_card_lookup_request(credit_card, options)
|
150
150
|
xml = Builder::XmlMarkup.new
|
151
151
|
|
152
|
-
xml.tag!
|
153
|
-
xml.tag!
|
152
|
+
xml.tag! 'TStream' do
|
153
|
+
xml.tag! 'Transaction' do
|
154
154
|
xml.tag! 'TranType', 'CardLookup'
|
155
155
|
xml.tag! 'RecordNo', 'RecordNumberRequested'
|
156
156
|
xml.tag! 'Frequency', 'OneTime'
|
@@ -172,15 +172,15 @@ module ActiveMerchant #:nodoc:
|
|
172
172
|
|
173
173
|
def add_reference(xml, record_no)
|
174
174
|
if @use_tokenization
|
175
|
-
xml.tag!
|
176
|
-
xml.tag!
|
175
|
+
xml.tag! 'Frequency', 'OneTime'
|
176
|
+
xml.tag! 'RecordNo', record_no
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
180
|
def add_customer_data(xml, options)
|
181
181
|
xml.tag! 'IpAddress', options[:ip] if options[:ip]
|
182
182
|
if options[:customer]
|
183
|
-
xml.tag!
|
183
|
+
xml.tag! 'TranInfo' do
|
184
184
|
xml.tag! 'CustomerCode', options[:customer]
|
185
185
|
end
|
186
186
|
end
|
@@ -255,12 +255,12 @@ module ActiveMerchant #:nodoc:
|
|
255
255
|
def hashify_xml!(xml, response)
|
256
256
|
xml = REXML::Document.new(xml)
|
257
257
|
|
258
|
-
xml.elements.each(
|
258
|
+
xml.elements.each('//CmdResponse/*') do |node|
|
259
259
|
response[node.name.underscore.to_sym] = node.text
|
260
260
|
end
|
261
261
|
|
262
|
-
xml.elements.each(
|
263
|
-
if node.name.to_s ==
|
262
|
+
xml.elements.each('//TranResponse/*') do |node|
|
263
|
+
if node.name.to_s == 'Amount'
|
264
264
|
node.elements.each do |amt|
|
265
265
|
response[amt.name.underscore.to_sym] = amt.text
|
266
266
|
end
|
@@ -293,8 +293,8 @@ module ActiveMerchant #:nodoc:
|
|
293
293
|
|
294
294
|
def build_header
|
295
295
|
{
|
296
|
-
|
297
|
-
|
296
|
+
'SOAPAction' => 'http://www.mercurypay.com/CreditTransaction',
|
297
|
+
'Content-Type' => 'text/xml; charset=utf-8'
|
298
298
|
}
|
299
299
|
end
|
300
300
|
|
@@ -319,7 +319,7 @@ module ActiveMerchant #:nodoc:
|
|
319
319
|
end
|
320
320
|
|
321
321
|
def authorization_from(response)
|
322
|
-
dollars, cents = (response[:purchase] ||
|
322
|
+
dollars, cents = (response[:purchase] || '').split('.').collect{|e| e.to_i}
|
323
323
|
dollars ||= 0
|
324
324
|
cents ||= 0
|
325
325
|
[
|
@@ -330,17 +330,17 @@ module ActiveMerchant #:nodoc:
|
|
330
330
|
response[:process_data],
|
331
331
|
response[:record_no],
|
332
332
|
((dollars * 100) + cents).to_s
|
333
|
-
].join(
|
333
|
+
].join(';')
|
334
334
|
end
|
335
335
|
|
336
336
|
def split_authorization(authorization)
|
337
|
-
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = authorization.split(
|
337
|
+
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = authorization.split(';')
|
338
338
|
[invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount]
|
339
339
|
end
|
340
340
|
|
341
341
|
ENVELOPE_NAMESPACES = {
|
342
342
|
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
343
|
-
'xmlns:soap' =>
|
343
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
344
344
|
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
|
345
345
|
}
|
346
346
|
|