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
@@ -2,24 +2,24 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  #
4
4
  # CardStream supports the following credit cards, which are auto-detected by
5
- # the gateway based on the card number used:
6
- # * AM American Express
7
- # * Diners Club
8
- # * Electron
9
- # * JCB
10
- # * UK Maestro
11
- # * Maestro International
12
- # * Mastercard
13
- # * Solo
14
- # * Style
15
- # * Switch
16
- # * Visa Credit
17
- # * Visa Debit
18
- # * Visa Purchasing
5
+ # the gateway based on the card number used:
6
+ # * AM American Express
7
+ # * Diners Club
8
+ # * Electron
9
+ # * JCB
10
+ # * UK Maestro
11
+ # * Maestro International
12
+ # * Mastercard
13
+ # * Solo
14
+ # * Style
15
+ # * Switch
16
+ # * Visa Credit
17
+ # * Visa Debit
18
+ # * Visa Purchasing
19
19
  #
20
20
  class CardStreamGateway < Gateway
21
21
  self.live_url = self.test_url = 'https://gateway.cardstream.com/process.ashx'
22
-
22
+
23
23
  self.money_format = :cents
24
24
  self.default_currency = 'GBP'
25
25
  self.supported_countries = ['GB']
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
 
30
30
  APPROVED = '00'
31
31
 
32
- CURRENCY_CODES = {
32
+ CURRENCY_CODES = {
33
33
  "AUD"=> '036',
34
34
  "CAD"=> '124',
35
35
  "CZK"=> '203',
@@ -45,24 +45,24 @@ module ActiveMerchant #:nodoc:
45
45
  "USD"=> '840',
46
46
  "EUR"=> '978'
47
47
  }
48
-
48
+
49
49
  TRANSACTIONS = {
50
50
  :purchase => 'ESALE_KEYED',
51
51
  :refund => 'EREFUND_KEYED',
52
52
  :authorization => 'ESALE_KEYED'
53
53
  }
54
-
54
+
55
55
  CVV_CODE = {
56
- '0' => 'U',
56
+ '0' => 'U',
57
57
  '1' => 'P',
58
58
  '2' => 'M',
59
59
  '4' => 'N'
60
60
  }
61
-
62
- # 0 - No additional information available.
63
- # 1 - Postcode not checked.
64
- # 2 - Postcode matched.
65
- # 4 - Postcode not matched.
61
+
62
+ # 0 - No additional information available.
63
+ # 1 - Postcode not checked.
64
+ # 2 - Postcode matched.
65
+ # 4 - Postcode not matched.
66
66
  # 8 - Postcode partially matched.
67
67
  AVS_POSTAL_MATCH = {
68
68
  "0" => nil,
@@ -71,11 +71,11 @@ module ActiveMerchant #:nodoc:
71
71
  "4" => "N",
72
72
  "8" => "N"
73
73
  }
74
-
75
- # 0 - No additional information available.
76
- # 1 - Address numeric not checked.
77
- # 2 - Address numeric matched.
78
- # 4 - Address numeric not matched.
74
+
75
+ # 0 - No additional information available.
76
+ # 1 - Address numeric not checked.
77
+ # 2 - Address numeric matched.
78
+ # 4 - Address numeric not matched.
79
79
  # 8 - Address numeric partially matched.
80
80
  AVS_STREET_MATCH = {
81
81
  "0" => nil,
@@ -84,18 +84,17 @@ module ActiveMerchant #:nodoc:
84
84
  "4" => "N",
85
85
  "8" => "N"
86
86
  }
87
-
87
+
88
88
  def initialize(options = {})
89
89
  requires!(options, :login, :password)
90
- @options = options
91
90
  super
92
91
  end
93
92
 
94
93
  def purchase(money, credit_card, options = {})
95
94
  requires!(options, :order_id)
96
-
95
+
97
96
  post = {}
98
-
97
+
99
98
  add_amount(post, money, options)
100
99
  add_invoice(post, money, credit_card, options)
101
100
  add_credit_card(post, credit_card)
@@ -104,9 +103,9 @@ module ActiveMerchant #:nodoc:
104
103
 
105
104
  commit(:purchase, post)
106
105
  end
107
-
106
+
108
107
  private
109
-
108
+
110
109
  def add_amount(post, money, options)
111
110
  add_pair(post, :Amount, amount(money), :required => true)
112
111
  add_pair(post, :CurrencyCode, currency_code(options[:currency] || currency(money)), :required => true)
@@ -119,7 +118,7 @@ module ActiveMerchant #:nodoc:
119
118
 
120
119
  def add_address(post, options)
121
120
  address = options[:billing_address] || options[:address]
122
-
121
+
123
122
  return if address.nil?
124
123
 
125
124
  add_pair(post, :BillingStreet, address[:address1])
@@ -132,10 +131,10 @@ module ActiveMerchant #:nodoc:
132
131
  def add_invoice(post, money, credit_card, options)
133
132
  add_pair(post, :TransactionUnique, options[:order_id], :required => true)
134
133
  add_pair(post, :OrderDesc, options[:description] || options[:order_id], :required => true)
135
-
134
+
136
135
  if [ 'american_express', 'diners_club' ].include?(card_brand(credit_card).to_s)
137
- add_pair(post, :AEIT1Quantity, 1)
138
- add_pair(post, :AEIT1Description, (options[:description] || options[:order_id]).slice(0, 15))
136
+ add_pair(post, :AEIT1Quantity, 1)
137
+ add_pair(post, :AEIT1Description, (options[:description] || options[:order_id]).slice(0, 15))
139
138
  add_pair(post, :AEIT1GrossValue, amount(money))
140
139
  end
141
140
  end
@@ -143,20 +142,20 @@ module ActiveMerchant #:nodoc:
143
142
  def add_credit_card(post, credit_card)
144
143
  add_pair(post, :CardName, credit_card.name, :required => true)
145
144
  add_pair(post, :CardNumber, credit_card.number, :required => true)
146
-
145
+
147
146
  add_pair(post, :ExpiryDateMM, format(credit_card.month, :two_digits), :required => true)
148
147
  add_pair(post, :ExpiryDateYY, format(credit_card.year, :two_digits), :required => true)
149
-
148
+
150
149
  if requires_start_date_or_issue_number?(credit_card)
151
150
  add_pair(post, :StartDateMM, format(credit_card.start_month, :two_digits))
152
151
  add_pair(post, :StartDateYY, format(credit_card.start_year, :two_digits))
153
-
152
+
154
153
  add_pair(post, :IssueNumber, credit_card.issue_number)
155
154
  end
156
-
155
+
157
156
  add_pair(post, :CV2, credit_card.verification_value)
158
157
  end
159
-
158
+
160
159
  def commit(action, parameters)
161
160
  response = parse( ssl_post(self.live_url, post_data(action, parameters)) )
162
161
 
@@ -188,19 +187,19 @@ module ActiveMerchant #:nodoc:
188
187
  :ReturnAVSCV2Message => "YES",
189
188
  :CountryCode => '826' # 826 for UK based merchant
190
189
  )
191
-
190
+
192
191
  add_pair(parameters, :Dispatch, action == :authorization ? "LATER" : "NOW")
193
-
192
+
194
193
  parameters.collect { |key, value| "VP#{key}=#{CGI.escape(value.to_s)}" }.join("&")
195
194
  end
196
-
197
- # VPCrossReference
198
- # The value in VPCrossReference on a success transaction will contain
199
- # a unique reference that you may use to run future transactions.
200
- # Please note that cross reference transactions must come a static IP
201
- # addressed that has been pre-registered with Cardstream. To
202
- # register an IP address please send it to support@cardstream.com
203
- # with your Cardstream issued merchant ID and it will be added to
195
+
196
+ # VPCrossReference
197
+ # The value in VPCrossReference on a success transaction will contain
198
+ # a unique reference that you may use to run future transactions.
199
+ # Please note that cross reference transactions must come a static IP
200
+ # addressed that has been pre-registered with Cardstream. To
201
+ # register an IP address please send it to support@cardstream.com
202
+ # with your Cardstream issued merchant ID and it will be added to
204
203
  # your account.
205
204
  def parse(body)
206
205
  result = {}
@@ -209,14 +208,10 @@ module ActiveMerchant #:nodoc:
209
208
  a = pair.split("=")
210
209
  result[a[0].gsub(/^VP/,'').underscore.to_sym] = a[1]
211
210
  end
212
-
211
+
213
212
  result
214
213
  end
215
214
 
216
- def test?
217
- @options[:test] || Base.gateway_mode == :test
218
- end
219
-
220
215
  def currency_code(currency)
221
216
  CURRENCY_CODES[currency]
222
217
  end
@@ -26,7 +26,6 @@ module ActiveMerchant #:nodoc:
26
26
  # Otherwise, perform transactions against the production server.
27
27
  def initialize(options = {})
28
28
  requires!(options, :login, :password)
29
- @options = options
30
29
  super
31
30
  end
32
31
 
@@ -107,15 +107,9 @@ module ActiveMerchant #:nodoc:
107
107
  # if CVV would have failed
108
108
  def initialize(options = {})
109
109
  requires!(options, :login, :password)
110
- @options = options
111
110
  super
112
111
  end
113
112
 
114
- # Should run against the test servers or not?
115
- def test?
116
- @options[:test] || Base.gateway_mode == :test
117
- end
118
-
119
113
  # Request an authorization for an amount from CyberSource
120
114
  #
121
115
  # You must supply an :order_id in the options hash
@@ -148,12 +142,13 @@ module ActiveMerchant #:nodoc:
148
142
  end
149
143
 
150
144
  def refund(money, identification, options = {})
151
- commit(build_credit_request(money, identification, options), options)
145
+ commit(build_refund_request(money, identification, options), options)
152
146
  end
153
147
 
154
- def credit(money, identification, options = {})
155
- deprecated CREDIT_DEPRECATION_MESSAGE
156
- refund(money, identification, options)
148
+ # Adds credit to a subscription (stand alone credit).
149
+ def credit(money, reference, options = {})
150
+ requires!(options, :order_id)
151
+ commit(build_credit_request(money, reference, options), options)
157
152
  end
158
153
 
159
154
  # Stores a customer subscription/profile with type "on-demand".
@@ -281,7 +276,7 @@ module ActiveMerchant #:nodoc:
281
276
  xml.target!
282
277
  end
283
278
 
284
- def build_credit_request(money, identification, options)
279
+ def build_refund_request(money, identification, options)
285
280
  order_id, request_id, request_token = identification.split(";")
286
281
  options[:order_id] = order_id
287
282
 
@@ -292,6 +287,16 @@ module ActiveMerchant #:nodoc:
292
287
  xml.target!
293
288
  end
294
289
 
290
+ def build_credit_request(money, reference, options)
291
+ xml = Builder::XmlMarkup.new :indent => 2
292
+
293
+ add_purchase_data(xml, money, true, options)
294
+ add_subscription(xml, options, reference)
295
+ add_credit_service(xml)
296
+
297
+ xml.target!
298
+ end
299
+
295
300
  def build_create_subscription_request(creditcard, options)
296
301
  options[:subscription] = (options[:subscription] || {}).merge(:frequency => "on-demand", :amount => 0, :automatic_renew => false)
297
302
 
@@ -435,10 +440,10 @@ module ActiveMerchant #:nodoc:
435
440
  end
436
441
  end
437
442
 
438
- def add_credit_service(xml, request_id, request_token)
443
+ def add_credit_service(xml, request_id = nil, request_token = nil)
439
444
  xml.tag! 'ccCreditService', {'run' => 'true'} do
440
- xml.tag! 'captureRequestID', request_id
441
- xml.tag! 'captureRequestToken', request_token
445
+ xml.tag! 'captureRequestID', request_id if request_id
446
+ xml.tag! 'captureRequestToken', request_token if request_token
442
447
  end
443
448
  end
444
449