activemerchant 1.77.0 → 1.78.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +49 -0
  3. data/lib/active_merchant/billing/gateways/adyen.rb +75 -29
  4. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -1
  5. data/lib/active_merchant/billing/gateways/blue_snap.rb +3 -8
  6. data/lib/active_merchant/billing/gateways/card_stream.rb +22 -1
  7. data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
  8. data/lib/active_merchant/billing/gateways/checkout_v2.rb +8 -1
  9. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  10. data/lib/active_merchant/billing/gateways/dibs.rb +0 -1
  11. data/lib/active_merchant/billing/gateways/first_pay.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/global_collect.rb +11 -5
  13. data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
  14. data/lib/active_merchant/billing/gateways/litle.rb +93 -17
  15. data/lib/active_merchant/billing/gateways/mercado_pago.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  17. data/lib/active_merchant/billing/gateways/migs.rb +12 -0
  18. data/lib/active_merchant/billing/gateways/netbilling.rb +0 -1
  19. data/lib/active_merchant/billing/gateways/ogone.rb +0 -1
  20. data/lib/active_merchant/billing/gateways/optimal_payment.rb +11 -0
  21. data/lib/active_merchant/billing/gateways/orbital.rb +5 -3
  22. data/lib/active_merchant/billing/gateways/payeezy.rb +14 -24
  23. data/lib/active_merchant/billing/gateways/payflow.rb +15 -1
  24. data/lib/active_merchant/billing/gateways/paymentez.rb +21 -11
  25. data/lib/active_merchant/billing/gateways/paystation.rb +4 -1
  26. data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/redsys.rb +5 -0
  29. data/lib/active_merchant/billing/gateways/secure_net.rb +11 -1
  30. data/lib/active_merchant/billing/gateways/spreedly_core.rb +12 -1
  31. data/lib/active_merchant/billing/gateways/stripe.rb +17 -6
  32. data/lib/active_merchant/billing/gateways/tns.rb +0 -1
  33. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +39 -21
  34. data/lib/active_merchant/billing/gateways/worldpay.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/worldpay_us.rb +12 -0
  36. data/lib/active_merchant/version.rb +1 -1
  37. data/lib/certs/cacert.pem +25 -0
  38. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2916b6ecc76df1529d668ccc2d077d93fbdb68d
4
- data.tar.gz: 6b87fb1550cd04e17d5091a9b2229c35142efd3f
3
+ metadata.gz: 74c4f022672e86aa7cd1f77ff2076e4c0da77484
4
+ data.tar.gz: 07e322c21469013b7c303291e7a05fc058255051
5
5
  SHA512:
6
- metadata.gz: 6a9f27cdd93c846986a4983379f86c7be7a263af8bcd3c240777497e70bda59a0cb4f0aa053edfbbc22f4f4e25d750e5f58a5b7c027fdd93b66b5bbb293466cd
7
- data.tar.gz: 85016ac5ec4a5d450cb1ac171ed9557dad231711674f3bcd771a26d4de5ae9c11f2b300899249a5dab5c61255b726072878b3beb19838a0898645bbe974dc8d1
6
+ metadata.gz: df95a75ad33fa425c7fd8b0d6aba3462c1bd9037e93ed29da6aaf9cfc4a1b441dc6b4da20f84e76875a964101666d95a3456dae3964b21a462ed3e1f20505a97
7
+ data.tar.gz: 0cbdceebdcacc3eee2d6d63625602da8e84e4f16dff6288c331d7137c33cb67b60946ad69111eae6aaafa430d31ac1d76e9e6efa31ddc90f5e25358f6eeae188
data/CHANGELOG CHANGED
@@ -2,6 +2,55 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.78.0 (March 29, 2018)
6
+ * Litle: Add store for echecks [nfarve] #2779
7
+ * Litle: Add Support for Echeck [nfarve] #2776
8
+ * Orbital: Correct level 2 tax handling [deedeelavinder] #2729
9
+ * Payeezy: Change determination method of endpoint for store request [deedeelavinder] #2731
10
+ * Adyen: Return refusal_reason_raw when present [curiousepic] #2728
11
+ * Payeezy: Update Store method [nfarve] #2733
12
+ * CenPOS: Remove gzip encoding header [curiousepic] #2735
13
+ * Mercado Pago: Allow binary_mode to be changed [nfarve] #2736
14
+ * Stripe: Accept strings for refund_fee_amount [curiousepic] #2738
15
+ * Orbital: Complete scrub test coverage [curiousepic] #2739
16
+ * MIGS: Scrub sensitive data [curiousepic] #2740
17
+ * Worldpay US: Scrub sensitive data [curiousepic] #2742
18
+ * WorldPay: Remove Israel from supported country list [dtykocki] #2746
19
+ * Optimal Payments: Scrub sensitive data [curiousepic] #2743
20
+ * USA Epay Transaction: Scrub sensitive data [curiousepic] #2745
21
+ * MIGS: Add unit test for scrub [curiousepic] #2747
22
+ * Worldpay US: Fix bank account scrub [curiousepic] #2748
23
+ * Litle: Add support for merchantData elements [dtykocki] #2751
24
+ * Paymentez: Add support for purchasing and authorizatin with tokens [bpollack] #2753
25
+ * Ingenico: Remove Trinidad and Tobego from supported country list [bpollack] #2754
26
+ * Barclaycard Smartpay: Remove Georgia from supported country list [bpollack] #2755
27
+ * Merchant Warrior: Remove requirement for state field [joshnuss] #2638
28
+ * Wirecard: Adding missing DigiCert Global Root G2 Cert [filipebarcos] #2759
29
+ * Redsys: Add support for CNY, IDR, INR, KRW and TWD [chopenhauer] #2761
30
+ * Optimal Payments: Fix scrub for double escaping [curiousepic] #2763
31
+ * Orbital: Scrub profile transactions [curiousepic] #2762
32
+ * BlueSnap: Fix currency passing [curiousepic] #2765
33
+ * Stripe: Support pickup_card decline code [dtykocki] #2764
34
+ * Improve scrub testing for five gateways [curiousepic] #2767
35
+ * Payflow: Support scrub [curiousepic] #2768
36
+ * SecureNet: Support scrub [curiousepic] #2769
37
+ * Payeezy: Update transaction method when using stored cards [dtykocki] #2770
38
+ * Citrus Pay, DIBS, 1stPayGateway, Global Transport, NETbilling, Ogone, TNS: remove TLS 1.0 requirement [bdewater] #2774
39
+ * CardStream: Default IP and customer country [dtykocki] #2773
40
+ * Stripe: Support destination amount [dtykocki] #2777
41
+ * GlobalCollect: Update supported country list [dtykocki] #2783
42
+ * Adyen: Support store action [curiousepic] #2784
43
+ * Psigate: Update Test URL and Card [nfarve] #2785
44
+ * USA ePay Transaction: Support ACH/eChecks [curiousepic] #2786
45
+ * PayU Latam: Support language parameter [dtykocki] #2787
46
+ * Payflow: Pass OrderDesc field [curiousepic] #2789
47
+ * Global Collect: Add arbitrary fraudField params [curiousepic] #2790
48
+ * Paystation: Support verify action [curiousepic] #2793
49
+ * Checkout V2: Return error codes in response [curiousepic] #2791
50
+ * CardStream: Change refund to use REFUND_SALE [dtykocki] #2795
51
+ * Spreedly: Scrub sensitive transaction data [abarrak] #2781
52
+ * Stripe: Add `exchange_rate` parameter [WilsonChiang] #2796
53
+
5
54
  == Version 1.77.0 (January 31, 2018)
6
55
  * Authorize.net: Allow Transaction Id to be passed for refuds [nfarve] #2698
7
56
  * Forte: ensure unit tests are local-only [bpollack] #2696
@@ -45,34 +45,45 @@ module ActiveMerchant #:nodoc:
45
45
  add_invoice(post, money, options)
46
46
  add_payment(post, payment)
47
47
  add_extra_data(post, options)
48
- add_shopper_interaction(post,payment,options)
48
+ add_shopper_interaction(post, payment, options)
49
49
  add_address(post, options)
50
50
  commit('authorise', post)
51
51
  end
52
52
 
53
53
  def capture(money, authorization, options={})
54
54
  post = init_post(options)
55
- add_invoice_for_modification(post, money, authorization, options)
56
- add_references(post, authorization, options)
55
+ add_invoice_for_modification(post, money, options)
56
+ add_reference(post, authorization, options)
57
57
  commit('capture', post)
58
58
  end
59
59
 
60
60
  def refund(money, authorization, options={})
61
61
  post = init_post(options)
62
- add_invoice_for_modification(post, money, authorization, options)
63
- add_references(post, authorization, options)
62
+ add_invoice_for_modification(post, money, options)
63
+ add_original_reference(post, authorization, options)
64
64
  commit('refund', post)
65
65
  end
66
66
 
67
67
  def void(authorization, options={})
68
68
  post = init_post(options)
69
- add_references(post, authorization, options)
69
+ add_reference(post, authorization, options)
70
70
  commit('cancel', post)
71
71
  end
72
72
 
73
+ def store(credit_card, options={})
74
+ requires!(options, :order_id)
75
+ post = init_post(options)
76
+ add_invoice(post, 0, options)
77
+ add_payment(post, credit_card)
78
+ add_extra_data(post, options)
79
+ add_recurring_contract(post, options)
80
+ add_address(post, options)
81
+ commit('authorise', post)
82
+ end
83
+
73
84
  def verify(credit_card, options={})
74
85
  MultiResponse.run(:use_first_response) do |r|
75
- r.process { authorize(100, credit_card, options) }
86
+ r.process { authorize(0, credit_card, options) }
76
87
  r.process(:ignore_result) { void(r.authorization, options) }
77
88
  end
78
89
  end
@@ -101,7 +112,12 @@ module ActiveMerchant #:nodoc:
101
112
  end
102
113
 
103
114
  def add_shopper_interaction(post, payment, options={})
104
- shopper_interaction = payment.verification_value ? "Ecommerce" : "ContAuth"
115
+ if payment.respond_to?(:verification_value) && payment.verification_value
116
+ shopper_interaction = "Ecommerce"
117
+ else
118
+ shopper_interaction = "ContAuth"
119
+ end
120
+
105
121
  post[:shopperInteraction] = options[:shopper_interaction] || shopper_interaction
106
122
  end
107
123
 
@@ -123,11 +139,10 @@ module ActiveMerchant #:nodoc:
123
139
  value: amount(money),
124
140
  currency: options[:currency] || currency(money)
125
141
  }
126
- post[:reference] = options[:order_id]
127
142
  post[:amount] = amount
128
143
  end
129
144
 
130
- def add_invoice_for_modification(post, money, authorization, options)
145
+ def add_invoice_for_modification(post, money, options)
131
146
  amount = {
132
147
  value: amount(money),
133
148
  currency: options[:currency] || currency(money)
@@ -136,12 +151,22 @@ module ActiveMerchant #:nodoc:
136
151
  end
137
152
 
138
153
  def add_payment(post, payment)
154
+ if payment.is_a?(String)
155
+ _, _, recurring_detail_reference = payment.split("#")
156
+ post[:selectedRecurringDetailReference] = recurring_detail_reference
157
+ add_recurring_contract(post, options)
158
+ else
159
+ add_card(post, payment)
160
+ end
161
+ end
162
+
163
+ def add_card(post, credit_card)
139
164
  card = {
140
- expiryMonth: payment.month,
141
- expiryYear: payment.year,
142
- holderName: payment.name,
143
- number: payment.number,
144
- cvc: payment.verification_value
165
+ expiryMonth: credit_card.month,
166
+ expiryYear: credit_card.year,
167
+ holderName: credit_card.name,
168
+ number: credit_card.number,
169
+ cvc: credit_card.verification_value
145
170
  }
146
171
 
147
172
  card.delete_if{|k,v| v.blank? }
@@ -149,9 +174,26 @@ module ActiveMerchant #:nodoc:
149
174
  post[:card] = card
150
175
  end
151
176
 
152
- def add_references(post, authorization, options = {})
153
- post[:originalReference] = psp_reference_from(authorization)
154
- post[:reference] = options[:order_id]
177
+ def add_reference(post, authorization, options = {})
178
+ _, psp_reference, _ = authorization.split("#")
179
+ post[:originalReference] = single_reference(authorization) || psp_reference
180
+ end
181
+
182
+ def add_original_reference(post, authorization, options = {})
183
+ original_psp_reference, _, _ = authorization.split("#")
184
+ post[:originalReference] = single_reference(authorization) || original_psp_reference
185
+ end
186
+
187
+ def single_reference(authorization)
188
+ authorization if !authorization.include?("#")
189
+ end
190
+
191
+ def add_recurring_contract(post, options = {})
192
+ recurring = {
193
+ contract: "RECURRING"
194
+ }
195
+
196
+ post[:recurring] = recurring
155
197
  end
156
198
 
157
199
  def parse(body)
@@ -205,20 +247,29 @@ module ActiveMerchant #:nodoc:
205
247
  end
206
248
 
207
249
  def message_from(action, response)
208
- case action.to_s
209
- when 'authorise'
250
+ return authorize_message_from(response) if action.to_s == 'authorise'
251
+ response['response'] || response['message']
252
+ end
253
+
254
+ def authorize_message_from(response)
255
+ if response['refusalReason'] && response['additionalData'] && response['additionalData']['refusalReasonRaw']
256
+ "#{response['refusalReason']} | #{response['additionalData']['refusalReasonRaw']}"
257
+ else
210
258
  response['refusalReason'] || response['resultCode'] || response['message']
211
- when 'capture', 'refund', 'cancel'
212
- response['response'] || response['message']
213
259
  end
214
260
  end
215
261
 
216
262
  def authorization_from(action, parameters, response)
217
- [parameters[:originalReference], response['pspReference']].compact.join("#").presence
263
+ return nil if response['pspReference'].nil?
264
+ recurring = response['additionalData']['recurring.recurringDetailReference'] if response['additionalData']
265
+ "#{parameters[:originalReference]}##{response['pspReference']}##{recurring}"
218
266
  end
219
267
 
220
268
  def init_post(options = {})
221
- {merchantAccount: options[:merchant_account] || @merchant_account}
269
+ post = {}
270
+ post[:merchantAccount] = options[:merchant_account] || @merchant_account
271
+ post[:reference] = options[:order_id] if options[:order_id]
272
+ post
222
273
  end
223
274
 
224
275
  def post_data(action, parameters = {})
@@ -228,11 +279,6 @@ module ActiveMerchant #:nodoc:
228
279
  def error_code_from(response)
229
280
  STANDARD_ERROR_CODE_MAPPING[response['errorCode']]
230
281
  end
231
-
232
- def psp_reference_from(authorization)
233
- authorization.nil? ? nil : authorization.split("#").first
234
- end
235
-
236
282
  end
237
283
  end
238
284
  end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
5
5
  self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
6
6
 
7
- self.supported_countries = ['AL', 'AD', 'AM', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'GE', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'KZ', 'LV', 'LI', 'LT', 'LU', 'MK', 'MT', 'MD', 'MC', 'ME', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TR', 'UA', 'GB', 'VA']
7
+ self.supported_countries = ['AL', 'AD', 'AM', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'KZ', 'LV', 'LI', 'LT', 'LU', 'MK', 'MT', 'MD', 'MC', 'ME', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TR', 'UA', 'GB', 'VA']
8
8
  self.default_currency = 'EUR'
9
9
  self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
10
10
  self.money_format = :cents
@@ -86,7 +86,7 @@ module ActiveMerchant
86
86
  def refund(money, authorization, options={})
87
87
  commit(:refund, :put) do |doc|
88
88
  add_authorization(doc, authorization)
89
- add_amount(doc, money)
89
+ add_amount(doc, money, options)
90
90
  add_order(doc, options)
91
91
  end
92
92
  end
@@ -140,7 +140,7 @@ module ActiveMerchant
140
140
  def add_auth_purchase(doc, money, payment_method, options)
141
141
  doc.send("recurring-transaction", options[:recurring] ? "RECURRING" : "ECOMMERCE")
142
142
  add_order(doc, options)
143
- add_amount(doc, money)
143
+ add_amount(doc, money, options)
144
144
  doc.send("transaction-fraud-info") do
145
145
  doc.send("shopper-ip-address", options[:ip]) if options[:ip]
146
146
  end
@@ -155,7 +155,7 @@ module ActiveMerchant
155
155
  end
156
156
  end
157
157
 
158
- def add_amount(doc, money)
158
+ def add_amount(doc, money, options)
159
159
  doc.amount(amount(money))
160
160
  doc.currency(options[:currency] || currency(money))
161
161
  end
@@ -203,11 +203,6 @@ module ActiveMerchant
203
203
  doc.zip(address[:zip]) if address[:zip]
204
204
  end
205
205
 
206
- def add_invoice(post, money, options)
207
- post[:amount] = amount(money)
208
- post[:currency] = (options[:currency] || currency(money))
209
- end
210
-
211
206
  def add_authorization(doc, authorization)
212
207
  doc.send("transaction-id", authorization)
213
208
  end
@@ -155,6 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  add_invoice(post, credit_card_or_reference, money, options)
156
156
  add_credit_card_or_reference(post, credit_card_or_reference)
157
157
  add_customer_data(post, options)
158
+ add_remote_address(post, options)
158
159
  commit('SALE', post)
159
160
  end
160
161
 
@@ -165,6 +166,7 @@ module ActiveMerchant #:nodoc:
165
166
  add_invoice(post, credit_card_or_reference, money, options)
166
167
  add_credit_card_or_reference(post, credit_card_or_reference)
167
168
  add_customer_data(post, options)
169
+ add_remote_address(post, options)
168
170
  commit('SALE', post)
169
171
  end
170
172
 
@@ -172,6 +174,7 @@ module ActiveMerchant #:nodoc:
172
174
  post = {}
173
175
  add_pair(post, :xref, authorization)
174
176
  add_pair(post, :amount, amount(money), :required => true)
177
+ add_remote_address(post, options)
175
178
 
176
179
  commit('CAPTURE', post)
177
180
  end
@@ -180,12 +183,23 @@ module ActiveMerchant #:nodoc:
180
183
  post = {}
181
184
  add_pair(post, :xref, authorization)
182
185
  add_amount(post, money, options)
183
- commit('REFUND', post)
186
+ add_remote_address(post, options)
187
+ response = commit('REFUND_SALE', post)
188
+
189
+ return response if response.success?
190
+ return response unless options[:force_full_refund_if_unsettled]
191
+
192
+ if response.params["responseCode"] == "65541"
193
+ void(authorization, options)
194
+ else
195
+ response
196
+ end
184
197
  end
185
198
 
186
199
  def void(authorization, options = {})
187
200
  post = {}
188
201
  add_pair(post, :xref, authorization)
202
+ add_remote_address(post, options)
189
203
  commit('CANCEL', post)
190
204
  end
191
205
 
@@ -220,6 +234,9 @@ module ActiveMerchant #:nodoc:
220
234
  add_pair(post, :customerAddress, "#{address[:address1]} #{address[:address2]}".strip)
221
235
  add_pair(post, :customerPostCode, address[:zip])
222
236
  add_pair(post, :customerPhone, options[:phone])
237
+ add_pair(post, :customerCountryCode, address[:country] || 'GB')
238
+ else
239
+ add_pair(post, :customerCountryCode, 'GB')
223
240
  end
224
241
  end
225
242
 
@@ -273,6 +290,10 @@ module ActiveMerchant #:nodoc:
273
290
  add_pair(post, :threeDSRequired, (options[:threeds_required] || @threeds_required) ? 'Y' : 'N')
274
291
  end
275
292
 
293
+ def add_remote_address(post, options={})
294
+ add_pair(post, :remoteAddress, options[:ip] || '1.1.1.1')
295
+ end
296
+
276
297
  def normalize_line_endings(str)
277
298
  str.gsub(/%0D%0A|%0A%0D|%0D/, "%0A")
278
299
  end
@@ -180,7 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
 
181
181
  def headers
182
182
  {
183
- "Accept-Encoding" => "gzip,deflate",
183
+ "Accept-Encoding" => "identity",
184
184
  "Content-Type" => "text/xml;charset=UTF-8",
185
185
  "SOAPAction" => "http://tempuri.org/Transactional/ProcessCreditCard"
186
186
  }
@@ -212,7 +212,14 @@ module ActiveMerchant #:nodoc:
212
212
  end
213
213
 
214
214
  def error_code_from(succeeded, response)
215
- succeeded ? nil : STANDARD_ERROR_CODE_MAPPING[response["responseCode"]]
215
+ return if succeeded
216
+ if response["errorCode"] && response["errorMessageCodes"]
217
+ "#{response["errorCode"]}: #{response["errorMessageCodes"].join(", ")}"
218
+ elsif response["errorCode"]
219
+ response["errorCode"]
220
+ else
221
+ STANDARD_ERROR_CODE_MAPPING[response["responseCode"]]
222
+ end
216
223
  end
217
224
  end
218
225
  end
@@ -16,7 +16,6 @@ module ActiveMerchant
16
16
  self.supported_countries = %w(AR AU BR FR DE HK MX NZ SG GB US)
17
17
  self.default_currency = 'USD'
18
18
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro, :laser]
19
- self.ssl_version = :TLSv1
20
19
 
21
20
  end
22
21
  end
@@ -9,7 +9,6 @@ module ActiveMerchant #:nodoc:
9
9
  self.supported_countries = ["US", "FI", "NO", "SE", "GB"]
10
10
  self.default_currency = "USD"
11
11
  self.money_format = :cents
12
- self.ssl_version = :TLSv1
13
12
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
14
13
 
15
14
  def initialize(options={})
@@ -12,7 +12,6 @@ module ActiveMerchant #:nodoc:
12
12
 
13
13
  self.homepage_url = 'http://1stpaygateway.net/'
14
14
  self.display_name = '1stPayGateway.Net'
15
- self.ssl_version = :TLSv1
16
15
 
17
16
  def initialize(options={})
18
17
  requires!(options, :transaction_center_id, :gateway_id)
@@ -7,10 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.test_url = "https://api-sandbox.globalcollect.com/"
8
8
  self.live_url = "https://api.globalcollect.com/"
9
9
 
10
- self.supported_countries = %w(AD AE AT AU BD BE BG BN CA CH CY CZ DE DK
11
- EE EG ES FI FR GB GI GR HK HU ID IE IL IM IN IS IT JO KW LB LI LK LT LU
12
- LV MC MT MU MV MX MY NL NO NZ OM PH PL PT QA RO SA SE SG SI SK SM TR TT
13
- UM US VA VN ZA)
10
+ self.supported_countries = ["AD", "AE", "AG", "AI", "AL", "AM", "AO", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PL", "PN", "PS", "PT", "PW", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TC", "TD", "TG", "TH", "TJ", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VE", "VG", "VI", "VN", "WF", "WS", "ZA", "ZM", "ZW"]
14
11
  self.default_currency = "USD"
15
12
  self.money_format = :cents
16
13
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
@@ -34,6 +31,7 @@ module ActiveMerchant #:nodoc:
34
31
  add_customer_data(post, options, payment)
35
32
  add_address(post, payment, options)
36
33
  add_creator_info(post, options)
34
+ add_fraud_fields(post, options)
37
35
 
38
36
  commit(:authorize, post)
39
37
  end
@@ -207,6 +205,14 @@ module ActiveMerchant #:nodoc:
207
205
  end
208
206
  end
209
207
 
208
+ def add_fraud_fields(post, options)
209
+ fraud_fields = {}
210
+ fraud_fields.merge!(options[:fraud_fields]) if options[:fraud_fields]
211
+ fraud_fields.merge!({customerIpAddress: options[:ip]}) if options[:ip]
212
+
213
+ post["fraudFields"] = fraud_fields unless fraud_fields.empty?
214
+ end
215
+
210
216
  def parse(body)
211
217
  JSON.parse(body)
212
218
  end
@@ -252,7 +258,7 @@ module ActiveMerchant #:nodoc:
252
258
 
253
259
  def headers(action, post, authorization = nil)
254
260
  {
255
- "Content-type" => content_type,
261
+ "Content-Type" => content_type,
256
262
  "Authorization" => auth_digest(action, post, authorization),
257
263
  "Date" => date
258
264
  }