activemerchant 1.28.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data.tar.gz.sig +3 -3
  2. data/CHANGELOG +36 -0
  3. data/CONTRIBUTORS +8 -0
  4. data/README.md +5 -0
  5. data/lib/active_merchant/billing/gateway.rb +2 -1
  6. data/lib/active_merchant/billing/gateways.rb +6 -7
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  9. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  10. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  11. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  12. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  14. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  15. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  16. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  17. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  19. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  20. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  21. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  23. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  24. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  25. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  26. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  27. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  28. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  29. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  30. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  31. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  32. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  33. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  34. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  35. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  36. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  39. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  40. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  41. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  42. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  43. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  44. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  45. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  46. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  47. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  48. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  49. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  50. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  51. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  54. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  55. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  56. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  57. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  58. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  59. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  62. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  63. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  64. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  65. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  67. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  68. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  69. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  70. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  71. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  72. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  75. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  76. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  77. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  78. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  80. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  81. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  82. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  83. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  84. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  85. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  86. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  87. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  88. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  89. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  90. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  91. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  92. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  93. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  94. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  95. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  99. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  102. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  103. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
  104. data/lib/active_merchant/billing/integrations/notification.rb +4 -0
  105. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  110. data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
  111. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
  112. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
  113. data/lib/active_merchant/billing/response.rb +19 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. metadata +45 -27
  116. metadata.gz.sig +0 -0
@@ -3,71 +3,70 @@ module ActiveMerchant #:nodoc:
3
3
  class EwayManagedGateway < Gateway
4
4
  self.test_url = 'https://www.eway.com.au/gateway/ManagedPaymentService/test/managedCreditCardPayment.asmx'
5
5
  self.live_url = 'https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx'
6
-
6
+
7
7
  # The countries the gateway supports merchants from as 2 digit ISO country codes
8
8
  self.supported_countries = ['AU']
9
-
9
+
10
10
  # The card types supported by the payment gateway
11
11
  self.supported_cardtypes = [:visa, :master]
12
-
12
+
13
13
  self.default_currency = 'AUD'
14
-
14
+
15
15
  #accepted money format
16
16
  self.money_format = :cents
17
-
17
+
18
18
  # The homepage URL of the gateway
19
19
  self.homepage_url = 'http://www.eway.com.au/'
20
-
20
+
21
21
  # The name of the gateway
22
22
  self.display_name = 'eWay Managed Payments'
23
-
23
+
24
24
  def initialize(options = {})
25
25
  requires!(options, :login, :username, :password)
26
- @options = options
27
26
 
28
27
  # eWay returns 500 code for faults, which AM snaffles.
29
28
  # So, we tell it to allow them.
30
- @options[:ignore_http_status]=true
29
+ options[:ignore_http_status] = true
31
30
  super
32
- end
33
-
31
+ end
32
+
34
33
  # add a new customer CC to your eway account and return unique ManagedCustomerID
35
34
  # supports storing details required by eway see "add_creditcard" and "add_address"
36
35
  def store(creditcard, options = {})
37
36
  post = {}
38
-
37
+
39
38
  # Handle our required fields
40
39
  requires!(options, :billing_address)
41
40
 
42
41
  # Handle eWay specific required fields.
43
42
  billing_address = options[:billing_address]
44
43
  eway_requires!(billing_address)
45
-
44
+
46
45
  add_creditcard(post, creditcard)
47
46
  add_address(post, billing_address)
48
47
  add_misc_fields(post, options)
49
-
48
+
50
49
  commit("CreateCustomer", post)
51
50
  end
52
-
51
+
53
52
  def update(billing_id, creditcard, options={})
54
53
  post = {}
55
-
54
+
56
55
  # Handle our required fields
57
56
  requires!(options, :billing_address)
58
57
 
59
58
  # Handle eWay specific required fields.
60
59
  billing_address = options[:billing_address]
61
60
  eway_requires!(billing_address)
62
-
61
+
63
62
  post[:managedCustomerID]=billing_id
64
63
  add_creditcard(post, creditcard)
65
64
  add_address(post, billing_address)
66
65
  add_misc_fields(post, options)
67
-
66
+
68
67
  commit("UpdateCustomer", post)
69
68
  end
70
-
69
+
71
70
  # Process a payment in the given amount against the stored credit card given by billing_id
72
71
  #
73
72
  # ==== Parameters
@@ -81,39 +80,36 @@ module ActiveMerchant #:nodoc:
81
80
  # * <tt>:order_id</tt> -- The order number, passed to eWay as the "Invoice Reference"
82
81
  # * <tt>:invoice</tt> -- The invoice number, passed to eWay as the "Invoice Reference" unless :order_id is also given
83
82
  # * <tt>:description</tt> -- A description of the payment, passed to eWay as the "Invoice Description"
84
- def purchase(money, billing_id, options={})
85
- post = {}
83
+ def purchase(money, billing_id, options={})
84
+ post = {}
86
85
  post[:managedCustomerID] = billing_id.to_s
87
86
  post[:amount]=money
88
87
  add_invoice(post, options)
89
-
88
+
90
89
  commit("ProcessPayment", post)
91
90
  end
92
-
91
+
93
92
  # TODO: eWay API also provides QueryCustomer
94
93
  # TODO: eWay API also provides QueryPayment
95
-
96
- def test?
97
- @options[:test] || Base.gateway_mode == :test
98
- end
99
- private
94
+
95
+ private
100
96
 
101
97
  def eway_requires!(hash)
102
98
  raise ArgumentError.new("Missing eWay required parameter in `billing_address`: title") unless hash.has_key?(:title)
103
99
  raise ArgumentError.new("Missing eWay required parameter in `billing_address`: country") unless hash.has_key?(:country)
104
100
  end
105
-
106
- def add_address(post, address)
101
+
102
+ def add_address(post, address)
107
103
  post[:Address] = address[:address1].to_s
108
104
  post[:Phone] = address[:phone].to_s
109
- post[:PostCode] = address[:zip].to_s
105
+ post[:PostCode] = address[:zip].to_s
110
106
  post[:Suburb] = address[:city].to_s
111
107
  post[:Country] = address[:country].to_s.downcase
112
- post[:State] = address[:state].to_s
108
+ post[:State] = address[:state].to_s
113
109
  post[:Mobile] = address[:mobile].to_s
114
110
  post[:Fax] = address[:fax].to_s
115
111
  end
116
-
112
+
117
113
  def add_misc_fields(post, options)
118
114
  post[:CustomerRef]=options[:billing_address][:customer_ref] || options[:customer]
119
115
  post[:Title]=options[:billing_address][:title]
@@ -123,13 +119,13 @@ private
123
119
  post[:URL]=options[:billing_address][:url]
124
120
  post[:Comments]=options[:description]
125
121
  end
126
-
122
+
127
123
  def add_invoice(post, options)
128
124
  post[:invoiceReference] = options[:order_id] || options[:invoice]
129
125
  post[:invoiceDescription] = options[:description]
130
126
  end
131
-
132
-
127
+
128
+
133
129
  # add credit card details to be stored by eway. NOTE eway requires "title" field
134
130
  def add_creditcard(post, creditcard)
135
131
  post[:CCNumber] = creditcard.number
@@ -139,7 +135,7 @@ private
139
135
  post[:FirstName] = creditcard.first_name
140
136
  post[:LastName] = creditcard.last_name
141
137
  end
142
-
138
+
143
139
  def parse(body)
144
140
  reply = {}
145
141
  xml = REXML::Document.new(body)
@@ -175,23 +171,23 @@ private
175
171
  end
176
172
  return reply
177
173
  end
178
-
174
+
179
175
  def parse_fault(node)
180
176
  reply={}
181
177
  reply[:message]=REXML::XPath.first(node, '//soap:Reason/soap:Text').text
182
178
  reply[:success]=false
183
179
  reply
184
180
  end
185
-
181
+
186
182
  def parse_purchase(node)
187
183
  reply={}
188
184
  reply[:message]=REXML::XPath.first(node, '//ewayTrxnError').text
189
185
  reply[:success]=(REXML::XPath.first(node, '//ewayTrxnStatus').text == 'True')
190
186
  reply[:auth_code]=REXML::XPath.first(node, '//ewayAuthCode').text
191
- reply[:transaction_number]=REXML::XPath.first(node, '//ewayTrxnNumber').text
187
+ reply[:transaction_number]=REXML::XPath.first(node, '//ewayTrxnNumber').text
192
188
  reply
193
189
  end
194
-
190
+
195
191
  def commit(action, post)
196
192
  raw = begin
197
193
  ssl_post(test? ? self.test_url : self.live_url, soap_request(post, action), 'Content-Type' => 'application/soap+xml; charset=utf-8')
@@ -199,23 +195,23 @@ private
199
195
  e.response.body
200
196
  end
201
197
  response = parse(raw)
202
-
203
- EwayResponse.new(response[:success], response[:message], response,
198
+
199
+ EwayResponse.new(response[:success], response[:message], response,
204
200
  :test => test?,
205
201
  :authorization => response[:auth_code]
206
202
  )
207
203
  end
208
-
204
+
209
205
  # Where we build the full SOAP 1.2 request using builder
210
206
  def soap_request(arguments, action)
211
207
  # eWay demands all fields be sent, but contain an empty string if blank
212
208
  post = case action
213
209
  when 'ProcessPayment'
214
210
  default_payment_fields.merge(arguments)
215
- else
211
+ else
216
212
  default_customer_fields.merge(arguments)
217
213
  end
218
-
214
+
219
215
  xml = Builder::XmlMarkup.new :indent => 2
220
216
  xml.instruct!
221
217
  xml.tag! 'soap12:Envelope', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope'} do
@@ -230,13 +226,13 @@ private
230
226
  x.tag! "#{action}", {'xmlns' => 'https://www.eway.com.au/gateway/managedpayment'} do |y|
231
227
  post.each do |key, value|
232
228
  y.tag! "#{key}", "#{value}"
233
- end
229
+ end
234
230
  end
235
231
  end
236
232
  end
237
233
  xml.target!
238
234
  end
239
-
235
+
240
236
  def default_customer_fields
241
237
  hash={}
242
238
  %w( CustomerRef Title FirstName LastName Company JobDesc Email Address Suburb State PostCode Country Phone Mobile Fax URL Comments CCNumber CCNameOnCard CCExpiryMonth CCExpiryYear ).each do |field|
@@ -244,7 +240,7 @@ private
244
240
  end
245
241
  return hash
246
242
  end
247
-
243
+
248
244
  def default_payment_fields
249
245
  hash={}
250
246
  %w( managedCustomerID amount invoiceReference invoiceDescription ).each do |field|
@@ -252,14 +248,14 @@ private
252
248
  end
253
249
  return hash
254
250
  end
255
-
251
+
256
252
  class EwayResponse < Response
257
253
  # add a method to response so we can easily get the eway token "ManagedCustomerID"
258
254
  def token
259
255
  @params['CreateCustomerResult']
260
256
  end
261
257
  end
262
-
258
+
263
259
  end
264
260
  end
265
261
  end
@@ -2,67 +2,58 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class ExactGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx'
5
-
5
+
6
6
  API_VERSION = "8.5"
7
-
7
+
8
8
  TEST_LOGINS = [ {:login => "A00049-01", :password => "test1"},
9
9
  {:login => "A00427-01", :password => "testus"} ]
10
-
10
+
11
11
  TRANSACTIONS = { :sale => "00",
12
12
  :authorization => "01",
13
13
  :capture => "32",
14
14
  :credit => "34" }
15
-
15
+
16
16
 
17
17
  ENVELOPE_NAMESPACES = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
18
18
  'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
19
19
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
20
20
  }
21
-
21
+
22
22
  SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request",
23
23
  'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
24
24
  }
25
-
25
+
26
26
  SEND_AND_COMMIT_SOURCE_ATTRIBUTES = { 'xmlns:n2' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes',
27
27
  'xsi:type' => 'n2:Transaction'
28
28
  }
29
-
29
+
30
30
  POST_HEADERS = { 'soapAction' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit",
31
- 'Content-Type' => 'text/xml'
31
+ 'Content-Type' => 'text/xml'
32
32
  }
33
-
33
+
34
34
  SUCCESS = "true"
35
-
35
+
36
36
  SENSITIVE_FIELDS = [ :verification_str2, :expiry_date, :card_number ]
37
-
37
+
38
38
  self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
39
39
  self.supported_countries = ['CA', 'US']
40
40
  self.homepage_url = 'http://www.e-xact.com'
41
41
  self.display_name = 'E-xact'
42
-
42
+
43
43
  def initialize(options = {})
44
44
  requires!(options, :login, :password)
45
- @options = options
46
-
47
- if TEST_LOGINS.include?( { :login => options[:login], :password => options[:password] } )
48
- @test_mode = true
49
- end
50
-
45
+
51
46
  super
52
47
  end
53
-
54
- def test?
55
- @test_mode || Base.gateway_mode == :test
56
- end
57
-
48
+
58
49
  def authorize(money, credit_card, options = {})
59
50
  commit(:authorization, build_sale_or_authorization_request(money, credit_card, options))
60
51
  end
61
-
52
+
62
53
  def purchase(money, credit_card, options = {})
63
54
  commit(:sale, build_sale_or_authorization_request(money, credit_card, options))
64
55
  end
65
-
56
+
66
57
  def capture(money, authorization, options = {})
67
58
  commit(:capture, build_capture_or_credit_request(money, authorization, options))
68
59
  end
@@ -75,11 +66,11 @@ module ActiveMerchant #:nodoc:
75
66
  def refund(money, authorization, options = {})
76
67
  commit(:credit, build_capture_or_credit_request(money, authorization, options))
77
68
  end
78
-
79
- private
69
+
70
+ private
80
71
  def build_request(action, body)
81
72
  xml = Builder::XmlMarkup.new
82
-
73
+
83
74
  xml.instruct!
84
75
  xml.tag! 'env:Envelope', ENVELOPE_NAMESPACES do
85
76
  xml.tag! 'env:Body' do
@@ -94,59 +85,59 @@ module ActiveMerchant #:nodoc:
94
85
  end
95
86
  xml.target!
96
87
  end
97
-
88
+
98
89
  def build_sale_or_authorization_request(money, credit_card, options)
99
90
  xml = Builder::XmlMarkup.new
100
-
91
+
101
92
  add_amount(xml, money)
102
93
  add_credit_card(xml, credit_card)
103
94
  add_customer_data(xml, options)
104
95
  add_invoice(xml, options)
105
-
106
- xml.target!
96
+
97
+ xml.target!
107
98
  end
108
-
99
+
109
100
  def build_capture_or_credit_request(money, identification, options)
110
101
  xml = Builder::XmlMarkup.new
111
-
102
+
112
103
  add_identification(xml, identification)
113
104
  add_amount(xml, money)
114
105
  add_customer_data(xml, options)
115
-
106
+
116
107
  xml.target!
117
108
  end
118
-
109
+
119
110
  def add_credentials(xml)
120
111
  xml.tag! 'ExactID', @options[:login]
121
112
  xml.tag! 'Password', @options[:password]
122
113
  end
123
-
114
+
124
115
  def add_transaction_type(xml, action)
125
116
  xml.tag! 'Transaction_Type', TRANSACTIONS[action]
126
117
  end
127
-
118
+
128
119
  def add_identification(xml, identification)
129
120
  authorization_num, transaction_tag = identification.split(';')
130
-
121
+
131
122
  xml.tag! 'Authorization_Num', authorization_num
132
123
  xml.tag! 'Transaction_Tag', transaction_tag
133
124
  end
134
-
125
+
135
126
  def add_amount(xml, money)
136
127
  xml.tag! 'DollarAmount', amount(money)
137
128
  end
138
-
129
+
139
130
  def add_credit_card(xml, credit_card)
140
131
  xml.tag! 'Card_Number', credit_card.number
141
132
  xml.tag! 'Expiry_Date', expdate(credit_card)
142
133
  xml.tag! 'CardHoldersName', credit_card.name
143
-
134
+
144
135
  if credit_card.verification_value?
145
136
  xml.tag! 'CVD_Presence_Ind', '1'
146
137
  xml.tag! 'VerificationStr2', credit_card.verification_value
147
138
  end
148
139
  end
149
-
140
+
150
141
  def add_customer_data(xml, options)
151
142
  xml.tag! 'Customer_Ref', options[:customer]
152
143
  xml.tag! 'Client_IP', options[:ip]
@@ -155,22 +146,22 @@ module ActiveMerchant #:nodoc:
155
146
 
156
147
  def add_address(xml, options)
157
148
  if address = options[:billing_address] || options[:address]
158
- xml.tag! 'ZipCode', address[:zip]
159
- end
149
+ xml.tag! 'ZipCode', address[:zip]
150
+ end
160
151
  end
161
152
 
162
153
  def add_invoice(xml, options)
163
154
  xml.tag! 'Reference_No', options[:order_id]
164
155
  xml.tag! 'Reference_3', options[:description]
165
156
  end
166
-
157
+
167
158
  def expdate(credit_card)
168
159
  "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
169
160
  end
170
-
161
+
171
162
  def commit(action, request)
172
163
  response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
173
-
164
+
174
165
  Response.new(successful?(response), message_from(response), response,
175
166
  :test => test?,
176
167
  :authorization => authorization_from(response),
@@ -178,19 +169,19 @@ module ActiveMerchant #:nodoc:
178
169
  :cvv_result => response[:cvv2]
179
170
  )
180
171
  end
181
-
172
+
182
173
  def successful?(response)
183
174
  response[:transaction_approved] == SUCCESS
184
175
  end
185
-
176
+
186
177
  def authorization_from(response)
187
178
  if response[:authorization_num] && response[:transaction_tag]
188
- "#{response[:authorization_num]};#{response[:transaction_tag]}"
179
+ "#{response[:authorization_num]};#{response[:transaction_tag]}"
189
180
  else
190
181
  ''
191
182
  end
192
183
  end
193
-
184
+
194
185
  def message_from(response)
195
186
  if response[:faultcode] && response[:faultstring]
196
187
  response[:faultstring]
@@ -202,11 +193,11 @@ module ActiveMerchant #:nodoc:
202
193
  result
203
194
  end
204
195
  end
205
-
196
+
206
197
  def parse(xml)
207
198
  response = {}
208
199
  xml = REXML::Document.new(xml)
209
-
200
+
210
201
  if root = REXML::XPath.first(xml, "//types:TransactionResult")
211
202
  parse_elements(response, root)
212
203
  elsif root = REXML::XPath.first(xml, "//soap:Fault")