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,173 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PayflowExpressTest < Test::Unit::TestCase
4
- TEST_REDIRECT_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=1234567890'
5
- LIVE_REDIRECT_URL = 'https://www.paypal.com/cgibin/webscr?cmd=_express-checkout&token=1234567890'
6
-
7
- TEST_REDIRECT_URL_WITHOUT_REVIEW = "#{TEST_REDIRECT_URL}&useraction=commit"
8
- LIVE_REDIRECT_URL_WITHOUT_REVIEW = "#{LIVE_REDIRECT_URL}&useraction=commit"
9
-
10
- def setup
11
- Base.gateway_mode = :test
12
-
13
- @gateway = PayflowExpressGateway.new(
14
- :login => 'LOGIN',
15
- :password => 'PASSWORD'
16
- )
17
-
18
- @address = { :address1 => '1234 My Street',
19
- :address2 => 'Apt 1',
20
- :company => 'Widgets Inc',
21
- :city => 'Ottawa',
22
- :state => 'ON',
23
- :zip => 'K1C2N6',
24
- :country => 'Canada',
25
- :phone => '(555)555-5555'
26
- }
27
- end
28
-
29
- def teardown
30
- Base.gateway_mode = :test
31
- end
32
-
33
- def test_using_test_mode
34
- assert @gateway.test?
35
- end
36
-
37
- def test_overriding_test_mode
38
- Base.gateway_mode = :production
39
-
40
- gateway = PayflowExpressGateway.new(
41
- :login => 'LOGIN',
42
- :password => 'PASSWORD',
43
- :test => true
44
- )
45
-
46
- assert gateway.test?
47
- end
48
-
49
- def test_using_production_mode
50
- Base.gateway_mode = :production
51
-
52
- gateway = PayflowExpressGateway.new(
53
- :login => 'LOGIN',
54
- :password => 'PASSWORD'
55
- )
56
-
57
- assert !gateway.test?
58
- end
59
-
60
- def test_live_redirect_url
61
- Base.gateway_mode = :production
62
- assert_equal LIVE_REDIRECT_URL, @gateway.redirect_url_for('1234567890')
63
- end
64
-
65
- def test_test_redirect_url
66
- assert_equal TEST_REDIRECT_URL, @gateway.redirect_url_for('1234567890')
67
- end
68
-
69
- def test_live_redirect_url_without_review
70
- Base.gateway_mode = :production
71
- assert_equal LIVE_REDIRECT_URL_WITHOUT_REVIEW, @gateway.redirect_url_for('1234567890', :review => false)
72
- end
73
-
74
- def test_test_redirect_url_without_review
75
- assert_equal :test, Base.gateway_mode
76
- assert_equal TEST_REDIRECT_URL_WITHOUT_REVIEW, @gateway.redirect_url_for('1234567890', :review => false)
77
- end
78
-
79
- def test_invalid_get_express_details_request
80
- @gateway.expects(:ssl_post).returns(invalid_get_express_details_response)
81
- response = @gateway.details_for('EC-2OPN7UJGFWK9OYFV')
82
- assert_failure response
83
- assert response.test?
84
- assert_equal 'Field format error: Invalid Token', response.message
85
- end
86
-
87
- def test_get_express_details
88
- @gateway.expects(:ssl_post).returns(successful_get_express_details_response)
89
- response = @gateway.details_for('EC-2OPN7UJGFWK9OYFV')
90
- assert_instance_of PayflowExpressResponse, response
91
- assert_success response
92
- assert response.test?
93
-
94
- assert_equal 'EC-2OPN7UJGFWK9OYFV', response.token
95
- assert_equal '12345678901234567', response.payer_id
96
- assert_equal 'Buyer1@paypal.com', response.email
97
- assert_equal 'Joe Smith', response.full_name
98
- assert_equal 'US', response.payer_country
99
-
100
- assert address = response.address
101
- assert_equal 'Joe Smith', address['name']
102
- assert_nil address['company']
103
- assert_equal '111 Main St.', address['address1']
104
- assert_nil address['address2']
105
- assert_equal 'San Jose', address['city']
106
- assert_equal 'CA', address['state']
107
- assert_equal '95100', address['zip']
108
- assert_equal 'US', address['country']
109
- assert_nil address['phone']
110
- end
111
-
112
- def test_button_source
113
- xml = Builder::XmlMarkup.new
114
- @gateway.send(:add_paypal_details, xml, {})
115
- xml_doc = REXML::Document.new(xml.target!)
116
- assert_equal 'ActiveMerchant', REXML::XPath.first(xml_doc, '/PayPal/ButtonSource').text
117
- end
118
-
119
- private
120
-
121
- def successful_get_express_details_response
122
- <<-RESPONSE
123
- <XMLPayResponse xmlns='http://www.verisign.com/XMLPay'>
124
- <ResponseData>
125
- <Vendor>TEST</Vendor>
126
- <Partner>verisign</Partner>
127
- <TransactionResults>
128
- <TransactionResult>
129
- <Result>0</Result>
130
- <Message>Approved</Message>
131
- <PayPalResult>
132
- <EMail>Buyer1@paypal.com</EMail>
133
- <PayerID>12345678901234567</PayerID>
134
- <Token>EC-2OPN7UJGFWK9OYFV</Token>
135
- <FeeAmount>0</FeeAmount>
136
- <PayerStatus>verified</PayerStatus>
137
- <Name>Joe</Name>
138
- <ShipTo>
139
- <Address>
140
- <Street>111 Main St.</Street>
141
- <City>San Jose</City>
142
- <State>CA</State>
143
- <Zip>95100</Zip>
144
- <Country>US</Country>
145
- </Address>
146
- </ShipTo>
147
- <CorrelationID>9c3706997455e</CorrelationID>
148
- </PayPalResult>
149
- <ExtData Name='LASTNAME' Value='Smith'/>
150
- </TransactionResult>
151
- </TransactionResults>
152
- </ResponseData>
153
- </XMLPayResponse>
154
- RESPONSE
155
- end
156
-
157
- def invalid_get_express_details_response
158
- <<-RESPONSE
159
- <XMLPayResponse xmlns='http://www.verisign.com/XMLPay'>
160
- <ResponseData>
161
- <Vendor>TEST</Vendor>
162
- <Partner>verisign</Partner>
163
- <TransactionResults>
164
- <TransactionResult>
165
- <Result>7</Result>
166
- <Message>Field format error: Invalid Token</Message>
167
- </TransactionResult>
168
- </TransactionResults>
169
- </ResponseData>
170
- </XMLPayResponse>
171
- RESPONSE
172
- end
173
- end
@@ -1,86 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PayflowExpressUkTest < Test::Unit::TestCase
4
- def setup
5
- @gateway = PayflowExpressUkGateway.new(
6
- :login => 'LOGIN',
7
- :password => 'PASSWORD'
8
- )
9
- end
10
-
11
- def test_supported_countries
12
- assert_equal ['GB'], PayflowExpressUkGateway.supported_countries
13
- end
14
-
15
- def test_get_express_details
16
- @gateway.expects(:ssl_post).returns(successful_get_express_details_response)
17
- response = @gateway.details_for('EC-2OPN7UJGFWK9OYFV')
18
- assert_instance_of PayflowExpressResponse, response
19
- assert_success response
20
- assert response.test?
21
-
22
- assert_equal 'EC-2OPN7UJGFWK9OYFV', response.token
23
- assert_equal 'LYWCMEN4FA7ZQ', response.payer_id
24
- assert_equal 'paul@test.com', response.email
25
- assert_equal 'paul smith', response.full_name
26
- assert_equal 'GB', response.payer_country
27
-
28
- assert address = response.address
29
- assert_equal 'paul smith', address['name']
30
- assert_nil address['company']
31
- assert_equal '10 keyworth avenue', address['address1']
32
- assert_equal 'grangetown', address['address2']
33
- assert_equal 'hinterland', address['city']
34
- assert_equal 'Tyne and Wear', address['state']
35
- assert_equal 'sr5 2uh', address['zip']
36
- assert_equal 'GB', address['country']
37
- assert_nil address['phone']
38
- end
39
-
40
- private
41
- def successful_get_express_details_response
42
- <<-RESPONSE
43
- <?xml version="1.0"?>
44
- <XMLPayResponse xmlns="http://www.paypal.com/XMLPay">
45
- <ResponseData>
46
- <Vendor>markcoop</Vendor>
47
- <Partner>paypaluk</Partner>
48
- <TransactionResults>
49
- <TransactionResult>
50
- <Result>0</Result>
51
- <AVSResult>
52
- <StreetMatch>Match</StreetMatch>
53
- <ZipMatch>Match</ZipMatch>
54
- </AVSResult>
55
- <Message>Approved</Message>
56
- <PayPalResult>
57
- <EMail>paul@test.com</EMail>
58
- <PayerID>LYWCMEN4FA7ZQ</PayerID>
59
- <Token>EC-2OPN7UJGFWK9OYFV</Token>
60
- <FeeAmount>0</FeeAmount>
61
- <PayerStatus>unverified</PayerStatus>
62
- <Name>paul</Name>
63
- <ShipTo>
64
- <Address>
65
- <Street>10 keyworth avenue</Street>
66
- <City>hinterland</City>
67
- <State>Tyne and Wear</State>
68
- <Zip>sr5 2uh</Zip>
69
- <Country>GB</Country>
70
- </Address>
71
- </ShipTo>
72
- <CorrelationID>1ea22ef3873ba</CorrelationID>
73
- </PayPalResult>
74
- <ExtData Name="LASTNAME" Value="smith"/>
75
- <ExtData Name="SHIPTOSTREET2" Value="grangetown"/>
76
- <ExtData Name="SHIPTONAME" Value="paul smith"/>
77
- <ExtData Name="STREET2" Value="ALLAWAY AVENUE"/>
78
- <ExtData Name="COUNTRYCODE" Value="GB"/>
79
- <ExtData Name="ADDRESSSTATUS" Value="Y"/>
80
- </TransactionResult>
81
- </TransactionResults>
82
- </ResponseData>
83
- </XMLPayResponse>
84
- RESPONSE
85
- end
86
- end
@@ -1,205 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PayflowNvpUkTest < Test::Unit::TestCase
4
- def setup
5
- @gateway = PayflowNvpUkGateway.new(
6
- :login => 'login',
7
- :password => 'password'
8
- )
9
-
10
- @credit_card = credit_card
11
- @amount = 100
12
-
13
- @options = {
14
- :order_id => '1',
15
- :billing_address => address,
16
- :description => 'Store Purchase'
17
- }
18
- end
19
-
20
- def test_able_to_view_gateway_url
21
- assert_equal("https://pilot-payflowpro.paypal.com", @gateway.gateway_url)
22
- end
23
-
24
- def test_successful_purchase
25
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
26
-
27
- assert response = @gateway.purchase(@amount, @credit_card, @options)
28
- assert_instance_of Response, response
29
- assert_success response
30
-
31
- # Replace with authorization number from the successful response
32
- assert_equal 'E78P1FF791C2', response.authorization
33
- assert response.test?
34
- end
35
-
36
- def test_failed_purchase
37
- @gateway.expects(:ssl_post).returns(failed_purchase_response)
38
-
39
- assert response = @gateway.authorize(@amount, @credit_card, @options)
40
- assert_instance_of Response, response
41
- assert_failure response
42
- end
43
-
44
- def test_add_creditcard
45
- result = {}
46
-
47
- @gateway.send(:add_creditcard, result, @credit_card)
48
- assert_equal "123", result[:cvv2]
49
- assert_equal "Longbob", result[:firstname]
50
- assert_equal "Longsen", result[:lastname]
51
- assert_equal "0911", result[:expdate]
52
- end
53
-
54
- def test_add_address
55
- result = {}
56
-
57
- @gateway.send(:add_address, result, { :address1 => '164 Waverley Street', :city => "Coldingham", :country => 'GB', :state => 'Essex', :zip => "NW12 8JB"} )
58
- assert_equal ["street", "city", "country", "state", "zip"].sort, result.stringify_keys.keys.sort
59
- assert_equal 'Essex', result["state"]
60
- assert_equal '164 Waverley Street', result["street"]
61
- assert_equal 'Coldingham', result["city"]
62
- assert_equal 'NW128JB', result["zip"]
63
- assert_equal 'GB', result["country"]
64
- end
65
-
66
- def test_add_shipping_address
67
- result = {}
68
-
69
- @gateway.send(:add_address, result, { :address1 => '164 Waverley Street', :city => "Coldingham", :country => 'GB', :state => 'Essex', :zip => "NW12 8JB"}, "shipto" )
70
- assert_equal ["shiptostreet", "shiptocity", "shiptocountry", "shiptostate", "shiptozip"].sort, result.stringify_keys.keys.sort
71
- assert_equal 'Essex', result["shiptostate"]
72
- assert_equal '164 Waverley Street', result["shiptostreet"]
73
- assert_equal 'Coldingham', result["shiptocity"]
74
- assert_equal 'NW128JB', result["shiptozip"]
75
- assert_equal 'GB', result["shiptocountry"]
76
- end
77
-
78
- def test_add_customer_data
79
- result = {}
80
-
81
- @gateway.send(:add_customer_data, result, { :ip => "2.3.4.5", :email => "john@jones.com", :customer => "johnjones" })
82
- assert_equal [:custref, :custip, :email].collect { |k| k.to_s }.sort, result.stringify_keys.keys.sort
83
- assert_equal "2.3.4.5", result[:custip]
84
- assert_equal "john@jones.com", result[:email]
85
- assert_equal "johnjones", result[:custref]
86
- end
87
-
88
- def test_add_order_id
89
- result = {}
90
-
91
- @gateway.send(:add_invoice, result, { :order_id => "12385" })
92
- assert_equal "12385", result[:invnum]
93
- end
94
-
95
- def test_custref_constrained_to_max_length
96
- result = {}
97
-
98
- @gateway.send(:add_customer_data, result, { :customer => "TheRightHonourableGeoff" })
99
- assert_equal "TheRightHono", result[:custref]
100
- end
101
-
102
- def test_add_currency_when_not_supplied
103
- result = {}
104
-
105
- @gateway.send(:add_currency, result, 1200, {})
106
-
107
- assert_equal "GBP", result[:currency]
108
- end
109
-
110
- def test_add_currency_when_supplied
111
- result = {}
112
-
113
- @gateway.send(:add_currency, result, 1200, { :currency => "USD" })
114
-
115
- assert_equal "USD", result[:currency]
116
- end
117
-
118
- def test_add_recurring_info
119
- result = {}
120
-
121
- time = 1.week.from_now
122
-
123
- @gateway.send(:add_recurring_info, result, @credit_card, @options.merge({ :starting_at => time, :payments => 12, :periodicity => :monthly }))
124
- assert_equal "Longbob Longsen", result[:profilename]
125
- assert_equal "A", result[:action]
126
- assert_equal "MONT", result[:payperiod]
127
- assert_equal 12, result[:term]
128
- assert_equal time.strftime("%m%d%Y"), result[:start]
129
- end
130
-
131
- def test_supported_countries
132
- assert_equal ['GB'], PayflowNvpUkGateway.supported_countries
133
- end
134
-
135
- def test_supported_card_types
136
- assert_equal [:visa, :master, :american_express, :discover, :solo, :switch], PayflowNvpUkGateway.supported_cardtypes
137
- end
138
-
139
- def test_unsuccessful_request
140
- @gateway.expects(:ssl_post).returns(failed_purchase_response)
141
-
142
- assert response = @gateway.purchase(@amount, @credit_card, @options)
143
- assert_failure response
144
- assert response.test?
145
- end
146
-
147
- def test_avs_result
148
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
149
-
150
- response = @gateway.purchase(@amount, @credit_card, @options)
151
- assert_equal 'D', response.avs_result['code']
152
- assert_equal 'Y', response.avs_result['street_match']
153
- assert_equal 'Y', response.avs_result['postal_match']
154
- end
155
-
156
- def test_partial_avs_match
157
- #@gateway.expects(:ssl_post).returns(successful_duplicate_response)
158
- #
159
- #response = @gateway.purchase(@amount, @credit_card, @options)
160
- #assert_equal 'X', response.avs_result['code']
161
- #assert_equal 'Y', response.avs_result['street_match']
162
- #assert_equal 'N', response.avs_result['postal_match']
163
- end
164
-
165
- def test_cvv_result
166
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
167
-
168
- response = @gateway.purchase(@amount, @credit_card, @options)
169
- assert_equal 'M', response.cvv_result['code']
170
- end
171
-
172
- private
173
-
174
- # Place raw successful response from gateway here
175
- def successful_purchase_response
176
- 'RESULT=0&PNREF=E78P1FF791C2&RESPMSG=Approved&AUTHCODE=111111&AVSADDR=Y&AVSZIP=Y&CVV2MATCH=Y&PROCCVV2=M&PPREF=EYHMAP72DIEARC7JY&CORRELATIONID=2c9706997458s&IAVS=Y&PROCAVS=D'
177
- end
178
-
179
- # Place raw failed response from gateway here
180
- def failed_purchase_response
181
- 'RESULT=12&PNREF=E19P2B7C2B37&RESPMSG=Declined: 10417-General decline&AVSADDR=Y&AVSZIP=Y&CVV2MATCH=Y&IAVS=N'
182
- end
183
-
184
- def successful_authorization_response
185
- 'RESULT=0&PNREF=E19P2B7CB478&RESPMSG=Approved&AUTHCODE=111111&AVSADDR=Y&AVSZIP=Y&CVV2MATCH=Y&PPREF=INPVKTX9GZDSSPOC4&CORRELATIONID=2c9706997458s&IAVS=N'
186
- end
187
-
188
- def successful_capture_response
189
- 'RESULT=0&PNREF=E19P2B7CB4F6&RESPMSG=Approved&PPREF=B4BPVUEZYHPD5969O&CORRELATIONID=6c5704997466g'
190
- end
191
-
192
- def successful_recurring_response
193
- 'RESULT=0&RESPMSG=Approved&RPREF=R79F2A3390CD&PROFILEID=I-00000000123456789&CORRELATIONID=2c9706997457r'
194
- end
195
-
196
- def successful_recurring_inquiry_response
197
- 'RESULT=0&PNREF=E18P2B7CB1F1&RESPMSG=Approved&AUTHCODE=111111&AVSADDR=Y&AVSZIP=Y&CVV2MATCH=Y&PPREF=ZRKTDWXI5ORK2398T&CORRELATIONID=2c9706997458s&IAVS=N'
198
- end
199
-
200
- def successful_duplicate_response
201
- end
202
-
203
- def failed_recurring_response
204
- end
205
- end