activemerchant 1.45.0 → 1.46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +3 -1
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG +25 -0
  5. data/CONTRIBUTORS +9 -0
  6. data/README.md +6 -20
  7. data/lib/active_merchant.rb +9 -50
  8. data/lib/active_merchant/billing.rb +1 -0
  9. data/lib/active_merchant/billing/gateway.rb +10 -1
  10. data/lib/active_merchant/billing/gateways.rb +6 -11
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +58 -47
  12. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +8 -8
  14. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  15. data/lib/active_merchant/billing/gateways/braintree_blue.rb +69 -22
  16. data/lib/active_merchant/billing/gateways/braintree_orange.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/checkout.rb +7 -2
  18. data/lib/active_merchant/billing/gateways/cyber_source.rb +25 -9
  19. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/eway_rapid.rb +6 -3
  21. data/lib/active_merchant/billing/gateways/finansbank.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/hps.rb +0 -1
  23. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
  25. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
  27. data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
  28. data/lib/active_merchant/billing/gateways/mercury.rb +4 -11
  29. data/lib/active_merchant/billing/gateways/migs.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/orbital.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +26 -0
  33. data/lib/active_merchant/billing/gateways/payflow.rb +3 -3
  34. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +16 -5
  35. data/lib/active_merchant/billing/gateways/payflow_express.rb +3 -3
  36. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
  37. data/lib/active_merchant/billing/gateways/payflow_uk.rb +4 -4
  38. data/lib/active_merchant/billing/gateways/paypal.rb +15 -3
  39. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +10 -1
  40. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  41. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +3 -3
  43. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -4
  44. data/lib/active_merchant/billing/gateways/pin.rb +10 -1
  45. data/lib/active_merchant/billing/gateways/quickbooks.rb +278 -0
  46. data/lib/active_merchant/billing/gateways/redsys.rb +2 -2
  47. data/lib/active_merchant/billing/gateways/sage.rb +3 -3
  48. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +1 -1
  50. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  51. data/lib/active_merchant/billing/gateways/skip_jack.rb +0 -1
  52. data/lib/active_merchant/billing/gateways/stripe.rb +13 -2
  53. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -1
  54. data/lib/active_merchant/billing/payment_token.rb +1 -1
  55. data/lib/active_merchant/connection.rb +169 -0
  56. data/lib/active_merchant/network_connection_retries.rb +78 -0
  57. data/lib/active_merchant/post_data.rb +24 -0
  58. data/lib/active_merchant/posts_data.rb +78 -0
  59. data/lib/active_merchant/version.rb +1 -1
  60. data/lib/certs/cacert.pem +3866 -0
  61. metadata +22 -44
  62. metadata.gz.sig +0 -0
  63. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 705744a332bbe4db27dc6e0dbbefd63712e94c28
4
- data.tar.gz: 452924bd903988716baa84b34969a9248abb6480
3
+ metadata.gz: fef1eb0d503d1d6aff1334d0a6715ac163f4f6fe
4
+ data.tar.gz: 4ae14dcf7fc8883c819ee1b2c36d00c95f63a7cc
5
5
  SHA512:
6
- metadata.gz: bea4d6dd57b28e0e6b852e05630ace0b08d51e6d3403f5754ba060b8651842ab26871e601833e966b293d2d3d28cc49a52aa6b54352b7fd774c4cb324c84d1fa
7
- data.tar.gz: 11dab3ab3cb2b85a54b31283f2127c6adfe0f1e2dbcdeb73a40e9d2096d45fa258474845f62ee73d6a6ecb6564bd04974941b85c2450cb403773bc739c41d3fa
6
+ metadata.gz: 337e1502bcf24ff67fc58da0128d2526bb449089df5908c38b02645c56024c760b8239eaaf675570aefcd99fcf654e1c87ad7daeeaf7c34511bcc1a089db1671
7
+ data.tar.gz: e0d8140445aa478bee95d90dd672df544aec404976b21b5f2583335713518281090509d92e0eeb240dcb618e8741de8d3f287290ea049c06fa61ca3a8bb42a84
@@ -1 +1,3 @@
1
- ��j#D>j(QVr�B��<���N�ז���zV�&��ҴL�C�N ��O�,��+�"G�&�j*��R�|���c�Li3t��Is�K[���������sz>����Շ���Tk�w�%��/�J`ą���Ճ&<����.�)i�m�6�r�^5��~/��8q�D<If ���͈����p��iL}Iٺ_x5e�*8��>>���w*�^h�G\A#���g����9�);T Z+i
1
+ f���g��b��eܸ���H7��%G\hPQ9��+֐��-�s2'dC��<�d6�&��Ǽ�Ȧof�<.'�<��� ݗy~e��D�
2
+ D�b�+������I[�}���2G��v2µ� (�~�O �׬{P^&B�[�E}'[r�<��"��`n�ת�����uG��[�d��O�AH&@V�P��B�D^�� ��
3
+ oF\w^��I5
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,5 +1,30 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ == Version 1.46.0 (January 20, 2015)
4
+
5
+ * CHANGE: drop `offsite_payments` and `active_utils` as dependencies. [wvanbergen]
6
+ * CHANGE: remove `OffsitePaymentShim`. You will have to add offsite_payments as a dependency,
7
+ and update any mentions of `ActiveSupport::Billing::Integration` to
8
+ `OffsitePayments::Integrations`. [wvanbergen]
9
+ * QuickBooks Payments: Add adapter [ivanfer, bizla]
10
+ * Quickbooks: Remove requirement of oauth gem.
11
+ * PayGate: Add support for refunds [StephanAtG2]
12
+ * PayPal: Add #scrub for scrubbing PCI information out of HTTP transcripts [girasquid]
13
+ * Stripe: Add #scrub for scrubbing PCI information out of HTTP transcripts [girasquid]
14
+ * Cybersource: Add ability to verify a card [duff]
15
+ * BraintreeBlue: Expose the error code in the response params [duff]
16
+ * eWay Rapid: Update supported countries and card types [incarnate]
17
+ * PayPal: Allow specifying ButtonSource at init [ntalbott]
18
+ * Payflow: Add fraud_review support [ntalbott]
19
+ * Add IPP gateway [InfraRuby]
20
+ * Redsys: Fix order_id truncation [duff]
21
+ * AuthorizeNet: Improve duplicate_window handling [duff]
22
+ * PayPal: Fix ButtonSource bug [ntalbott]
23
+ * Checkout: Prevent multiple trackids from being passed [markabe]
24
+ * Pin: Handle JSON parsing exception in response [duff]
25
+ * Improve test suite to test against multiple ActiveSupport versions [wvanbergen]
26
+ * Misc. code cleanup [wvanbergen]
27
+
3
28
  == Version 1.45.0 (December 1, 2014)
4
29
 
5
30
  * HPS: Always pass CardHolderData element [SecureSubmit, ntalbott]
@@ -509,3 +509,12 @@ Bank Frick (September 2014)
509
509
  Global Transport (September 2014)
510
510
 
511
511
  * Duff O'Melia (duff)
512
+
513
+ IPP (December 2014)
514
+
515
+ * (InfraRuby)
516
+
517
+ QuickBooks Payments (January 2015)
518
+
519
+ * Arbab Ahmed (bizla)
520
+ * Ivan Sanchez (ivanfer)
data/README.md CHANGED
@@ -41,7 +41,6 @@ This simple example demonstrates how a purchase can be made using a person's
41
41
  credit card details.
42
42
 
43
43
  ```ruby
44
- require 'rubygems'
45
44
  require 'active_merchant'
46
45
 
47
46
  # Use the TrustCommerce test servers
@@ -112,7 +111,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
112
111
  * [ePay](http://epay.dk/) - DK, SE, NO
113
112
  * [EVO Canada](http://www.evocanada.com/) - CA
114
113
  * [eWAY](http://www.eway.com.au/) - AU, NZ, GB
115
- * [eWAY Rapid 3.0](http://www.eway.com.au/) - AU
114
+ * [eWAY Rapid](http://www.eway.com.au/) - AU, NZ, GB, SG
116
115
  * [E-xact](http://www.e-xact.com) - CA, US
117
116
  * [Fat Zebra](https://www.fatzebra.com.au/) - AU
118
117
  * [Federated Canada](http://www.federatedcanada.com/) - CA
@@ -127,6 +126,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
127
126
  * [iATS Payments](http://home.iatspayments.com/) - AU, BR, CA, CH, DE, DK, ES, FI, FR, GR, HK, IE, IT, NL, NO, PT, SE, SG, TR, UK, US
128
127
  * [Inspire Commerce](http://www.inspiregateway.com) - US
129
128
  * [InstaPay](http://www.instapayllc.com) - US
129
+ * [IPP](http://www.ippayments.com.au/) - AU
130
130
  * [Iridium](http://www.iridiumcorp.co.uk/) - GB, ES
131
131
  * [iTransact](http://www.itransact.com/) - US
132
132
  * [JetPay](http://www.jetpay.com/) - US
@@ -137,7 +137,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
137
137
  * [Merchant One Gateway](http://merchantone.com/) - US
138
138
  * [MerchantWARE](http://merchantwarehouse.com/merchantware) - US
139
139
  * [MerchantWarrior](http://www.merchantwarrior.com/) - AU
140
- * [Mercury](http://www.mercurypay.com) - US
140
+ * [Mercury](http://www.mercurypay.com) - US, CA
141
141
  * [Metrics Global](http://www.metricsglobal.com) - US
142
142
  * [MasterCard Internet Gateway Service (MiGS)](http://mastercard.com/mastercardsps) - AU, AE, BD, BN, EG, HK, ID, IN, JO, KW, LB, LK, MU, MV, MY, NZ, OM, PH, QA, SA, SG, TT, VN
143
143
  * [Modern Payments](http://www.modpay.com) - US
@@ -177,6 +177,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
177
177
  * [Psigate](http://www.psigate.com/) - CA
178
178
  * [PSL Payment Solutions](http://www.paymentsolutionsltd.com/) - GB
179
179
  * [QuickBooks Merchant Services](http://payments.intuit.com/) - US
180
+ * [QuickBooks Payments](http://payments.intuit.com/) - US
180
181
  * [Quantum Gateway](http://www.quantumgateway.com) - US
181
182
  * [QuickPay](http://quickpay.net/) - DE, DK, ES, FI, FR, FO, GB, IS, NO, SE
182
183
  * [Raven PacNet](http://www.pacnetservices.com/) - US
@@ -208,21 +209,6 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
208
209
  * [Worldpay](http://www.worldpay.com/) - HK, US, GB, AU, AD, BE, CH, CY, CZ, DE, DK, ES, FI, FR, GI, GR, HU, IE, IL, IT, LI, LU, MC, MT, NL, NO, NZ, PL, PT, SE, SG, SI, SM, TR, UM, VA
209
210
  * [Worldpay US](http://www.worldpay.com/us) - US
210
211
 
211
- ## Deprecation Policy
212
-
213
- Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.
214
-
215
- ## Contributing
216
-
217
- 1. [Fork it](http://github.com/Shopify/active_merchant/fork) and clone your new repo
218
- 2. Create a branch (`git checkout -b my_awesome_feature`)
219
- 3. Commit your changes (`git add my/awesome/file.rb; git commit -m "Added my awesome feature"`)
220
- 4. Push your changes to your fork (`git push origin my_awesome_feature`)
221
- 5. Open a [Pull Request](https://github.com/shopify/active_merchant/pulls)
222
-
223
- Please see the [ActiveMerchant Guide to Contributing](http://github.com/Shopify/active_merchant/wikis/contributing) for
224
- information on adding a new gateway to ActiveMerchant.
225
-
226
- Please don't touch the CHANGELOG in your pull requests, we'll add the appropriate CHANGELOG entries
227
- at release time.
212
+ ## API stability policy
228
213
 
214
+ Functionality or APIs that are deprecated will be marked as such. Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.
@@ -27,7 +27,7 @@ require 'active_support/core_ext/hash/indifferent_access'
27
27
  require 'active_support/core_ext/hash/conversions'
28
28
  require 'active_support/core_ext/object/conversions'
29
29
  require 'active_support/core_ext/class/attribute'
30
- require 'active_support/core_ext/enumerable.rb'
30
+ require 'active_support/core_ext/enumerable'
31
31
 
32
32
  if(!defined?(ActiveSupport::VERSION) || (ActiveSupport::VERSION::STRING < "4.1"))
33
33
  require 'active_support/core_ext/class/attribute_accessors'
@@ -36,22 +36,7 @@ end
36
36
  require 'active_support/core_ext/class/delegating_attributes'
37
37
  require 'active_support/core_ext/module/attribute_accessors'
38
38
 
39
- begin
40
- require 'active_support/base64'
41
-
42
- unless defined?(Base64)
43
- Base64 = ActiveSupport::Base64
44
- end
45
-
46
- unless Base64.respond_to?(:strict_encode64)
47
- def Base64.strict_encode64(v)
48
- ActiveSupport::Base64.encode64s(v)
49
- end
50
- end
51
- rescue LoadError
52
- require 'base64'
53
- end
54
-
39
+ require 'base64'
55
40
  require 'securerandom'
56
41
  require 'builder'
57
42
  require 'cgi'
@@ -59,44 +44,16 @@ require 'rexml/document'
59
44
  require 'timeout'
60
45
  require 'socket'
61
46
 
62
- require 'active_utils/common/network_connection_retries'
63
- silence_warnings{require 'active_utils/common/connection'}
64
- require 'active_utils/common/post_data'
65
- require 'active_utils/common/posts_data'
47
+ require 'active_merchant/network_connection_retries'
48
+ require 'active_merchant/connection'
49
+ require 'active_merchant/post_data'
50
+ require 'active_merchant/posts_data'
66
51
 
67
52
  require 'active_merchant/billing'
68
53
  require 'active_merchant/version'
69
54
  require 'active_merchant/country'
70
55
 
71
- I18n.enforce_available_locales = false
72
-
73
- module ActiveMerchant #:nodoc:
74
- OFFSITE_PAYMENT_EXTRACTION_MESSAGE = "Integrations have been extracted into a separate gem (https://github.com/Shopify/offsite_payments) and will no longer be loaded by ActiveMerchant 2.x."
75
-
76
- module Billing #:nodoc:
77
- def self.const_missing(name)
78
- if name.to_s == "Integrations"
79
- ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
80
- require "active_merchant/offsite_payments_shim"
81
- ActiveMerchant::OffsitePaymentsShim
82
- else
83
- super
84
- end
85
- end
86
-
87
- def self.included(klass)
88
- def klass.const_missing(name)
89
- if name.to_s == "Integrations"
90
- ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
91
- require "active_merchant/offsite_payments_shim"
92
- ActiveMerchant::OffsitePaymentsShim
93
- else
94
- super
95
- end
96
- end
97
- end
98
- end
99
-
56
+ module ActiveMerchant
100
57
  def self.deprecated(message, caller=Kernel.caller[1])
101
58
  warning = caller + ": " + message
102
59
  if(respond_to?(:logger) && logger.present?)
@@ -106,3 +63,5 @@ module ActiveMerchant #:nodoc:
106
63
  end
107
64
  end
108
65
  end
66
+
67
+ I18n.enforce_available_locales = false
@@ -11,3 +11,4 @@ require 'active_merchant/billing/payment_token'
11
11
  require 'active_merchant/billing/apple_pay_payment_token'
12
12
  require 'active_merchant/billing/response'
13
13
  require 'active_merchant/billing/gateways'
14
+ require 'active_merchant/billing/gateway'
@@ -128,7 +128,7 @@ module ActiveMerchant #:nodoc:
128
128
 
129
129
  # The application making the calls to the gateway
130
130
  # Useful for things like the PayPal build notation (BN) id fields
131
- superclass_delegating_accessor :application_id
131
+ class_attribute :application_id, instance_writer: false
132
132
  self.application_id = 'ActiveMerchant'
133
133
 
134
134
  attr_reader :options
@@ -181,6 +181,15 @@ module ActiveMerchant #:nodoc:
181
181
  (@options.has_key?(:test) ? @options[:test] : Base.test?)
182
182
  end
183
183
 
184
+ # Does this gateway know how to scrub sensitive information out of HTTP transcripts?
185
+ def supports_scrubbing?
186
+ false
187
+ end
188
+
189
+ def scrub(transcript)
190
+ raise RuntimeError.new("This gateway does not support scrubbing.")
191
+ end
192
+
184
193
  protected # :nodoc: all
185
194
 
186
195
  def normalize(field)
@@ -1,17 +1,12 @@
1
1
  module ActiveMerchant
2
2
  module Billing
3
- autoload :Gateway, 'active_merchant/billing/gateway'
3
+ load_path = Pathname.new(__FILE__ + '/../../..')
4
+ Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |filename|
5
+ gateway_name = File.basename(filename, '.rb')
6
+ gateway_classname = "#{gateway_name}_gateway".camelize
7
+ gateway_filename = Pathname.new(filename).relative_path_from(load_path).sub_ext('')
4
8
 
5
- Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |f|
6
- # Get camelized class name
7
- filename = File.basename(f, '.rb')
8
- # Add _gateway suffix
9
- gateway_name = filename + '_gateway'
10
- # Camelize the string to get the class name
11
- gateway_class = gateway_name.camelize
12
-
13
- # Register for autoloading
14
- autoload gateway_class, f
9
+ autoload(gateway_classname, gateway_filename)
15
10
  end
16
11
  end
17
12
  end
@@ -41,8 +41,9 @@ module ActiveMerchant #:nodoc:
41
41
  commit("AUTH_CAPTURE") do |xml|
42
42
  add_order_id(xml, options)
43
43
  xml.transactionRequest do
44
- xml.transactionType 'authCaptureTransaction'
45
- xml.amount amount(amount)
44
+ xml.transactionType('authCaptureTransaction')
45
+ xml.amount(amount(amount))
46
+
46
47
  add_payment_source(xml, payment)
47
48
  add_invoice(xml, options)
48
49
  add_customer_data(xml, payment, options)
@@ -57,8 +58,9 @@ module ActiveMerchant #:nodoc:
57
58
  commit("AUTH_ONLY") do |xml|
58
59
  add_order_id(xml, options)
59
60
  xml.transactionRequest do
60
- xml.transactionType 'authOnlyTransaction'
61
- xml.amount amount(amount)
61
+ xml.transactionType('authOnlyTransaction')
62
+ xml.amount(amount(amount))
63
+
62
64
  add_payment_source(xml, payment)
63
65
  add_invoice(xml, options)
64
66
  add_customer_data(xml, payment, options)
@@ -72,9 +74,10 @@ module ActiveMerchant #:nodoc:
72
74
  commit("PRIOR_AUTH_CAPTURE") do |xml|
73
75
  add_order_id(xml, options)
74
76
  xml.transactionRequest do
75
- xml.transactionType 'priorAuthCaptureTransaction'
76
- xml.amount amount(amount)
77
- xml.refTransId split_authorization(authorization)[0]
77
+ xml.transactionType('priorAuthCaptureTransaction')
78
+ xml.amount(amount(amount))
79
+ xml.refTransId(split_authorization(authorization)[0])
80
+
78
81
  add_invoice(xml, options)
79
82
  add_user_fields(xml, amount, options)
80
83
  end
@@ -85,15 +88,16 @@ module ActiveMerchant #:nodoc:
85
88
  transaction_id, card_number = split_authorization(authorization)
86
89
  commit("CREDIT") do |xml|
87
90
  xml.transactionRequest do
88
- xml.transactionType 'refundTransaction'
89
- xml.amount (amount.nil? ? 0 : amount(amount))
91
+ xml.transactionType('refundTransaction')
92
+ xml.amount(amount.nil? ? 0 : amount(amount))
90
93
  xml.payment do
91
94
  xml.creditCard do
92
95
  xml.cardNumber(card_number || options[:card_number])
93
- xml.expirationDate 'XXXX'
96
+ xml.expirationDate('XXXX')
94
97
  end
95
98
  end
96
- xml.refTransId transaction_id
99
+ xml.refTransId(transaction_id)
100
+
97
101
  add_customer_data(xml, nil, options)
98
102
  add_user_fields(xml, amount, options)
99
103
  end
@@ -104,8 +108,9 @@ module ActiveMerchant #:nodoc:
104
108
  commit("VOID") do |xml|
105
109
  add_order_id(xml, options)
106
110
  xml.transactionRequest do
107
- xml.transactionType 'voidTransaction'
108
- xml.refTransId split_authorization(authorization)[0]
111
+ xml.transactionType('voidTransaction')
112
+ xml.refTransId(split_authorization(authorization)[0])
113
+
109
114
  add_user_fields(xml, nil, options)
110
115
  end
111
116
  end
@@ -133,33 +138,40 @@ module ActiveMerchant #:nodoc:
133
138
 
134
139
  def add_settings(xml, source, options)
135
140
  xml.transactionSettings do
136
- if(card_brand(source) == "check" && options[:recurring])
141
+ if card_brand(source) == "check" && options[:recurring]
137
142
  xml.setting do
138
- xml.settingName "recurringBilling"
139
- xml.settingValue "true"
143
+ xml.settingName("recurringBilling")
144
+ xml.settingValue("true")
140
145
  end
141
146
  end
142
- if(self.class.duplicate_window)
143
- xml.setting do
144
- xml.settingName "duplicateWindow"
145
- xml.settingValue self.class.duplicate_window
146
- end
147
+ if options[:duplicate_window]
148
+ set_duplicate_window(xml, options[:duplicate_window])
149
+ elsif self.class.duplicate_window
150
+ ActiveMerchant.deprecated "Using the duplicate_window class_attribute is deprecated. Use the transaction options hash instead."
151
+ set_duplicate_window(xml, self.class.duplicate_window)
147
152
  end
148
153
  end
149
154
  end
150
155
 
156
+ def set_duplicate_window(xml, value)
157
+ xml.setting do
158
+ xml.settingName("duplicateWindow")
159
+ xml.settingValue(value)
160
+ end
161
+ end
162
+
151
163
  def add_user_fields(xml, amount, options)
152
164
  xml.userFields do
153
- if(currency = (options[:currency] || currency(amount)))
165
+ if currency = (options[:currency] || currency(amount))
154
166
  xml.userField do
155
- xml.name "x_currency_code"
156
- xml.value currency
167
+ xml.name("x_currency_code")
168
+ xml.value(currency)
157
169
  end
158
170
  end
159
- if(application_id.present? && application_id != "ActiveMerchant")
171
+ if application_id.present? && application_id != "ActiveMerchant"
160
172
  xml.userField do
161
- xml.name "x_solution_id"
162
- xml.value application_id
173
+ xml.name("x_solution_id")
174
+ xml.value(application_id)
163
175
  end
164
176
  end
165
177
  end
@@ -171,10 +183,10 @@ module ActiveMerchant #:nodoc:
171
183
  else
172
184
  xml.payment do
173
185
  xml.creditCard do
174
- xml.cardNumber credit_card.number
175
- xml.expirationDate (format(credit_card.month, :two_digits) + '/' + format(credit_card.year, :four_digits))
186
+ xml.cardNumber(credit_card.number)
187
+ xml.expirationDate(format(credit_card.month, :two_digits) + '/' + format(credit_card.year, :four_digits))
176
188
  unless empty?(credit_card.verification_value)
177
- xml.cardCode credit_card.verification_value
189
+ xml.cardCode(credit_card.verification_value)
178
190
  end
179
191
  end
180
192
  end
@@ -198,8 +210,8 @@ module ActiveMerchant #:nodoc:
198
210
  def add_apple_pay_payment_token(xml, apple_pay_payment_token)
199
211
  xml.payment do
200
212
  xml.opaqueData do
201
- xml.dataDescriptor APPLE_PAY_DATA_DESCRIPTOR
202
- xml.dataValue Base64.strict_encode64(apple_pay_payment_token.payment_data.to_json)
213
+ xml.dataDescriptor(APPLE_PAY_DATA_DESCRIPTOR)
214
+ xml.dataValue(Base64.strict_encode64(apple_pay_payment_token.payment_data.to_json))
203
215
  end
204
216
  end
205
217
  end
@@ -208,7 +220,7 @@ module ActiveMerchant #:nodoc:
208
220
  return unless valid_track_data
209
221
  xml.retail do
210
222
  # As per http://www.authorize.net/support/CP_guide.pdf, '2' is for Retail, the only current market_type
211
- xml.marketType 2
223
+ xml.marketType(2)
212
224
  end
213
225
  end
214
226
 
@@ -219,12 +231,12 @@ module ActiveMerchant #:nodoc:
219
231
  def add_check(xml, check)
220
232
  xml.payment do
221
233
  xml.bankAccount do
222
- xml.routingNumber check.routing_number
223
- xml.accountNumber check.account_number
224
- xml.nameOnAccount check.name
225
- xml.echeckType "WEB"
226
- xml.bankName check.bank_name
227
- xml.checkNumber check.number
234
+ xml.routingNumber(check.routing_number)
235
+ xml.accountNumber(check.account_number)
236
+ xml.nameOnAccount(check.name)
237
+ xml.echeckType("WEB")
238
+ xml.bankName(check.bank_name)
239
+ xml.checkNumber(check.number)
228
240
  end
229
241
  end
230
242
  end
@@ -271,19 +283,19 @@ module ActiveMerchant #:nodoc:
271
283
  xml.customerIP(options[:ip]) unless empty?(options[:ip])
272
284
 
273
285
  xml.cardholderAuthentication do
274
- xml.authenticationIndicator options[:authentication_indicator]
275
- xml.cardholderAuthenticationValue options[:cardholder_authentication_value]
286
+ xml.authenticationIndicator(options[:authentication_indicator])
287
+ xml.cardholderAuthenticationValue(options[:cardholder_authentication_value])
276
288
  end
277
289
  end
278
290
 
279
291
  def add_order_id(xml, options)
280
- xml.refId truncate(options[:order_id], 20)
292
+ xml.refId(truncate(options[:order_id], 20))
281
293
  end
282
294
 
283
295
  def add_invoice(xml, options)
284
296
  xml.order do
285
- xml.invoiceNumber truncate(options[:order_id], 20)
286
- xml.description truncate(options[:description], 255)
297
+ xml.invoiceNumber(truncate(options[:order_id], 20))
298
+ xml.description(truncate(options[:description], 255))
287
299
  end
288
300
  end
289
301
 
@@ -318,8 +330,8 @@ module ActiveMerchant #:nodoc:
318
330
  Nokogiri::XML::Builder.new do |xml|
319
331
  xml.createTransactionRequest('xmlns' => 'AnetApi/xml/v1/schema/AnetApiSchema.xsd') do
320
332
  xml.merchantAuthentication do
321
- xml.name @options[:login]
322
- xml.transactionKey @options[:password]
333
+ xml.name(@options[:login])
334
+ xml.transactionKey(@options[:password])
323
335
  end
324
336
  yield(xml)
325
337
  end
@@ -413,7 +425,6 @@ module ActiveMerchant #:nodoc:
413
425
  return nil unless value
414
426
  value.to_s[0, max_size]
415
427
  end
416
-
417
428
  end
418
429
  end
419
430
  end