activemerchant 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +310 -294
  3. data/CONTRIBUTERS +13 -0
  4. data/README +55 -31
  5. data/Rakefile +21 -13
  6. data/lib/active_merchant.rb +7 -0
  7. data/lib/active_merchant/billing/avs_result.rb +95 -0
  8. data/lib/active_merchant/billing/base.rb +8 -3
  9. data/lib/active_merchant/billing/check.rb +61 -0
  10. data/lib/active_merchant/billing/credit_card.rb +104 -80
  11. data/lib/active_merchant/billing/credit_card_formatting.rb +11 -8
  12. data/lib/active_merchant/billing/credit_card_methods.rb +76 -32
  13. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  14. data/lib/active_merchant/billing/expiry_date.rb +28 -0
  15. data/lib/active_merchant/billing/gateway.rb +47 -111
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +508 -121
  17. data/lib/active_merchant/billing/gateways/bogus.rb +26 -32
  18. data/lib/active_merchant/billing/gateways/brain_tree.rb +82 -70
  19. data/lib/active_merchant/billing/gateways/card_stream.rb +43 -15
  20. data/lib/active_merchant/billing/gateways/cyber_source.rb +9 -29
  21. data/lib/active_merchant/billing/gateways/data_cash.rb +18 -38
  22. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -50
  23. data/lib/active_merchant/billing/gateways/eway.rb +8 -19
  24. data/lib/active_merchant/billing/gateways/exact.rb +17 -25
  25. data/lib/active_merchant/billing/gateways/linkpoint.rb +18 -25
  26. data/lib/active_merchant/billing/gateways/moneris.rb +9 -39
  27. data/lib/active_merchant/billing/gateways/net_registry.rb +113 -182
  28. data/lib/active_merchant/billing/gateways/netbilling.rb +168 -0
  29. data/lib/active_merchant/billing/gateways/pay_junction.rb +52 -73
  30. data/lib/active_merchant/billing/gateways/pay_secure.rb +120 -0
  31. data/lib/active_merchant/billing/gateways/payflow.rb +13 -14
  32. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +55 -37
  33. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +4 -0
  34. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -4
  35. data/lib/active_merchant/billing/gateways/payment_express.rb +11 -30
  36. data/lib/active_merchant/billing/gateways/paypal.rb +3 -14
  37. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +36 -16
  38. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -2
  39. data/lib/active_merchant/billing/gateways/plugnpay.rb +7 -15
  40. data/lib/active_merchant/billing/gateways/protx.rb +24 -25
  41. data/lib/active_merchant/billing/gateways/psigate.rb +34 -71
  42. data/lib/active_merchant/billing/gateways/psl_card.rb +24 -19
  43. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -24
  44. data/lib/active_merchant/billing/gateways/realex.rb +7 -19
  45. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +113 -0
  46. data/lib/active_merchant/billing/gateways/skip_jack.rb +437 -0
  47. data/lib/active_merchant/billing/gateways/trans_first.rb +5 -14
  48. data/lib/active_merchant/billing/gateways/trust_commerce.rb +100 -39
  49. data/lib/active_merchant/billing/gateways/usa_epay.rb +60 -55
  50. data/lib/active_merchant/billing/gateways/verifi.rb +32 -39
  51. data/lib/active_merchant/billing/gateways/viaklix.rb +31 -37
  52. data/lib/active_merchant/billing/integrations.rb +2 -0
  53. data/lib/active_merchant/billing/integrations/bogus.rb +5 -0
  54. data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
  55. data/lib/active_merchant/billing/integrations/chronopay.rb +5 -0
  56. data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
  57. data/lib/active_merchant/billing/integrations/gestpay.rb +5 -0
  58. data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
  59. data/lib/active_merchant/billing/integrations/hi_trust.rb +26 -0
  60. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
  61. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +57 -0
  62. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
  63. data/lib/active_merchant/billing/integrations/nochex.rb +5 -0
  64. data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
  65. data/lib/active_merchant/billing/integrations/paypal.rb +5 -0
  66. data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
  67. data/lib/active_merchant/billing/integrations/return.rb +35 -0
  68. data/lib/active_merchant/billing/integrations/two_checkout.rb +5 -0
  69. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
  70. data/lib/active_merchant/billing/response.rb +12 -8
  71. data/lib/active_merchant/lib/posts_data.rb +39 -7
  72. data/lib/active_merchant/lib/requires_parameters.rb +2 -3
  73. data/lib/active_merchant/lib/utils.rb +18 -0
  74. data/lib/active_merchant/lib/validateable.rb +3 -3
  75. data/lib/support/gateway_support.rb +22 -9
  76. data/script/destroy +14 -0
  77. data/script/generate +7 -7
  78. data/test/fixtures.yml +25 -3
  79. data/test/remote/gateways/remote_authorize_net_test.rb +145 -0
  80. data/test/remote/gateways/remote_brain_tree_test.rb +118 -0
  81. data/test/{remote_tests → remote/gateways}/remote_card_stream_test.rb +56 -68
  82. data/test/{remote_tests → remote/gateways}/remote_cyber_source_test.rb +21 -32
  83. data/test/{remote_tests → remote/gateways}/remote_data_cash_test.rb +2 -2
  84. data/test/{remote_tests → remote/gateways}/remote_efsnet_test.rb +22 -34
  85. data/test/{remote_tests → remote/gateways}/remote_eway_test.rb +18 -15
  86. data/test/{remote_tests → remote/gateways}/remote_exact_test.rb +20 -19
  87. data/test/{remote_tests → remote/gateways}/remote_linkpoint_test.rb +31 -63
  88. data/test/remote/gateways/remote_moneris_test.rb +82 -0
  89. data/test/{remote_tests → remote/gateways}/remote_net_registry_test.rb +19 -54
  90. data/test/remote/gateways/remote_netbilling_test.rb +70 -0
  91. data/test/{remote_tests → remote/gateways}/remote_pay_junction_test.rb +41 -60
  92. data/test/remote/gateways/remote_pay_secure_test.rb +39 -0
  93. data/test/{remote_tests → remote/gateways}/remote_payflow_express_test.rb +2 -2
  94. data/test/{remote_tests → remote/gateways}/remote_payflow_test.rb +34 -38
  95. data/test/{remote_tests → remote/gateways}/remote_payflow_uk_test.rb +13 -12
  96. data/test/{remote_tests → remote/gateways}/remote_payment_express_test.rb +26 -36
  97. data/test/{remote_tests → remote/gateways}/remote_paypal_express_test.rb +3 -3
  98. data/test/{remote_tests → remote/gateways}/remote_paypal_test.rb +25 -21
  99. data/test/{remote_tests → remote/gateways}/remote_plugnpay_test.rb +18 -16
  100. data/test/{remote_tests → remote/gateways}/remote_protx_test.rb +33 -33
  101. data/test/remote/gateways/remote_psigate_test.rb +50 -0
  102. data/test/{remote_tests → remote/gateways}/remote_psl_card_test.rb +27 -26
  103. data/test/{remote_tests → remote/gateways}/remote_quickpay_test.rb +48 -48
  104. data/test/{remote_tests → remote/gateways}/remote_realex_test.rb +30 -33
  105. data/test/remote/gateways/remote_secure_pay_tech_test.rb +37 -0
  106. data/test/remote/gateways/remote_secure_pay_test.rb +28 -0
  107. data/test/remote/gateways/remote_skipjack_test.rb +105 -0
  108. data/test/{remote_tests → remote/gateways}/remote_trans_first_test.rb +7 -10
  109. data/test/remote/gateways/remote_trust_commerce_test.rb +152 -0
  110. data/test/{remote_tests → remote/gateways}/remote_usa_epay_test.rb +11 -22
  111. data/test/{remote_tests → remote/gateways}/remote_verifi_test.rb +27 -27
  112. data/test/{remote_tests → remote/gateways}/remote_viaklix_test.rb +8 -18
  113. data/test/{remote_tests → remote/integrations}/remote_gestpay_integration_test.rb +1 -1
  114. data/test/{remote_tests → remote/integrations}/remote_paypal_integration_test.rb +1 -1
  115. data/test/test_helper.rb +102 -61
  116. data/test/unit/avs_result_test.rb +59 -0
  117. data/test/unit/base_test.rb +33 -39
  118. data/test/unit/check_test.rb +76 -0
  119. data/test/unit/credit_card_formatting_test.rb +10 -15
  120. data/test/unit/credit_card_methods_test.rb +132 -17
  121. data/test/unit/credit_card_test.rb +157 -228
  122. data/test/unit/cvv_result_test.rb +33 -0
  123. data/test/unit/expiry_date_test.rb +21 -0
  124. data/test/unit/gateways/authorize_net_test.rb +180 -40
  125. data/test/unit/gateways/bogus_test.rb +2 -3
  126. data/test/unit/gateways/brain_tree_test.rb +63 -29
  127. data/test/unit/gateways/card_stream_test.rb +59 -6
  128. data/test/unit/gateways/cyber_source_test.rb +59 -40
  129. data/test/unit/gateways/data_cash_test.rb +82 -1
  130. data/test/unit/gateways/efsnet_test.rb +97 -44
  131. data/test/unit/gateways/eway_test.rb +55 -42
  132. data/test/unit/gateways/exact_test.rb +93 -55
  133. data/test/unit/gateways/gateway_test.rb +7 -0
  134. data/test/unit/gateways/linkpoint_test.rb +60 -58
  135. data/test/unit/gateways/moneris_test.rb +67 -76
  136. data/test/unit/gateways/net_registry_test.rb +351 -419
  137. data/test/unit/gateways/netbilling_test.rb +54 -0
  138. data/test/unit/gateways/pay_junction_test.rb +108 -46
  139. data/test/unit/gateways/pay_secure_test.rb +71 -0
  140. data/test/unit/gateways/payflow_express_test.rb +0 -8
  141. data/test/unit/gateways/payflow_test.rb +136 -65
  142. data/test/unit/gateways/payflow_uk_test.rb +0 -38
  143. data/test/unit/gateways/payment_express_test.rb +31 -51
  144. data/test/unit/gateways/paypal_express_test.rb +8 -2
  145. data/test/unit/gateways/paypal_test.rb +213 -54
  146. data/test/unit/gateways/plugnpay_test.rb +39 -32
  147. data/test/unit/gateways/protx_test.rb +45 -33
  148. data/test/unit/gateways/psigate_test.rb +146 -87
  149. data/test/unit/gateways/psl_card_test.rb +37 -24
  150. data/test/unit/gateways/quickpay_test.rb +33 -46
  151. data/test/unit/gateways/realex_test.rb +32 -31
  152. data/test/unit/gateways/secure_pay_tech_test.rb +44 -0
  153. data/test/unit/gateways/secure_pay_test.rb +35 -26
  154. data/test/unit/gateways/skip_jack_test.rb +125 -0
  155. data/test/unit/gateways/trans_first_test.rb +24 -37
  156. data/test/unit/gateways/trust_commerce_test.rb +47 -26
  157. data/test/unit/gateways/usa_epay_test.rb +52 -41
  158. data/test/unit/gateways/verifi_test.rb +41 -35
  159. data/test/unit/gateways/viaklix_test.rb +38 -32
  160. data/test/unit/generators/test_gateway_generator.rb +46 -0
  161. data/test/unit/generators/test_generator_helper.rb +20 -0
  162. data/test/unit/generators/test_integration_generator.rb +53 -0
  163. data/test/unit/integrations/action_view_helper_test.rb +7 -14
  164. data/test/unit/integrations/bogus_module_test.rb +4 -0
  165. data/test/unit/integrations/chronopay_module_test.rb +4 -0
  166. data/test/unit/integrations/gestpay_module_test.rb +4 -0
  167. data/test/unit/integrations/helpers/hi_trust_helper_test.rb +16 -0
  168. data/test/unit/integrations/hi_trust_module_test.rb +13 -0
  169. data/test/unit/integrations/nochex_module_test.rb +4 -0
  170. data/test/unit/integrations/notifications/hi_trust_notification_test.rb +38 -0
  171. data/test/unit/integrations/paypal_module_test.rb +4 -0
  172. data/test/unit/integrations/returns/chronopay_return_test.rb +11 -0
  173. data/test/unit/integrations/returns/gestpay_return_test.rb +10 -0
  174. data/test/unit/integrations/returns/hi_trust_return_test.rb +24 -0
  175. data/test/unit/integrations/returns/nochex_return_test.rb +10 -0
  176. data/test/unit/integrations/returns/paypal_return_test.rb +10 -0
  177. data/test/unit/integrations/returns/return_test.rb +11 -0
  178. data/test/unit/integrations/returns/two_checkout_return_test.rb +24 -0
  179. data/test/unit/integrations/two_checkout_module_test.rb +4 -0
  180. data/test/unit/posts_data_test.rb +86 -0
  181. data/test/unit/response_test.rb +15 -1
  182. data/test/unit/utils_test.rb +7 -0
  183. data/test/unit/validateable_test.rb +10 -6
  184. metadata +180 -142
  185. metadata.gz.sig +0 -0
  186. data/lib/active_merchant/billing/gateways/paypal/api_cert_chain.crt +0 -35
  187. data/script/generator/base.rb +0 -45
  188. data/script/generator/generator.rb +0 -24
  189. data/script/generator/generators/gateway/gateway_generator.rb +0 -14
  190. data/script/generator/generators/gateway/templates/gateway.rb +0 -73
  191. data/script/generator/generators/gateway/templates/gateway_test.rb +0 -41
  192. data/script/generator/generators/gateway/templates/remote_gateway_test.rb +0 -56
  193. data/script/generator/generators/integration/integration_generator.rb +0 -25
  194. data/script/generator/generators/integration/templates/helper.rb +0 -34
  195. data/script/generator/generators/integration/templates/helper_test.rb +0 -54
  196. data/script/generator/generators/integration/templates/integration.rb +0 -18
  197. data/script/generator/generators/integration/templates/module_test.rb +0 -9
  198. data/script/generator/generators/integration/templates/notification.rb +0 -100
  199. data/script/generator/generators/integration/templates/notification_test.rb +0 -41
  200. data/script/generator/manifest.rb +0 -20
  201. data/test/remote_tests/remote_authorize_net_test.rb +0 -113
  202. data/test/remote_tests/remote_brain_tree_test.rb +0 -78
  203. data/test/remote_tests/remote_moneris_test.rb +0 -110
  204. data/test/remote_tests/remote_psigate_test.rb +0 -87
  205. data/test/remote_tests/remote_secure_pay_test.rb +0 -36
  206. data/test/remote_tests/remote_trust_commerce_test.rb +0 -136
@@ -6,12 +6,12 @@ class EwayTest < Test::Unit::TestCase
6
6
  :login => '87654321'
7
7
  )
8
8
 
9
- @creditcard = credit_card('4646464646464646')
9
+ @credit_card = credit_card('4646464646464646')
10
10
 
11
- @test_params_success = {
11
+ @options = {
12
12
  :order_id => '1230123',
13
13
  :email => 'bob@testbob.com',
14
- :address => {
14
+ :billing_address => {
15
15
  :address1 => '1234 First St.',
16
16
  :address2 => 'Apt. 1',
17
17
  :city => 'Melbourne',
@@ -20,37 +20,26 @@ class EwayTest < Test::Unit::TestCase
20
20
  :zip => '12345'
21
21
  },
22
22
  :description => 'purchased items'
23
- }
24
-
25
- @xml_test_parameters = {
26
- :CustomerID => @test_params_success[:login],
27
- :CustomerInvoiceRef => @test_params_success[:order_id],
28
- :TotalAmount => 100,
29
- :CardNumber => @creditcard.number,
30
- :CardExpiryMonth => sprintf("%.2i", @creditcard.month),
31
- :CardExpiryYear => sprintf("%.4i", @creditcard.year)[-2..-1],
32
- :CustomerFirstName => @creditcard.first_name,
33
- :CustomerLastName => @creditcard.last_name,
34
- :CustomerEmail => @test_params_success[:email],
35
- :CustomerAddress => @test_params_success[:address][:address1],
36
- :CustomerPostcode => @test_params_success[:address][:zip],
37
- :CustomerInvoiceDescription => @test_params_success[:description],
38
- :CardHoldersName => @creditcard.name,
39
- :TrxnNumber => @test_params_success[:order_id],
40
- :Option1 => '',
41
- :Option2 => '',
42
- :Option3 => ''
43
- }
23
+ }
44
24
  end
45
-
46
- def test_purchase_exceptions
47
- @creditcard.number = 3
48
-
49
- assert_raise(Error) do
50
- assert response = @gateway.purchase(100, @creditcard, @test_params_success)
51
- end
25
+
26
+ def test_successful_purchase
27
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
28
+
29
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
30
+ assert_instance_of Response, response
31
+ assert_success response
32
+ assert_equal '123456', response.authorization
52
33
  end
53
-
34
+
35
+ def test_failed_purchase
36
+ @gateway.expects(:ssl_post).returns(failed_purchase_response)
37
+
38
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
39
+ assert_instance_of Response, response
40
+ assert_failure response
41
+ end
42
+
54
43
  def test_amount_style
55
44
  assert_equal '1034', @gateway.send(:amount, 1034)
56
45
 
@@ -59,11 +48,6 @@ class EwayTest < Test::Unit::TestCase
59
48
  end
60
49
  end
61
50
 
62
- def test_purchase_is_valid_xml
63
- assert data = @gateway.send(:post_data, @xml_test_parameters)
64
- assert REXML::Document.new(data)
65
- end
66
-
67
51
  def test_ensure_does_not_respond_to_authorize
68
52
  assert !@gateway.respond_to?(:authorize)
69
53
  end
@@ -90,15 +74,44 @@ class EwayTest < Test::Unit::TestCase
90
74
 
91
75
  def test_add_address
92
76
  post = {}
93
- @gateway.send(:add_address, post, @test_params_success)
77
+ @gateway.send(:add_address, post, @options)
94
78
  assert_equal '1234 First St., Apt. 1, Melbourne, ACT, AU', post[:CustomerAddress]
95
- assert_equal @test_params_success[:address][:zip], post[:CustomerPostcode]
79
+ assert_equal @options[:billing_address][:zip], post[:CustomerPostcode]
96
80
  end
97
81
 
98
82
  private
99
-
100
- def xml_purchase_fixture
101
- %q{<ewaygateway><ewayCustomerID>87654321</ewayCustomerID><ewayOption3></ewayOption3><ewayCustomerFirstName>Longbob</ewayCustomerFirstName><ewayCustomerAddress>47 Bobway, Bobville, WA, Australia</ewayCustomerAddress><ewayCustomerInvoiceRef>1230123</ewayCustomerInvoiceRef><ewayCardHoldersName>Longbob Longsen</ewayCardHoldersName><ewayTotalAmount>100</ewayTotalAmount><ewayTrxnNumber>1230123</ewayTrxnNumber><ewayCustomerLastName>Longsen</ewayCustomerLastName><ewayCustomerPostcode>2000</ewayCustomerPostcode><ewayCardNumber>4646464646464646</ewayCardNumber><ewayOption1></ewayOption1><ewayCardExpiryMonth>08</ewayCardExpiryMonth><ewayOption2></ewayOption2><ewayCustomerEmail>bob@testbob.com</ewayCustomerEmail><ewayCustomerInvoiceDescription>purchased items</ewayCustomerInvoiceDescription><ewayCardExpiryYear>07</ewayCardExpiryYear></ewaygateway>}
83
+ def successful_purchase_response
84
+ <<-XML
85
+ <?xml version="1.0"?>
86
+ <ewayResponse>
87
+ <ewayTrxnStatus>True</ewayTrxnStatus>
88
+ <ewayTrxnNumber>11292</ewayTrxnNumber>
89
+ <ewayTrxnReference/>
90
+ <ewayTrxnOption1/>
91
+ <ewayTrxnOption2/>
92
+ <ewayTrxnOption3/>
93
+ <ewayAuthCode>123456</ewayAuthCode>
94
+ <ewayReturnAmount>100</ewayReturnAmount>
95
+ <ewayTrxnError>00,Transaction Approved(Test CVN Gateway)</ewayTrxnError>
96
+ </ewayResponse>
97
+ XML
98
+ end
99
+
100
+ def failed_purchase_response
101
+ <<-XML
102
+ <?xml version="1.0"?>
103
+ <ewayResponse>
104
+ <ewayTrxnStatus>False</ewayTrxnStatus>
105
+ <ewayTrxnNumber>11290</ewayTrxnNumber>
106
+ <ewayTrxnReference/>
107
+ <ewayTrxnOption1/>
108
+ <ewayTrxnOption2/>
109
+ <ewayTrxnOption3/>
110
+ <ewayAuthCode/>
111
+ <ewayReturnAmount>100</ewayReturnAmount>
112
+ <ewayTrxnError>eWAY Error: Invalid Expiry Date. Your credit card has not been billed for this transaction.(Test CVN Gateway)</ewayTrxnError>
113
+ </ewayResponse>
114
+ XML
102
115
  end
103
116
  end
104
117
 
@@ -5,49 +5,41 @@ class ExactTest < Test::Unit::TestCase
5
5
  @gateway = ExactGateway.new( :login => "A00427-01",
6
6
  :password => "testus" )
7
7
 
8
- @credit_card = credit_card("4111111111111111")
9
-
10
- @options = { :address => { :address1 => "1234 Testing Ave.",
11
- :zip => "55555" } }
8
+ @credit_card = credit_card
9
+ @amount = 100
10
+ @options = {
11
+ :order_id => '1',
12
+ :billing_address => address,
13
+ :description => 'Store Purchase'
14
+ }
12
15
  end
13
16
 
14
- def test_successful_request
15
- @credit_card.number = "1"
16
- assert response = @gateway.purchase(100, @credit_card, {})
17
+ def test_successful_purchase
18
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
19
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
17
20
  assert_success response
18
- assert_equal '5555', response.authorization
21
+ assert_equal 'ET1700;106625152', response.authorization
19
22
  assert response.test?
23
+ assert_equal 'Transaction Normal - VER UNAVAILABLE', response.message
24
+
25
+ ExactGateway::SENSITIVE_FIELDS.each{ |f| assert !response.params.has_key?(f.to_s) }
20
26
  end
21
-
22
- def test_unsuccessful_request
23
- @credit_card.number = "2"
24
- assert response = @gateway.purchase(100, @credit_card, {})
27
+
28
+ def test_failed_purchase
29
+ @gateway.expects(:ssl_post).returns(failed_purchase_response)
30
+
31
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
32
+ assert_instance_of Response, response
25
33
  assert_failure response
26
- assert response.test?
27
- end
28
-
29
- def test_request_error
30
- @credit_card.number = "3"
31
- assert_raise(Error){ @gateway.purchase(100, @credit_card, {}) }
32
34
  end
33
35
 
36
+
34
37
  def test_expdate
35
38
  assert_equal( "%02d%s" % [ @credit_card.month,
36
39
  @credit_card.year.to_s[-2..-1] ],
37
40
  @gateway.send(:expdate, @credit_card) )
38
41
  end
39
-
40
- def test_successful_purchase
41
- @gateway.expects(:ssl_post).returns(successful_purchase_response)
42
- assert response = @gateway.purchase(100, @credit_card, {})
43
- assert_success response
44
- assert_equal 'ET0426;80928103', response.authorization
45
- assert response.test?
46
- assert_equal 'Transaction Normal - VER UNAVAILABLE', response.message
47
42
 
48
- ExactGateway::SENSITIVE_FIELDS.each{ |f| assert !response.params.has_key?(f.to_s) }
49
- end
50
-
51
43
  def test_soap_fault
52
44
  @gateway.expects(:ssl_post).returns(soap_fault_response)
53
45
  assert response = @gateway.purchase(100, @credit_card, {})
@@ -64,42 +56,88 @@ class ExactTest < Test::Unit::TestCase
64
56
  assert_equal [:visa, :master, :american_express, :jcb, :discover], ExactGateway.supported_cardtypes
65
57
  end
66
58
 
59
+ def test_avs_result
60
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
61
+
62
+ response = @gateway.purchase(@amount, @credit_card)
63
+ assert_equal 'U', response.avs_result['code']
64
+ end
65
+
66
+ def test_cvv_result
67
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
68
+
69
+ response = @gateway.purchase(@amount, @credit_card)
70
+ assert_equal 'M', response.cvv_result['code']
71
+ end
72
+
73
+
67
74
  private
68
75
  def successful_purchase_response
69
76
  <<-RESPONSE
70
- <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><q1:SendAndCommitResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response"><SendAndCommitResult href="#id1" /></q1:SendAndCommitResponse><types:TransactionResult id="id1" xsi:type="types:TransactionResult"><ExactID xsi:type="xsd:string">A00427-01</ExactID><Password xsi:type="xsd:string">#######</Password><Transaction_Type xsi:type="xsd:string">00</Transaction_Type><DollarAmount xsi:type="xsd:string">1</DollarAmount><SurchargeAmount xsi:type="xsd:string">0</SurchargeAmount><Card_Number xsi:type="xsd:string">4111111111111111</Card_Number><Verification_Str2 xsi:type="xsd:string">123</Verification_Str2><Transaction_Tag xsi:type="xsd:string">80928103</Transaction_Tag><Authorization_Num xsi:type="xsd:string">ET0426</Authorization_Num><Expiry_Date xsi:type="xsd:string">0909</Expiry_Date><CardHoldersName xsi:type="xsd:string">Active Merchant</CardHoldersName><CVD_Presence_Ind xsi:type="xsd:string">0</CVD_Presence_Ind><ZipCode xsi:type="xsd:string">55555</ZipCode><Secure_AuthRequired xsi:type="xsd:string">0</Secure_AuthRequired><Secure_AuthResult xsi:type="xsd:string">0</Secure_AuthResult><Ecommerce_Flag xsi:type="xsd:string">0</Ecommerce_Flag><CAVV_Algorithm xsi:type="xsd:string">0</CAVV_Algorithm><Language xsi:type="xsd:string">0</Language><LogonMessage xsi:type="xsd:string">Processed by:
71
- E-xact Transaction Gateway :- Version 8.4.0 B19
72
- Copyright 2006
73
- {34:2652}</LogonMessage><Error_Number xsi:type="xsd:string">0</Error_Number><Error_Description xsi:type="xsd:string" /><Transaction_Error xsi:type="xsd:boolean">false</Transaction_Error><Transaction_Approved xsi:type="xsd:boolean">true</Transaction_Approved><EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code><EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message><Bank_Resp_Code xsi:type="xsd:string">00</Bank_Resp_Code><Bank_Message xsi:type="xsd:string">VER UNAVAILABLE </Bank_Message><SequenceNo xsi:type="xsd:string">431</SequenceNo><AVS xsi:type="xsd:string">U</AVS><Retrieval_Ref_No xsi:type="xsd:string">200703280426</Retrieval_Ref_No><MerchantName xsi:type="xsd:string">E-xact ConnectionShop</MerchantName><MerchantAddress xsi:type="xsd:string">Suite 304 - 134 Abbott Street</MerchantAddress><MerchantCity xsi:type="xsd:string">Vancouver</MerchantCity><MerchantProvince xsi:type="xsd:string">BC</MerchantProvince><MerchantCountry xsi:type="xsd:string">Canada</MerchantCountry><MerchantPostal xsi:type="xsd:string">V6B 2K4</MerchantPostal><MerchantURL xsi:type="xsd:string">www.e-xact.com</MerchantURL><CTR xsi:type="xsd:string">========== TRANSACTION RECORD =========
74
-
75
- E-xact ConnectionShop
76
- Suite 304 - 134 Abbott Street
77
- Vancouver, BC V6B 2K4
78
- www.e-xact.com
79
-
80
- TYPE: Purchase
81
-
82
- ACCT: Visa $1.00 USD
83
-
84
- CARD NUMBER : ############1111
85
- TRANS. REF. :
86
- CARD HOLDER : Active Merchant
87
- EXPIRY DATE : xx/xx
88
- DATE/TIME : 28 Mar 07 12:04:26
89
- REFERENCE # : 5999 431 M
90
- AUTHOR.# : ET0426
91
-
92
- Approved - Thank You 00
93
-
94
- SIGNATURE
77
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><q1:SendAndCommitResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response"><SendAndCommitResult href="#id1" /></q1:SendAndCommitResponse><types:TransactionResult id="id1" xsi:type="types:TransactionResult"><ExactID xsi:type="xsd:string">A00427-01</ExactID><Password xsi:type="xsd:string">#######</Password><Transaction_Type xsi:type="xsd:string">00</Transaction_Type><DollarAmount xsi:type="xsd:string">1</DollarAmount><SurchargeAmount xsi:type="xsd:string">0</SurchargeAmount><Card_Number xsi:type="xsd:string">4242424242424242</Card_Number><Transaction_Tag xsi:type="xsd:string">106625152</Transaction_Tag><Authorization_Num xsi:type="xsd:string">ET1700</Authorization_Num><Expiry_Date xsi:type="xsd:string">0909</Expiry_Date><CardHoldersName xsi:type="xsd:string">Longbob Longsen</CardHoldersName><VerificationStr2 xsi:type="xsd:string">123</VerificationStr2><CVD_Presence_Ind xsi:type="xsd:string">1</CVD_Presence_Ind><Secure_AuthRequired xsi:type="xsd:string">0</Secure_AuthRequired><Secure_AuthResult xsi:type="xsd:string">0</Secure_AuthResult><Ecommerce_Flag xsi:type="xsd:string">0</Ecommerce_Flag><CAVV_Algorithm xsi:type="xsd:string">0</CAVV_Algorithm><Reference_No xsi:type="xsd:string">1</Reference_No><Reference_3 xsi:type="xsd:string">Store Purchase</Reference_3><Language xsi:type="xsd:string">0</Language><LogonMessage xsi:type="xsd:string">Processed by:
78
+ E-xact Transaction Gateway :- Version 8.4.0 B19b
79
+ Copyright 2006
80
+ {34:2652}</LogonMessage><Error_Number xsi:type="xsd:string">0</Error_Number><Error_Description xsi:type="xsd:string" /><Transaction_Error xsi:type="xsd:boolean">false</Transaction_Error><Transaction_Approved xsi:type="xsd:boolean">true</Transaction_Approved><EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code><EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message><Bank_Resp_Code xsi:type="xsd:string">00</Bank_Resp_Code><Bank_Message xsi:type="xsd:string">VER UNAVAILABLE </Bank_Message><SequenceNo xsi:type="xsd:string">377</SequenceNo><AVS xsi:type="xsd:string">U</AVS><CVV2 xsi:type="xsd:string">M</CVV2><Retrieval_Ref_No xsi:type="xsd:string">200801181700</Retrieval_Ref_No><MerchantName xsi:type="xsd:string">E-xact ConnectionShop</MerchantName><MerchantAddress xsi:type="xsd:string">Suite 400 - 1152 Mainland St.</MerchantAddress><MerchantCity xsi:type="xsd:string">Vancouver</MerchantCity><MerchantProvince xsi:type="xsd:string">BC</MerchantProvince><MerchantCountry xsi:type="xsd:string">Canada</MerchantCountry><MerchantPostal xsi:type="xsd:string">V6B 4X2</MerchantPostal><MerchantURL xsi:type="xsd:string">www.e-xact.com</MerchantURL><CTR xsi:type="xsd:string">========== TRANSACTION RECORD =========
81
+
82
+ E-xact ConnectionShop
83
+ Suite 400 - 1152 Mainland St.
84
+ Vancouver, BC V6B 4X2
85
+ www.e-xact.com
86
+
87
+ TYPE: Purchase
88
+
89
+ ACCT: Visa $1.00 USD
90
+
91
+ CARD NUMBER : ############4242
92
+ TRANS. REF. : 1
93
+ CARD HOLDER : Longbob Longsen
94
+ EXPIRY DATE : xx/xx
95
+ DATE/TIME : 18 Jan 08 14:17:00
96
+ REFERENCE # : 5999 377 M
97
+ AUTHOR.# : ET1700
98
+
99
+ Approved - Thank You 00
100
+
101
+ SIGNATURE
95
102
 
96
103
 
97
104
 
98
- _______________________________________
105
+ _______________________________________
99
106
 
100
107
  </CTR></types:TransactionResult></soap:Body></soap:Envelope>
101
108
  RESPONSE
102
109
  end
110
+
111
+ def failed_purchase_response
112
+ <<-RESPONSE
113
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/" xmlns:types="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><q1:SendAndCommitResponse xmlns:q1="http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Response"><SendAndCommitResult href="#id1" /></q1:SendAndCommitResponse><types:TransactionResult id="id1" xsi:type="types:TransactionResult"><ExactID xsi:type="xsd:string">A00427-01</ExactID><Password xsi:type="xsd:string">#######</Password><Transaction_Type xsi:type="xsd:string">00</Transaction_Type><DollarAmount xsi:type="xsd:string">5013</DollarAmount><SurchargeAmount xsi:type="xsd:string">0</SurchargeAmount><Card_Number xsi:type="xsd:string">4111111111111111</Card_Number><Transaction_Tag xsi:type="xsd:string">106624668</Transaction_Tag><Expiry_Date xsi:type="xsd:string">0909</Expiry_Date><CardHoldersName xsi:type="xsd:string">Longbob Longsen</CardHoldersName><VerificationStr2 xsi:type="xsd:string">123</VerificationStr2><CVD_Presence_Ind xsi:type="xsd:string">1</CVD_Presence_Ind><Secure_AuthRequired xsi:type="xsd:string">0</Secure_AuthRequired><Secure_AuthResult xsi:type="xsd:string">0</Secure_AuthResult><Ecommerce_Flag xsi:type="xsd:string">0</Ecommerce_Flag><CAVV_Algorithm xsi:type="xsd:string">0</CAVV_Algorithm><Reference_No xsi:type="xsd:string">1</Reference_No><Reference_3 xsi:type="xsd:string">Store Purchase</Reference_3><Language xsi:type="xsd:string">0</Language><LogonMessage xsi:type="xsd:string">Processed by:
114
+ E-xact Transaction Gateway :- Version 8.4.0 B19b
115
+ Copyright 2006
116
+ {34:2652}</LogonMessage><Error_Number xsi:type="xsd:string">0</Error_Number><Error_Description xsi:type="xsd:string" /><Transaction_Error xsi:type="xsd:boolean">false</Transaction_Error><Transaction_Approved xsi:type="xsd:boolean">false</Transaction_Approved><EXact_Resp_Code xsi:type="xsd:string">00</EXact_Resp_Code><EXact_Message xsi:type="xsd:string">Transaction Normal</EXact_Message><Bank_Resp_Code xsi:type="xsd:string">13</Bank_Resp_Code><Bank_Message xsi:type="xsd:string">AMOUNT ERR</Bank_Message><SequenceNo xsi:type="xsd:string">376</SequenceNo><AVS xsi:type="xsd:string">U</AVS><CVV2 xsi:type="xsd:string">M</CVV2><MerchantName xsi:type="xsd:string">E-xact ConnectionShop</MerchantName><MerchantAddress xsi:type="xsd:string">Suite 400 - 1152 Mainland St.</MerchantAddress><MerchantCity xsi:type="xsd:string">Vancouver</MerchantCity><MerchantProvince xsi:type="xsd:string">BC</MerchantProvince><MerchantCountry xsi:type="xsd:string">Canada</MerchantCountry><MerchantPostal xsi:type="xsd:string">V6B 4X2</MerchantPostal><MerchantURL xsi:type="xsd:string">www.e-xact.com</MerchantURL><CTR xsi:type="xsd:string">========== TRANSACTION RECORD =========
117
+
118
+ E-xact ConnectionShop
119
+ Suite 400 - 1152 Mainland St.
120
+ Vancouver, BC V6B 4X2
121
+ www.e-xact.com
122
+
123
+ TYPE: Purchase
124
+
125
+ ACCT: Visa $5,013.00 USD
126
+
127
+ CARD NUMBER : ############1111
128
+ TRANS. REF. : 1
129
+ CARD HOLDER : Longbob Longsen
130
+ EXPIRY DATE : xx/xx
131
+ DATE/TIME : 18 Jan 08 14:11:09
132
+ REFERENCE # : 5999 376 M
133
+ AUTHOR.# :
134
+
135
+ Transaction not Approved 13
136
+
137
+
138
+ </CTR></types:TransactionResult></soap:Body></soap:Envelope>
139
+ RESPONSE
140
+ end
103
141
 
104
142
  def soap_fault_response
105
143
  <<-RESPONSE
@@ -21,4 +21,11 @@ class Gateway < Test::Unit::TestCase
21
21
  assert_false Gateway.new.test?
22
22
  end
23
23
 
24
+ def test_amount_style
25
+ assert_equal '10.34', Gateway.new.send(:amount, 1034)
26
+
27
+ assert_raise(ArgumentError) do
28
+ Gateway.new.send(:amount, '10.34')
29
+ end
30
+ end
24
31
  end
@@ -1,21 +1,18 @@
1
1
  require File.dirname(__FILE__) + '/../../test_helper'
2
2
 
3
- class LinkpointResponseTest < Test::Unit::TestCase
3
+ class LinkpointTest < Test::Unit::TestCase
4
4
  def setup
5
- Base.gateway_mode = :test
5
+ Base.mode = :test
6
6
 
7
7
  @gateway = LinkpointGateway.new(
8
8
  :login => 123123,
9
9
  :pem => 'PEM'
10
10
  )
11
11
 
12
- @creditcard = credit_card('4111111111111111')
12
+ @credit_card = credit_card('4111111111111111')
13
+ @options = { :order_id => 1000, :billing_address => address }
13
14
  end
14
15
 
15
- def teardown
16
- Base.gateway_mode = :test
17
- end
18
-
19
16
  def test_credit_card_formatting
20
17
  assert_equal '04', @gateway.send(:format_creditcard_expiry_year, 2004)
21
18
  assert_equal '04', @gateway.send(:format_creditcard_expiry_year, '2004')
@@ -23,51 +20,36 @@ class LinkpointResponseTest < Test::Unit::TestCase
23
20
  assert_equal '04', @gateway.send(:format_creditcard_expiry_year, '04')
24
21
  end
25
22
 
26
- def test_authorize
27
- @creditcard.number = '1'
23
+ def test_successful_authorization
24
+ @gateway.expects(:ssl_post).returns(successful_authorization_response)
28
25
 
29
- assert response = @gateway.authorize(2400, @creditcard, :order_id => 1000,
30
- :address1 => '1313 lucky lane',
31
- :city => 'Lost Angeles',
32
- :state => 'CA',
33
- :zip => '90210'
34
- )
35
- assert_equal Response, response.class
36
- assert_equal true, response.success?
26
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
27
+ assert_instance_of Response, response
28
+ assert_success response
29
+ assert_equal '1000', response.authorization
37
30
  end
38
31
 
39
- def test_purchase_success
40
- @creditcard.number = '1'
32
+ def test_successful_purchase
33
+ @gateway.expects(:ssl_post).returns(successful_purchase_response)
41
34
 
42
- assert response = @gateway.purchase(2400, @creditcard, :order_id => 1001,
43
- :address1 => '1313 lucky lane',
44
- :city => 'Lost Angeles',
45
- :state => 'CA',
46
- :zip => '90210'
47
- )
48
- assert_equal Response, response.class
49
- assert_equal true, response.success?
35
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
36
+ assert_instance_of Response, response
37
+ assert_success response
38
+ assert_equal '1000', response.authorization
50
39
  end
51
40
 
52
- def test_purchase_decline
53
- @creditcard.number = '2'
41
+ def test_failed_purchase
42
+ @gateway.expects(:ssl_post).returns(failed_purchase_response)
54
43
 
55
- @gateway = LinkpointGateway.new(
56
- :login => 123123,
57
- :pem => 'PEM'
58
- )
59
-
60
- assert response = @gateway.purchase(100, @creditcard, :order_id => 1002)
61
- assert_equal Response, response.class
62
- assert_equal false, response.success?
44
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
45
+ assert_failure response
63
46
  end
64
47
 
65
48
  def test_recurring
66
- @creditcard.number = '1'
49
+ @gateway.expects(:ssl_post).returns(successful_recurring_response)
67
50
 
68
- assert response = @gateway.recurring(2400, @creditcard, :order_id => 1003, :installments => 12, :startdate => "immediate", :periodicity => :monthly)
69
- assert_equal Response, response.class
70
- assert_equal true, response.success?
51
+ assert response = @gateway.recurring(2400, @credit_card, :order_id => 1003, :installments => 12, :startdate => "immediate", :periodicity => :monthly)
52
+ assert_success response
71
53
  end
72
54
 
73
55
  def test_amount_style
@@ -77,19 +59,9 @@ class LinkpointResponseTest < Test::Unit::TestCase
77
59
  @gateway.send(:amount, '10.34')
78
60
  end
79
61
  end
80
- end
81
-
82
-
83
- class LinkpointRequestTest < Test::Unit::TestCase
84
- def setup
85
- @gateway = LinkpointGateway.new(:login => 123123, :pem => 'PEM')
86
-
87
- @creditcard = credit_card('4111111111111111')
88
- end
89
-
90
62
 
91
63
  def test_purchase_is_valid_xml
92
- parameters = @gateway.send(:parameters, 1000, @creditcard, :ordertype => "SALE", :order_id => 1004,
64
+ parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :order_id => 1004,
93
65
  :billing_address => {
94
66
  :address1 => '1313 lucky lane',
95
67
  :city => 'Lost Angeles',
@@ -98,13 +70,12 @@ class LinkpointRequestTest < Test::Unit::TestCase
98
70
  }
99
71
  )
100
72
 
101
- assert data = @gateway.send(:post_data, parameters)
73
+ assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
102
74
  assert REXML::Document.new(data)
103
75
  end
104
-
105
76
 
106
77
  def test_recurring_is_valid_xml
107
- parameters = @gateway.send(:parameters, 1000, @creditcard, :ordertype => "SALE", :action => "SUBMIT", :installments => 12, :startdate => "immediate", :periodicity => "monthly", :order_id => 1006,
78
+ parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :action => "SUBMIT", :installments => 12, :startdate => "immediate", :periodicity => "monthly", :order_id => 1006,
108
79
  :billing_address => {
109
80
  :address1 => '1313 lucky lane',
110
81
  :city => 'Lost Angeles',
@@ -112,14 +83,14 @@ class LinkpointRequestTest < Test::Unit::TestCase
112
83
  :zip => '90210'
113
84
  }
114
85
  )
115
- assert data = @gateway.send(:post_data, parameters)
86
+ assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
116
87
  assert REXML::Document.new(data)
117
88
  end
118
89
 
119
90
  def test_declined_purchase_is_valid_xml
120
91
  @gateway = LinkpointGateway.new(:login => 123123, :pem => 'PEM')
121
92
 
122
- parameters = @gateway.send(:parameters, 1000, @creditcard, :ordertype => "SALE", :order_id => 1005,
93
+ parameters = @gateway.send(:parameters, 1000, @credit_card, :ordertype => "SALE", :order_id => 1005,
123
94
  :billing_address => {
124
95
  :address1 => '1313 lucky lane',
125
96
  :city => 'Lost Angeles',
@@ -128,7 +99,7 @@ class LinkpointRequestTest < Test::Unit::TestCase
128
99
  }
129
100
  )
130
101
 
131
- assert data = @gateway.send(:post_data, parameters)
102
+ assert data = @gateway.send(:post_data, @amount, @credit_card, @options)
132
103
  assert REXML::Document.new(data)
133
104
  end
134
105
 
@@ -162,4 +133,35 @@ class LinkpointRequestTest < Test::Unit::TestCase
162
133
  def test_supported_card_types
163
134
  assert_equal [:visa, :master, :american_express, :discover], LinkpointGateway.supported_cardtypes
164
135
  end
136
+
137
+ def test_avs_result
138
+ @gateway.expects(:ssl_post).returns(successful_authorization_response)
139
+
140
+ response = @gateway.purchase(@amount, @credit_card, @options)
141
+ assert_equal 'N', response.avs_result['code']
142
+ end
143
+
144
+ def test_cvv_result
145
+ @gateway.expects(:ssl_post).returns(successful_authorization_response)
146
+
147
+ response = @gateway.purchase(@amount, @credit_card, @options)
148
+ assert_equal 'M', response.cvv_result['code']
149
+ end
150
+
151
+ private
152
+ def successful_authorization_response
153
+ '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:41:31 2008</r_time><r_ref>0004486182</r_ref><r_error/><r_ordernum>1000</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486182:NNNM:100018312899:</r_code><r_tdate>1199680890</r_tdate><r_score/><r_authresponse/><r_approved>APPROVED</r_approved><r_avs>NNNM</r_avs>'
154
+ end
155
+
156
+ def successful_purchase_response
157
+ '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:45:22 2008</r_time><r_ref>0004486195</r_ref><r_error></r_error><r_ordernum>1000</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486195:NNNM:100018312912:</r_code><r_tdate>1199681121</r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>APPROVED</r_approved><r_avs>NNNM</r_avs>'
158
+ end
159
+
160
+ def failed_purchase_response
161
+ '<r_csp></r_csp><r_time>Sun Jan 6 21:50:51 2008</r_time><r_ref></r_ref><r_error>SGS-002300: Invalid credit card type.</r_error><r_ordernum>2aec6babe076111deb2c94c21181d9fe</r_ordernum><r_message></r_message><r_code></r_code><r_tdate></r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>DECLINED</r_approved><r_avs></r_avs>'
162
+ end
163
+
164
+ def successful_recurring_response
165
+ '<r_csp>CSI</r_csp><r_time>Sun Jan 6 21:49:00 2008</r_time><r_ref>0004486198</r_ref><r_error></r_error><r_ordernum>2206b7c9a31de5fb077913134011059d</r_ordernum><r_message>APPROVED</r_message><r_code>1234560004486198:NNNM:100018312915:</r_code><r_tdate>1199681339</r_tdate><r_score></r_score><r_authresponse></r_authresponse><r_approved>APPROVED</r_approved><r_avs>NNN</r_avs>'
166
+ end
165
167
  end