smulube-activemerchant 1.5.1.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +9 -0
  3. data/CONTRIBUTORS +5 -1
  4. data/gem-public_cert.pem +18 -18
  5. data/lib/active_merchant.rb +9 -9
  6. data/lib/active_merchant/billing/gateways/braintree.rb +11 -11
  7. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
  8. data/lib/active_merchant/billing/gateways/braintree_blue.rb +210 -0
  9. data/lib/active_merchant/billing/gateways/braintree_orange.rb +17 -0
  10. data/lib/active_merchant/billing/gateways/payflow_nvp_uk.rb +10 -5
  11. data/lib/active_merchant/billing/integrations/action_view_helper.rb +1 -1
  12. data/lib/active_merchant/common.rb +14 -0
  13. data/lib/active_merchant/{lib → common}/connection.rb +2 -5
  14. data/lib/active_merchant/{lib → common}/country.rb +1 -1
  15. data/lib/active_merchant/common/error.rb +26 -0
  16. data/lib/active_merchant/common/post_data.rb +24 -0
  17. data/lib/active_merchant/{lib → common}/posts_data.rb +0 -0
  18. data/lib/active_merchant/{lib → common}/requires_parameters.rb +0 -0
  19. data/lib/active_merchant/{lib → common}/utils.rb +0 -0
  20. data/lib/active_merchant/{lib → common}/validateable.rb +0 -0
  21. data/lib/active_merchant/version.rb +1 -1
  22. data/lib/active_merchant/version.rb.orig +7 -0
  23. data/lib/activemerchant.rb +1 -0
  24. data/lib/support/outbound_hosts.rb +25 -0
  25. metadata +175 -493
  26. metadata.gz.sig +0 -0
  27. data/.gitignore +0 -7
  28. data/Rakefile +0 -85
  29. data/generators/gateway/USAGE +0 -5
  30. data/generators/gateway/gateway_generator.rb +0 -61
  31. data/generators/gateway/templates/gateway.rb +0 -77
  32. data/generators/gateway/templates/gateway_test.rb +0 -49
  33. data/generators/gateway/templates/remote_gateway_test.rb +0 -57
  34. data/generators/integration/USAGE +0 -5
  35. data/generators/integration/integration_generator.rb +0 -68
  36. data/generators/integration/templates/helper.rb +0 -34
  37. data/generators/integration/templates/helper_test.rb +0 -54
  38. data/generators/integration/templates/integration.rb +0 -18
  39. data/generators/integration/templates/module_test.rb +0 -9
  40. data/generators/integration/templates/notification.rb +0 -100
  41. data/generators/integration/templates/notification_test.rb +0 -41
  42. data/init.rb +0 -3
  43. data/lib/active_merchant/lib/error.rb +0 -4
  44. data/lib/active_merchant/lib/post_data.rb +0 -22
  45. data/script/destroy +0 -14
  46. data/script/generate +0 -14
  47. data/test/fixtures.yml +0 -360
  48. data/test/remote/gateways/remote_authorize_net_cim_test.rb +0 -460
  49. data/test/remote/gateways/remote_authorize_net_test.rb +0 -145
  50. data/test/remote/gateways/remote_beanstream_interac_test.rb +0 -53
  51. data/test/remote/gateways/remote_beanstream_test.rb +0 -150
  52. data/test/remote/gateways/remote_braintree_test.rb +0 -147
  53. data/test/remote/gateways/remote_card_stream_test.rb +0 -148
  54. data/test/remote/gateways/remote_cyber_source_test.rb +0 -146
  55. data/test/remote/gateways/remote_data_cash_test.rb +0 -356
  56. data/test/remote/gateways/remote_efsnet_test.rb +0 -81
  57. data/test/remote/gateways/remote_elavon_test.rb +0 -66
  58. data/test/remote/gateways/remote_eway_test.rb +0 -74
  59. data/test/remote/gateways/remote_exact_test.rb +0 -60
  60. data/test/remote/gateways/remote_first_pay_test.rb +0 -87
  61. data/test/remote/gateways/remote_garanti_test.rb +0 -58
  62. data/test/remote/gateways/remote_instapay_test.rb +0 -61
  63. data/test/remote/gateways/remote_jetpay_test.rb +0 -103
  64. data/test/remote/gateways/remote_linkpoint_test.rb +0 -121
  65. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +0 -173
  66. data/test/remote/gateways/remote_merchant_ware_test.rb +0 -113
  67. data/test/remote/gateways/remote_modern_payments_cim_test.rb +0 -58
  68. data/test/remote/gateways/remote_modern_payments_test.rb +0 -57
  69. data/test/remote/gateways/remote_moneris_test.rb +0 -82
  70. data/test/remote/gateways/remote_net_registry_test.rb +0 -85
  71. data/test/remote/gateways/remote_netbilling_test.rb +0 -70
  72. data/test/remote/gateways/remote_ogone_test.rb +0 -115
  73. data/test/remote/gateways/remote_pay_junction_test.rb +0 -143
  74. data/test/remote/gateways/remote_pay_secure_test.rb +0 -39
  75. data/test/remote/gateways/remote_payflow_express_test.rb +0 -50
  76. data/test/remote/gateways/remote_payflow_nvp_uk_test.rb +0 -57
  77. data/test/remote/gateways/remote_payflow_test.rb +0 -237
  78. data/test/remote/gateways/remote_payflow_uk_test.rb +0 -173
  79. data/test/remote/gateways/remote_payment_express_test.rb +0 -136
  80. data/test/remote/gateways/remote_paypal_express_test.rb +0 -49
  81. data/test/remote/gateways/remote_paypal_test.rb +0 -191
  82. data/test/remote/gateways/remote_plugnpay_test.rb +0 -72
  83. data/test/remote/gateways/remote_psigate_test.rb +0 -50
  84. data/test/remote/gateways/remote_psl_card_test.rb +0 -123
  85. data/test/remote/gateways/remote_quickpay_test.rb +0 -190
  86. data/test/remote/gateways/remote_realex_test.rb +0 -224
  87. data/test/remote/gateways/remote_sage_bankcard_test.rb +0 -109
  88. data/test/remote/gateways/remote_sage_pay_test.rb +0 -219
  89. data/test/remote/gateways/remote_sage_test.rb +0 -87
  90. data/test/remote/gateways/remote_sage_virtual_check_test.rb +0 -62
  91. data/test/remote/gateways/remote_sallie_mae_test.rb +0 -51
  92. data/test/remote/gateways/remote_secure_pay_au_test.rb +0 -40
  93. data/test/remote/gateways/remote_secure_pay_tech_test.rb +0 -37
  94. data/test/remote/gateways/remote_secure_pay_test.rb +0 -28
  95. data/test/remote/gateways/remote_skipjack_test.rb +0 -105
  96. data/test/remote/gateways/remote_trans_first_test.rb +0 -34
  97. data/test/remote/gateways/remote_transax_test.rb +0 -112
  98. data/test/remote/gateways/remote_trust_commerce_test.rb +0 -152
  99. data/test/remote/gateways/remote_usa_epay_test.rb +0 -46
  100. data/test/remote/gateways/remote_verifi_test.rb +0 -107
  101. data/test/remote/gateways/remote_viaklix_test.rb +0 -43
  102. data/test/remote/gateways/remote_wirecard_test.rb +0 -111
  103. data/test/remote/integrations/remote_gestpay_integration_test.rb +0 -37
  104. data/test/remote/integrations/remote_paypal_integration_test.rb +0 -26
  105. data/test/test_helper.rb +0 -184
  106. data/test/unit/avs_result_test.rb +0 -59
  107. data/test/unit/base_test.rb +0 -54
  108. data/test/unit/check_test.rb +0 -88
  109. data/test/unit/connection_test.rb +0 -137
  110. data/test/unit/country_code_test.rb +0 -33
  111. data/test/unit/country_test.rb +0 -64
  112. data/test/unit/credit_card_formatting_test.rb +0 -19
  113. data/test/unit/credit_card_methods_test.rb +0 -192
  114. data/test/unit/credit_card_test.rb +0 -318
  115. data/test/unit/cvv_result_test.rb +0 -33
  116. data/test/unit/expiry_date_test.rb +0 -32
  117. data/test/unit/gateways/authorize_net_cim_test.rb +0 -676
  118. data/test/unit/gateways/authorize_net_test.rb +0 -290
  119. data/test/unit/gateways/beanstream_interac_test.rb +0 -51
  120. data/test/unit/gateways/beanstream_test.rb +0 -144
  121. data/test/unit/gateways/bogus_test.rb +0 -58
  122. data/test/unit/gateways/braintree_test.rb +0 -118
  123. data/test/unit/gateways/card_stream_test.rb +0 -90
  124. data/test/unit/gateways/cyber_source_test.rb +0 -188
  125. data/test/unit/gateways/data_cash_test.rb +0 -133
  126. data/test/unit/gateways/efsnet_test.rb +0 -123
  127. data/test/unit/gateways/elavon_test.rb +0 -139
  128. data/test/unit/gateways/eway_test.rb +0 -118
  129. data/test/unit/gateways/exact_test.rb +0 -156
  130. data/test/unit/gateways/first_pay_test.rb +0 -125
  131. data/test/unit/gateways/garanti_test.rb +0 -86
  132. data/test/unit/gateways/gateway_test.rb +0 -48
  133. data/test/unit/gateways/instapay_test.rb +0 -102
  134. data/test/unit/gateways/jetpay_test.rb +0 -185
  135. data/test/unit/gateways/linkpoint_test.rb +0 -197
  136. data/test/unit/gateways/merchant_e_solutions_test.rb +0 -169
  137. data/test/unit/gateways/merchant_ware_test.rb +0 -188
  138. data/test/unit/gateways/modern_payments_cim_test.rb +0 -162
  139. data/test/unit/gateways/moneris_test.rb +0 -158
  140. data/test/unit/gateways/net_registry_test.rb +0 -416
  141. data/test/unit/gateways/netbilling_test.rb +0 -54
  142. data/test/unit/gateways/ogone_test.rb +0 -319
  143. data/test/unit/gateways/pay_junction_test.rb +0 -123
  144. data/test/unit/gateways/pay_secure_test.rb +0 -71
  145. data/test/unit/gateways/payflow_express_test.rb +0 -173
  146. data/test/unit/gateways/payflow_express_uk_test.rb +0 -86
  147. data/test/unit/gateways/payflow_nvp_uk_test.rb +0 -205
  148. data/test/unit/gateways/payflow_test.rb +0 -305
  149. data/test/unit/gateways/payflow_uk_test.rb +0 -30
  150. data/test/unit/gateways/payment_express_test.rb +0 -195
  151. data/test/unit/gateways/paypal_express_test.rb +0 -389
  152. data/test/unit/gateways/paypal_test.rb +0 -569
  153. data/test/unit/gateways/plugnpay_test.rb +0 -86
  154. data/test/unit/gateways/psigate_test.rb +0 -169
  155. data/test/unit/gateways/psl_card_test.rb +0 -64
  156. data/test/unit/gateways/quickpay_test.rb +0 -112
  157. data/test/unit/gateways/realex_test.rb +0 -151
  158. data/test/unit/gateways/sage_bankcard_test.rb +0 -196
  159. data/test/unit/gateways/sage_pay_test.rb +0 -139
  160. data/test/unit/gateways/sage_virtual_check_test.rb +0 -71
  161. data/test/unit/gateways/sallie_mae_test.rb +0 -53
  162. data/test/unit/gateways/secure_pay_au_test.rb +0 -207
  163. data/test/unit/gateways/secure_pay_tech_test.rb +0 -44
  164. data/test/unit/gateways/secure_pay_test.rb +0 -101
  165. data/test/unit/gateways/skip_jack_test.rb +0 -228
  166. data/test/unit/gateways/trans_first_test.rb +0 -112
  167. data/test/unit/gateways/trust_commerce_test.rb +0 -90
  168. data/test/unit/gateways/usa_epay_test.rb +0 -128
  169. data/test/unit/gateways/verifi_test.rb +0 -96
  170. data/test/unit/gateways/viaklix_test.rb +0 -78
  171. data/test/unit/gateways/wirecard_test.rb +0 -250
  172. data/test/unit/generators/test_gateway_generator.rb +0 -46
  173. data/test/unit/generators/test_generator_helper.rb +0 -20
  174. data/test/unit/generators/test_integration_generator.rb +0 -53
  175. data/test/unit/integrations/action_view_helper_test.rb +0 -50
  176. data/test/unit/integrations/bogus_module_test.rb +0 -20
  177. data/test/unit/integrations/chronopay_module_test.rb +0 -13
  178. data/test/unit/integrations/gestpay_module_test.rb +0 -14
  179. data/test/unit/integrations/helpers/bogus_helper_test.rb +0 -28
  180. data/test/unit/integrations/helpers/chronopay_helper_test.rb +0 -110
  181. data/test/unit/integrations/helpers/gestpay_helper_test.rb +0 -100
  182. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +0 -16
  183. data/test/unit/integrations/helpers/nochex_helper_test.rb +0 -53
  184. data/test/unit/integrations/helpers/paypal_helper_test.rb +0 -171
  185. data/test/unit/integrations/helpers/quickpay_helper_test.rb +0 -40
  186. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +0 -92
  187. data/test/unit/integrations/hi_trust_module_test.rb +0 -13
  188. data/test/unit/integrations/nochex_module_test.rb +0 -13
  189. data/test/unit/integrations/notifications/chronopay_notification_test.rb +0 -66
  190. data/test/unit/integrations/notifications/gestpay_notification_test.rb +0 -60
  191. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +0 -59
  192. data/test/unit/integrations/notifications/nochex_notification_test.rb +0 -51
  193. data/test/unit/integrations/notifications/notification_test.rb +0 -54
  194. data/test/unit/integrations/notifications/paypal_notification_test.rb +0 -85
  195. data/test/unit/integrations/notifications/quickpay_notification_test.rb +0 -69
  196. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +0 -55
  197. data/test/unit/integrations/paypal_module_test.rb +0 -28
  198. data/test/unit/integrations/quickpay_module_test.rb +0 -9
  199. data/test/unit/integrations/returns/chronopay_return_test.rb +0 -11
  200. data/test/unit/integrations/returns/gestpay_return_test.rb +0 -10
  201. data/test/unit/integrations/returns/hi_trust_return_test.rb +0 -24
  202. data/test/unit/integrations/returns/nochex_return_test.rb +0 -10
  203. data/test/unit/integrations/returns/paypal_return_test.rb +0 -10
  204. data/test/unit/integrations/returns/return_test.rb +0 -11
  205. data/test/unit/integrations/returns/two_checkout_return_test.rb +0 -24
  206. data/test/unit/integrations/two_checkout_module_test.rb +0 -13
  207. data/test/unit/post_data_test.rb +0 -55
  208. data/test/unit/posts_data_test.rb +0 -48
  209. data/test/unit/response_test.rb +0 -28
  210. data/test/unit/utils_test.rb +0 -7
  211. data/test/unit/validateable_test.rb +0 -60
@@ -1,460 +0,0 @@
1
- require 'test_helper'
2
- require 'pp'
3
-
4
- class AuthorizeNetCimTest < Test::Unit::TestCase
5
- def setup
6
- Base.mode = :test
7
-
8
- @gateway = AuthorizeNetCimGateway.new(fixtures(:authorize_net))
9
- @amount = 100
10
- @credit_card = credit_card('4242424242424242')
11
- @payment = {
12
- :credit_card => @credit_card
13
- }
14
- @profile = {
15
- :merchant_customer_id => 'Up to 20 chars', # Optional
16
- :description => 'Up to 255 Characters', # Optional
17
- :email => 'Up to 255 Characters', # Optional
18
- :payment_profiles => { # Optional
19
- :customer_type => 'individual', # Optional
20
- :bill_to => @address,
21
- :payment => @payment
22
- },
23
- :ship_to_list => {
24
- :first_name => 'John',
25
- :last_name => 'Doe',
26
- :company => 'Widgets, Inc',
27
- :address1 => '1234 Fake Street',
28
- :city => 'Anytown',
29
- :state => 'MD',
30
- :zip => '12345',
31
- :country => 'USA',
32
- :phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
33
- :fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
34
- }
35
- }
36
- @options = {
37
- :ref_id => '1234', # Optional
38
- :profile => @profile
39
- }
40
- end
41
-
42
- def teardown
43
- if @customer_profile_id
44
- assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
45
- assert_success response
46
- @customer_profile_id = nil
47
- end
48
- end
49
-
50
- def test_successful_profile_create_get_update_and_delete
51
- assert response = @gateway.create_customer_profile(@options)
52
- @customer_profile_id = response.authorization
53
-
54
- assert_success response
55
- assert response.test?
56
-
57
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
58
- assert response.test?
59
- assert_success response
60
- assert_equal @customer_profile_id, response.authorization
61
- assert_equal 'Successful.', response.message
62
- assert response.params['profile']['payment_profiles']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
63
- assert_equal "XXXX#{@credit_card.last_digits}", response.params['profile']['payment_profiles']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
64
- assert_equal @profile[:merchant_customer_id], response.params['profile']['merchant_customer_id']
65
- assert_equal @profile[:description], response.params['profile']['description']
66
- assert_equal @profile[:email], response.params['profile']['email']
67
- assert_equal @profile[:payment_profiles][:customer_type], response.params['profile']['payment_profiles']['customer_type']
68
- assert_equal @profile[:ship_to_list][:phone_number], response.params['profile']['ship_to_list']['phone_number']
69
- assert_equal @profile[:ship_to_list][:company], response.params['profile']['ship_to_list']['company']
70
-
71
- assert response = @gateway.update_customer_profile(:profile => {:customer_profile_id => @customer_profile_id, :email => 'new email address'})
72
- assert response.test?
73
- assert_success response
74
- assert_nil response.authorization
75
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
76
- assert_nil response.params['profile']['merchant_customer_id']
77
- assert_nil response.params['profile']['description']
78
- assert_equal 'new email address', response.params['profile']['email']
79
- end
80
-
81
- def test_successful_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
82
- assert response = @gateway.create_customer_profile(@options)
83
- @customer_profile_id = response.authorization
84
-
85
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
86
- @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
87
-
88
- assert response = @gateway.create_customer_profile_transaction(
89
- :transaction => {
90
- :customer_profile_id => @customer_profile_id,
91
- :customer_payment_profile_id => @customer_payment_profile_id,
92
- :type => :auth_only,
93
- :amount => @amount
94
- }
95
- )
96
-
97
- assert response.test?
98
- assert_success response
99
- assert_nil response.authorization
100
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
101
- assert response.params['direct_response']['approval_code'] =~ /\w{6}/
102
- assert_equal "auth_only", response.params['direct_response']['transaction_type']
103
- assert_equal "100.00", response.params['direct_response']['amount']
104
- assert_match /\d+/, response.params['direct_response']['transaction_id']
105
-
106
- approval_code = response.params['direct_response']['approval_code']
107
-
108
- # Capture the previously authorized funds
109
-
110
- assert response = @gateway.create_customer_profile_transaction(
111
- :transaction => {
112
- :customer_profile_id => @customer_profile_id,
113
- :customer_payment_profile_id => @customer_payment_profile_id,
114
- :type => :capture_only,
115
- :amount => @amount,
116
- :approval_code => approval_code
117
- }
118
- )
119
-
120
- assert response.test?
121
- assert_success response
122
- assert_nil response.authorization
123
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
124
- assert_equal approval_code, response.params['direct_response']['approval_code']
125
- assert_equal "capture_only", response.params['direct_response']['transaction_type']
126
- assert_equal "100.00", response.params['direct_response']['amount']
127
- end
128
-
129
- def test_successful_create_customer_profile_transaction_auth_capture_request
130
- assert response = @gateway.create_customer_profile(@options)
131
- @customer_profile_id = response.authorization
132
-
133
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
134
- @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
135
-
136
- assert response = @gateway.create_customer_profile_transaction(
137
- :transaction => {
138
- :customer_profile_id => @customer_profile_id,
139
- :customer_payment_profile_id => @customer_payment_profile_id,
140
- :type => :auth_capture,
141
- :order => {
142
- :invoice_number => '1234',
143
- :description => 'Test Order Description',
144
- :purchase_order_number => '4321'
145
- },
146
- :amount => @amount
147
- }
148
- )
149
-
150
- assert response.test?
151
- assert_success response
152
- assert_nil response.authorization
153
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
154
- assert response.params['direct_response']['approval_code'] =~ /\w{6}/
155
- assert_equal "auth_capture", response.params['direct_response']['transaction_type']
156
- assert_equal "100.00", response.params['direct_response']['amount']
157
- assert_equal response.params['direct_response']['invoice_number'], '1234'
158
- assert_equal response.params['direct_response']['order_description'], 'Test Order Description'
159
- assert_equal response.params['direct_response']['purchase_order_number'], '4321'
160
- end
161
-
162
- def test_successful_create_customer_payment_profile_request
163
- payment_profile = @options[:profile].delete(:payment_profiles)
164
- assert response = @gateway.create_customer_profile(@options)
165
- @customer_profile_id = response.authorization
166
-
167
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
168
- assert_nil response.params['profile']['payment_profiles']
169
-
170
- assert response = @gateway.create_customer_payment_profile(
171
- :customer_profile_id => @customer_profile_id,
172
- :payment_profile => payment_profile
173
- )
174
-
175
- assert response.test?
176
- assert_success response
177
- assert_nil response.authorization
178
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
179
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
180
- end
181
-
182
- def test_successful_create_customer_payment_profile_request_with_bank_account
183
- payment_profile = @options[:profile].delete(:payment_profiles)
184
- assert response = @gateway.create_customer_profile(@options)
185
- @customer_profile_id = response.authorization
186
-
187
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
188
- assert_nil response.params['profile']['payment_profiles']
189
-
190
- assert response = @gateway.create_customer_payment_profile(
191
- :customer_profile_id => @customer_profile_id,
192
- :payment_profile => {
193
- :customer_type => 'individual', # Optional
194
- :bill_to => @address,
195
- :payment => {
196
- :bank_account => {
197
- :account_type => :checking,
198
- :name_on_account => 'John Doe',
199
- :echeck_type => :ccd,
200
- :bank_name => 'Bank of America',
201
- :routing_number => '123456789',
202
- :account_number => '12345'
203
- }
204
- },
205
- :drivers_license => {
206
- :state => 'MD',
207
- :number => '12345',
208
- :date_of_birth => '1981-3-31'
209
- },
210
- :tax_id => '123456789'
211
- }
212
- )
213
-
214
- assert response.test?
215
- assert_success response
216
- assert_nil response.authorization
217
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
218
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
219
- end
220
-
221
- def test_successful_create_customer_shipping_address_request
222
- shipping_address = @options[:profile].delete(:ship_to_list)
223
- assert response = @gateway.create_customer_profile(@options)
224
- @customer_profile_id = response.authorization
225
-
226
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
227
- assert_nil response.params['profile']['ship_to_list']
228
-
229
- assert response = @gateway.create_customer_shipping_address(
230
- :customer_profile_id => @customer_profile_id,
231
- :address => shipping_address
232
- )
233
-
234
- assert response.test?
235
- assert_success response
236
- assert_nil response.authorization
237
- assert customer_address_id = response.params['customer_address_id']
238
- assert customer_address_id =~ /\d+/, "The customerAddressId should be numeric. It was #{customer_address_id}"
239
- end
240
-
241
- def test_successful_get_customer_profile_with_multiple_payment_profiles
242
- second_payment_profile = {
243
- :customer_type => 'individual',
244
- :bill_to => @address,
245
- :payment => {
246
- :credit_card => credit_card('1234123412341234')
247
- }
248
- }
249
- assert response = @gateway.create_customer_profile(@options)
250
- @customer_profile_id = response.authorization
251
-
252
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
253
-
254
- assert response = @gateway.create_customer_payment_profile(
255
- :customer_profile_id => @customer_profile_id,
256
- :payment_profile => second_payment_profile
257
- )
258
-
259
- assert response.test?
260
- assert_success response
261
- assert_nil response.authorization
262
- assert customer_payment_profile_id = response.params['customer_payment_profile_id']
263
- assert customer_payment_profile_id =~ /\d+/, "The customerPaymentProfileId should be numeric. It was #{customer_payment_profile_id}"
264
-
265
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
266
- assert_equal 2, response.params['profile']['payment_profiles'].size
267
- assert_equal 'XXXX4242', response.params['profile']['payment_profiles'][0]['payment']['credit_card']['card_number']
268
- assert_equal 'XXXX1234', response.params['profile']['payment_profiles'][1]['payment']['credit_card']['card_number']
269
- end
270
-
271
- def test_successful_delete_customer_payment_profile_request
272
- assert response = @gateway.create_customer_profile(@options)
273
- @customer_profile_id = response.authorization
274
-
275
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
276
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
277
-
278
- assert response = @gateway.delete_customer_payment_profile(
279
- :customer_profile_id => @customer_profile_id,
280
- :customer_payment_profile_id => customer_payment_profile_id
281
- )
282
-
283
- assert response.test?
284
- assert_success response
285
- assert_nil response.authorization
286
-
287
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
288
- assert_nil response.params['profile']['payment_profiles']
289
- end
290
-
291
- def test_successful_delete_customer_shipping_address_request
292
- assert response = @gateway.create_customer_profile(@options)
293
- @customer_profile_id = response.authorization
294
-
295
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
296
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
297
-
298
- assert response = @gateway.delete_customer_shipping_address(
299
- :customer_profile_id => @customer_profile_id,
300
- :customer_address_id => customer_address_id
301
- )
302
-
303
- assert response.test?
304
- assert_success response
305
- assert_nil response.authorization
306
-
307
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
308
- assert_nil response.params['profile']['ship_to_list']
309
- end
310
-
311
- def test_successful_get_customer_payment_profile_request
312
- assert response = @gateway.create_customer_profile(@options)
313
- @customer_profile_id = response.authorization
314
-
315
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
316
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
317
-
318
- assert response = @gateway.get_customer_payment_profile(
319
- :customer_profile_id => @customer_profile_id,
320
- :customer_payment_profile_id => customer_payment_profile_id
321
- )
322
-
323
- assert response.test?
324
- assert_success response
325
- assert_nil response.authorization
326
- assert response.params['payment_profile']['customer_payment_profile_id'] =~ /\d+/, 'The customer_payment_profile_id should be a number'
327
- assert_equal "XXXX#{@credit_card.last_digits}", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in #{@credit_card.last_digits}"
328
- assert_equal @profile[:payment_profiles][:customer_type], response.params['payment_profile']['customer_type']
329
- end
330
-
331
- def test_successful_get_customer_shipping_address_request
332
- assert response = @gateway.create_customer_profile(@options)
333
- @customer_profile_id = response.authorization
334
-
335
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
336
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
337
-
338
- assert response = @gateway.get_customer_shipping_address(
339
- :customer_profile_id => @customer_profile_id,
340
- :customer_address_id => customer_address_id
341
- )
342
-
343
- assert response.test?
344
- assert_success response
345
- assert_nil response.authorization
346
- assert response.params['address']['customer_address_id'] =~ /\d+/, 'The customer_address_id should be a number'
347
- assert_equal @profile[:ship_to_list][:city], response.params['address']['city']
348
- end
349
-
350
- def test_successful_update_customer_payment_profile_request
351
- # Create a new Customer Profile with Payment Profile
352
- assert response = @gateway.create_customer_profile(@options)
353
- @customer_profile_id = response.authorization
354
-
355
- # Get the customerPaymentProfileId
356
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
357
- assert customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
358
-
359
- # Get the customerPaymentProfile
360
- assert response = @gateway.get_customer_payment_profile(
361
- :customer_profile_id => @customer_profile_id,
362
- :customer_payment_profile_id => customer_payment_profile_id
363
- )
364
-
365
- # The value before updating
366
- assert_equal "XXXX4242", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in 4242"
367
-
368
- #Update the payment profile
369
- assert response = @gateway.update_customer_payment_profile(
370
- :customer_profile_id => @customer_profile_id,
371
- :payment_profile => {
372
- :customer_payment_profile_id => customer_payment_profile_id,
373
- :payment => {
374
- :credit_card => credit_card('1234123412341234')
375
- }
376
- }
377
- )
378
- assert response.test?
379
- assert_success response
380
- assert_nil response.authorization
381
-
382
- # Get the updated payment profile
383
- assert response = @gateway.get_customer_payment_profile(
384
- :customer_profile_id => @customer_profile_id,
385
- :customer_payment_profile_id => customer_payment_profile_id
386
- )
387
-
388
- # Show that the payment profile was updated
389
- assert_equal "XXXX1234", response.params['payment_profile']['payment']['credit_card']['card_number'], "The card number should contain the last 4 digits of the card we passed in: 1234"
390
- # Show that fields that were left out of the update were cleared
391
- assert_nil response.params['payment_profile']['customer_type']
392
- end
393
-
394
- def test_successful_update_customer_shipping_address_request
395
- # Create a new Customer Profile with Shipping Address
396
- assert response = @gateway.create_customer_profile(@options)
397
- @customer_profile_id = response.authorization
398
-
399
- # Get the customerAddressId
400
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
401
- assert customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
402
-
403
- # Get the customerShippingAddress
404
- assert response = @gateway.get_customer_shipping_address(
405
- :customer_profile_id => @customer_profile_id,
406
- :customer_address_id => customer_address_id
407
- )
408
-
409
- assert address = response.params['address']
410
- # The value before updating
411
- assert_equal "1234 Fake Street", address['address']
412
-
413
- # Update the address and remove the phone_number
414
- new_address = address.symbolize_keys.merge!(
415
- :address => '5678 Fake Street'
416
- )
417
- new_address.delete(:phone_number)
418
-
419
- #Update the shipping address
420
- assert response = @gateway.update_customer_shipping_address(
421
- :customer_profile_id => @customer_profile_id,
422
- :address => new_address
423
- )
424
- assert response.test?
425
- assert_success response
426
- assert_nil response.authorization
427
-
428
- # Get the updated shipping address
429
- assert response = @gateway.get_customer_shipping_address(
430
- :customer_profile_id => @customer_profile_id,
431
- :customer_address_id => customer_address_id
432
- )
433
-
434
- # Show that the shipping address was updated
435
- assert_equal "5678 Fake Street", response.params['address']['address']
436
- # Show that fields that were left out of the update were cleared
437
- assert_nil response.params['address']['phone_number']
438
- end
439
-
440
- def test_successful_validate_customer_payment_profile_request
441
- assert response = @gateway.create_customer_profile(@options)
442
- @customer_profile_id = response.authorization
443
-
444
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
445
- assert @customer_payment_profile_id = response.params['profile']['payment_profiles']['customer_payment_profile_id']
446
- assert @customer_address_id = response.params['profile']['ship_to_list']['customer_address_id']
447
-
448
- assert response = @gateway.validate_customer_payment_profile(
449
- :customer_profile_id => @customer_profile_id,
450
- :customer_payment_profile_id => @customer_payment_profile_id,
451
- :customer_address_id => @customer_address_id,
452
- :validation_mode => :live
453
- )
454
-
455
- assert response.test?
456
- assert_success response
457
- assert_nil response.authorization
458
- assert_equal "This transaction has been approved.", response.params['direct_response']['message']
459
- end
460
- end