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
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- �LB0�q ^���CD���i��:�����nkU[su��&W�֩�v��_���eN��B"��Q�*J1͌ә�NT'9b"*��}C}���~���Ց�c�W�.�!�Xws�c
2
- P[4|��9 1ۺ4�<�]a˫�E����z�<VA�u��С ��7^4��z;�zխ�v�ә@?�N�� �]�2馯�Z���@{7��6{\���
3
- B��j�E@):�9AxR���6mDVO2�
1
+ (L��+��~>�}(,V> Pp fH;���E?R]$�7
2
+ �۝,*jl] ^F��p<�9�Z}/��z}k���vfN1M_1 dF��"�����j2r:65�K
3
+ h��iPƯh�@Q=�t�^ZV(Ƹ��Y�`���`��b��y���jj���;����If����$�d��^q��2�/f�\�*1�Nr�4l��,�߱���N��e�u�p�^�,P��!c�>� q����f��A|���=
data/CHANGELOG CHANGED
@@ -1,5 +1,41 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ == Version 1.29.0 (November 30, 2012)
4
+
5
+ * Authorize.Net gateway: Support description and order_id for capture [ntalbott]
6
+ * Add Mercury gateway [adr1anx, opendining]
7
+ * Webmoney integration: Add gross, item_id, and amount accessors to notification [fr33z3]
8
+ * Fix running tests under ActiveSupport 2.3.14 [ntalbott]
9
+ * SagePay Form integration: Remove dependency on ActiveSupport's String#truncate [ntalbott]
10
+ * Elavon gateway: Add support for the sales tax parameter [stevestmartin]
11
+ * Add WebPay gateway [keikubo]
12
+ * iTransact gateway: make void API consistent [frobcode]
13
+ * Stripe gateway: Pass city in add_address [npverni]
14
+ * Paypal gateway: Add option to change the outstanding balance of a recurring billing profile [mattwhite]
15
+ * Mercury gateway: Fix authorizations API [ntalbott]
16
+ * Mercury gateway: Support refund properly [ntalbott]
17
+ * Braintree Blue gateway: Add support for the recurring flag [ntalbott]
18
+ * Add HDFC gateway [ntalbott]
19
+ * HDFC gateway: Add more supported currencies [ntalbott]
20
+ * HDFC gateway: Add support for passing ECI value [ntalbott]
21
+ * HDFC gateway: Allow setting test mode via options [ntalbott]
22
+ * HDFC gateway: Pass phone number in UDF3 [ntalbott]
23
+ * HDFC gateway: Fix unescaped '&' entity in XML [ntalbott]
24
+ * HDFC gateway: More robust entity fixing [ntalbott]
25
+ * Add A1Agregator integration [england]
26
+ * Refactored handling of #test? and @options [ntalbott]
27
+ * Realex gateway: Realex gateway: Fix billing address format [ntalbott]
28
+ * Orbital gateway: handle custom AVS response codes [jonm-okc]
29
+ * Orbital gateway: Fix infinite connection retry [jonm-okc, ntalbott]
30
+ * PayPal integration: Add support for MassPay IPN notifications [damonmorgan]
31
+ * Orbital gateway: Fix status of void result [jonm-okc]
32
+ * Add Redsys gateway [samlown]
33
+ * Cybersource gateway: Add support for subscription credit [fabiokr]
34
+ * Use Thor for generators [ntalbott]
35
+ * Psigate gateway: Add void support [samuelreh]
36
+ * Add Liqpay integration [beorc]
37
+ * Paypal Express gateway: Add shipping accessor to response [v-fedorov]
38
+
3
39
  == Version 1.28.0 (August 10, 2012)
4
40
 
5
41
  * PayPal Express: support non standard locale codes [Soleone]
data/CONTRIBUTORS CHANGED
@@ -345,3 +345,11 @@ Paxum integration (July 2012)
345
345
  Balanced gateway (July 2012)
346
346
 
347
347
  * Marshall Jones (mjallday)
348
+
349
+ A1Agregator (November 2012)
350
+
351
+ * Roman Ivanilov (england)
352
+
353
+ Liqpay integration (November 2012)
354
+
355
+ * beorc
data/README.md CHANGED
@@ -105,6 +105,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
105
105
  * [Federated Canada](http://www.federatedcanada.com/) - CA
106
106
  * [FirstPay](http://www.first-pay.com) - US
107
107
  * [Garanti Sanal POS](https://ccpos.garanti.com.tr/ccRaporlar/garanti/ccReports) - US, TR
108
+ * [HDFC](http://www.hdfcbank.com/sme/sme-details/merchant-services/guzh6m0i) - IN
108
109
  * [Inspire](http://www.inspiregateway.com) - US
109
110
  * [InstaPay](http://www.instapayllc.com) - US
110
111
  * [Iridium](http://www.iridiumcorp.co.uk/) - UK, ES
@@ -114,6 +115,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
114
115
  * [Litle](http://www.litle.com/) - US
115
116
  * [Merchant e-Solutions](http://merchante-solutions.com/) - US
116
117
  * [MerchantWare](http://merchantwarehouse.com/merchantware) - US
118
+ * [Mercury](http://www.mercurypay.com) - US
117
119
  * [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
118
120
  * [Modern Payments](http://www.modpay.com) - US
119
121
  * [Moneris](http://www.moneris.com/) - CA
@@ -147,6 +149,7 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
147
149
  * [Quickpay](http://quickpay.dk/) - DK, SE
148
150
  * [Rabobank Nederland](http://www.rabobank.nl/) - NL
149
151
  * [Realex](http://www.realexpayments.com/) - IE, UK
152
+ * [Redsys](http://www.redsys.es) - ES
150
153
  * [SagePay](http://www.sagepay.com) - UK
151
154
  * [Sage Payment Solutions](http://www.sagepayments.com) - US, CA
152
155
  * [Sallie Mae](http://www.salliemae.com) - US
@@ -162,12 +165,14 @@ The [ActiveMerchant Wiki](http://github.com/Shopify/active_merchant/wikis) conta
162
165
  * [Verifi](http://www.verifi.com/) - US
163
166
  * [ViaKLIX](http://viaklix.com) - US
164
167
  * [Vindica](http://www.vindicia.com/) - US, CA, UK, AU, MX, BR, DE, KR, CN, HK
168
+ * [WebPay](https://webpay.jp/) - JP
165
169
  * [Wirecard](http://www.wirecard.com) - DE
166
170
  * [WorldPay](http://www.worldpay.com) - AU, HK, UK, US
167
171
 
168
172
  ## Supported Offsite Payment Gateways
169
173
 
170
174
  * [2 Checkout](http://www.2checkout.com)
175
+ * [A1Agregator](http://a1agregator.ru/) - RU
171
176
  * [Authorize.Net SIM](http://developer.authorize.net/api/sim/) - US
172
177
  * [Banca Sella GestPay](https://www.sella.it/banca/ecommerce/gestpay/gestpay.jsp)
173
178
  * [Chronopay](http://www.chronopay.com)
@@ -125,11 +125,12 @@ module ActiveMerchant #:nodoc:
125
125
  # See the documentation for the gateway you will be using to make sure there are no other
126
126
  # required options.
127
127
  def initialize(options = {})
128
+ @options = options
128
129
  end
129
130
 
130
131
  # Are we running in test mode?
131
132
  def test?
132
- Base.gateway_mode == :test
133
+ (@options[:test] || Base.test?)
133
134
  end
134
135
 
135
136
  private # :nodoc: all
@@ -1,18 +1,17 @@
1
1
  module ActiveMerchant
2
2
  module Billing
3
3
  autoload :Gateway, 'active_merchant/billing/gateway'
4
-
5
- Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |f|
6
-
7
- # Get camelized class name
4
+
5
+ Dir[File.dirname(__FILE__) + '/gateways/**/*.rb'].each do |f|
6
+ # Get camelized class name
8
7
  filename = File.basename(f, '.rb')
9
8
  # Add _gateway suffix
10
9
  gateway_name = filename + '_gateway'
11
10
  # Camelize the string to get the class name
12
- gateway_class = gateway_name.camelize
13
-
11
+ gateway_class = gateway_name.camelize
12
+
14
13
  # Register for autoloading
15
- autoload gateway_class, f
14
+ autoload gateway_class, f
16
15
  end
17
16
  end
18
17
  end
@@ -72,7 +72,6 @@ module ActiveMerchant #:nodoc:
72
72
  # Otherwise, perform transactions against the production server.
73
73
  def initialize(options = {})
74
74
  requires!(options, :login, :password)
75
- @options = options
76
75
  super
77
76
  end
78
77
 
@@ -122,6 +121,7 @@ module ActiveMerchant #:nodoc:
122
121
  def capture(money, authorization, options = {})
123
122
  post = {:trans_id => authorization}
124
123
  add_customer_data(post, options)
124
+ add_invoice(post, options)
125
125
  commit('PRIOR_AUTH_CAPTURE', money, post)
126
126
  end
127
127
 
@@ -268,7 +268,8 @@ module ActiveMerchant #:nodoc:
268
268
  url = test? ? self.test_url : self.live_url
269
269
  data = ssl_post url, post_data(action, parameters)
270
270
 
271
- response = parse(data)
271
+ response = parse(data)
272
+ response[:action] = action
272
273
 
273
274
  message = message_from(response)
274
275
 
@@ -2,23 +2,23 @@
2
2
  module ActiveMerchant #:nodoc:
3
3
  module Billing #:nodoc:
4
4
  # ==== Customer Information Manager (CIM)
5
- #
5
+ #
6
6
  # The Authorize.Net Customer Information Manager (CIM) is an optional additional service that allows you to store sensitive payment information on
7
- # Authorize.Net's servers, simplifying payments for returning customers and recurring transactions. It can also help with Payment Card Industry (PCI)
7
+ # Authorize.Net's servers, simplifying payments for returning customers and recurring transactions. It can also help with Payment Card Industry (PCI)
8
8
  # Data Security Standard compliance, since customer data is no longer stored locally.
9
- #
9
+ #
10
10
  # To use the AuthorizeNetCimGateway CIM must be enabled for your account.
11
- #
11
+ #
12
12
  # Information about CIM is available on the {Authorize.Net website}[http://www.authorize.net/solutions/merchantsolutions/merchantservices/cim/].
13
13
  # Information about the CIM API is available at the {Authorize.Net Integration Center}[http://developer.authorize.net/]
14
- #
14
+ #
15
15
  # ==== Login and Password
16
- #
17
- # The login and password are not the username and password you use to
18
- # login to the Authorize.Net Merchant Interface. Instead, you will
19
- # use the API Login ID as the login and Transaction Key as the
16
+ #
17
+ # The login and password are not the username and password you use to
18
+ # login to the Authorize.Net Merchant Interface. Instead, you will
19
+ # use the API Login ID as the login and Transaction Key as the
20
20
  # password.
21
- #
21
+ #
22
22
  # ==== How to Get Your API Login ID and Transaction Key
23
23
  #
24
24
  # 1. Log into the Merchant Interface
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
  class AuthorizeNetCimGateway < Gateway
30
30
  self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
31
31
  self.live_url = 'https://api.authorize.net/xml/v1/request.api'
32
-
32
+
33
33
  AUTHORIZE_NET_CIM_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
34
34
 
35
35
  CIM_ACTIONS = {
@@ -49,7 +49,7 @@ module ActiveMerchant #:nodoc:
49
49
  :create_customer_profile_transaction => 'createCustomerProfileTransaction',
50
50
  :validate_customer_payment_profile => 'validateCustomerPaymentProfile'
51
51
  }
52
-
52
+
53
53
  CIM_TRANSACTION_TYPES = {
54
54
  :auth_capture => 'profileTransAuthCapture',
55
55
  :auth_only => 'profileTransAuthOnly',
@@ -65,24 +65,24 @@ module ActiveMerchant #:nodoc:
65
65
  :live => 'liveMode',
66
66
  :old => 'oldLiveMode'
67
67
  }
68
-
68
+
69
69
  BANK_ACCOUNT_TYPES = {
70
70
  :checking => 'checking',
71
71
  :savings => 'savings',
72
72
  :business_checking => 'businessChecking'
73
73
  }
74
-
74
+
75
75
  ECHECK_TYPES = {
76
76
  :ccd => 'CCD',
77
77
  :ppd => 'PPD',
78
78
  :web => 'WEB'
79
79
  }
80
-
80
+
81
81
  self.homepage_url = 'http://www.authorize.net/'
82
82
  self.display_name = 'Authorize.Net CIM'
83
83
  self.supported_countries = ['US']
84
84
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
85
-
85
+
86
86
  # Creates a new AuthorizeNetCimGateway
87
87
  #
88
88
  # The gateway requires that a valid API Login ID and Transaction Key be passed
@@ -92,26 +92,25 @@ module ActiveMerchant #:nodoc:
92
92
  #
93
93
  # * <tt>:login</tt> -- The Authorize.Net API Login ID (REQUIRED)
94
94
  # * <tt>:password</tt> -- The Authorize.Net Transaction Key. (REQUIRED)
95
- # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
95
+ # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
96
96
  # * <tt>:delimiter</tt> -- The delimiter used in the direct response. Default is ',' (comma).
97
97
  # Otherwise, perform transactions against the production server.
98
98
  def initialize(options = {})
99
99
  requires!(options, :login, :password)
100
- @options = options
101
100
  super
102
101
  end
103
102
 
104
103
  # Creates a new customer profile along with any customer payment profiles and customer shipping addresses
105
104
  # for the customer profile.
106
- #
107
- # Returns a Response with the Customer Profile ID of the new customer profile in the authorization field.
108
- # It is *CRITICAL* that you save this ID. There is no way to retrieve this through the API. You will not
105
+ #
106
+ # Returns a Response with the Customer Profile ID of the new customer profile in the authorization field.
107
+ # It is *CRITICAL* that you save this ID. There is no way to retrieve this through the API. You will not
109
108
  # be able to create another Customer Profile with the same information.
110
109
  #
111
- #
110
+ #
112
111
  #
113
112
  # ==== Options
114
- #
113
+ #
115
114
  # * <tt>:profile</tt> -- A hash containing at least one of the CONDITIONAL profile options below (REQUIRED)
116
115
  #
117
116
  # ==== Profile
@@ -129,7 +128,7 @@ module ActiveMerchant #:nodoc:
129
128
  requires!(options[:profile], :email) unless options[:profile][:merchant_customer_id] || options[:profile][:description]
130
129
  requires!(options[:profile], :description) unless options[:profile][:email] || options[:profile][:merchant_customer_id]
131
130
  requires!(options[:profile], :merchant_customer_id) unless options[:profile][:description] || options[:profile][:email]
132
-
131
+
133
132
  request = build_request(:create_customer_profile, options)
134
133
  commit(:create_customer_profile, request)
135
134
  end
@@ -148,7 +147,7 @@ module ActiveMerchant #:nodoc:
148
147
  requires!(options, :customer_profile_id)
149
148
  requires!(options, :payment_profile)
150
149
  requires!(options[:payment_profile], :payment)
151
-
150
+
152
151
  request = build_request(:create_customer_payment_profile, options)
153
152
  commit(:create_customer_payment_profile, request)
154
153
  end
@@ -162,7 +161,7 @@ module ActiveMerchant #:nodoc:
162
161
  def create_customer_shipping_address(options)
163
162
  requires!(options, :customer_profile_id)
164
163
  requires!(options, :address)
165
-
164
+
166
165
  request = build_request(:create_customer_shipping_address, options)
167
166
  commit(:create_customer_shipping_address, request)
168
167
  end
@@ -228,9 +227,9 @@ module ActiveMerchant #:nodoc:
228
227
 
229
228
  # Retrieve a customer payment profile for an existing customer profile.
230
229
  #
231
- # Returns a Response whose params hash contains all the payment profile information. Sensitive information such as credit card
230
+ # Returns a Response whose params hash contains all the payment profile information. Sensitive information such as credit card
232
231
  # numbers will be masked.
233
- #
232
+ #
234
233
  # ==== Options
235
234
  #
236
235
  # * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer with the payment profile to be retrieved. (REQUIRED)
@@ -245,8 +244,8 @@ module ActiveMerchant #:nodoc:
245
244
 
246
245
  # Retrieve a customer shipping address for an existing customer profile.
247
246
  #
248
- # Returns a Response whose params hash contains all the shipping address information.
249
- #
247
+ # Returns a Response whose params hash contains all the shipping address information.
248
+ #
250
249
  # ==== Options
251
250
  #
252
251
  # * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer with the payment profile to be retrieved. (REQUIRED)
@@ -259,16 +258,16 @@ module ActiveMerchant #:nodoc:
259
258
  commit(:get_customer_shipping_address, request)
260
259
  end
261
260
 
262
- # Updates an existing customer profile.
263
- #
264
- # Warning: if you do not provide a parameter in the <tt>:payment_profile</tt> hash, it is automatically set to nil at
265
- # Authorize.Net. You will most likely want to first get the profile hash using get_customer_profile and then only change the
261
+ # Updates an existing customer profile.
262
+ #
263
+ # Warning: if you do not provide a parameter in the <tt>:payment_profile</tt> hash, it is automatically set to nil at
264
+ # Authorize.Net. You will most likely want to first get the profile hash using get_customer_profile and then only change the
266
265
  # elements you wish to change.
267
266
  #
268
267
  # ==== Options
269
268
  #
270
269
  # * <tt>:profile</tt> -- A hash containing the values the Customer Profile should be updated to. (REQUIRED)
271
- #
270
+ #
272
271
  # ==== Profile
273
272
  #
274
273
  # * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer profile to update. (REQUIRED)
@@ -281,8 +280,8 @@ module ActiveMerchant #:nodoc:
281
280
  end
282
281
 
283
282
  # Updates a customer payment profile for an existing customer profile.
284
- #
285
- # Warning: if you do not provide a parameter in the <tt>:payment_profile</tt> hash, it is automatically set to nil at
283
+ #
284
+ # Warning: if you do not provide a parameter in the <tt>:payment_profile</tt> hash, it is automatically set to nil at
286
285
  # Authorize.Net. You will most likely want to first get the profile hash using get_customer_payment_profile and then only
287
286
  # change the elements you wish to change.
288
287
  #
@@ -290,7 +289,7 @@ module ActiveMerchant #:nodoc:
290
289
  #
291
290
  # * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer with the payment profile to be updated. (REQUIRED)
292
291
  # * <tt>:payment_profile</tt> -- A hash containing the values the Customer Payment Profile should be updated to. (REQUIRED)
293
- #
292
+ #
294
293
  # ==== Payment Profile
295
294
  #
296
295
  # * <tt>:customer_payment_profile_id</tt> -- The Customer Payment Profile ID of the Customer Payment Profile to update. (REQUIRED)
@@ -303,8 +302,8 @@ module ActiveMerchant #:nodoc:
303
302
  end
304
303
 
305
304
  # Updates a customer shipping address for an existing customer profile.
306
- #
307
- # Warning: if you do not provide a parameter in the <tt>:address</tt> hash, it is automatically set to nil at
305
+ #
306
+ # Warning: if you do not provide a parameter in the <tt>:address</tt> hash, it is automatically set to nil at
308
307
  # Authorize.Net. You will most likely want to first get the profile hash using get_customer_shipping_address and then only
309
308
  # change the elements you wish to change.
310
309
  #
@@ -312,7 +311,7 @@ module ActiveMerchant #:nodoc:
312
311
  #
313
312
  # * <tt>:customer_profile_id</tt> -- The Customer Profile ID of the customer with the payment profile to be updated. (REQUIRED)
314
313
  # * <tt>:address</tt> -- A hash containing the values the Customer Shipping Address should be updated to. (REQUIRED)
315
- #
314
+ #
316
315
  # ==== Address
317
316
  #
318
317
  # * <tt>:customer_address_id</tt> -- The Customer Address ID of the Customer Payment Profile to update. (REQUIRED)
@@ -327,7 +326,7 @@ module ActiveMerchant #:nodoc:
327
326
  # Creates a new payment transaction from an existing customer profile
328
327
  #
329
328
  # This is what is used to charge a customer whose information you have stored in a Customer Profile.
330
- #
329
+ #
331
330
  # Returns a Response object that contains the result of the transaction in <tt>params['direct_response']</tt>
332
331
  #
333
332
  # ==== Options
@@ -471,7 +470,7 @@ module ActiveMerchant #:nodoc:
471
470
  def expdate(credit_card)
472
471
  sprintf('%04d-%02d', credit_card.year, credit_card.month)
473
472
  end
474
-
473
+
475
474
  def build_request(action, options = {})
476
475
  unless CIM_ACTIONS.include?(action)
477
476
  raise StandardError, "Invalid Customer Information Manager Action: #{action}"
@@ -496,7 +495,7 @@ module ActiveMerchant #:nodoc:
496
495
  xml.tag!('transactionKey', @options[:password])
497
496
  end
498
497
  end
499
-
498
+
500
499
  def build_create_customer_profile_request(xml, options)
501
500
  add_profile(xml, options[:profile])
502
501
 
@@ -507,29 +506,29 @@ module ActiveMerchant #:nodoc:
507
506
  add_payment_profile(xml, options[:payment_profile])
508
507
  end
509
508
  end
510
-
509
+
511
510
  xml.target!
512
511
  end
513
512
 
514
513
  def build_create_customer_payment_profile_request(xml, options)
515
514
  xml.tag!('customerProfileId', options[:customer_profile_id])
516
-
515
+
517
516
  xml.tag!('paymentProfile') do
518
517
  add_payment_profile(xml, options[:payment_profile])
519
518
  end
520
-
519
+
521
520
  xml.tag!('validationMode', CIM_VALIDATION_MODES[options[:validation_mode]]) if options[:validation_mode]
522
521
 
523
522
  xml.target!
524
523
  end
525
-
524
+
526
525
  def build_create_customer_shipping_address_request(xml, options)
527
526
  xml.tag!('customerProfileId', options[:customer_profile_id])
528
-
527
+
529
528
  xml.tag!('address') do
530
529
  add_address(xml, options[:address])
531
530
  end
532
-
531
+
533
532
  xml.target!
534
533
  end
535
534
 
@@ -572,8 +571,8 @@ module ActiveMerchant #:nodoc:
572
571
  end
573
572
 
574
573
  def build_update_customer_profile_request(xml, options)
575
- add_profile(xml, options[:profile], true)
576
-
574
+ add_profile(xml, options[:profile], true)
575
+
577
576
  xml.target!
578
577
  end
579
578
 
@@ -581,11 +580,11 @@ module ActiveMerchant #:nodoc:
581
580
  xml.tag!('customerProfileId', options[:customer_profile_id])
582
581
 
583
582
  xml.tag!('paymentProfile') do
584
- add_payment_profile(xml, options[:payment_profile])
583
+ add_payment_profile(xml, options[:payment_profile])
585
584
  end
586
585
 
587
586
  xml.tag!('validationMode', CIM_VALIDATION_MODES[options[:validation_mode]]) if options[:validation_mode]
588
-
587
+
589
588
  xml.target!
590
589
  end
591
590
 
@@ -593,7 +592,7 @@ module ActiveMerchant #:nodoc:
593
592
  xml.tag!('customerProfileId', options[:customer_profile_id])
594
593
 
595
594
  xml.tag!('address') do
596
- add_address(xml, options[:address])
595
+ add_address(xml, options[:address])
597
596
  end
598
597
 
599
598
  xml.target!
@@ -602,10 +601,10 @@ module ActiveMerchant #:nodoc:
602
601
  def build_create_customer_profile_transaction_request(xml, options)
603
602
  add_transaction(xml, options[:transaction])
604
603
  xml.tag!('extraOptions', "x_test_request=TRUE") if @options[:test]
605
-
604
+
606
605
  xml.target!
607
606
  end
608
-
607
+
609
608
  def build_validate_customer_payment_profile_request(xml, options)
610
609
  xml.tag!('customerProfileId', options[:customer_profile_id])
611
610
  xml.tag!('customerPaymentProfileId', options[:customer_payment_profile_id])
@@ -637,12 +636,12 @@ module ActiveMerchant #:nodoc:
637
636
  end
638
637
  end
639
638
  end
640
-
639
+
641
640
  def add_transaction(xml, transaction)
642
641
  unless CIM_TRANSACTION_TYPES.include?(transaction[:type])
643
642
  raise StandardError, "Invalid Customer Information Manager Transaction Type: #{transaction[:type]}"
644
643
  end
645
-
644
+
646
645
  xml.tag!('transaction') do
647
646
  xml.tag!(CIM_TRANSACTION_TYPES[transaction[:type]]) do
648
647
  # The amount to be billed to the customer
@@ -653,7 +652,7 @@ module ActiveMerchant #:nodoc:
653
652
  tag_unless_blank(xml,'customerShippingAddressId', transaction[:customer_shipping_address_id])
654
653
  xml.tag!('transId', transaction[:trans_id])
655
654
  when :refund
656
- #TODO - add lineItems and extraOptions fields
655
+ #TODO - add lineItems and extraOptions fields
657
656
  xml.tag!('amount', transaction[:amount])
658
657
  tag_unless_blank(xml, 'customerProfileId', transaction[:customer_profile_id])
659
658
  tag_unless_blank(xml, 'customerPaymentProfileId', transaction[:customer_payment_profile_id])
@@ -697,7 +696,7 @@ module ActiveMerchant #:nodoc:
697
696
  xml.tag!('description', duty[:description]) if duty[:description]
698
697
  end
699
698
  end
700
-
699
+
701
700
  def add_shipping(xml, shipping)
702
701
  xml.tag!('shipping') do
703
702
  xml.tag!('amount', shipping[:amount]) if shipping[:amount]
@@ -713,7 +712,7 @@ module ActiveMerchant #:nodoc:
713
712
  xml.tag!('purchaseOrderNumber', order[:purchase_order_number]) if order[:purchase_order_number]
714
713
  end
715
714
  end
716
-
715
+
717
716
  def add_payment_profiles(xml, payment_profiles)
718
717
  xml.tag!('paymentProfiles') do
719
718
  add_payment_profile(xml, payment_profiles)
@@ -732,7 +731,7 @@ module ActiveMerchant #:nodoc:
732
731
  add_address(xml, payment_profile[:bill_to])
733
732
  end
734
733
  end
735
-
734
+
736
735
  if payment_profile[:payment]
737
736
  xml.tag!('payment') do
738
737
  add_credit_card(xml, payment_profile[:payment][:credit_card]) if payment_profile[:payment].has_key?(:credit_card)
@@ -743,7 +742,7 @@ module ActiveMerchant #:nodoc:
743
742
  xml.tag!('taxId', payment_profile[:payment]) if payment_profile[:payment].has_key?(:tax_id)
744
743
  end
745
744
  end
746
-
745
+
747
746
  xml.tag!('customerPaymentProfileId', payment_profile[:customer_payment_profile_id]) if payment_profile[:customer_payment_profile_id]
748
747
  end
749
748
 
@@ -765,7 +764,7 @@ module ActiveMerchant #:nodoc:
765
764
  xml.tag!('country', address[:country])
766
765
  xml.tag!('phoneNumber', address[:phone_number]) if address[:phone_number]
767
766
  xml.tag!('faxNumber', address[:fax_number]) if address[:fax_number]
768
-
767
+
769
768
  xml.tag!('customerAddressId', address[:customer_address_id]) if address[:customer_address_id]
770
769
  end
771
770
 
@@ -786,14 +785,14 @@ module ActiveMerchant #:nodoc:
786
785
  xml.tag!('cardCode', credit_card.verification_value) if credit_card.verification_value?
787
786
  end
788
787
  end
789
-
788
+
790
789
  # Adds customer’s bank account information
791
- # Note: This element should only be included
790
+ # Note: This element should only be included
792
791
  # when the payment method is bank account.
793
792
  def add_bank_account(xml, bank_account)
794
793
  raise StandardError, "Invalid Bank Account Type: #{bank_account[:account_type]}" unless BANK_ACCOUNT_TYPES.include?(bank_account[:account_type])
795
794
  raise StandardError, "Invalid eCheck Type: #{bank_account[:echeck_type]}" unless ECHECK_TYPES.include?(bank_account[:echeck_type])
796
-
795
+
797
796
  xml.tag!('bankAccount') do
798
797
  # The type of bank account
799
798
  xml.tag!('accountType', BANK_ACCOUNT_TYPES[bank_account[:account_type]])
@@ -801,19 +800,19 @@ module ActiveMerchant #:nodoc:
801
800
  xml.tag!('routingNumber', bank_account[:routing_number])
802
801
  # The bank account number
803
802
  xml.tag!('accountNumber', bank_account[:account_number])
804
- # The full name of the individual associated
803
+ # The full name of the individual associated
805
804
  # with the bank account number
806
805
  xml.tag!('nameOnAccount', bank_account[:name_on_account])
807
806
  # The type of electronic check transaction
808
807
  xml.tag!('echeckType', ECHECK_TYPES[bank_account[:echeck_type]])
809
- # The full name of the individual associated
808
+ # The full name of the individual associated
810
809
  # with the bank account number (optional)
811
810
  xml.tag!('bankName', bank_account[:bank_name]) if bank_account[:bank_name]
812
811
  end
813
812
  end
814
-
813
+
815
814
  # Adds customer’s driver's license information
816
- # Note: This element is only required for
815
+ # Note: This element is only required for
817
816
  # Wells Fargo SecureSource eCheck.Net merchants
818
817
  def add_drivers_license(xml, drivers_license)
819
818
  xml.tag!('driversLicense') do
@@ -827,11 +826,11 @@ module ActiveMerchant #:nodoc:
827
826
  xml.tag!('dateOfBirth', drivers_license[:date_of_birth])
828
827
  end
829
828
  end
830
-
829
+
831
830
  def commit(action, request)
832
831
  url = test? ? test_url : live_url
833
832
  xml = ssl_post(url, request, "Content-Type" => "text/xml")
834
-
833
+
835
834
  response_params = parse(action, xml)
836
835
 
837
836
  message = response_params['messages']['message']['text']
@@ -845,7 +844,7 @@ module ActiveMerchant #:nodoc:
845
844
  :authorization => transaction_id || response_params['customer_profile_id'] || (response_params['profile'] ? response_params['profile']['customer_profile_id'] : nil)
846
845
  )
847
846
  end
848
-
847
+
849
848
  def tag_unless_blank(xml, tag_name, data)
850
849
  xml.tag!(tag_name, data) unless data.blank? || data.nil?
851
850
  end
@@ -906,7 +905,7 @@ module ActiveMerchant #:nodoc:
906
905
  }
907
906
  )
908
907
  end
909
-
908
+
910
909
  def parse(action, xml)
911
910
  xml = REXML::Document.new(xml)
912
911
  root = REXML::XPath.first(xml, "//#{CIM_ACTIONS[action]}Response") ||
@@ -931,8 +930,8 @@ module ActiveMerchant #:nodoc:
931
930
  response[key] = [response[key], value]
932
931
  end
933
932
  else
934
- response[key] = parse_element(e)
935
- end
933
+ response[key] = parse_element(e)
934
+ end
936
935
  }
937
936
  else
938
937
  response = node.text