activemerchant 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
metadata.gz.sig CHANGED
Binary file
@@ -1,35 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDgzCCAuygAwIBAgIQJUuKhThCzONY+MXdriJupDANBgkqhkiG9w0BAQUFADBf
3
- MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT
4
- LkNsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw
5
- HhcNOTcwNDE3MDAwMDAwWhcNMTExMDI0MjM1OTU5WjCBujEfMB0GA1UEChMWVmVy
6
- aVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24sIEluYy4xMzAx
7
- BgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2VydmVyIENBIC0gQ2xhc3Mg
8
- MzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNvbS9DUFMgSW5jb3JwLmJ5IFJlZi4g
9
- TElBQklMSVRZIExURC4oYyk5NyBWZXJpU2lnbjCBnzANBgkqhkiG9w0BAQEFAAOB
10
- jQAwgYkCgYEA2IKA6NYZAn0fhRg5JaJlK+G/1AXTvOY2O6rwTGxbtueqPHNFVbLx
11
- veqXQu2aNAoV1Klc9UAl3dkHwTKydWzEyruj/lYncUOqY/UwPpMo5frxCTvzt01O
12
- OfdcSVq4wR3Tsor+cDCVQsv+K1GLWjw6+SJPkLICp1OcTzTnqwSye28CAwEAAaOB
13
- 4zCB4DAPBgNVHRMECDAGAQH/AgEAMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHAQEw
14
- KjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQUzA0BgNV
15
- HSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIGCWCGSAGG+EIEAQYKYIZIAYb4RQEI
16
- ATALBgNVHQ8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgEGMDEGA1UdHwQqMCgwJqAk
17
- oCKGIGh0dHA6Ly9jcmwudmVyaXNpZ24uY29tL3BjYTMuY3JsMA0GCSqGSIb3DQEB
18
- BQUAA4GBAAgB7ORolANC8XPxI6I63unx2sZUxCM+hurPajozq+qcBBQHNgYL+Yhv
19
- 1RPuKSvD5HKNRO3RrCAJLeH24RkFOLA9D59/+J4C3IYChmFOJl9en5IeDCSk9dBw
20
- E88mw0M9SR2egi5SX7w+xmYpAY5Okiy8RnUDgqxz6dl+C2fvVFIa
21
- -----END CERTIFICATE-----
22
- -----BEGIN CERTIFICATE-----
23
- MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG
24
- A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
25
- cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
26
- MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
27
- BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
28
- YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
29
- ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
30
- BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
31
- I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
32
- CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do
33
- lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc
34
- AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k
35
- -----END CERTIFICATE-----
@@ -1,45 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Generator
3
- class Base
4
- attr_reader :class_name, :name
5
-
6
- def initialize(name, class_name)
7
- @name = name
8
- @class_name = class_name
9
- end
10
-
11
- def root
12
- File.dirname(__FILE__) + '/../..'
13
- end
14
-
15
- def run
16
- # Create the required directories
17
- manifest.directories.each do |d|
18
- if File.exists?("#{root}/#{d}")
19
- puts "Ignoring existing directory #{d}"
20
- else
21
- puts "Creating directory #{d}"
22
- Dir.mkdir("#{root}/#{d}")
23
- end
24
- end
25
-
26
- manifest.templates.each do |t|
27
- template = ERB.new(File.read(File.dirname(__FILE__) + "/generators/#{name}/templates/#{t[:input]}"), nil, '-')
28
- File.open("#{root}/#{t[:output]}", 'w') do |f|
29
- puts "Writing file #{t[:output]}"
30
- f.puts template.result(binding)
31
- end
32
- end
33
- end
34
-
35
- def file_name
36
- @class_name.underscore
37
- end
38
-
39
- protected
40
- def record
41
- Manifest.new{ |m| yield m }
42
- end
43
- end
44
- end
45
- end
@@ -1,24 +0,0 @@
1
- require 'script/generator/manifest'
2
- require 'script/generator/base'
3
-
4
- module ActiveMerchant #:nodoc:
5
- module Generator
6
- class Generator
7
- def self.run(args = [])
8
- unless args.size == 2
9
- puts <<-BANNER
10
- Usage: script/generate <generator> <ClassName>
11
- Where <generator> is one of:
12
- gateway - Generate a new payment gateway
13
- integration - Generate a new payment integration
14
- BANNER
15
- exit
16
- end
17
-
18
- generator, class_name = ARGV
19
- require "script/generator/generators/#{generator}/#{generator}_generator"
20
- "#{generator.classify}Generator".constantize.new(generator, class_name).run
21
- end
22
- end
23
- end
24
- end
@@ -1,14 +0,0 @@
1
- class GatewayGenerator < ActiveMerchant::Generator::Base
2
- def manifest
3
- record do |m|
4
- m.template 'gateway.rb',
5
- "lib/active_merchant/billing/gateways/#{file_name}.rb"
6
-
7
- m.template 'gateway_test.rb',
8
- "test/unit/gateways/#{file_name}_test.rb"
9
-
10
- m.template 'remote_gateway_test.rb',
11
- "test/remote_tests/remote_#{file_name}_test.rb"
12
- end
13
- end
14
- end
@@ -1,73 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- class <%= class_name %>Gateway < Gateway
4
- TEST_URL = 'https://example.com/test'
5
- LIVE_URL = 'https://example.com/live'
6
-
7
- attr_reader :url
8
- attr_reader :response
9
- attr_reader :options
10
-
11
- def initialize(options = {})
12
- #requires!(options, :login, :password)
13
- @options = options
14
- super
15
- end
16
-
17
- def authorize(money, creditcard, options = {})
18
- post = {}
19
- add_invoice(post, options)
20
- add_creditcard(post, creditcard)
21
- add_address(post, creditcard, options)
22
- add_customer_data(post, options)
23
-
24
- commit('authonly', money, post)
25
- end
26
-
27
- def purchase(money, creditcard, options = {})
28
- post = {}
29
- add_invoice(post, options)
30
- add_creditcard(post, creditcard)
31
- add_address(post, creditcard, options)
32
- add_customer_data(post, options)
33
-
34
- commit('sale', money, post)
35
- end
36
-
37
- def capture(money, authorization, options = {})
38
- commit('capture', money, post)
39
- end
40
-
41
- def self.supported_cardtypes
42
- [:visa, :master, :american_express]
43
- end
44
-
45
- private
46
-
47
- def add_customer_data(post, options)
48
- end
49
-
50
- def add_address(post, creditcard, options)
51
- end
52
-
53
- def add_invoice(post, options)
54
- end
55
-
56
- def add_creditcard(post, creditcard)
57
- end
58
-
59
- def parse(body)
60
- end
61
-
62
- def commit(action, money, parameters)
63
- end
64
-
65
- def message_from(response)
66
- end
67
-
68
- def post_data(action, parameters = {})
69
- end
70
- end
71
- end
72
- end
73
-
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
2
-
3
- class <%= class_name %>Test < Test::Unit::TestCase
4
- AMOUNT = 100
5
-
6
- def setup
7
- @gateway = <%= class_name %>Gateway.new(fixtures(:<%= class_name.underscore %>))
8
-
9
- @creditcard = credit_card('4242424242424242')
10
-
11
- @address = { :address1 => '1234 My Street',
12
- :address2 => 'Apt 1',
13
- :company => 'Widgets Inc',
14
- :city => 'Ottawa',
15
- :state => 'ON',
16
- :zip => 'K1C2N6',
17
- :country => 'Canada',
18
- :phone => '(555)555-5555'
19
- }
20
- end
21
-
22
- def test_successful_request
23
- @creditcard.number = 1
24
- assert response = @gateway.purchase(AMOUNT, @creditcard, {})
25
- assert_success response
26
- assert_equal '5555', response.authorization
27
- assert response.test?
28
- end
29
-
30
- def test_unsuccessful_request
31
- @creditcard.number = 2
32
- assert response = @gateway.purchase(AMOUNT, @creditcard, {})
33
- assert_failure response
34
- assert response.test?
35
- end
36
-
37
- def test_request_error
38
- @creditcard.number = 3
39
- assert_raise(Error){ @gateway.purchase(AMOUNT, @creditcard, {}) }
40
- end
41
- end
@@ -1,56 +0,0 @@
1
- require File.dirname(__FILE__) + '/../test_helper'
2
-
3
- class Remote<%= class_name %>Test < Test::Unit::TestCase
4
- AMOUNT = 100
5
-
6
- def setup
7
- @gateway = <%= class_name %>Gateway.new(fixtures(:<%= class_name.underscore %>))
8
-
9
- @creditcard = credit_card('4000100011112224')
10
-
11
- @declined_card = credit_card('4000300011112220')
12
-
13
- @options = { :address => { :address1 => '1234 Shady Brook Lane',
14
- :zip => '90210'
15
- }
16
- }
17
- end
18
-
19
- def test_successful_purchase
20
- assert response = @gateway.purchase(AMOUNT, @creditcard, @options)
21
- assert_equal 'REPLACE WITH SUCCESS MESSAGE', response.message
22
- assert_success response
23
- end
24
-
25
- def test_unsuccessful_purchase
26
- assert response = @gateway.purchase(AMOUNT, @declined_card, @options)
27
- assert_equal 'REPLACE WITH FAILED PURCHASE MESSAGE', response.message
28
- assert_failure response
29
- end
30
-
31
- def test_authorize_and_capture
32
- amount = AMOUNT
33
- assert auth = @gateway.authorize(amount, @creditcard, @options)
34
- assert_success auth
35
- assert_equal 'Success', auth.message
36
- assert auth.authorization
37
- assert capture = @gateway.capture(amount, auth.authorization)
38
- assert_success capture
39
- end
40
-
41
- def test_failed_capture
42
- assert response = @gateway.capture(AMOUNT, '')
43
- assert_failure response
44
- assert_equal 'REPLACE WITH GATEWAY FAILURE MESSAGE', response.message
45
- end
46
-
47
- def test_invalid_login
48
- gateway = <%= class_name %>Gateway.new({
49
- :login => '',
50
- :password => ''
51
- })
52
- assert response = gateway.purchase(AMOUNT, @creditcard, @options)
53
- assert_equal 'REPLACE WITH FAILURE MESSAGE', response.message
54
- assert_failure response
55
- end
56
- end
@@ -1,25 +0,0 @@
1
- class IntegrationGenerator < ActiveMerchant::Generator::Base
2
- def manifest
3
- @manifest ||= record do |m|
4
- m.directory "lib/active_merchant/billing/integrations/#{file_name}"
5
-
6
- m.template 'integration.rb',
7
- "lib/active_merchant/billing/integrations/#{file_name}.rb"
8
-
9
- m.template 'helper.rb',
10
- "lib/active_merchant/billing/integrations/#{file_name}/helper.rb"
11
-
12
- m.template 'notification.rb',
13
- "lib/active_merchant/billing/integrations/#{file_name}/notification.rb"
14
-
15
- m.template 'module_test.rb',
16
- "test/unit/integrations/#{file_name}_module_test.rb"
17
-
18
- m.template 'helper_test.rb',
19
- "test/unit/integrations/helpers/#{file_name}_helper_test.rb"
20
-
21
- m.template 'notification_test.rb',
22
- "test/unit/integrations/notifications/#{file_name}_notification_test.rb"
23
- end
24
- end
25
- end
@@ -1,34 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- module Integrations #:nodoc:
4
- module <%= class_name %>
5
- class Helper < ActiveMerchant::Billing::Integrations::Helper
6
- # Replace with the real mapping
7
- mapping :account, ''
8
- mapping :amount, ''
9
-
10
- mapping :order, ''
11
-
12
- mapping :customer, :first_name => '',
13
- :last_name => '',
14
- :email => '',
15
- :phone => ''
16
-
17
- mapping :billing_address, :city => '',
18
- :address1 => '',
19
- :address2 => '',
20
- :state => '',
21
- :zip => '',
22
- :country => ''
23
-
24
- mapping :notify_url, ''
25
- mapping :return_url, ''
26
- mapping :cancel_return_url, ''
27
- mapping :description, ''
28
- mapping :tax, ''
29
- mapping :shipping, ''
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,54 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../test_helper'
2
-
3
- class <%= class_name %>HelperTest < Test::Unit::TestCase
4
- include ActiveMerchant::Billing::Integrations
5
-
6
- def setup
7
- @helper = <%= class_name %>::Helper.new('order-500','cody@example.com', :amount => 500, :currency => 'USD')
8
- end
9
-
10
- def test_basic_helper_fields
11
- assert_field '', 'cody@example.com'
12
-
13
- assert_field '', '5.00'
14
- assert_field '', 'order-500'
15
- end
16
-
17
- def test_customer_fields
18
- @helper.customer :first_name => 'Cody', :last_name => 'Fauser', :email => 'cody@example.com'
19
- assert_field '', 'Cody'
20
- assert_field '', 'Fauser'
21
- assert_field '', 'cody@example.com'
22
- end
23
-
24
- def test_address_mapping
25
- @helper.billing_address :address1 => '1 My Street',
26
- :address2 => '',
27
- :city => 'Leeds',
28
- :state => 'Yorkshire',
29
- :zip => 'LS2 7EE',
30
- :country => 'CA'
31
-
32
- assert_field '', '1 My Street'
33
- assert_field '', 'Leeds'
34
- assert_field '', 'Yorkshire'
35
- assert_field '', 'LS2 7EE'
36
- end
37
-
38
- def test_unknown_address_mapping
39
- @helper.billing_address :farm => 'CA'
40
- assert_equal 3, @helper.fields.size
41
- end
42
-
43
- def test_unknown_mapping
44
- assert_nothing_raised do
45
- @helper.company_address :address => '500 Dwemthy Fox Road'
46
- end
47
- end
48
-
49
- def test_setting_invalid_address_field
50
- fields = @helper.fields.dup
51
- @helper.billing_address :street => 'My Street'
52
- assert_equal fields, @helper.fields
53
- end
54
- end
@@ -1,18 +0,0 @@
1
- require File.dirname(__FILE__) + '/<%= file_name %>/helper.rb'
2
- require File.dirname(__FILE__) + '/<%= file_name %>/notification.rb'
3
-
4
- module ActiveMerchant #:nodoc:
5
- module Billing #:nodoc:
6
- module Integrations #:nodoc:
7
- module <%= class_name %>
8
-
9
- mattr_accessor :service_url
10
- self.service_url = 'https://www.example.com'
11
-
12
- def self.notification(post)
13
- Notification.new(post)
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,9 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../test_helper'
2
-
3
- class <%= class_name %>ModuleTest < Test::Unit::TestCase
4
- include ActiveMerchant::Billing::Integrations
5
-
6
- def test_notification_method
7
- assert_instance_of <%= class_name %>::Notification, <%= class_name %>.notification('name=cody')
8
- end
9
- end