activemerchant 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +9 -0
  3. data/MIT-LICENSE +1 -1
  4. data/lib/active_merchant.rb +6 -26
  5. data/lib/active_merchant/billing.rb +9 -0
  6. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -1
  7. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -1
  8. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +40 -1
  9. data/lib/active_merchant/billing/integrations/two_checkout.rb +1 -1
  10. metadata +9 -173
  11. metadata.gz.sig +0 -0
  12. data/Rakefile +0 -153
  13. data/init.rb +0 -3
  14. data/script/destroy +0 -14
  15. data/script/generate +0 -14
  16. data/test/fixtures.yml +0 -355
  17. data/test/remote/gateways/remote_authorize_net_cim_test.rb +0 -460
  18. data/test/remote/gateways/remote_authorize_net_test.rb +0 -145
  19. data/test/remote/gateways/remote_beanstream_interac_test.rb +0 -53
  20. data/test/remote/gateways/remote_beanstream_test.rb +0 -150
  21. data/test/remote/gateways/remote_braintree_test.rb +0 -147
  22. data/test/remote/gateways/remote_card_stream_test.rb +0 -148
  23. data/test/remote/gateways/remote_cyber_source_test.rb +0 -144
  24. data/test/remote/gateways/remote_data_cash_test.rb +0 -356
  25. data/test/remote/gateways/remote_efsnet_test.rb +0 -81
  26. data/test/remote/gateways/remote_elavon_test.rb +0 -66
  27. data/test/remote/gateways/remote_eway_test.rb +0 -74
  28. data/test/remote/gateways/remote_exact_test.rb +0 -60
  29. data/test/remote/gateways/remote_first_pay_test.rb +0 -87
  30. data/test/remote/gateways/remote_instapay_test.rb +0 -61
  31. data/test/remote/gateways/remote_jetpay_test.rb +0 -103
  32. data/test/remote/gateways/remote_linkpoint_test.rb +0 -121
  33. data/test/remote/gateways/remote_merchant_e_solutions_test.rb +0 -173
  34. data/test/remote/gateways/remote_merchant_ware_test.rb +0 -113
  35. data/test/remote/gateways/remote_modern_payments_cim_test.rb +0 -58
  36. data/test/remote/gateways/remote_modern_payments_test.rb +0 -57
  37. data/test/remote/gateways/remote_moneris_test.rb +0 -82
  38. data/test/remote/gateways/remote_net_registry_test.rb +0 -85
  39. data/test/remote/gateways/remote_netbilling_test.rb +0 -70
  40. data/test/remote/gateways/remote_ogone_test.rb +0 -115
  41. data/test/remote/gateways/remote_pay_junction_test.rb +0 -143
  42. data/test/remote/gateways/remote_pay_secure_test.rb +0 -39
  43. data/test/remote/gateways/remote_payflow_express_test.rb +0 -50
  44. data/test/remote/gateways/remote_payflow_test.rb +0 -237
  45. data/test/remote/gateways/remote_payflow_uk_test.rb +0 -173
  46. data/test/remote/gateways/remote_payment_express_test.rb +0 -136
  47. data/test/remote/gateways/remote_paypal_express_test.rb +0 -49
  48. data/test/remote/gateways/remote_paypal_test.rb +0 -191
  49. data/test/remote/gateways/remote_plugnpay_test.rb +0 -72
  50. data/test/remote/gateways/remote_psigate_test.rb +0 -50
  51. data/test/remote/gateways/remote_psl_card_test.rb +0 -123
  52. data/test/remote/gateways/remote_quickpay_test.rb +0 -190
  53. data/test/remote/gateways/remote_realex_test.rb +0 -224
  54. data/test/remote/gateways/remote_sage_bankcard_test.rb +0 -109
  55. data/test/remote/gateways/remote_sage_pay_test.rb +0 -219
  56. data/test/remote/gateways/remote_sage_test.rb +0 -87
  57. data/test/remote/gateways/remote_sage_virtual_check_test.rb +0 -62
  58. data/test/remote/gateways/remote_sallie_mae_test.rb +0 -51
  59. data/test/remote/gateways/remote_secure_pay_au_test.rb +0 -40
  60. data/test/remote/gateways/remote_secure_pay_tech_test.rb +0 -37
  61. data/test/remote/gateways/remote_secure_pay_test.rb +0 -28
  62. data/test/remote/gateways/remote_skipjack_test.rb +0 -105
  63. data/test/remote/gateways/remote_trans_first_test.rb +0 -34
  64. data/test/remote/gateways/remote_transax_test.rb +0 -112
  65. data/test/remote/gateways/remote_trust_commerce_test.rb +0 -152
  66. data/test/remote/gateways/remote_usa_epay_test.rb +0 -46
  67. data/test/remote/gateways/remote_verifi_test.rb +0 -107
  68. data/test/remote/gateways/remote_viaklix_test.rb +0 -43
  69. data/test/remote/gateways/remote_wirecard_test.rb +0 -111
  70. data/test/remote/integrations/remote_gestpay_integration_test.rb +0 -37
  71. data/test/remote/integrations/remote_paypal_integration_test.rb +0 -26
  72. data/test/test_helper.rb +0 -184
  73. data/test/unit/avs_result_test.rb +0 -59
  74. data/test/unit/base_test.rb +0 -54
  75. data/test/unit/check_test.rb +0 -88
  76. data/test/unit/connection_test.rb +0 -129
  77. data/test/unit/country_code_test.rb +0 -33
  78. data/test/unit/country_test.rb +0 -64
  79. data/test/unit/credit_card_formatting_test.rb +0 -19
  80. data/test/unit/credit_card_methods_test.rb +0 -179
  81. data/test/unit/credit_card_test.rb +0 -318
  82. data/test/unit/cvv_result_test.rb +0 -33
  83. data/test/unit/expiry_date_test.rb +0 -32
  84. data/test/unit/gateways/authorize_net_cim_test.rb +0 -676
  85. data/test/unit/gateways/authorize_net_test.rb +0 -290
  86. data/test/unit/gateways/beanstream_interac_test.rb +0 -51
  87. data/test/unit/gateways/beanstream_test.rb +0 -108
  88. data/test/unit/gateways/bogus_test.rb +0 -46
  89. data/test/unit/gateways/braintree_test.rb +0 -118
  90. data/test/unit/gateways/card_stream_test.rb +0 -90
  91. data/test/unit/gateways/cyber_source_test.rb +0 -188
  92. data/test/unit/gateways/data_cash_test.rb +0 -133
  93. data/test/unit/gateways/efsnet_test.rb +0 -123
  94. data/test/unit/gateways/elavon_test.rb +0 -139
  95. data/test/unit/gateways/eway_test.rb +0 -118
  96. data/test/unit/gateways/exact_test.rb +0 -156
  97. data/test/unit/gateways/first_pay_test.rb +0 -125
  98. data/test/unit/gateways/gateway_test.rb +0 -48
  99. data/test/unit/gateways/instapay_test.rb +0 -102
  100. data/test/unit/gateways/jetpay_test.rb +0 -185
  101. data/test/unit/gateways/linkpoint_test.rb +0 -197
  102. data/test/unit/gateways/merchant_e_solutions_test.rb +0 -169
  103. data/test/unit/gateways/merchant_ware_test.rb +0 -188
  104. data/test/unit/gateways/modern_payments_cim_test.rb +0 -162
  105. data/test/unit/gateways/moneris_test.rb +0 -158
  106. data/test/unit/gateways/net_registry_test.rb +0 -416
  107. data/test/unit/gateways/netbilling_test.rb +0 -54
  108. data/test/unit/gateways/ogone_test.rb +0 -319
  109. data/test/unit/gateways/pay_junction_test.rb +0 -123
  110. data/test/unit/gateways/pay_secure_test.rb +0 -71
  111. data/test/unit/gateways/payflow_express_test.rb +0 -173
  112. data/test/unit/gateways/payflow_express_uk_test.rb +0 -86
  113. data/test/unit/gateways/payflow_test.rb +0 -305
  114. data/test/unit/gateways/payflow_uk_test.rb +0 -30
  115. data/test/unit/gateways/payment_express_test.rb +0 -195
  116. data/test/unit/gateways/paypal_express_test.rb +0 -382
  117. data/test/unit/gateways/paypal_test.rb +0 -569
  118. data/test/unit/gateways/plugnpay_test.rb +0 -86
  119. data/test/unit/gateways/psigate_test.rb +0 -169
  120. data/test/unit/gateways/psl_card_test.rb +0 -64
  121. data/test/unit/gateways/quickpay_test.rb +0 -112
  122. data/test/unit/gateways/realex_test.rb +0 -151
  123. data/test/unit/gateways/sage_bankcard_test.rb +0 -196
  124. data/test/unit/gateways/sage_pay_test.rb +0 -139
  125. data/test/unit/gateways/sage_virtual_check_test.rb +0 -71
  126. data/test/unit/gateways/sallie_mae_test.rb +0 -53
  127. data/test/unit/gateways/secure_pay_au_test.rb +0 -207
  128. data/test/unit/gateways/secure_pay_tech_test.rb +0 -44
  129. data/test/unit/gateways/secure_pay_test.rb +0 -101
  130. data/test/unit/gateways/skip_jack_test.rb +0 -213
  131. data/test/unit/gateways/trans_first_test.rb +0 -112
  132. data/test/unit/gateways/trust_commerce_test.rb +0 -90
  133. data/test/unit/gateways/usa_epay_test.rb +0 -128
  134. data/test/unit/gateways/verifi_test.rb +0 -96
  135. data/test/unit/gateways/viaklix_test.rb +0 -78
  136. data/test/unit/gateways/wirecard_test.rb +0 -250
  137. data/test/unit/generators/test_gateway_generator.rb +0 -46
  138. data/test/unit/generators/test_generator_helper.rb +0 -20
  139. data/test/unit/generators/test_integration_generator.rb +0 -53
  140. data/test/unit/integrations/action_view_helper_test.rb +0 -50
  141. data/test/unit/integrations/bogus_module_test.rb +0 -20
  142. data/test/unit/integrations/chronopay_module_test.rb +0 -13
  143. data/test/unit/integrations/gestpay_module_test.rb +0 -14
  144. data/test/unit/integrations/helpers/bogus_helper_test.rb +0 -28
  145. data/test/unit/integrations/helpers/chronopay_helper_test.rb +0 -67
  146. data/test/unit/integrations/helpers/gestpay_helper_test.rb +0 -100
  147. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +0 -16
  148. data/test/unit/integrations/helpers/nochex_helper_test.rb +0 -53
  149. data/test/unit/integrations/helpers/paypal_helper_test.rb +0 -171
  150. data/test/unit/integrations/helpers/quickpay_helper_test.rb +0 -40
  151. data/test/unit/integrations/helpers/two_checkout_helper_test.rb +0 -92
  152. data/test/unit/integrations/hi_trust_module_test.rb +0 -13
  153. data/test/unit/integrations/nochex_module_test.rb +0 -13
  154. data/test/unit/integrations/notifications/chronopay_notification_test.rb +0 -66
  155. data/test/unit/integrations/notifications/gestpay_notification_test.rb +0 -60
  156. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +0 -59
  157. data/test/unit/integrations/notifications/nochex_notification_test.rb +0 -51
  158. data/test/unit/integrations/notifications/notification_test.rb +0 -54
  159. data/test/unit/integrations/notifications/paypal_notification_test.rb +0 -85
  160. data/test/unit/integrations/notifications/quickpay_notification_test.rb +0 -69
  161. data/test/unit/integrations/notifications/two_checkout_notification_test.rb +0 -55
  162. data/test/unit/integrations/paypal_module_test.rb +0 -28
  163. data/test/unit/integrations/quickpay_module_test.rb +0 -9
  164. data/test/unit/integrations/returns/chronopay_return_test.rb +0 -11
  165. data/test/unit/integrations/returns/gestpay_return_test.rb +0 -10
  166. data/test/unit/integrations/returns/hi_trust_return_test.rb +0 -24
  167. data/test/unit/integrations/returns/nochex_return_test.rb +0 -10
  168. data/test/unit/integrations/returns/paypal_return_test.rb +0 -10
  169. data/test/unit/integrations/returns/return_test.rb +0 -11
  170. data/test/unit/integrations/returns/two_checkout_return_test.rb +0 -24
  171. data/test/unit/integrations/two_checkout_module_test.rb +0 -13
  172. data/test/unit/post_data_test.rb +0 -55
  173. data/test/unit/posts_data_test.rb +0 -48
  174. data/test/unit/response_test.rb +0 -28
  175. data/test/unit/utils_test.rb +0 -7
  176. data/test/unit/validateable_test.rb +0 -60
@@ -1,33 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CVVResultTest < Test::Unit::TestCase
4
- def test_nil_data
5
- result = CVVResult.new(nil)
6
- assert_nil result.code
7
- assert_nil result.message
8
- end
9
-
10
- def test_blank_data
11
- result = CVVResult.new('')
12
- assert_nil result.code
13
- assert_nil result.message
14
- end
15
-
16
- def test_successful_match
17
- result = CVVResult.new('M')
18
- assert_equal 'M', result.code
19
- assert_equal CVVResult.messages['M'], result.message
20
- end
21
-
22
- def test_failed_match
23
- result = CVVResult.new('N')
24
- assert_equal 'N', result.code
25
- assert_equal CVVResult.messages['N'], result.message
26
- end
27
-
28
- def test_to_hash
29
- result = CVVResult.new('M').to_hash
30
- assert_equal 'M', result['code']
31
- assert_equal CVVResult.messages['M'], result['message']
32
- end
33
- end
@@ -1,32 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ExpiryDateTest < Test::Unit::TestCase
4
- def test_should_be_expired
5
- last_month = 2.months.ago
6
- date = CreditCard::ExpiryDate.new(last_month.month, last_month.year)
7
- assert date.expired?
8
- end
9
-
10
- def test_today_should_not_be_expired
11
- today = Time.now.utc
12
- date = CreditCard::ExpiryDate.new(today.month, today.year)
13
- assert_false date.expired?
14
- end
15
-
16
- def test_dates_in_the_future_should_not_be_expired
17
- next_month = 1.month.from_now
18
- date = CreditCard::ExpiryDate.new(next_month.month, next_month.year)
19
- assert_false date.expired?
20
- end
21
-
22
- def test_invalid_date
23
- expiry = CreditCard::ExpiryDate.new(13, 2009)
24
- assert_equal Time.at(0).utc, expiry.expiration
25
- end
26
-
27
- def test_month_and_year_coerced_to_integer
28
- expiry = CreditCard::ExpiryDate.new("13", "2009")
29
- assert_equal 13, expiry.month
30
- assert_equal 2009, expiry.year
31
- end
32
- end
@@ -1,676 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AuthorizeNetCimTest < Test::Unit::TestCase
4
- def setup
5
- @gateway = AuthorizeNetCimGateway.new(
6
- :login => 'X',
7
- :password => 'Y'
8
- )
9
- @amount = 100
10
- @credit_card = credit_card
11
- @address = address
12
- @customer_profile_id = '3187'
13
- @customer_payment_profile_id = '7813'
14
- @customer_address_id = '4321'
15
- @payment = {
16
- :credit_card => @credit_card
17
- }
18
- @profile = {
19
- :merchant_customer_id => 'Up to 20 chars', # Optional
20
- :description => 'Up to 255 Characters', # Optional
21
- :email => 'Up to 255 Characters', # Optional
22
- :payment_profiles => { # Optional
23
- :customer_type => 'individual or business', # Optional
24
- :bill_to => @address,
25
- :payment => @payment
26
- },
27
- :ship_to_list => {
28
- :first_name => 'John',
29
- :last_name => 'Doe',
30
- :company => 'Widgets, Inc',
31
- :address1 => '1234 Fake Street',
32
- :city => 'Anytown',
33
- :state => 'MD',
34
- :zip => '12345',
35
- :country => 'USA',
36
- :phone_number => '(123)123-1234', # Optional - Up to 25 digits (no letters)
37
- :fax_number => '(123)123-1234' # Optional - Up to 25 digits (no letters)
38
- }
39
- }
40
- @options = {
41
- :ref_id => '1234', # Optional
42
- :profile => @profile
43
- }
44
- end
45
-
46
- def test_expdate_formatting
47
- assert_equal '2009-09', @gateway.send(:expdate, credit_card('4111111111111111', :month => "9", :year => "2009"))
48
- assert_equal '2013-11', @gateway.send(:expdate, credit_card('4111111111111111', :month => "11", :year => "2013"))
49
- end
50
-
51
- def test_should_create_customer_profile_request
52
- @gateway.expects(:ssl_post).returns(successful_create_customer_profile_response)
53
-
54
- assert response = @gateway.create_customer_profile(@options)
55
- assert_instance_of Response, response
56
- assert_success response
57
- assert_equal @customer_profile_id, response.authorization
58
- assert_equal "Successful.", response.message
59
- end
60
-
61
- def test_should_create_customer_payment_profile_request
62
- @gateway.expects(:ssl_post).returns(successful_create_customer_payment_profile_response)
63
-
64
- assert response = @gateway.create_customer_payment_profile(
65
- :customer_profile_id => @customer_profile_id,
66
- :payment_profile => {
67
- :customer_type => 'individual',
68
- :bill_to => @address,
69
- :payment => @payment
70
- },
71
- :validation_mode => :test
72
- )
73
- assert_instance_of Response, response
74
- assert_success response
75
- assert_equal @customer_payment_profile_id, response.params['customer_payment_profile_id']
76
- assert_equal "This output is only present if the ValidationMode input parameter is passed with a value of testMode or liveMode", response.params['validation_direct_response']
77
- end
78
-
79
- def test_should_create_customer_shipping_address_request
80
- @gateway.expects(:ssl_post).returns(successful_create_customer_shipping_address_response)
81
-
82
- assert response = @gateway.create_customer_shipping_address(
83
- :customer_profile_id => @customer_profile_id,
84
- :address => {
85
- :first_name => 'John',
86
- :last_name => 'Doe',
87
- :company => 'Widgets, Inc',
88
- :address1 => '1234 Fake Street',
89
- :city => 'Anytown',
90
- :state => 'MD',
91
- :country => 'USA',
92
- :phone_number => '(123)123-1234',
93
- :fax_number => '(123)123-1234'
94
- }
95
- )
96
- assert_instance_of Response, response
97
- assert_success response
98
- assert_nil response.authorization
99
- assert_equal 'customerAddressId', response.params['customer_address_id']
100
- end
101
-
102
- def test_should_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
103
- @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_only))
104
-
105
- assert response = @gateway.create_customer_profile_transaction(
106
- :transaction => {
107
- :customer_profile_id => @customer_profile_id,
108
- :customer_payment_profile_id => @customer_payment_profile_id,
109
- :type => :auth_only,
110
- :amount => @amount
111
- }
112
- )
113
- assert_instance_of Response, response
114
- assert_success response
115
- assert_nil response.authorization
116
- assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
117
- assert_equal 'auth_only', response.params['direct_response']['transaction_type']
118
- assert_equal 'Gw4NGI', approval_code = response.params['direct_response']['approval_code']
119
- assert_equal '508223659', response.params['direct_response']['transaction_id']
120
-
121
- assert_equal '1', response.params['direct_response']['response_code']
122
- assert_equal '1', response.params['direct_response']['response_subcode']
123
- assert_equal '1', response.params['direct_response']['response_reason_code']
124
- assert_equal 'Y', response.params['direct_response']['avs_response']
125
- assert_equal '', response.params['direct_response']['invoice_number']
126
- assert_equal '', response.params['direct_response']['order_description']
127
- assert_equal '100.00', response.params['direct_response']['amount']
128
- assert_equal 'CC', response.params['direct_response']['method']
129
- assert_equal 'Up to 20 chars', response.params['direct_response']['customer_id']
130
- assert_equal '', response.params['direct_response']['first_name']
131
- assert_equal '', response.params['direct_response']['last_name']
132
- assert_equal '', response.params['direct_response']['company']
133
- assert_equal '', response.params['direct_response']['address']
134
- assert_equal '', response.params['direct_response']['city']
135
- assert_equal '', response.params['direct_response']['state']
136
- assert_equal '', response.params['direct_response']['zip_code']
137
- assert_equal '', response.params['direct_response']['country']
138
- assert_equal '', response.params['direct_response']['phone']
139
- assert_equal '', response.params['direct_response']['fax']
140
- assert_equal 'Up to 255 Characters', response.params['direct_response']['email_address']
141
- assert_equal '', response.params['direct_response']['ship_to_first_name']
142
- assert_equal '', response.params['direct_response']['ship_to_last_name']
143
- assert_equal '', response.params['direct_response']['ship_to_company']
144
- assert_equal '', response.params['direct_response']['ship_to_address']
145
- assert_equal '', response.params['direct_response']['ship_to_city']
146
- assert_equal '', response.params['direct_response']['ship_to_state']
147
- assert_equal '', response.params['direct_response']['ship_to_zip_code']
148
- assert_equal '', response.params['direct_response']['ship_to_country']
149
- assert_equal '', response.params['direct_response']['tax']
150
- assert_equal '', response.params['direct_response']['duty']
151
- assert_equal '', response.params['direct_response']['freight']
152
- assert_equal '', response.params['direct_response']['tax_exempt']
153
- assert_equal '', response.params['direct_response']['purchase_order_number']
154
- assert_equal '6E5334C13C78EA078173565FD67318E4', response.params['direct_response']['md5_hash']
155
- assert_equal '', response.params['direct_response']['card_code']
156
- assert_equal '2', response.params['direct_response']['cardholder_authentication_verification_response']
157
-
158
- @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:capture_only))
159
-
160
- assert response = @gateway.create_customer_profile_transaction(
161
- :transaction => {
162
- :customer_profile_id => @customer_profile_id,
163
- :customer_payment_profile_id => @customer_payment_profile_id,
164
- :type => :capture_only,
165
- :amount => @amount,
166
- :approval_code => approval_code
167
- }
168
- )
169
- assert_instance_of Response, response
170
- assert_success response
171
- assert_nil response.authorization
172
- assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
173
- end
174
-
175
- def test_should_create_customer_profile_transaction_auth_capture_request
176
- @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_capture))
177
-
178
- assert response = @gateway.create_customer_profile_transaction(
179
- :transaction => {
180
- :customer_profile_id => @customer_profile_id,
181
- :customer_payment_profile_id => @customer_payment_profile_id,
182
- :type => :auth_capture,
183
- :order => {
184
- :invoice_number => '1234',
185
- :description => 'Test Order Description',
186
- :purchase_order_number => '4321'
187
- },
188
- :amount => @amount
189
- }
190
- )
191
- assert_instance_of Response, response
192
- assert_success response
193
- assert_nil response.authorization
194
- assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
195
- end
196
-
197
- def test_should_delete_customer_profile_request
198
- @gateway.expects(:ssl_post).returns(successful_delete_customer_profile_response)
199
-
200
- assert response = @gateway.delete_customer_profile(:customer_profile_id => @customer_profile_id)
201
- assert_instance_of Response, response
202
- assert_success response
203
- assert_equal @customer_profile_id, response.authorization
204
- end
205
-
206
- def test_should_delete_customer_payment_profile_request
207
- @gateway.expects(:ssl_post).returns(successful_delete_customer_payment_profile_response)
208
-
209
- assert response = @gateway.delete_customer_payment_profile(:customer_profile_id => @customer_profile_id, :customer_payment_profile_id => @customer_payment_profile_id)
210
- assert_instance_of Response, response
211
- assert_success response
212
- assert_nil response.authorization
213
- end
214
-
215
- def test_should_delete_customer_shipping_address_request
216
- @gateway.expects(:ssl_post).returns(successful_delete_customer_shipping_address_response)
217
-
218
- assert response = @gateway.delete_customer_shipping_address(:customer_profile_id => @customer_profile_id, :customer_address_id => @customer_address_id)
219
- assert_instance_of Response, response
220
- assert_success response
221
- assert_nil response.authorization
222
- end
223
-
224
- def test_should_get_customer_profile_request
225
- @gateway.expects(:ssl_post).returns(successful_get_customer_profile_response)
226
-
227
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
228
- assert_instance_of Response, response
229
- assert_success response
230
- assert_equal @customer_profile_id, response.authorization
231
- end
232
-
233
- def test_should_get_customer_profile_request_with_multiple_payment_profiles
234
- @gateway.expects(:ssl_post).returns(successful_get_customer_profile_response_with_multiple_payment_profiles)
235
-
236
- assert response = @gateway.get_customer_profile(:customer_profile_id => @customer_profile_id)
237
- assert_instance_of Response, response
238
- assert_success response
239
-
240
- assert_equal @customer_profile_id, response.authorization
241
- assert_equal 2, response.params['profile']['payment_profiles'].size
242
- end
243
-
244
- def test_should_get_customer_payment_profile_request
245
- @gateway.expects(:ssl_post).returns(successful_get_customer_payment_profile_response)
246
-
247
- assert response = @gateway.get_customer_payment_profile(
248
- :customer_profile_id => @customer_profile_id,
249
- :customer_payment_profile_id => @customer_payment_profile_id
250
- )
251
- assert_instance_of Response, response
252
- assert_success response
253
- assert_nil response.authorization
254
- assert_equal @customer_payment_profile_id, response.params['profile']['payment_profiles']['customer_payment_profile_id']
255
- end
256
-
257
- def test_should_get_customer_shipping_address_request
258
- @gateway.expects(:ssl_post).returns(successful_get_customer_shipping_address_response)
259
-
260
- assert response = @gateway.get_customer_shipping_address(
261
- :customer_profile_id => @customer_profile_id,
262
- :customer_address_id => @customer_address_id
263
- )
264
- assert_instance_of Response, response
265
- assert_success response
266
- assert_nil response.authorization
267
- end
268
-
269
- def test_should_update_customer_profile_request
270
- @gateway.expects(:ssl_post).returns(successful_update_customer_profile_response)
271
-
272
- assert response = @gateway.update_customer_profile(
273
- :profile => {
274
- :customer_profile_id => @customer_profile_id,
275
- :email => 'new email address'
276
- }
277
- )
278
- assert_instance_of Response, response
279
- assert_success response
280
- assert_equal @customer_profile_id, response.authorization
281
- end
282
-
283
- def test_should_update_customer_payment_profile_request
284
- @gateway.expects(:ssl_post).returns(successful_update_customer_payment_profile_response)
285
-
286
- assert response = @gateway.update_customer_payment_profile(
287
- :customer_profile_id => @customer_profile_id,
288
- :payment_profile => {
289
- :customer_payment_profile_id => @customer_payment_profile_id,
290
- :customer_type => 'business'
291
- }
292
- )
293
- assert_instance_of Response, response
294
- assert_success response
295
- assert_nil response.authorization
296
- end
297
-
298
- def test_should_update_customer_shipping_address_request
299
- @gateway.expects(:ssl_post).returns(successful_update_customer_shipping_address_response)
300
-
301
- assert response = @gateway.update_customer_shipping_address(
302
- :customer_profile_id => @customer_profile_id,
303
- :address => {
304
- :customer_address_id => @customer_address_id,
305
- :city => 'New City'
306
- }
307
- )
308
- assert_instance_of Response, response
309
- assert_success response
310
- assert_nil response.authorization
311
- end
312
-
313
- def test_should_validate_customer_payment_profile_request
314
- @gateway.expects(:ssl_post).returns(successful_validate_customer_payment_profile_response)
315
-
316
- assert response = @gateway.validate_customer_payment_profile(
317
- :customer_profile_id => @customer_profile_id,
318
- :customer_payment_profile_id => @customer_payment_profile_id,
319
- :customer_address_id => @customer_address_id,
320
- :validation_mode => :live
321
- )
322
- assert_instance_of Response, response
323
- assert_success response
324
- assert_nil response.authorization
325
- assert_equal 'This transaction has been approved.', response.params['direct_response']['message']
326
- end
327
-
328
- private
329
-
330
- def successful_create_customer_profile_response
331
- <<-XML
332
- <?xml version="1.0" encoding="utf-8" ?>
333
- <createCustomerProfileResponse
334
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
335
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
336
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
337
- <refId>refid1</refId>
338
- <messages>
339
- <resultCode>Ok</resultCode>
340
- <message>
341
- <code>I00001</code>
342
- <text>Successful.</text>
343
- </message>
344
- </messages>
345
- <customerProfileId>#{@customer_profile_id}</customerProfileId>
346
- </createCustomerProfileResponse>
347
- XML
348
- end
349
-
350
- def successful_create_customer_payment_profile_response
351
- <<-XML
352
- <?xml version="1.0" encoding="utf-8" ?>
353
- <createCustomerPaymentProfileResponse
354
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
355
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
356
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
357
- <refId>refid1</refId>
358
- <messages>
359
- <resultCode>Ok</resultCode>
360
- <message>
361
- <code>I00001</code>
362
- <text>Successful.</text>
363
- </message>
364
- </messages>
365
- <customerPaymentProfileId>#{@customer_payment_profile_id}</customerPaymentProfileId>
366
- <validationDirectResponse>This output is only present if the ValidationMode input parameter is passed with a value of testMode or liveMode</validationDirectResponse>
367
- </createCustomerPaymentProfileResponse>
368
- XML
369
- end
370
-
371
- def successful_create_customer_shipping_address_response
372
- <<-XML
373
- <?xml version="1.0" encoding="utf-8" ?>
374
- <createCustomerShippingAddressResponse
375
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
376
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
377
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
378
- <refId>refid1</refId>
379
- <messages>
380
- <resultCode>Ok</resultCode>
381
- <message>
382
- <code>I00001</code>
383
- <text>Successful.</text>
384
- </message>
385
- </messages>
386
- <customerAddressId>customerAddressId</customerAddressId>
387
- </createCustomerShippingAddressResponse>
388
- XML
389
- end
390
-
391
- def successful_delete_customer_profile_response
392
- <<-XML
393
- <?xml version="1.0" encoding="utf-8" ?>
394
- <deleteCustomerProfileResponse
395
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
396
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
397
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
398
- <refId>refid1</refId>
399
- <messages>
400
- <resultCode>Ok</resultCode>
401
- <message>
402
- <code>I00001</code>
403
- <text>Successful.</text>
404
- </message>
405
- </messages>
406
- <customerProfileId>#{@customer_profile_id}</customerProfileId>
407
- </deleteCustomerProfileResponse>
408
- XML
409
- end
410
-
411
- def successful_delete_customer_payment_profile_response
412
- <<-XML
413
- <?xml version="1.0" encoding="utf-8" ?>
414
- <deleteCustomerPaymentProfileResponse
415
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
416
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
417
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
418
- <refId>refid1</refId>
419
- <messages>
420
- <resultCode>Ok</resultCode>
421
- <message>
422
- <code>I00001</code>
423
- <text>Successful.</text>
424
- </message>
425
- </messages>
426
- </deleteCustomerPaymentProfileResponse>
427
- XML
428
- end
429
-
430
- def successful_delete_customer_shipping_address_response
431
- <<-XML
432
- <?xml version="1.0" encoding="utf-8" ?>
433
- <deleteCustomerShippingAddressResponse
434
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
435
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
436
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
437
- <refId>refid1</refId>
438
- <messages>
439
- <resultCode>Ok</resultCode>
440
- <message>
441
- <code>I00001</code>
442
- <text>Successful.</text>
443
- </message>
444
- </messages>
445
- </deleteCustomerShippingAddressResponse>
446
- XML
447
- end
448
-
449
- def successful_get_customer_profile_response
450
- <<-XML
451
- <?xml version="1.0" encoding="utf-8" ?>
452
- <getCustomerProfileResponse
453
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
454
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
455
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
456
- <refId>refid1</refId>
457
- <messages>
458
- <resultCode>Ok</resultCode>
459
- <message>
460
- <code>I00001</code>
461
- <text>Successful.</text>
462
- </message>
463
- </messages>
464
- <customerProfileId>#{@customer_profile_id}</customerProfileId>
465
- <profile>
466
- <paymentProfiles>
467
- <customerPaymentProfileId>123456</customerPaymentProfileId>
468
- <payment>
469
- <creditCard>
470
- <cardNumber>#{@credit_card.number}</cardNumber>
471
- <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
472
- </creditCard>
473
- </payment>
474
- </paymentProfiles>
475
- </profile>
476
- </getCustomerProfileResponse>
477
- XML
478
- end
479
-
480
- def successful_get_customer_profile_response_with_multiple_payment_profiles
481
- <<-XML
482
- <?xml version="1.0" encoding="utf-8"?>
483
- <getCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
484
- <messages>
485
- <resultCode>Ok</resultCode>
486
- <message>
487
- <code>I00001</code>
488
- <text>Successful.</text>
489
- </message>
490
- </messages>
491
- <profile>
492
- <merchantCustomerId>Up to 20 chars</merchantCustomerId>
493
- <description>Up to 255 Characters</description>
494
- <email>Up to 255 Characters</email>
495
- <customerProfileId>#{@customer_profile_id}</customerProfileId>
496
- <paymentProfiles>
497
- <customerPaymentProfileId>1000</customerPaymentProfileId>
498
- <payment>
499
- <creditCard>
500
- <cardNumber>#{@credit_card.number}</cardNumber>
501
- <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
502
- </creditCard>
503
- </payment>
504
- </paymentProfiles>
505
- <paymentProfiles>
506
- <customerType>individual</customerType>
507
- <customerPaymentProfileId>1001</customerPaymentProfileId>
508
- <payment>
509
- <creditCard>
510
- <cardNumber>XXXX1234</cardNumber>
511
- <expirationDate>XXXX</expirationDate>
512
- </creditCard>
513
- </payment>
514
- </paymentProfiles>
515
- </profile>
516
- </getCustomerProfileResponse>
517
- XML
518
- end
519
-
520
- def successful_get_customer_payment_profile_response
521
- <<-XML
522
- <?xml version="1.0" encoding="utf-8" ?>
523
- <getCustomerPaymentProfileResponse
524
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
525
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
526
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
527
- <refId>refid1</refId>
528
- <messages>
529
- <resultCode>Ok</resultCode>
530
- <message>
531
- <code>I00001</code>
532
- <text>Successful.</text>
533
- </message>
534
- </messages>
535
- <profile>
536
- <paymentProfiles>
537
- <customerPaymentProfileId>#{@customer_payment_profile_id}</customerPaymentProfileId>
538
- <payment>
539
- <creditCard>
540
- <cardNumber>#{@credit_card.number}</cardNumber>
541
- <expirationDate>#{@gateway.send(:expdate, @credit_card)}</expirationDate>
542
- </creditCard>
543
- </payment>
544
- </paymentProfiles>
545
- </profile>
546
- </getCustomerPaymentProfileResponse>
547
- XML
548
- end
549
-
550
- def successful_get_customer_shipping_address_response
551
- <<-XML
552
- <?xml version="1.0" encoding="utf-8" ?>
553
- <getCustomerShippingAddressResponse
554
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
555
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
556
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
557
- <refId>refid1</refId>
558
- <messages>
559
- <resultCode>Ok</resultCode>
560
- <message>
561
- <code>I00001</code>
562
- <text>Successful.</text>
563
- </message>
564
- </messages>
565
- <address>
566
- <customerAddressId>#{@customer_address_id}</customerAddressId>
567
- </address>
568
- </getCustomerShippingAddressResponse>
569
- XML
570
- end
571
-
572
- def successful_update_customer_profile_response
573
- <<-XML
574
- <?xml version="1.0" encoding="utf-8" ?>
575
- <updateCustomerProfileResponse
576
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
577
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
578
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
579
- <refId>refid1</refId>
580
- <messages>
581
- <resultCode>Ok</resultCode>
582
- <message>
583
- <code>I00001</code>
584
- <text>Successful.</text>
585
- </message>
586
- </messages>
587
- <customerProfileId>#{@customer_profile_id}</customerProfileId>
588
- </updateCustomerProfileResponse>
589
- XML
590
- end
591
-
592
- def successful_update_customer_payment_profile_response
593
- <<-XML
594
- <?xml version="1.0" encoding="utf-8" ?>
595
- <updateCustomerPaymentProfileResponse
596
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
597
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
598
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
599
- <refId>refid1</refId>
600
- <messages>
601
- <resultCode>Ok</resultCode>
602
- <message>
603
- <code>I00001</code>
604
- <text>Successful.</text>
605
- </message>
606
- </messages>
607
- </updateCustomerPaymentProfileResponse>
608
- XML
609
- end
610
-
611
- def successful_update_customer_shipping_address_response
612
- <<-XML
613
- <?xml version="1.0" encoding="utf-8" ?>
614
- <updateCustomerShippingAddressResponse
615
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
616
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
617
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
618
- <refId>refid1</refId>
619
- <messages>
620
- <resultCode>Ok</resultCode>
621
- <message>
622
- <code>I00001</code>
623
- <text>Successful.</text>
624
- </message>
625
- </messages>
626
- </updateCustomerShippingAddressResponse>
627
- XML
628
- end
629
-
630
- SUCCESSFUL_DIRECT_RESPONSE = {
631
- :auth_only => '1,1,1,This transaction has been approved.,Gw4NGI,Y,508223659,,,100.00,CC,auth_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,,,,,,,,,,,,,,6E5334C13C78EA078173565FD67318E4,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
632
- :capture_only => '1,1,1,This transaction has been approved.,,Y,508223660,,,100.00,CC,capture_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,,,,,,,,,,,,,,6E5334C13C78EA078173565FD67318E4,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
633
- :auth_capture => '1,1,1,This transaction has been approved.,d1GENk,Y,508223661,32968c18334f16525227,Store purchase,1.00,CC,auth_capture,,Longbob,Longsen,,,,,,,,,,,,,,,,,,,,,,,269862C030129C1173727CC10B1935ED,P,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,'
634
- }
635
-
636
- def successful_create_customer_profile_transaction_response(transaction_type)
637
- <<-XML
638
- <?xml version="1.0" encoding="utf-8" ?>
639
- <createCustomerProfileTransactionResponse
640
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
641
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
642
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
643
- <refId>refid1</refId>
644
- <messages>
645
- <resultCode>Ok</resultCode>
646
- <message>
647
- <code>I00001</code>
648
- <text>Successful.</text>
649
- </message>
650
- </messages>
651
- <directResponse>#{SUCCESSFUL_DIRECT_RESPONSE[transaction_type]}</directResponse>
652
- </createCustomerProfileTransactionResponse>
653
- XML
654
- end
655
-
656
- def successful_validate_customer_payment_profile_response
657
- <<-XML
658
- <?xml version="1.0" encoding="utf-8" ?>
659
- <validateCustomerPaymentProfileResponse
660
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
661
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
662
- xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
663
- <refId>refid1</refId>
664
- <messages>
665
- <resultCode>Ok</resultCode>
666
- <message>
667
- <code>I00001</code>
668
- <text>Successful.</text>
669
- </message>
670
- </messages>
671
- <directResponse>1,1,1,This transaction has been approved.,DEsVh8,Y,508276300,none,Test transaction for ValidateCustomerPaymentProfile.,0.01,CC,auth_only,Up to 20 chars,,,,,,,,,,,Up to 255 Characters,John,Doe,Widgets, Inc,1234 Fake Street,Anytown,MD,12345,USA,0.0000,0.0000,0.0000,TRUE,none,7EB3A44624C0C10FAAE47E276B48BF17,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,</directResponse>
672
- </validateCustomerPaymentProfileResponse>
673
- XML
674
- end
675
-
676
- end