activemerchant 1.56.0 → 1.66.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +331 -0
- data/README.md +9 -9
- data/lib/active_merchant/billing/check.rb +3 -0
- data/lib/active_merchant/billing/credit_card.rb +8 -3
- data/lib/active_merchant/billing/credit_card_methods.rb +41 -1
- data/lib/active_merchant/billing/gateway.rb +14 -6
- data/lib/active_merchant/billing/gateways/adyen.rb +228 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +157 -44
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +7 -4
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +68 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -2
- data/lib/active_merchant/billing/gateways/blue_snap.rb +348 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +58 -20
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +37 -8
- data/lib/active_merchant/billing/gateways/card_stream.rb +161 -40
- data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +5 -2
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +24 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +24 -40
- data/lib/active_merchant/billing/gateways/conekta.rb +6 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
- data/lib/active_merchant/billing/gateways/credorax.rb +310 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +80 -64
- data/lib/active_merchant/billing/gateways/data_cash.rb +10 -304
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +40 -26
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +16 -2
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -1
- data/lib/active_merchant/billing/gateways/forte.rb +10 -2
- data/lib/active_merchant/billing/gateways/global_collect.rb +311 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +1 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +13 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +33 -19
- data/lib/active_merchant/billing/gateways/kushki.rb +217 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -0
- data/lib/active_merchant/billing/gateways/litle.rb +29 -13
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -122
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -1
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +10 -7
- data/lib/active_merchant/billing/gateways/mercury.rb +13 -5
- data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +23 -1
- data/lib/active_merchant/billing/gateways/monei.rb +1 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +21 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +245 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +30 -9
- data/lib/active_merchant/billing/gateways/omise.rb +9 -5
- data/lib/active_merchant/billing/gateways/openpay.rb +10 -1
- data/lib/active_merchant/billing/gateways/opp.rb +362 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +28 -7
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +61 -12
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +6 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paymill.rb +29 -11
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -6
- data/lib/active_merchant/billing/gateways/payu_in.rb +3 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +402 -0
- data/lib/active_merchant/billing/gateways/pin.rb +6 -3
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +0 -2
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay.rb +3 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +44 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +3 -0
- data/lib/active_merchant/billing/gateways/s5.rb +8 -5
- data/lib/active_merchant/billing/gateways/safe_charge.rb +220 -0
- data/lib/active_merchant/billing/gateways/sage.rb +397 -128
- data/lib/active_merchant/billing/gateways/sage_pay.rb +45 -20
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -5
- data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +46 -17
- data/lib/active_merchant/billing/gateways/stripe.rb +125 -29
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +13 -222
- data/lib/active_merchant/billing/gateways/trans_first.rb +40 -16
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +606 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +114 -9
- data/lib/active_merchant/billing/gateways/vanco.rb +14 -10
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +73 -38
- data/lib/active_merchant/billing/gateways/wirecard.rb +1 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +48 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -0
- data/lib/active_merchant/country.rb +6 -4
- data/lib/active_merchant/posts_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- metadata +32 -13
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -89
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -115
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -97
@@ -6,23 +6,14 @@ module ActiveMerchant
|
|
6
6
|
self.default_currency = 'GBP'
|
7
7
|
self.supported_countries = ['GB']
|
8
8
|
|
9
|
-
# From the DataCash docs; Page 13, the following cards are
|
10
|
-
# usable:
|
11
|
-
# American Express, ATM, Carte Blanche, Diners Club, Discover,
|
12
|
-
# EnRoute, GE Capital, JCB, Laser, Maestro, Mastercard, Solo,
|
13
|
-
# Switch, Visa, Visa Delta, VISA Electron, Visa Purchasing
|
14
|
-
#
|
15
|
-
# Note continuous authority is only supported for :visa, :master and :american_express card types
|
16
9
|
self.supported_cardtypes = [ :visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro, :switch, :solo, :laser ]
|
17
10
|
|
18
11
|
self.homepage_url = 'http://www.datacash.com/'
|
19
12
|
self.display_name = 'DataCash'
|
20
13
|
|
21
|
-
# Datacash server URLs
|
22
14
|
self.test_url = 'https://testserver.datacash.com/Transaction'
|
23
15
|
self.live_url = 'https://mars.transaction.datacash.com/Transaction'
|
24
16
|
|
25
|
-
# Different Card Transaction Types
|
26
17
|
AUTH_TYPE = 'auth'
|
27
18
|
CANCEL_TYPE = 'cancel'
|
28
19
|
FULFILL_TYPE = 'fulfill'
|
@@ -30,44 +21,14 @@ module ActiveMerchant
|
|
30
21
|
REFUND_TYPE = 'refund'
|
31
22
|
TRANSACTION_REFUND_TYPE = 'txn_refund'
|
32
23
|
|
33
|
-
# Constant strings for use in the ExtendedPolicy complex element for
|
34
|
-
# CV2 checks
|
35
24
|
POLICY_ACCEPT = 'accept'
|
36
25
|
POLICY_REJECT = 'reject'
|
37
26
|
|
38
|
-
# Datacash success code
|
39
|
-
DATACASH_SUCCESS = '1'
|
40
|
-
|
41
|
-
# Creates a new DataCashGateway
|
42
|
-
#
|
43
|
-
# The gateway requires that a valid login and password be passed
|
44
|
-
# in the +options+ hash.
|
45
|
-
#
|
46
|
-
# ==== Options
|
47
|
-
#
|
48
|
-
# * <tt>:login</tt> -- The Datacash account login.
|
49
|
-
# * <tt>:password</tt> -- The Datacash account password.
|
50
|
-
# * <tt>:test => +true+ or +false+</tt> -- Use the test or live Datacash url.
|
51
|
-
#
|
52
27
|
def initialize(options = {})
|
53
28
|
requires!(options, :login, :password)
|
54
29
|
super
|
55
30
|
end
|
56
31
|
|
57
|
-
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
58
|
-
#
|
59
|
-
# ==== Parameters
|
60
|
-
# * <tt>money</tt> The amount to be authorized as an Integer value in cents.
|
61
|
-
# * <tt>authorization_or_credit_card</tt>:: The continuous authority reference or CreditCard details for the transaction.
|
62
|
-
# * <tt>options</tt> A hash of optional parameters.
|
63
|
-
# * <tt>:order_id</tt> A unique reference for this order (corresponds to merchantreference in datacash documentation)
|
64
|
-
# * <tt>:set_up_continuous_authority</tt>
|
65
|
-
# Set to true to set up a recurring historic transaction account be set up.
|
66
|
-
# Only supported for :visa, :master and :american_express card types
|
67
|
-
# See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
|
68
|
-
# * <tt>:address</tt>:: billing address for card
|
69
|
-
#
|
70
|
-
# The continuous authority reference will be available in response#params['ca_reference'] if you have requested one
|
71
32
|
def purchase(money, authorization_or_credit_card, options = {})
|
72
33
|
requires!(options, :order_id)
|
73
34
|
|
@@ -80,22 +41,6 @@ module ActiveMerchant
|
|
80
41
|
commit(request)
|
81
42
|
end
|
82
43
|
|
83
|
-
# Performs an authorization, which reserves the funds on the customer's credit card, but does not
|
84
|
-
# charge the card.
|
85
|
-
#
|
86
|
-
# ==== Parameters
|
87
|
-
#
|
88
|
-
# * <tt>money</tt> The amount to be authorized as an Integer value in cents.
|
89
|
-
# * <tt>authorization_or_credit_card</tt>:: The continuous authority reference or CreditCard details for the transaction.
|
90
|
-
# * <tt>options</tt> A hash of optional parameters.
|
91
|
-
# * <tt>:order_id</tt> A unique reference for this order (corresponds to merchantreference in datacash documentation)
|
92
|
-
# * <tt>:set_up_continuous_authority</tt>::
|
93
|
-
# Set to true to set up a recurring historic transaction account be set up.
|
94
|
-
# Only supported for :visa, :master and :american_express card types
|
95
|
-
# See http://www.datacash.com/services/recurring/historic.php for more details of historic transactions.
|
96
|
-
# * <tt>:address</tt>:: billing address for card
|
97
|
-
#
|
98
|
-
# The continuous authority reference will be available in response#params['ca_reference'] if you have requested one
|
99
44
|
def authorize(money, authorization_or_credit_card, options = {})
|
100
45
|
requires!(options, :order_id)
|
101
46
|
|
@@ -108,42 +53,22 @@ module ActiveMerchant
|
|
108
53
|
commit(request)
|
109
54
|
end
|
110
55
|
|
111
|
-
# Captures the funds from an authorized transaction.
|
112
|
-
#
|
113
|
-
# ==== Parameters
|
114
|
-
#
|
115
|
-
# * <tt>money</tt> -- The amount to be captured as anInteger value in cents.
|
116
|
-
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
|
117
56
|
def capture(money, authorization, options = {})
|
118
57
|
commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))
|
119
58
|
end
|
120
59
|
|
121
|
-
# Void a previous transaction
|
122
|
-
#
|
123
|
-
# ==== Parameters
|
124
|
-
#
|
125
|
-
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
|
126
60
|
def void(authorization, options = {})
|
127
61
|
request = build_void_or_capture_request(CANCEL_TYPE, nil, authorization, options)
|
128
62
|
|
129
63
|
commit(request)
|
130
64
|
end
|
131
65
|
|
132
|
-
# Refund to a card
|
133
|
-
#
|
134
|
-
# ==== Parameters
|
135
|
-
#
|
136
|
-
# * <tt>money</tt> The amount to be refunded as an Integer value in cents. Set to nil for a full refund on existing transaction.
|
137
|
-
# * <tt>reference_or_credit_card</tt> The credit card you want to refund OR the datacash_reference for the existing transaction you are refunding
|
138
|
-
# * <tt>options</tt> Are ignored when refunding via reference to an existing transaction, otherwise
|
139
|
-
# * <tt>:order_id</tt> A unique reference for this order (corresponds to merchantreference in datacash documentation)
|
140
|
-
# * <tt>:address</tt>:: billing address for card
|
141
66
|
def credit(money, reference_or_credit_card, options = {})
|
142
67
|
if reference_or_credit_card.is_a?(String)
|
143
68
|
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
144
69
|
refund(money, reference_or_credit_card)
|
145
70
|
else
|
146
|
-
request =
|
71
|
+
request = build_credit_request(money, reference_or_credit_card, options)
|
147
72
|
commit(request)
|
148
73
|
end
|
149
74
|
end
|
@@ -152,42 +77,14 @@ module ActiveMerchant
|
|
152
77
|
commit(build_transaction_refund_request(money, reference))
|
153
78
|
end
|
154
79
|
|
80
|
+
|
155
81
|
private
|
156
|
-
|
157
|
-
#
|
158
|
-
# Final XML should look like:
|
159
|
-
# <Request>
|
160
|
-
# <Authentication>
|
161
|
-
# <client>99000001</client>
|
162
|
-
# <password>******</password>
|
163
|
-
# </Authentication>
|
164
|
-
# <Transaction>
|
165
|
-
# <TxnDetails>
|
166
|
-
# <amount>25.00</amount>
|
167
|
-
# </TxnDetails>
|
168
|
-
# <HistoricTxn>
|
169
|
-
# <reference>4900200000000001</reference>
|
170
|
-
# <authcode>A6</authcode>
|
171
|
-
# <method>fulfill</method>
|
172
|
-
# </HistoricTxn>
|
173
|
-
# </Transaction>
|
174
|
-
# </Request>
|
175
|
-
#
|
176
|
-
# Parameters:
|
177
|
-
# * <tt>type</tt> must be FULFILL_TYPE or CANCEL_TYPE
|
178
|
-
# * <tt>money</tt> - optional - Integer value in cents
|
179
|
-
# * <tt>authorization</tt> - the Datacash authorization from a previous succesful authorize transaction
|
180
|
-
# * <tt>options</tt>
|
181
|
-
# * <tt>order_id</tt> - A unique reference for the transaction
|
182
|
-
#
|
183
|
-
# Returns:
|
184
|
-
# -Builder xml document
|
185
|
-
#
|
82
|
+
|
186
83
|
def build_void_or_capture_request(type, money, authorization, options)
|
187
84
|
parsed_authorization = parse_authorization_string(authorization)
|
188
85
|
xml = Builder::XmlMarkup.new :indent => 2
|
189
86
|
xml.instruct!
|
190
|
-
xml.tag! :Request do
|
87
|
+
xml.tag! :Request, :version => '2' do
|
191
88
|
add_authentication(xml)
|
192
89
|
|
193
90
|
xml.tag! :Transaction do
|
@@ -209,71 +106,10 @@ module ActiveMerchant
|
|
209
106
|
xml.target!
|
210
107
|
end
|
211
108
|
|
212
|
-
# Create the xml document for an 'auth' or 'pre' transaction with a credit card
|
213
|
-
#
|
214
|
-
# Final XML should look like:
|
215
|
-
#
|
216
|
-
# <Request>
|
217
|
-
# <Authentication>
|
218
|
-
# <client>99000000</client>
|
219
|
-
# <password>*******</password>
|
220
|
-
# </Authentication>
|
221
|
-
# <Transaction>
|
222
|
-
# <TxnDetails>
|
223
|
-
# <merchantreference>123456</merchantreference>
|
224
|
-
# <amount currency="EUR">10.00</amount>
|
225
|
-
# </TxnDetails>
|
226
|
-
# <CardTxn>
|
227
|
-
# <Card>
|
228
|
-
# <pan>4444********1111</pan>
|
229
|
-
# <expirydate>03/04</expirydate>
|
230
|
-
# <Cv2Avs>
|
231
|
-
# <street_address1>Flat 7</street_address1>
|
232
|
-
# <street_address2>89 Jumble
|
233
|
-
# Street</street_address2>
|
234
|
-
# <street_address3>Mytown</street_address3>
|
235
|
-
# <postcode>AV12FR</postcode>
|
236
|
-
# <cv2>123</cv2>
|
237
|
-
# <ExtendedPolicy>
|
238
|
-
# <cv2_policy notprovided="reject"
|
239
|
-
# notchecked="accept"
|
240
|
-
# matched="accept"
|
241
|
-
# notmatched="reject"
|
242
|
-
# partialmatch="reject"/>
|
243
|
-
# <postcode_policy notprovided="reject"
|
244
|
-
# notchecked="accept"
|
245
|
-
# matched="accept"
|
246
|
-
# notmatched="reject"
|
247
|
-
# partialmatch="accept"/>
|
248
|
-
# <address_policy notprovided="reject"
|
249
|
-
# notchecked="accept"
|
250
|
-
# matched="accept"
|
251
|
-
# notmatched="reject"
|
252
|
-
# partialmatch="accept"/>
|
253
|
-
# </ExtendedPolicy>
|
254
|
-
# </Cv2Avs>
|
255
|
-
# </Card>
|
256
|
-
# <method>auth</method>
|
257
|
-
# </CardTxn>
|
258
|
-
# </Transaction>
|
259
|
-
# </Request>
|
260
|
-
#
|
261
|
-
# Parameters:
|
262
|
-
# -type must be 'auth' or 'pre'
|
263
|
-
# -money - A money object with the price and currency
|
264
|
-
# -credit_card - The credit_card details to use
|
265
|
-
# -options:
|
266
|
-
# :order_id is the merchant reference number
|
267
|
-
# :billing_address is the billing address for the cc
|
268
|
-
# :address is the delivery address
|
269
|
-
#
|
270
|
-
# Returns:
|
271
|
-
# -xml: Builder document containing the markup
|
272
|
-
#
|
273
109
|
def build_purchase_or_authorization_request_with_credit_card_request(type, money, credit_card, options)
|
274
110
|
xml = Builder::XmlMarkup.new :indent => 2
|
275
111
|
xml.instruct!
|
276
|
-
xml.tag! :Request do
|
112
|
+
xml.tag! :Request, :version => '2' do
|
277
113
|
add_authentication(xml)
|
278
114
|
|
279
115
|
xml.tag! :Transaction do
|
@@ -294,47 +130,13 @@ module ActiveMerchant
|
|
294
130
|
xml.target!
|
295
131
|
end
|
296
132
|
|
297
|
-
# Create the xml document for an 'auth' or 'pre' transaction with
|
298
|
-
# continuous authorization
|
299
|
-
#
|
300
|
-
# Final XML should look like:
|
301
|
-
#
|
302
|
-
# <Request>
|
303
|
-
# <Transaction>
|
304
|
-
# <ContAuthTxn type="historic" />
|
305
|
-
# <TxnDetails>
|
306
|
-
# <merchantreference>3851231</merchantreference>
|
307
|
-
# <capturemethod>cont_auth</capturemethod>
|
308
|
-
# <amount currency="GBP">18.50</amount>
|
309
|
-
# </TxnDetails>
|
310
|
-
# <HistoricTxn>
|
311
|
-
# <reference>4500200040925092</reference>
|
312
|
-
# <method>auth</method>
|
313
|
-
# </HistoricTxn>
|
314
|
-
# </Transaction>
|
315
|
-
# <Authentication>
|
316
|
-
# <client>99000001</client>
|
317
|
-
# <password>mypasswd</password>
|
318
|
-
# </Authentication>
|
319
|
-
# </Request>
|
320
|
-
#
|
321
|
-
# Parameters:
|
322
|
-
# -type must be 'auth' or 'pre'
|
323
|
-
# -money - A money object with the price and currency
|
324
|
-
# -authorization - The authorization containing a continuous authority reference previously set up on a credit card
|
325
|
-
# -options:
|
326
|
-
# :order_id is the merchant reference number
|
327
|
-
#
|
328
|
-
# Returns:
|
329
|
-
# -xml: Builder document containing the markup
|
330
|
-
#
|
331
133
|
def build_purchase_or_authorization_request_with_continuous_authority_reference_request(type, money, authorization, options)
|
332
134
|
parsed_authorization = parse_authorization_string(authorization)
|
333
135
|
raise ArgumentError, "The continuous authority reference is required for continuous authority transactions" if parsed_authorization[:ca_reference].blank?
|
334
136
|
|
335
137
|
xml = Builder::XmlMarkup.new :indent => 2
|
336
138
|
xml.instruct!
|
337
|
-
xml.tag! :Request do
|
139
|
+
xml.tag! :Request, :version => '2' do
|
338
140
|
add_authentication(xml)
|
339
141
|
xml.tag! :Transaction do
|
340
142
|
xml.tag! :ContAuthTxn, :type => 'historic'
|
@@ -352,31 +154,11 @@ module ActiveMerchant
|
|
352
154
|
xml.target!
|
353
155
|
end
|
354
156
|
|
355
|
-
# Create the xml document for a full or partial refund transaction with
|
356
|
-
#
|
357
|
-
# Final XML should look like:
|
358
|
-
#
|
359
|
-
# <Request>
|
360
|
-
# <Authentication>
|
361
|
-
# <client>99000001</client>
|
362
|
-
# <password>*******</password>
|
363
|
-
# </Authentication>
|
364
|
-
# <Transaction>
|
365
|
-
# <HistoricTxn>
|
366
|
-
# <method>txn_refund</method>
|
367
|
-
# <reference>12345678</reference>
|
368
|
-
# </HistoricTxn>
|
369
|
-
# <TxnDetails>
|
370
|
-
# <amount>10.00</amount>
|
371
|
-
# </TxnDetails>
|
372
|
-
# </Transaction>
|
373
|
-
# </Request>
|
374
|
-
#
|
375
157
|
def build_transaction_refund_request(money, authorization)
|
376
158
|
parsed_authorization = parse_authorization_string(authorization)
|
377
159
|
xml = Builder::XmlMarkup.new :indent => 2
|
378
160
|
xml.instruct!
|
379
|
-
xml.tag! :Request do
|
161
|
+
xml.tag! :Request, :version => '2' do
|
380
162
|
add_authentication(xml)
|
381
163
|
xml.tag! :Transaction do
|
382
164
|
xml.tag! :HistoricTxn do
|
@@ -393,34 +175,10 @@ module ActiveMerchant
|
|
393
175
|
xml.target!
|
394
176
|
end
|
395
177
|
|
396
|
-
|
397
|
-
#
|
398
|
-
# Final XML should look like:
|
399
|
-
#
|
400
|
-
# <Request>
|
401
|
-
# <Authentication>
|
402
|
-
# <client>99000001</client>
|
403
|
-
# <password>*****</password>
|
404
|
-
# </Authentication>
|
405
|
-
# <Transaction>
|
406
|
-
# <CardTxn>
|
407
|
-
# <Card>
|
408
|
-
# <pan>633300*********1</pan>
|
409
|
-
# <expirydate>04/06</expirydate>
|
410
|
-
# <startdate>01/04</startdate>
|
411
|
-
# </Card>
|
412
|
-
# <method>refund</method>
|
413
|
-
# </CardTxn>
|
414
|
-
# <TxnDetails>
|
415
|
-
# <merchantreference>1000001</merchantreference>
|
416
|
-
# <amount currency="GBP">95.99</amount>
|
417
|
-
# </TxnDetails>
|
418
|
-
# </Transaction>
|
419
|
-
# </Request>
|
420
|
-
def build_refund_request(money, credit_card, options)
|
178
|
+
def build_credit_request(money, credit_card, options)
|
421
179
|
xml = Builder::XmlMarkup.new :indent => 2
|
422
180
|
xml.instruct!
|
423
|
-
xml.tag! :Request do
|
181
|
+
xml.tag! :Request, :version => '2' do
|
424
182
|
add_authentication(xml)
|
425
183
|
xml.tag! :Transaction do
|
426
184
|
xml.tag! :CardTxn do
|
@@ -436,15 +194,6 @@ module ActiveMerchant
|
|
436
194
|
xml.target!
|
437
195
|
end
|
438
196
|
|
439
|
-
|
440
|
-
# Adds the authentication element to the passed builder xml doc
|
441
|
-
#
|
442
|
-
# Parameters:
|
443
|
-
# -xml: Builder document that is being built up
|
444
|
-
#
|
445
|
-
# Returns:
|
446
|
-
# -none: The results is stored in the passed xml document
|
447
|
-
#
|
448
197
|
def add_authentication(xml)
|
449
198
|
xml.tag! :Authentication do
|
450
199
|
xml.tag! :client, @options[:login]
|
@@ -452,16 +201,6 @@ module ActiveMerchant
|
|
452
201
|
end
|
453
202
|
end
|
454
203
|
|
455
|
-
# Add credit_card details to the passed XML Builder doc
|
456
|
-
#
|
457
|
-
# Parameters:
|
458
|
-
# -xml: Builder document that is being built up
|
459
|
-
# -credit_card: ActiveMerchant::Billing::CreditCard object
|
460
|
-
# -billing_address: Hash containing all of the billing address details
|
461
|
-
#
|
462
|
-
# Returns:
|
463
|
-
# -none: The results is stored in the passed xml document
|
464
|
-
#
|
465
204
|
def add_credit_card(xml, credit_card, address)
|
466
205
|
|
467
206
|
xml.tag! :Card do
|
@@ -520,44 +259,19 @@ module ActiveMerchant
|
|
520
259
|
end
|
521
260
|
end
|
522
261
|
|
523
|
-
# Send the passed data to DataCash for processing
|
524
|
-
#
|
525
|
-
# Parameters:
|
526
|
-
# -request: The XML data that is to be sent to Datacash
|
527
|
-
#
|
528
|
-
# Returns:
|
529
|
-
# - ActiveMerchant::Billing::Response object
|
530
|
-
#
|
531
262
|
def commit(request)
|
532
263
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
|
533
264
|
|
534
|
-
Response.new(response[:status] ==
|
265
|
+
Response.new(response[:status] == '1', response[:reason], response,
|
535
266
|
:test => test?,
|
536
267
|
:authorization => "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}"
|
537
268
|
)
|
538
269
|
end
|
539
270
|
|
540
|
-
# Returns a date string in the format Datacash expects
|
541
|
-
#
|
542
|
-
# Parameters:
|
543
|
-
# -month: integer, the month
|
544
|
-
# -year: integer, the year
|
545
|
-
#
|
546
|
-
# Returns:
|
547
|
-
# -String: date in MM/YY format
|
548
|
-
#
|
549
271
|
def format_date(month, year)
|
550
272
|
"#{format(month,:two_digits)}/#{format(year, :two_digits)}"
|
551
273
|
end
|
552
274
|
|
553
|
-
# Parse the datacash response and create a Response object
|
554
|
-
#
|
555
|
-
# Parameters:
|
556
|
-
# -body: The XML returned from Datacash
|
557
|
-
#
|
558
|
-
# Returns:
|
559
|
-
# -a hash with all of the values returned in the Datacash XML response
|
560
|
-
#
|
561
275
|
def parse(body)
|
562
276
|
|
563
277
|
response = {}
|
@@ -571,14 +285,6 @@ module ActiveMerchant
|
|
571
285
|
response
|
572
286
|
end
|
573
287
|
|
574
|
-
# Parse an xml element
|
575
|
-
#
|
576
|
-
# Parameters:
|
577
|
-
# -response: The hash that the values are being returned in
|
578
|
-
# -node: The node that is currently being read
|
579
|
-
#
|
580
|
-
# Returns:
|
581
|
-
# - none (results are stored in the passed hash)
|
582
288
|
def parse_element(response, node)
|
583
289
|
if node.has_elements?
|
584
290
|
node.elements.each{|e| parse_element(response, e) }
|