activemerchant 1.28.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/CHANGELOG +41 -0
  2. data/CONTRIBUTORS +12 -0
  3. data/README.md +6 -0
  4. data/lib/active_merchant/billing/gateway.rb +2 -1
  5. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  6. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  7. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  8. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  9. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  10. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  11. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  12. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  13. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  14. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  15. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  16. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  17. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  18. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  19. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  20. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  21. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  22. data/lib/active_merchant/billing/gateways/eway_rapid.rb +300 -0
  23. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  24. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  25. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  26. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  27. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  28. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  29. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  30. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  31. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  32. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  33. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  34. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  35. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  36. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  37. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  38. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  39. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  40. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  41. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  42. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  43. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  44. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  45. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  46. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  47. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  48. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  50. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  51. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  54. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  55. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  56. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  57. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  58. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  59. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  62. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  63. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  64. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  65. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  66. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  67. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  68. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  69. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  70. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  71. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  72. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  75. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  76. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  77. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  78. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  79. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  80. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  81. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  82. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  83. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  84. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  85. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  86. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  87. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  88. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  89. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  90. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  91. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  92. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  93. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  94. data/lib/active_merchant/billing/gateways.rb +6 -7
  95. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  99. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  102. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -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/common.rb +42 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -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 +17 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. data.tar.gz.sig +0 -0
  116. metadata +46 -27
  117. metadata.gz.sig +0 -0
@@ -3,22 +3,22 @@ module ActiveMerchant #:nodoc:
3
3
  class JetpayGateway < Gateway
4
4
  self.test_url = 'https://test1.jetpay.com/jetpay'
5
5
  self.live_url = 'https://gateway17.jetpay.com/jetpay'
6
-
6
+
7
7
  # The countries the gateway supports merchants from as 2 digit ISO country codes
8
8
  self.supported_countries = ['US']
9
-
9
+
10
10
  # The card types supported by the payment gateway
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
-
12
+
13
13
  # The homepage URL of the gateway
14
14
  self.homepage_url = 'http://www.jetpay.com/'
15
-
15
+
16
16
  # The name of the gateway
17
17
  self.display_name = 'JetPay'
18
-
18
+
19
19
  # all transactions are in cents
20
20
  self.money_format = :cents
21
-
21
+
22
22
  ACTION_CODE_MESSAGES = {
23
23
  "001" => "Refer to card issuer.",
24
24
  "002" => "Refer to card issuer, special condition.",
@@ -61,25 +61,24 @@ module ActiveMerchant #:nodoc:
61
61
  "996" => "Terminal ID Not Found.",
62
62
  nil => "No response returned (missing credentials?)."
63
63
  }
64
-
64
+
65
65
  def initialize(options = {})
66
66
  requires!(options, :login)
67
- @options = options
68
67
  super
69
- end
70
-
68
+ end
69
+
71
70
  def purchase(money, credit_card, options = {})
72
71
  commit(money, build_sale_request(money, credit_card, options))
73
72
  end
74
-
73
+
75
74
  def authorize(money, credit_card, options = {})
76
75
  commit(money, build_authonly_request(money, credit_card, options))
77
76
  end
78
-
77
+
79
78
  def capture(money, reference, options = {})
80
79
  commit(money, build_capture_request('CAPT', reference.split(";").first))
81
80
  end
82
-
81
+
83
82
  def void(reference, options = {})
84
83
  transaction_id, approval, amount = reference.split(";")
85
84
  commit(amount.to_i, build_void_request(amount.to_i, transaction_id, approval))
@@ -100,9 +99,9 @@ module ActiveMerchant #:nodoc:
100
99
  commit(money, build_credit_request('CREDIT', money, transaction_id, credit_card))
101
100
  end
102
101
 
103
-
102
+
104
103
  private
105
-
104
+
106
105
  def build_xml_request(transaction_type, transaction_id = nil, &block)
107
106
  xml = Builder::XmlMarkup.new
108
107
  xml.tag! 'JetPay' do
@@ -110,15 +109,15 @@ module ActiveMerchant #:nodoc:
110
109
  xml.tag! 'TerminalID', @options[:login]
111
110
  xml.tag! 'TransactionType', transaction_type
112
111
  xml.tag! 'TransactionID', transaction_id.nil? ? generate_unique_id.slice(0, 18) : transaction_id
113
-
112
+
114
113
  if block_given?
115
114
  yield xml
116
- else
115
+ else
117
116
  xml.target!
118
117
  end
119
118
  end
120
119
  end
121
-
120
+
122
121
  def build_sale_request(money, credit_card, options)
123
122
  build_xml_request('SALE') do |xml|
124
123
  add_credit_card(xml, credit_card)
@@ -126,11 +125,11 @@ module ActiveMerchant #:nodoc:
126
125
  add_customer_data(xml, options)
127
126
  add_invoice_data(xml, options)
128
127
  xml.tag! 'TotalAmount', amount(money)
129
-
128
+
130
129
  xml.target!
131
130
  end
132
131
  end
133
-
132
+
134
133
  def build_authonly_request(money, credit_card, options)
135
134
  build_xml_request('AUTHONLY') do |xml|
136
135
  add_credit_card(xml, credit_card)
@@ -138,22 +137,22 @@ module ActiveMerchant #:nodoc:
138
137
  add_customer_data(xml, options)
139
138
  add_invoice_data(xml, options)
140
139
  xml.tag! 'TotalAmount', amount(money)
141
-
140
+
142
141
  xml.target!
143
142
  end
144
143
  end
145
-
144
+
146
145
  def build_capture_request(transaction_type, transaction_id)
147
146
  build_xml_request(transaction_type, transaction_id)
148
147
  end
149
-
148
+
150
149
  def build_void_request(money, transaction_id, approval)
151
150
  build_xml_request('VOID', transaction_id) do |xml|
152
151
  xml.tag! 'Approval', approval
153
152
  xml.tag! 'TotalAmount', amount(money)
154
-
153
+
155
154
  xml.target!
156
- end
155
+ end
157
156
  end
158
157
 
159
158
  # `transaction_id` may be nil for unlinked credit transactions.
@@ -161,37 +160,37 @@ module ActiveMerchant #:nodoc:
161
160
  build_xml_request(transaction_type, transaction_id) do |xml|
162
161
  add_credit_card(xml, card) if card
163
162
  xml.tag! 'TotalAmount', amount(money)
164
-
163
+
165
164
  xml.target!
166
165
  end
167
166
  end
168
-
167
+
169
168
  def commit(money, request)
170
169
  response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
171
-
170
+
172
171
  success = success?(response)
173
- Response.new(success,
174
- success ? 'APPROVED' : message_from(response),
175
- response,
176
- :test => test?,
172
+ Response.new(success,
173
+ success ? 'APPROVED' : message_from(response),
174
+ response,
175
+ :test => test?,
177
176
  :authorization => authorization_from(response, money),
178
177
  :avs_result => { :code => response[:avs] },
179
178
  :cvv_result => response[:cvv2]
180
179
  )
181
180
  end
182
-
181
+
183
182
  def parse(body)
184
183
  return {} if body.blank?
185
184
 
186
185
  xml = REXML::Document.new(body)
187
-
186
+
188
187
  response = {}
189
188
  xml.root.elements.to_a.each do |node|
190
189
  parse_element(response, node)
191
190
  end
192
191
  response
193
192
  end
194
-
193
+
195
194
  def parse_element(response, node)
196
195
  if node.has_elements?
197
196
  node.elements.each{|element| parse_element(response, element) }
@@ -199,24 +198,24 @@ module ActiveMerchant #:nodoc:
199
198
  response[node.name.underscore.to_sym] = node.text
200
199
  end
201
200
  end
202
-
201
+
203
202
  def format_exp(value)
204
203
  format(value, :two_digits)
205
204
  end
206
-
205
+
207
206
  def success?(response)
208
207
  response[:action_code] == "000"
209
208
  end
210
-
209
+
211
210
  def message_from(response)
212
211
  ACTION_CODE_MESSAGES[response[:action_code]]
213
212
  end
214
-
213
+
215
214
  def authorization_from(response, money)
216
215
  original_amount = amount(money) if money
217
216
  [ response[:transaction_id], response[:approval], original_amount ].join(";")
218
217
  end
219
-
218
+
220
219
  def add_credit_card(xml, credit_card)
221
220
  xml.tag! 'CardNum', credit_card.number
222
221
  xml.tag! 'CardExpMonth', format_exp(credit_card.month)
@@ -230,7 +229,7 @@ module ActiveMerchant #:nodoc:
230
229
  xml.tag! 'CVV2', credit_card.verification_value
231
230
  end
232
231
  end
233
-
232
+
234
233
  def add_addresses(xml, options)
235
234
  if billing_address = options[:billing_address] || options[:address]
236
235
  xml.tag! 'BillingAddress', [billing_address[:address1], billing_address[:address2]].compact.join(" ")
@@ -240,11 +239,11 @@ module ActiveMerchant #:nodoc:
240
239
  xml.tag! 'BillingCountry', lookup_country_code(billing_address[:country])
241
240
  xml.tag! 'BillingPhone', billing_address[:phone]
242
241
  end
243
-
242
+
244
243
  if shipping_address = options[:shipping_address]
245
244
  xml.tag! 'ShippingInfo' do
246
245
  xml.tag! 'ShippingName', shipping_address[:name]
247
-
246
+
248
247
  xml.tag! 'ShippingAddr' do
249
248
  xml.tag! 'Address', [shipping_address[:address1], shipping_address[:address2]].compact.join(" ")
250
249
  xml.tag! 'City', shipping_address[:city]
@@ -260,14 +259,14 @@ module ActiveMerchant #:nodoc:
260
259
  xml.tag! 'Email', options[:email] if options[:email]
261
260
  xml.tag! 'UserIPAddress', options[:ip] if options[:ip]
262
261
  end
263
-
262
+
264
263
  def add_invoice_data(xml, options)
265
264
  xml.tag! 'OrderNumber', options[:order_id] if options[:order_id]
266
265
  xml.tag! 'TaxAmount', amount(options[:tax]) if options[:tax]
267
266
  end
268
-
267
+
269
268
  def lookup_country_code(code)
270
- country = Country.find(code) rescue nil
269
+ country = Country.find(code) rescue nil
271
270
  country && country.code(:alpha3)
272
271
  end
273
272
  end