tomriley-active_merchant 1.4.2.3 → 1.4.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/CHANGELOG +14 -0
  2. data/CONTRIBUTERS +12 -0
  3. data/active_merchant.gemspec +3 -2
  4. data/init.rb +0 -1
  5. data/lib/active_merchant/billing/credit_card_methods.rb +1 -1
  6. data/lib/active_merchant/billing/expiry_date.rb +10 -4
  7. data/lib/active_merchant/billing/gateway.rb +4 -0
  8. data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -1
  9. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -1
  10. data/lib/active_merchant/billing/gateways/bogus.rb +19 -0
  11. data/lib/active_merchant/billing/gateways/eway.rb +6 -1
  12. data/lib/active_merchant/billing/gateways/first_pay.rb +172 -0
  13. data/lib/active_merchant/billing/gateways/merchant_ware.rb +283 -0
  14. data/lib/active_merchant/billing/gateways/ogone.rb +259 -0
  15. data/lib/active_merchant/billing/gateways/paypal.rb +22 -9
  16. data/lib/active_merchant/billing/gateways/{protx.rb → sage_pay.rb} +45 -12
  17. data/lib/active_merchant/billing/integrations/nochex/notification.rb +1 -1
  18. data/lib/active_merchant/billing/response.rb +9 -1
  19. data/test/fixtures.yml +16 -1
  20. data/test/remote/gateways/remote_first_pay_test.rb +87 -0
  21. data/test/remote/gateways/remote_merchant_ware_test.rb +113 -0
  22. data/test/remote/gateways/remote_ogone_test.rb +108 -0
  23. data/test/remote/gateways/remote_paypal_test.rb +12 -1
  24. data/test/remote/gateways/remote_protx_three_d_secure_test.rb +259 -0
  25. data/test/remote/gateways/{remote_protx_test.rb → remote_sage_pay_test.rb} +8 -8
  26. data/test/unit/credit_card_methods_test.rb +9 -0
  27. data/test/unit/expiry_date_test.rb +12 -1
  28. data/test/unit/gateways/bogus_test.rb +31 -0
  29. data/test/unit/gateways/first_pay_test.rb +125 -0
  30. data/test/unit/gateways/gateway_test.rb +6 -0
  31. data/test/unit/gateways/merchant_ware_test.rb +188 -0
  32. data/test/unit/gateways/ogone_test.rb +256 -0
  33. data/test/unit/gateways/paypal_test.rb +49 -0
  34. data/test/unit/gateways/sage_pay_test.rb +183 -0
  35. data/test/unit/integrations/notifications/nochex_notification_test.rb +1 -1
  36. data/test/unit/response_test.rb +16 -0
  37. metadata +16 -5
  38. data/test/unit/gateways/protx_test.rb +0 -139
data/CHANGELOG CHANGED
@@ -1,5 +1,19 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
+ * Fix typo preventing OgoneGateway from working in production [Nicolas Jacobeus]
4
+ * Fix recurring transactions in Ogone gateway [cody]
5
+ * Fix money formatting for Ogone gateway [cody]
6
+ * Tweak Ogone gateway to use ActiveMerchant conventions for reference transactions [cody, jstorimer]
7
+ * Add support for the Ogone DirectLink payment gateway [Nicolas Jacobeus]
8
+ * Add support for the Antigua based FirstPay payment gateway [Phil R]
9
+ * Add support for PayPal reference transactions [kevin, John, Rahsun McAfee]
10
+ * Add support for the MerchantWARE payment gateway [cody]
11
+ * Rename Protx to SagePay [jstorimer]
12
+ * Allow test mode for eWay gateway [Duff OMelia]
13
+ * Don't use Time.parse for the ExpiryDate [cody]
14
+ * Add support for CVV code to Authorize.net CIM [Guy Naor]
15
+ * Add shipping address to Authorize.net [Eric Tarn]
16
+ * Don't setup the logger by default [cody]
3
17
  * Refactor ActiveMerchant::Connection out of the PostsData module. Add support for logging and wiredumping requests [cody]
4
18
  * Assume a valid load path when running tests [cody]
5
19
  * Use SHIPTOSTREET2 element instead of STREET2 element for Payflow Express Uk address [cody]
data/CONTRIBUTERS CHANGED
@@ -100,3 +100,15 @@ Merchant E-Solutions Gateway (May 3, 2009)
100
100
  Instapay Gateway (May 3, 2009)
101
101
 
102
102
  * Thomas Rideout
103
+
104
+ MerchantWARE (July 7, 2009)
105
+
106
+ * Cody Fauser
107
+
108
+ FirstPay (July 24, 2009)
109
+
110
+ * Phil R
111
+
112
+ Ogone (July 20, 2009)
113
+
114
+ * Nicolas Jacobeus
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "active_merchant"
3
- s.version = "1.4.2.3"
3
+ s.version = "1.4.2.4"
4
4
  s.date = "2009-01-12"
5
5
  s.summary = "Active Merchant is a simple payment abstraction library used in and sponsored by Shopify."
6
6
  s.homepage = "http://www.activemerchant.org/"
@@ -11,5 +11,6 @@ Gem::Specification.new do |s|
11
11
  ]
12
12
  s.has_rdoc = true
13
13
  # s.files = Dir['[a-zA-Z]*'] + Dir['generators/**/*'] + Dir['lib/**/*'] + Dir['rails/*'] + Dir['script/*'] + Dir['test/**/*']
14
- s.files = ["lib/active_merchant", "lib/active_merchant/billing", "lib/active_merchant/billing/avs_result.rb", "lib/active_merchant/billing/base.rb", "lib/active_merchant/billing/check.rb", "lib/active_merchant/billing/credit_card.rb", "lib/active_merchant/billing/credit_card_formatting.rb", "lib/active_merchant/billing/credit_card_methods.rb", "lib/active_merchant/billing/cvv_result.rb", "lib/active_merchant/billing/expiry_date.rb", "lib/active_merchant/billing/gateway.rb", "lib/active_merchant/billing/gateways", "lib/active_merchant/billing/gateways/authorize_net.rb", "lib/active_merchant/billing/gateways/authorize_net_cim.rb", "lib/active_merchant/billing/gateways/beanstream", "lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb", "lib/active_merchant/billing/gateways/beanstream.rb", "lib/active_merchant/billing/gateways/beanstream_interac.rb", "lib/active_merchant/billing/gateways/bogus.rb", "lib/active_merchant/billing/gateways/braintree.rb", "lib/active_merchant/billing/gateways/card_stream.rb", "lib/active_merchant/billing/gateways/cyber_source.rb", "lib/active_merchant/billing/gateways/data_cash.rb", "lib/active_merchant/billing/gateways/efsnet.rb", "lib/active_merchant/billing/gateways/eway.rb", "lib/active_merchant/billing/gateways/exact.rb", "lib/active_merchant/billing/gateways/instapay.rb", "lib/active_merchant/billing/gateways/linkpoint.rb", "lib/active_merchant/billing/gateways/merchant_e_solutions.rb", "lib/active_merchant/billing/gateways/modern_payments.rb", "lib/active_merchant/billing/gateways/modern_payments_cim.rb", "lib/active_merchant/billing/gateways/moneris.rb", "lib/active_merchant/billing/gateways/net_registry.rb", "lib/active_merchant/billing/gateways/netbilling.rb", "lib/active_merchant/billing/gateways/pay_junction.rb", "lib/active_merchant/billing/gateways/pay_secure.rb", "lib/active_merchant/billing/gateways/payflow", "lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb", "lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb", "lib/active_merchant/billing/gateways/payflow/payflow_response.rb", "lib/active_merchant/billing/gateways/payflow.rb", "lib/active_merchant/billing/gateways/payflow_express.rb", "lib/active_merchant/billing/gateways/payflow_express_uk.rb", "lib/active_merchant/billing/gateways/payflow_uk.rb", "lib/active_merchant/billing/gateways/payment_express.rb", "lib/active_merchant/billing/gateways/paypal", "lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb", "lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb", "lib/active_merchant/billing/gateways/paypal.rb", "lib/active_merchant/billing/gateways/paypal_ca.rb", "lib/active_merchant/billing/gateways/paypal_express.rb", "lib/active_merchant/billing/gateways/paypal_express_common.rb", "lib/active_merchant/billing/gateways/plugnpay.rb", "lib/active_merchant/billing/gateways/protx.rb", "lib/active_merchant/billing/gateways/psigate.rb", "lib/active_merchant/billing/gateways/psl_card.rb", "lib/active_merchant/billing/gateways/quickpay.rb", "lib/active_merchant/billing/gateways/realex.rb", "lib/active_merchant/billing/gateways/sage", "lib/active_merchant/billing/gateways/sage/sage_bankcard.rb", "lib/active_merchant/billing/gateways/sage/sage_core.rb", "lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb", "lib/active_merchant/billing/gateways/sage.rb", "lib/active_merchant/billing/gateways/secure_pay.rb", "lib/active_merchant/billing/gateways/secure_pay_au.rb", "lib/active_merchant/billing/gateways/secure_pay_tech.rb", "lib/active_merchant/billing/gateways/skip_jack.rb", "lib/active_merchant/billing/gateways/smart_ps.rb", "lib/active_merchant/billing/gateways/trans_first.rb", "lib/active_merchant/billing/gateways/transax.rb", "lib/active_merchant/billing/gateways/trust_commerce.rb", "lib/active_merchant/billing/gateways/usa_epay.rb", "lib/active_merchant/billing/gateways/verifi.rb", "lib/active_merchant/billing/gateways/viaklix.rb", "lib/active_merchant/billing/gateways/wirecard.rb", "lib/active_merchant/billing/gateways.rb", "lib/active_merchant/billing/integrations", "lib/active_merchant/billing/integrations/action_view_helper.rb", "lib/active_merchant/billing/integrations/bogus", "lib/active_merchant/billing/integrations/bogus/helper.rb", "lib/active_merchant/billing/integrations/bogus/notification.rb", "lib/active_merchant/billing/integrations/bogus/return.rb", "lib/active_merchant/billing/integrations/bogus.rb", "lib/active_merchant/billing/integrations/chronopay", "lib/active_merchant/billing/integrations/chronopay/helper.rb", "lib/active_merchant/billing/integrations/chronopay/notification.rb", "lib/active_merchant/billing/integrations/chronopay/return.rb", "lib/active_merchant/billing/integrations/chronopay.rb", "lib/active_merchant/billing/integrations/gestpay", "lib/active_merchant/billing/integrations/gestpay/common.rb", "lib/active_merchant/billing/integrations/gestpay/helper.rb", "lib/active_merchant/billing/integrations/gestpay/notification.rb", "lib/active_merchant/billing/integrations/gestpay/return.rb", "lib/active_merchant/billing/integrations/gestpay.rb", "lib/active_merchant/billing/integrations/helper.rb", "lib/active_merchant/billing/integrations/hi_trust", "lib/active_merchant/billing/integrations/hi_trust/helper.rb", "lib/active_merchant/billing/integrations/hi_trust/notification.rb", "lib/active_merchant/billing/integrations/hi_trust/return.rb", "lib/active_merchant/billing/integrations/hi_trust.rb", "lib/active_merchant/billing/integrations/nochex", "lib/active_merchant/billing/integrations/nochex/helper.rb", "lib/active_merchant/billing/integrations/nochex/notification.rb", "lib/active_merchant/billing/integrations/nochex/return.rb", "lib/active_merchant/billing/integrations/nochex.rb", "lib/active_merchant/billing/integrations/notification.rb", "lib/active_merchant/billing/integrations/paypal", "lib/active_merchant/billing/integrations/paypal/helper.rb", "lib/active_merchant/billing/integrations/paypal/notification.rb", "lib/active_merchant/billing/integrations/paypal/return.rb", "lib/active_merchant/billing/integrations/paypal.rb", "lib/active_merchant/billing/integrations/quickpay", "lib/active_merchant/billing/integrations/quickpay/helper.rb", "lib/active_merchant/billing/integrations/quickpay/notification.rb", "lib/active_merchant/billing/integrations/quickpay.rb", "lib/active_merchant/billing/integrations/return.rb", "lib/active_merchant/billing/integrations/two_checkout", "lib/active_merchant/billing/integrations/two_checkout/helper.rb", "lib/active_merchant/billing/integrations/two_checkout/notification.rb", "lib/active_merchant/billing/integrations/two_checkout/return.rb", "lib/active_merchant/billing/integrations/two_checkout.rb", "lib/active_merchant/billing/integrations.rb", "lib/active_merchant/billing/response.rb", "lib/active_merchant/lib", "lib/active_merchant/lib/connection.rb", "lib/active_merchant/lib/country.rb", "lib/active_merchant/lib/error.rb", "lib/active_merchant/lib/post_data.rb", "lib/active_merchant/lib/posts_data.rb", "lib/active_merchant/lib/requires_parameters.rb", "lib/active_merchant/lib/utils.rb", "lib/active_merchant/lib/validateable.rb", "lib/active_merchant.rb", "lib/certs", "lib/certs/cacert.pem", "lib/support", "lib/support/gateway_support.rb", "test/fixtures.yml", "test/remote", "test/remote/gateways", "test/remote/gateways/remote_authorize_net_cim_test.rb", "test/remote/gateways/remote_authorize_net_test.rb", "test/remote/gateways/remote_beanstream_interac_test.rb", "test/remote/gateways/remote_beanstream_test.rb", "test/remote/gateways/remote_braintree_test.rb", "test/remote/gateways/remote_card_stream_test.rb", "test/remote/gateways/remote_cyber_source_test.rb", "test/remote/gateways/remote_data_cash_test.rb", "test/remote/gateways/remote_efsnet_test.rb", "test/remote/gateways/remote_eway_test.rb", "test/remote/gateways/remote_exact_test.rb", "test/remote/gateways/remote_instapay_test.rb", "test/remote/gateways/remote_linkpoint_test.rb", "test/remote/gateways/remote_merchant_e_solutions_test.rb", "test/remote/gateways/remote_modern_payments_cim_test.rb", "test/remote/gateways/remote_modern_payments_test.rb", "test/remote/gateways/remote_moneris_test.rb", "test/remote/gateways/remote_net_registry_test.rb", "test/remote/gateways/remote_netbilling_test.rb", "test/remote/gateways/remote_pay_junction_test.rb", "test/remote/gateways/remote_pay_secure_test.rb", "test/remote/gateways/remote_payflow_express_test.rb", "test/remote/gateways/remote_payflow_test.rb", "test/remote/gateways/remote_payflow_uk_test.rb", "test/remote/gateways/remote_payment_express_test.rb", "test/remote/gateways/remote_paypal_express_test.rb", "test/remote/gateways/remote_paypal_test.rb", "test/remote/gateways/remote_plugnpay_test.rb", "test/remote/gateways/remote_protx_test.rb", "test/remote/gateways/remote_psigate_test.rb", "test/remote/gateways/remote_psl_card_test.rb", "test/remote/gateways/remote_quickpay_test.rb", "test/remote/gateways/remote_realex_test.rb", "test/remote/gateways/remote_sage_bankcard_test.rb", "test/remote/gateways/remote_sage_test.rb", "test/remote/gateways/remote_sage_virtual_check_test.rb", "test/remote/gateways/remote_secure_pay_au_test.rb", "test/remote/gateways/remote_secure_pay_tech_test.rb", "test/remote/gateways/remote_secure_pay_test.rb", "test/remote/gateways/remote_skipjack_test.rb", "test/remote/gateways/remote_trans_first_test.rb", "test/remote/gateways/remote_transax_test.rb", "test/remote/gateways/remote_trust_commerce_test.rb", "test/remote/gateways/remote_usa_epay_test.rb", "test/remote/gateways/remote_verifi_test.rb", "test/remote/gateways/remote_viaklix_test.rb", "test/remote/gateways/remote_wirecard_test.rb", "test/remote/integrations", "test/remote/integrations/remote_gestpay_integration_test.rb", "test/remote/integrations/remote_paypal_integration_test.rb", "test/test_helper.rb", "test/unit", "test/unit/avs_result_test.rb", "test/unit/base_test.rb", "test/unit/check_test.rb", "test/unit/connection_test.rb", "test/unit/country_code_test.rb", "test/unit/country_test.rb", "test/unit/credit_card_formatting_test.rb", "test/unit/credit_card_methods_test.rb", "test/unit/credit_card_test.rb", "test/unit/cvv_result_test.rb", "test/unit/expiry_date_test.rb", "test/unit/gateways", "test/unit/gateways/authorize_net_cim_test.rb", "test/unit/gateways/authorize_net_test.rb", "test/unit/gateways/beanstream_interac_test.rb", "test/unit/gateways/beanstream_test.rb", "test/unit/gateways/bogus_test.rb", "test/unit/gateways/braintree_test.rb", "test/unit/gateways/card_stream_test.rb", "test/unit/gateways/cyber_source_test.rb", "test/unit/gateways/data_cash_test.rb", "test/unit/gateways/efsnet_test.rb", "test/unit/gateways/eway_test.rb", "test/unit/gateways/exact_test.rb", "test/unit/gateways/gateway_test.rb", "test/unit/gateways/instapay_test.rb", "test/unit/gateways/linkpoint_test.rb", "test/unit/gateways/merchant_e_solutions_test.rb", "test/unit/gateways/modern_payments_cim_test.rb", "test/unit/gateways/moneris_test.rb", "test/unit/gateways/net_registry_test.rb", "test/unit/gateways/netbilling_test.rb", "test/unit/gateways/pay_junction_test.rb", "test/unit/gateways/pay_secure_test.rb", "test/unit/gateways/payflow_express_test.rb", "test/unit/gateways/payflow_express_uk_test.rb", "test/unit/gateways/payflow_test.rb", "test/unit/gateways/payflow_uk_test.rb", "test/unit/gateways/payment_express_test.rb", "test/unit/gateways/paypal_express_test.rb", "test/unit/gateways/paypal_test.rb", "test/unit/gateways/plugnpay_test.rb", "test/unit/gateways/protx_test.rb", "test/unit/gateways/psigate_test.rb", "test/unit/gateways/psl_card_test.rb", "test/unit/gateways/quickpay_test.rb", "test/unit/gateways/realex_test.rb", "test/unit/gateways/sage_bankcard_test.rb", "test/unit/gateways/sage_virtual_check_test.rb", "test/unit/gateways/secure_pay_au_test.rb", "test/unit/gateways/secure_pay_tech_test.rb", "test/unit/gateways/secure_pay_test.rb", "test/unit/gateways/skip_jack_test.rb", "test/unit/gateways/trans_first_test.rb", "test/unit/gateways/trust_commerce_test.rb", "test/unit/gateways/usa_epay_test.rb", "test/unit/gateways/verifi_test.rb", "test/unit/gateways/viaklix_test.rb", "test/unit/gateways/wirecard_test.rb", "test/unit/generators", "test/unit/generators/test_gateway_generator.rb", "test/unit/generators/test_generator_helper.rb", "test/unit/generators/test_integration_generator.rb", "test/unit/integrations", "test/unit/integrations/action_view_helper_test.rb", "test/unit/integrations/bogus_module_test.rb", "test/unit/integrations/chronopay_module_test.rb", "test/unit/integrations/gestpay_module_test.rb", "test/unit/integrations/helpers", "test/unit/integrations/helpers/bogus_helper_test.rb", "test/unit/integrations/helpers/chronopay_helper_test.rb", "test/unit/integrations/helpers/gestpay_helper_test.rb", "test/unit/integrations/helpers/hi_trust_helper_test.rb", "test/unit/integrations/helpers/nochex_helper_test.rb", "test/unit/integrations/helpers/paypal_helper_test.rb", "test/unit/integrations/helpers/quickpay_helper_test.rb", "test/unit/integrations/helpers/two_checkout_helper_test.rb", "test/unit/integrations/hi_trust_module_test.rb", "test/unit/integrations/nochex_module_test.rb", "test/unit/integrations/notifications", "test/unit/integrations/notifications/chronopay_notification_test.rb", "test/unit/integrations/notifications/gestpay_notification_test.rb", "test/unit/integrations/notifications/hi_trust_notification_test.rb", "test/unit/integrations/notifications/nochex_notification_test.rb", "test/unit/integrations/notifications/notification_test.rb", "test/unit/integrations/notifications/paypal_notification_test.rb", "test/unit/integrations/notifications/quickpay_notification_test.rb", "test/unit/integrations/notifications/two_checkout_notification_test.rb", "test/unit/integrations/paypal_module_test.rb", "test/unit/integrations/quickpay_module_test.rb", "test/unit/integrations/returns", "test/unit/integrations/returns/chronopay_return_test.rb", "test/unit/integrations/returns/gestpay_return_test.rb", "test/unit/integrations/returns/hi_trust_return_test.rb", "test/unit/integrations/returns/nochex_return_test.rb", "test/unit/integrations/returns/paypal_return_test.rb", "test/unit/integrations/returns/return_test.rb", "test/unit/integrations/returns/two_checkout_return_test.rb", "test/unit/integrations/two_checkout_module_test.rb", "test/unit/post_data_test.rb", "test/unit/posts_data_test.rb", "test/unit/response_test.rb", "test/unit/utils_test.rb", "test/unit/validateable_test.rb", "script/destroy", "script/generate", "active_merchant.gemspec", "CHANGELOG", "CONTRIBUTERS", "gem-public_cert.pem", "generators", "init.rb", "lib", "MIT-LICENSE", "rails", "Rakefile", "README", "script", "test"]
14
+ s.files = ["lib/active_merchant", "lib/active_merchant/billing", "lib/active_merchant/billing/avs_result.rb", "lib/active_merchant/billing/base.rb", "lib/active_merchant/billing/check.rb", "lib/active_merchant/billing/credit_card.rb", "lib/active_merchant/billing/credit_card_formatting.rb", "lib/active_merchant/billing/credit_card_methods.rb", "lib/active_merchant/billing/cvv_result.rb", "lib/active_merchant/billing/expiry_date.rb", "lib/active_merchant/billing/gateway.rb", "lib/active_merchant/billing/gateways", "lib/active_merchant/billing/gateways/authorize_net.rb", "lib/active_merchant/billing/gateways/authorize_net_cim.rb", "lib/active_merchant/billing/gateways/beanstream", "lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb", "lib/active_merchant/billing/gateways/beanstream.rb", "lib/active_merchant/billing/gateways/beanstream_interac.rb", "lib/active_merchant/billing/gateways/bogus.rb", "lib/active_merchant/billing/gateways/braintree.rb", "lib/active_merchant/billing/gateways/card_stream.rb", "lib/active_merchant/billing/gateways/cyber_source.rb", "lib/active_merchant/billing/gateways/data_cash.rb", "lib/active_merchant/billing/gateways/efsnet.rb", "lib/active_merchant/billing/gateways/eway.rb", "lib/active_merchant/billing/gateways/exact.rb", "lib/active_merchant/billing/gateways/first_pay.rb", "lib/active_merchant/billing/gateways/instapay.rb", "lib/active_merchant/billing/gateways/linkpoint.rb", "lib/active_merchant/billing/gateways/merchant_e_solutions.rb", "lib/active_merchant/billing/gateways/merchant_ware.rb", "lib/active_merchant/billing/gateways/modern_payments.rb", "lib/active_merchant/billing/gateways/modern_payments_cim.rb", "lib/active_merchant/billing/gateways/moneris.rb", "lib/active_merchant/billing/gateways/net_registry.rb", "lib/active_merchant/billing/gateways/netbilling.rb", "lib/active_merchant/billing/gateways/ogone.rb", "lib/active_merchant/billing/gateways/pay_junction.rb", "lib/active_merchant/billing/gateways/pay_secure.rb", "lib/active_merchant/billing/gateways/payflow", "lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb", "lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb", "lib/active_merchant/billing/gateways/payflow/payflow_response.rb", "lib/active_merchant/billing/gateways/payflow.rb", "lib/active_merchant/billing/gateways/payflow_express.rb", "lib/active_merchant/billing/gateways/payflow_express_uk.rb", "lib/active_merchant/billing/gateways/payflow_uk.rb", "lib/active_merchant/billing/gateways/payment_express.rb", "lib/active_merchant/billing/gateways/paypal", "lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb", "lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb", "lib/active_merchant/billing/gateways/paypal.rb", "lib/active_merchant/billing/gateways/paypal_ca.rb", "lib/active_merchant/billing/gateways/paypal_express.rb", "lib/active_merchant/billing/gateways/paypal_express_common.rb", "lib/active_merchant/billing/gateways/plugnpay.rb", "lib/active_merchant/billing/gateways/psigate.rb", "lib/active_merchant/billing/gateways/psl_card.rb", "lib/active_merchant/billing/gateways/quickpay.rb", "lib/active_merchant/billing/gateways/realex.rb", "lib/active_merchant/billing/gateways/sage", "lib/active_merchant/billing/gateways/sage/sage_bankcard.rb", "lib/active_merchant/billing/gateways/sage/sage_core.rb", "lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb", "lib/active_merchant/billing/gateways/sage.rb", "lib/active_merchant/billing/gateways/sage_pay.rb", "lib/active_merchant/billing/gateways/secure_pay.rb", "lib/active_merchant/billing/gateways/secure_pay_au.rb", "lib/active_merchant/billing/gateways/secure_pay_tech.rb", "lib/active_merchant/billing/gateways/skip_jack.rb", "lib/active_merchant/billing/gateways/smart_ps.rb", "lib/active_merchant/billing/gateways/trans_first.rb", "lib/active_merchant/billing/gateways/transax.rb", "lib/active_merchant/billing/gateways/trust_commerce.rb", "lib/active_merchant/billing/gateways/usa_epay.rb", "lib/active_merchant/billing/gateways/verifi.rb", "lib/active_merchant/billing/gateways/viaklix.rb", "lib/active_merchant/billing/gateways/wirecard.rb", "lib/active_merchant/billing/gateways.rb", "lib/active_merchant/billing/integrations", "lib/active_merchant/billing/integrations/action_view_helper.rb", "lib/active_merchant/billing/integrations/bogus", "lib/active_merchant/billing/integrations/bogus/helper.rb", "lib/active_merchant/billing/integrations/bogus/notification.rb", "lib/active_merchant/billing/integrations/bogus/return.rb", "lib/active_merchant/billing/integrations/bogus.rb", "lib/active_merchant/billing/integrations/chronopay", "lib/active_merchant/billing/integrations/chronopay/helper.rb", "lib/active_merchant/billing/integrations/chronopay/notification.rb", "lib/active_merchant/billing/integrations/chronopay/return.rb", "lib/active_merchant/billing/integrations/chronopay.rb", "lib/active_merchant/billing/integrations/gestpay", "lib/active_merchant/billing/integrations/gestpay/common.rb", "lib/active_merchant/billing/integrations/gestpay/helper.rb", "lib/active_merchant/billing/integrations/gestpay/notification.rb", "lib/active_merchant/billing/integrations/gestpay/return.rb", "lib/active_merchant/billing/integrations/gestpay.rb", "lib/active_merchant/billing/integrations/helper.rb", "lib/active_merchant/billing/integrations/hi_trust", "lib/active_merchant/billing/integrations/hi_trust/helper.rb", "lib/active_merchant/billing/integrations/hi_trust/notification.rb", "lib/active_merchant/billing/integrations/hi_trust/return.rb", "lib/active_merchant/billing/integrations/hi_trust.rb", "lib/active_merchant/billing/integrations/nochex", "lib/active_merchant/billing/integrations/nochex/helper.rb", "lib/active_merchant/billing/integrations/nochex/notification.rb", "lib/active_merchant/billing/integrations/nochex/return.rb", "lib/active_merchant/billing/integrations/nochex.rb", "lib/active_merchant/billing/integrations/notification.rb", "lib/active_merchant/billing/integrations/paypal", "lib/active_merchant/billing/integrations/paypal/helper.rb", "lib/active_merchant/billing/integrations/paypal/notification.rb", "lib/active_merchant/billing/integrations/paypal/return.rb", "lib/active_merchant/billing/integrations/paypal.rb", "lib/active_merchant/billing/integrations/quickpay", "lib/active_merchant/billing/integrations/quickpay/helper.rb", "lib/active_merchant/billing/integrations/quickpay/notification.rb", "lib/active_merchant/billing/integrations/quickpay.rb", "lib/active_merchant/billing/integrations/return.rb", "lib/active_merchant/billing/integrations/two_checkout", "lib/active_merchant/billing/integrations/two_checkout/helper.rb", "lib/active_merchant/billing/integrations/two_checkout/notification.rb", "lib/active_merchant/billing/integrations/two_checkout/return.rb", "lib/active_merchant/billing/integrations/two_checkout.rb", "lib/active_merchant/billing/integrations.rb", "lib/active_merchant/billing/response.rb", "lib/active_merchant/lib", "lib/active_merchant/lib/connection.rb", "lib/active_merchant/lib/country.rb", "lib/active_merchant/lib/error.rb", "lib/active_merchant/lib/post_data.rb", "lib/active_merchant/lib/posts_data.rb", "lib/active_merchant/lib/requires_parameters.rb", "lib/active_merchant/lib/utils.rb", "lib/active_merchant/lib/validateable.rb", "lib/active_merchant.rb", "lib/certs", "lib/certs/cacert.pem", "lib/support", "lib/support/gateway_support.rb", "test/fixtures.yml", "test/remote", "test/remote/gateways", "test/remote/gateways/remote_authorize_net_cim_test.rb", "test/remote/gateways/remote_authorize_net_test.rb", "test/remote/gateways/remote_beanstream_interac_test.rb", "test/remote/gateways/remote_beanstream_test.rb", "test/remote/gateways/remote_braintree_test.rb", "test/remote/gateways/remote_card_stream_test.rb", "test/remote/gateways/remote_cyber_source_test.rb", "test/remote/gateways/remote_data_cash_test.rb", "test/remote/gateways/remote_efsnet_test.rb", "test/remote/gateways/remote_eway_test.rb", "test/remote/gateways/remote_exact_test.rb", "test/remote/gateways/remote_first_pay_test.rb", "test/remote/gateways/remote_instapay_test.rb", "test/remote/gateways/remote_linkpoint_test.rb", "test/remote/gateways/remote_merchant_e_solutions_test.rb", "test/remote/gateways/remote_merchant_ware_test.rb", "test/remote/gateways/remote_modern_payments_cim_test.rb", "test/remote/gateways/remote_modern_payments_test.rb", "test/remote/gateways/remote_moneris_test.rb", "test/remote/gateways/remote_net_registry_test.rb", "test/remote/gateways/remote_netbilling_test.rb", "test/remote/gateways/remote_ogone_test.rb", "test/remote/gateways/remote_pay_junction_test.rb", "test/remote/gateways/remote_pay_secure_test.rb", "test/remote/gateways/remote_payflow_express_test.rb", "test/remote/gateways/remote_payflow_test.rb", "test/remote/gateways/remote_payflow_uk_test.rb", "test/remote/gateways/remote_payment_express_test.rb", "test/remote/gateways/remote_paypal_express_test.rb", "test/remote/gateways/remote_paypal_test.rb", "test/remote/gateways/remote_plugnpay_test.rb", "test/remote/gateways/remote_protx_three_d_secure_test.rb", "test/remote/gateways/remote_psigate_test.rb", "test/remote/gateways/remote_psl_card_test.rb", "test/remote/gateways/remote_quickpay_test.rb", "test/remote/gateways/remote_realex_test.rb", "test/remote/gateways/remote_sage_bankcard_test.rb", "test/remote/gateways/remote_sage_pay_test.rb", "test/remote/gateways/remote_sage_test.rb", "test/remote/gateways/remote_sage_virtual_check_test.rb", "test/remote/gateways/remote_secure_pay_au_test.rb", "test/remote/gateways/remote_secure_pay_tech_test.rb", "test/remote/gateways/remote_secure_pay_test.rb", "test/remote/gateways/remote_skipjack_test.rb", "test/remote/gateways/remote_trans_first_test.rb", "test/remote/gateways/remote_transax_test.rb", "test/remote/gateways/remote_trust_commerce_test.rb", "test/remote/gateways/remote_usa_epay_test.rb", "test/remote/gateways/remote_verifi_test.rb", "test/remote/gateways/remote_viaklix_test.rb", "test/remote/gateways/remote_wirecard_test.rb", "test/remote/integrations", "test/remote/integrations/remote_gestpay_integration_test.rb", "test/remote/integrations/remote_paypal_integration_test.rb", "test/test_helper.rb", "test/unit", "test/unit/avs_result_test.rb", "test/unit/base_test.rb", "test/unit/check_test.rb", "test/unit/connection_test.rb", "test/unit/country_code_test.rb", "test/unit/country_test.rb", "test/unit/credit_card_formatting_test.rb", "test/unit/credit_card_methods_test.rb", "test/unit/credit_card_test.rb", "test/unit/cvv_result_test.rb", "test/unit/expiry_date_test.rb", "test/unit/gateways", "test/unit/gateways/authorize_net_cim_test.rb", "test/unit/gateways/authorize_net_test.rb", "test/unit/gateways/beanstream_interac_test.rb", "test/unit/gateways/beanstream_test.rb", "test/unit/gateways/bogus_test.rb", "test/unit/gateways/braintree_test.rb", "test/unit/gateways/card_stream_test.rb", "test/unit/gateways/cyber_source_test.rb", "test/unit/gateways/data_cash_test.rb", "test/unit/gateways/efsnet_test.rb", "test/unit/gateways/eway_test.rb", "test/unit/gateways/exact_test.rb", "test/unit/gateways/first_pay_test.rb", "test/unit/gateways/gateway_test.rb", "test/unit/gateways/instapay_test.rb", "test/unit/gateways/linkpoint_test.rb", "test/unit/gateways/merchant_e_solutions_test.rb", "test/unit/gateways/merchant_ware_test.rb", "test/unit/gateways/modern_payments_cim_test.rb", "test/unit/gateways/moneris_test.rb", "test/unit/gateways/net_registry_test.rb", "test/unit/gateways/netbilling_test.rb", "test/unit/gateways/ogone_test.rb", "test/unit/gateways/pay_junction_test.rb", "test/unit/gateways/pay_secure_test.rb", "test/unit/gateways/payflow_express_test.rb", "test/unit/gateways/payflow_express_uk_test.rb", "test/unit/gateways/payflow_test.rb", "test/unit/gateways/payflow_uk_test.rb", "test/unit/gateways/payment_express_test.rb", "test/unit/gateways/paypal_express_test.rb", "test/unit/gateways/paypal_test.rb", "test/unit/gateways/plugnpay_test.rb", "test/unit/gateways/psigate_test.rb", "test/unit/gateways/psl_card_test.rb", "test/unit/gateways/quickpay_test.rb", "test/unit/gateways/realex_test.rb", "test/unit/gateways/sage_bankcard_test.rb", "test/unit/gateways/sage_pay_test.rb", "test/unit/gateways/sage_virtual_check_test.rb", "test/unit/gateways/secure_pay_au_test.rb", "test/unit/gateways/secure_pay_tech_test.rb", "test/unit/gateways/secure_pay_test.rb", "test/unit/gateways/skip_jack_test.rb", "test/unit/gateways/trans_first_test.rb", "test/unit/gateways/trust_commerce_test.rb", "test/unit/gateways/usa_epay_test.rb", "test/unit/gateways/verifi_test.rb", "test/unit/gateways/viaklix_test.rb", "test/unit/gateways/wirecard_test.rb", "test/unit/generators", "test/unit/generators/test_gateway_generator.rb", "test/unit/generators/test_generator_helper.rb", "test/unit/generators/test_integration_generator.rb", "test/unit/integrations", "test/unit/integrations/action_view_helper_test.rb", "test/unit/integrations/bogus_module_test.rb", "test/unit/integrations/chronopay_module_test.rb", "test/unit/integrations/gestpay_module_test.rb", "test/unit/integrations/helpers", "test/unit/integrations/helpers/bogus_helper_test.rb", "test/unit/integrations/helpers/chronopay_helper_test.rb", "test/unit/integrations/helpers/gestpay_helper_test.rb", "test/unit/integrations/helpers/hi_trust_helper_test.rb", "test/unit/integrations/helpers/nochex_helper_test.rb", "test/unit/integrations/helpers/paypal_helper_test.rb", "test/unit/integrations/helpers/quickpay_helper_test.rb", "test/unit/integrations/helpers/two_checkout_helper_test.rb", "test/unit/integrations/hi_trust_module_test.rb", "test/unit/integrations/nochex_module_test.rb", "test/unit/integrations/notifications", "test/unit/integrations/notifications/chronopay_notification_test.rb", "test/unit/integrations/notifications/gestpay_notification_test.rb", "test/unit/integrations/notifications/hi_trust_notification_test.rb", "test/unit/integrations/notifications/nochex_notification_test.rb", "test/unit/integrations/notifications/notification_test.rb", "test/unit/integrations/notifications/paypal_notification_test.rb", "test/unit/integrations/notifications/quickpay_notification_test.rb", "test/unit/integrations/notifications/two_checkout_notification_test.rb", "test/unit/integrations/paypal_module_test.rb", "test/unit/integrations/quickpay_module_test.rb", "test/unit/integrations/returns", "test/unit/integrations/returns/chronopay_return_test.rb", "test/unit/integrations/returns/gestpay_return_test.rb", "test/unit/integrations/returns/hi_trust_return_test.rb", "test/unit/integrations/returns/nochex_return_test.rb", "test/unit/integrations/returns/paypal_return_test.rb", "test/unit/integrations/returns/return_test.rb", "test/unit/integrations/returns/two_checkout_return_test.rb", "test/unit/integrations/two_checkout_module_test.rb", "test/unit/post_data_test.rb", "test/unit/posts_data_test.rb", "test/unit/response_test.rb", "test/unit/utils_test.rb", "test/unit/validateable_test.rb", "script/destroy", "script/generate", "active_merchant.gemspec", "CHANGELOG", "CONTRIBUTERS", "gem-public_cert.pem", "generators", "init.rb", "lib", "MIT-LICENSE", "rails", "Rakefile", "README", "script", "test"]
15
+
15
16
  end
data/init.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  require 'active_merchant'
2
2
  require 'active_merchant/billing/integrations/action_view_helper'
3
3
  ActionView::Base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
4
- ActiveMerchant::Billing::Gateway.logger = Rails.logger
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
14
14
  'dankort' => /^5019\d{12}$/,
15
15
  'maestro' => /^(5[06-8]|6\d)\d{10,17}$/,
16
16
  'forbrugsforeningen' => /^600722\d{10}$/,
17
- 'laser' => /^(6304[89]\d{11}(\d{2,3})?|670695\d{13})$/
17
+ 'laser' => /^(6304|6706|6771|6709)\d{8}(\d{4}|\d{6,7})?$/
18
18
  }
19
19
 
20
20
  def self.included(base)
@@ -1,19 +1,25 @@
1
+ require 'date'
2
+
1
3
  module ActiveMerchant
2
4
  module Billing
3
5
  class CreditCard
4
6
  class ExpiryDate #:nodoc:
5
7
  attr_reader :month, :year
6
8
  def initialize(month, year)
7
- @month = month
8
- @year = year
9
+ @month = month.to_i
10
+ @year = year.to_i
9
11
  end
10
12
 
11
13
  def expired? #:nodoc:
12
- Time.now > expiration rescue true
14
+ Time.now.utc > expiration
13
15
  end
14
16
 
15
17
  def expiration #:nodoc:
16
- Time.parse("#{month}/#{month_days}/#{year} 23:59:59") rescue Time.at(0)
18
+ begin
19
+ Time.utc(year, month, month_days, 23, 59, 59)
20
+ rescue ArgumentError
21
+ Time.at(0).utc
22
+ end
17
23
  end
18
24
 
19
25
  private
@@ -88,6 +88,10 @@ module ActiveMerchant #:nodoc:
88
88
  class_inheritable_accessor :supported_cardtypes
89
89
  self.supported_cardtypes = []
90
90
 
91
+ # Indicates if the gateway supports 3D Secure authentication or not
92
+ class_inheritable_accessor :supports_3d_secure
93
+ self.supports_3d_secure = false
94
+
91
95
  class_inheritable_accessor :homepage_url
92
96
  class_inheritable_accessor :display_name
93
97
 
@@ -334,7 +334,6 @@ module ActiveMerchant #:nodoc:
334
334
  end
335
335
 
336
336
  def add_address(post, options)
337
-
338
337
  if address = options[:billing_address] || options[:address]
339
338
  post[:address] = address[:address1].to_s
340
339
  post[:company] = address[:company].to_s
@@ -344,6 +343,18 @@ module ActiveMerchant #:nodoc:
344
343
  post[:country] = address[:country].to_s
345
344
  post[:state] = address[:state].blank? ? 'n/a' : address[:state]
346
345
  end
346
+
347
+ if address = options[:shipping_address]
348
+ post[:ship_to_first_name] = address[:first_name].to_s
349
+ post[:ship_to_last_name] = address[:last_name].to_s
350
+ post[:ship_to_address] = address[:address1].to_s
351
+ post[:ship_to_company] = address[:company].to_s
352
+ post[:ship_to_phone] = address[:phone].to_s
353
+ post[:ship_to_zip] = address[:zip].to_s
354
+ post[:ship_to_city] = address[:city].to_s
355
+ post[:ship_to_country] = address[:country].to_s
356
+ post[:ship_to_state] = address[:state].blank? ? 'n/a' : address[:state]
357
+ end
347
358
  end
348
359
 
349
360
  # Make a ruby type out of the response string
@@ -583,6 +583,7 @@ module ActiveMerchant #:nodoc:
583
583
  xml.tag!('cardNumber', credit_card.number)
584
584
  # The expiration date of the credit card used for the subscription
585
585
  xml.tag!('expirationDate', expdate(credit_card))
586
+ xml.tag!('cardCode', credit_card.verification_value) if credit_card.verification_value?
586
587
  end
587
588
  end
588
589
 
@@ -699,4 +700,4 @@ module ActiveMerchant #:nodoc:
699
700
  end
700
701
  end
701
702
  end
702
- end
703
+ end
@@ -6,14 +6,21 @@ module ActiveMerchant #:nodoc:
6
6
 
7
7
  SUCCESS_MESSAGE = "Bogus Gateway: Forced success"
8
8
  FAILURE_MESSAGE = "Bogus Gateway: Forced failure"
9
+ THREE_D_SECURE_MESSAGE = "Bogus Gateway: Requires additional 3D secure authentication"
9
10
  ERROR_MESSAGE = "Bogus Gateway: Use CreditCard number 1 for success, 2 for exception and anything else for error"
10
11
  CREDIT_ERROR_MESSAGE = "Bogus Gateway: Use trans_id 1 for success, 2 for exception and anything else for error"
11
12
  UNSTORE_ERROR_MESSAGE = "Bogus Gateway: Use trans_id 1 for success, 2 for exception and anything else for error"
12
13
  CAPTURE_ERROR_MESSAGE = "Bogus Gateway: Use authorization number 1 for exception, 2 for error and anything else for success"
13
14
  VOID_ERROR_MESSAGE = "Bogus Gateway: Use authorization number 1 for exception, 2 for error and anything else for success"
14
15
 
16
+ THREE_D_MD = 'md'
17
+ THREE_D_PA_REQ = 'pa_req'
18
+ THREE_D_PA_RES = 'pa_res'
19
+ THREE_D_ACS_URL = 'https://domain.com/3d_secure_page'
20
+
15
21
  self.supported_countries = ['US']
16
22
  self.supported_cardtypes = [:bogus]
23
+ self.supports_3d_secure = true
17
24
  self.homepage_url = 'http://example.com'
18
25
  self.display_name = 'Bogus'
19
26
 
@@ -23,6 +30,8 @@ module ActiveMerchant #:nodoc:
23
30
  Response.new(true, SUCCESS_MESSAGE, {:authorized_amount => money.to_s}, :test => true, :authorization => AUTHORIZATION )
24
31
  when '2'
25
32
  Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money.to_s, :error => FAILURE_MESSAGE }, :test => true)
33
+ when '4'
34
+ Response.new(false, THREE_D_SECURE_MESSAGE, {:authorized_amount => money.to_s}, :three_d_secure => true, :pa_req => THREE_D_PA_REQ, :md => THREE_D_MD, :acs_url => THREE_D_ACS_URL, :test => true)
26
35
  else
27
36
  raise Error, ERROR_MESSAGE
28
37
  end
@@ -34,11 +43,21 @@ module ActiveMerchant #:nodoc:
34
43
  Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money.to_s}, :test => true)
35
44
  when '2'
36
45
  Response.new(false, FAILURE_MESSAGE, {:paid_amount => money.to_s, :error => FAILURE_MESSAGE },:test => true)
46
+ when '4'
47
+ Response.new(false, THREE_D_SECURE_MESSAGE, {:paid_amount => money.to_s}, :three_d_secure => true, :pa_req => THREE_D_PA_REQ, :md => THREE_D_MD, :acs_url => THREE_D_ACS_URL, :test => true)
37
48
  else
38
49
  raise Error, ERROR_MESSAGE
39
50
  end
40
51
  end
41
52
 
53
+ def three_d_complete(pa_res, md)
54
+ if pa_res == THREE_D_PA_RES && md == THREE_D_MD
55
+ Response.new(true, SUCCESS_MESSAGE, {}, :test => true, :authorization => AUTHORIZATION)
56
+ else
57
+ Response.new(false, FAILURE_MESSAGE, {},:test => true)
58
+ end
59
+ end
60
+
42
61
  def credit(money, ident, options = {})
43
62
  case ident
44
63
  when '1'
@@ -155,7 +155,11 @@ module ActiveMerchant #:nodoc:
155
155
 
156
156
  commit(money, post)
157
157
  end
158
-
158
+
159
+ def test?
160
+ @options[:test] || super
161
+ end
162
+
159
163
  private
160
164
  def add_creditcard(post, creditcard)
161
165
  post[:CardNumber] = creditcard.number
@@ -267,6 +271,7 @@ module ActiveMerchant #:nodoc:
267
271
  test ? TEST_URL : LIVE_URL
268
272
  end
269
273
  end
274
+
270
275
  end
271
276
  end
272
277
  end
@@ -0,0 +1,172 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class FirstPayGateway < Gateway
4
+ class FirstPayPostData < PostData
5
+ # Fields that will be sent even if they are blank
6
+ self.required_fields = [ :action, :amount, :trackid ]
7
+ end
8
+
9
+ # both URLs are IP restricted
10
+ TEST_URL = 'https://apgcert.first-pay.com/AcqENGIN/SecureCapture'
11
+ LIVE_URL = 'https://acqengin.first-pay.com/AcqENGIN/SecureCapture'
12
+
13
+ # The countries the gateway supports merchants from as 2 digit ISO country codes
14
+ self.supported_countries = ['US']
15
+
16
+ # The card types supported by the payment gateway
17
+ self.supported_cardtypes = [:visa, :master]
18
+
19
+ # The homepage URL of the gateway
20
+ self.homepage_url = 'http://www.first-pay.com'
21
+
22
+ # The name of the gateway
23
+ self.display_name = 'First Pay'
24
+
25
+ # all transactions are in cents
26
+ self.money_format = :cents
27
+
28
+ ACTIONS = {
29
+ 'sale' => 1,
30
+ 'credit' => 2,
31
+ 'void' => 3
32
+ }
33
+
34
+ def initialize(options = {})
35
+ requires!(options, :login, :password)
36
+ @options = options
37
+ super
38
+ end
39
+
40
+ def purchase(money, creditcard, options = {})
41
+ post = FirstPayPostData.new
42
+ add_invoice(post, options)
43
+ add_creditcard(post, creditcard)
44
+ add_address(post, options)
45
+ add_customer_data(post, options)
46
+
47
+ commit('sale', money, post)
48
+ end
49
+
50
+ def credit(money, reference, options = {})
51
+ raise ArgumentError, "Both TransactionID and CreditCard are required" unless reference.is_a?(String) && options[:credit_card]
52
+
53
+ post = FirstPayPostData.new
54
+ add_invoice(post, options)
55
+ add_creditcard(post, options[:credit_card])
56
+ add_address(post, options)
57
+ add_customer_data(post, options)
58
+ add_credit_data(post, reference)
59
+
60
+ commit('credit', money, post)
61
+ end
62
+
63
+ def void(money, creditcard, options = {})
64
+ post = FirstPayPostData.new
65
+ add_creditcard(post, creditcard)
66
+ add_void_data(post, options)
67
+ add_invoice(post, options)
68
+ add_customer_data(post, options)
69
+
70
+ commit('void', money, post)
71
+ end
72
+
73
+
74
+ private
75
+
76
+ def add_customer_data(post, options)
77
+ post[:cardip] = options[:ip]
78
+ post[:email] = options[:email]
79
+ end
80
+
81
+ def add_address(post, options)
82
+ if billing_address = options[:billing_address] || options[:address]
83
+ post[:addr] = billing_address[:address1].to_s + ' ' + billing_address[:address2].to_s
84
+ post[:city] = billing_address[:city]
85
+ post[:state] = billing_address[:state]
86
+ post[:zip] = billing_address[:zip]
87
+ post[:country] = billing_address[:country]
88
+ end
89
+ end
90
+
91
+ def add_invoice(post, options)
92
+ post[:trackid] = rand(Time.now)
93
+ end
94
+
95
+ def add_creditcard(post, creditcard)
96
+ post[:member] = creditcard.first_name.to_s + " " + creditcard.last_name.to_s
97
+ post[:card] = creditcard.number
98
+ post[:exp] = expdate(creditcard)
99
+ end
100
+
101
+ def expdate(credit_card)
102
+ year = sprintf("%.4i", credit_card.year)
103
+ month = sprintf("%.2i", credit_card.month)
104
+
105
+ "#{month}#{year[-2..-1]}"
106
+ end
107
+
108
+ def add_credit_data(post, transaction_id)
109
+ post[:transid] = transaction_id
110
+ end
111
+
112
+ def add_void_data(post, options)
113
+ post[:transid] = options[:transactionid]
114
+ end
115
+
116
+ def commit(action, money, post)
117
+ response = parse( ssl_post(test? ? TEST_URL : LIVE_URL, post_data(action, post, money)) )
118
+
119
+ Response.new(response[:response] == 'CAPTURED', response[:message], response,
120
+ :test => test?,
121
+ :authorization => response[:authorization],
122
+ :avs_result => { :code => response[:avsresponse] },
123
+ :cvv_result => response[:cvvresponse])
124
+ end
125
+
126
+ def parse(body)
127
+ response = {}
128
+
129
+ # check for an error first
130
+ if body.include?('!ERROR!')
131
+ response[:response] = 'ERROR'
132
+ response[:message] = error_message_from(body)
133
+ else
134
+ # a capture / not captured response will be : delimited
135
+ split = body.split(':')
136
+ response[:response] = split[0]
137
+
138
+ # FirstPay docs are worthless. turns out the transactionid is required for credits
139
+ # so we need to store that in authorization, not the actual auth.
140
+ if response[:response] == 'CAPTURED'
141
+ response[:message] = 'CAPTURED'
142
+ response[:authorization] = split[9] # actually the transactionid
143
+ response[:auth] = split[1]
144
+ response[:avsresponse] = split[3]
145
+ response[:cvvresponse] = split[17]
146
+ else
147
+ # NOT CAPTURED response
148
+ response[:message] = split[1]
149
+ response[:transactionid] = split[9]
150
+ end
151
+ end
152
+
153
+ return response
154
+ end
155
+
156
+ def error_message_from(response)
157
+ # error messages use this format - '!ERROR! 704-MISSING BASIC DATA TYPE:card, exp, zip, addr, member, amount\n'
158
+ response.split("! ")[1].chomp
159
+ end
160
+
161
+ def post_data(action, post, money)
162
+ post[:vid] = @options[:login]
163
+ post[:password] = @options[:password]
164
+ post[:action] = ACTIONS[action]
165
+ post[:amount] = amount(money)
166
+
167
+ return post.to_post_data
168
+ end
169
+ end
170
+ end
171
+ end
172
+
@@ -0,0 +1,283 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class MerchantWareGateway < Gateway
4
+ URL = 'https://ps1.merchantware.net/MerchantWARE/ws/RetailTransaction/TXRetail.asmx'
5
+
6
+ self.supported_countries = ['US']
7
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
8
+ self.homepage_url = 'http://merchantwarehouse.com/merchantware'
9
+ self.display_name = 'MerchantWARE'
10
+
11
+ ENV_NAMESPACES = { "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
12
+ "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
13
+ "xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/"
14
+ }
15
+ TX_NAMESPACE = "http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail"
16
+
17
+ ACTIONS = {
18
+ :purchase => "IssueKeyedSale",
19
+ :authorize => "IssueKeyedPreAuth",
20
+ :capture => "IssuePostAuth",
21
+ :void => "IssueVoid",
22
+ :credit => "IssueKeyedRefund",
23
+ :reference_credit => "IssueRefundByReference"
24
+ }
25
+
26
+ # Creates a new MerchantWareGateway
27
+ #
28
+ # The gateway requires that a valid login, password, and name be passed
29
+ # in the +options+ hash.
30
+ #
31
+ # ==== Options
32
+ #
33
+ # * <tt>:login</tt> - The MerchantWARE SiteID.
34
+ # * <tt>:password</tt> - The MerchantWARE Key.
35
+ # * <tt>:name</tt> - The MerchantWARE Name.
36
+ def initialize(options = {})
37
+ requires!(options, :login, :password, :name)
38
+ @options = options
39
+ super
40
+ end
41
+
42
+ # Authorize a credit card for a given amount.
43
+ #
44
+ # ==== Parameters
45
+ # * <tt>money</tt> - The amount to be authorized. Either an Integer value in cents or a Money object.
46
+ # * <tt>credit_card</tt> - The CreditCard details for the transaction.
47
+ # * <tt>options</tt>
48
+ # * <tt>:order_id</tt> - A unique reference for this order (required).
49
+ # * <tt>:billing_address</tt> - The billing address for the cardholder.
50
+ def authorize(money, credit_card, options = {})
51
+ request = build_purchase_request(:authorize, money, credit_card, options)
52
+ commit(:authorize, request)
53
+ end
54
+
55
+ # Authorize and immediately capture funds from a credit card.
56
+ #
57
+ # ==== Parameters
58
+ # * <tt>money</tt> - The amount to be authorized. Either an Integer value in cents or a Money object.
59
+ # * <tt>credit_card</tt> - The CreditCard details for the transaction.
60
+ # * <tt>options</tt>
61
+ # * <tt>:order_id</tt> - A unique reference for this order (required).
62
+ # * <tt>:billing_address</tt> - The billing address for the cardholder.
63
+ def purchase(money, credit_card, options = {})
64
+ request = build_purchase_request(:purchase, money, credit_card, options)
65
+ commit(:purchase, request)
66
+ end
67
+
68
+ # Capture authorized funds from a credit card.
69
+ #
70
+ # ==== Parameters
71
+ # * <tt>money</tt> - The amount to be captured. Either an Integer value in cents or a Money object.
72
+ # * <tt>authorization</tt> - The authorization string returned from the initial authorization.
73
+ def capture(money, authorization, options = {})
74
+ request = build_capture_request(:capture, money, authorization, options)
75
+ commit(:capture, request)
76
+ end
77
+
78
+ # Void a transaction.
79
+ #
80
+ # ==== Parameters
81
+ # * <tt>authorization</tt> - The authorization string returned from the initial authorization or purchase.
82
+ def void(authorization, options = {})
83
+ reference, options[:order_id] = split_reference(authorization)
84
+
85
+ request = soap_request(:void) do |xml|
86
+ add_reference(xml, reference)
87
+ end
88
+ commit(:void, request)
89
+ end
90
+
91
+ # Refund an amount back a cardholder
92
+ #
93
+ # ==== Parameters
94
+ #
95
+ # * <tt>money</tt> - The amount to be refunded. Either an Integer value in cents or a Money object.
96
+ # * <tt>identification</tt> - The credit card you want to refund or the authorization for the existing transaction you are refunding.
97
+ # * <tt>options</tt>
98
+ # * <tt>:order_id</tt> - A unique reference for this order (required when performing a non-referenced credit)
99
+ def credit(money, identification, options = {})
100
+ if identification.is_a?(String)
101
+ perform_reference_credit(money, identification, options)
102
+ else
103
+ perform_credit(money, identification, options)
104
+ end
105
+ end
106
+
107
+ private
108
+
109
+ def soap_request(action)
110
+ xml = Builder::XmlMarkup.new :indent => 2
111
+ xml.instruct!
112
+ xml.tag! "env:Envelope", ENV_NAMESPACES do
113
+ xml.tag! "env:Body" do
114
+ xml.tag! ACTIONS[action], "xmlns" => TX_NAMESPACE do
115
+ add_credentials(xml)
116
+ yield xml
117
+ end
118
+ end
119
+ end
120
+ xml.target!
121
+ end
122
+
123
+ def build_purchase_request(action, money, credit_card, options)
124
+ requires!(options, :order_id)
125
+
126
+ request = soap_request(action) do |xml|
127
+ add_invoice(xml, options)
128
+ add_amount(xml, money)
129
+ add_credit_card(xml, credit_card)
130
+ add_address(xml, options)
131
+ end
132
+ end
133
+
134
+ def build_capture_request(action, money, identification, options)
135
+ reference, options[:order_id] = split_reference(identification)
136
+
137
+ request = soap_request(action) do |xml|
138
+ add_reference(xml, reference)
139
+ add_invoice(xml, options)
140
+ add_amount(xml, money)
141
+ end
142
+ end
143
+
144
+ def perform_reference_credit(money, identification, options)
145
+ reference, options[:order_id] = split_reference(identification)
146
+
147
+ request = soap_request(:reference_credit) do |xml|
148
+ add_reference(xml, reference)
149
+ add_invoice(xml, options)
150
+ add_amount(xml, money, "strOverrideAmount")
151
+ end
152
+
153
+ commit(:reference_credit, request)
154
+ end
155
+
156
+ def perform_credit(money, credit_card, options)
157
+ requires!(options, :order_id)
158
+
159
+ request = soap_request(:credit) do |xml|
160
+ add_invoice(xml, options)
161
+ add_amount(xml, money)
162
+ add_credit_card(xml, credit_card)
163
+ end
164
+
165
+ commit(:credit, request)
166
+ end
167
+
168
+ def add_credentials(xml)
169
+ xml.tag! "strSiteId", @options[:login]
170
+ xml.tag! "strKey", @options[:password]
171
+ xml.tag! "strName", @options[:name]
172
+ end
173
+
174
+ def expdate(credit_card)
175
+ year = sprintf("%.4i", credit_card.year)
176
+ month = sprintf("%.2i", credit_card.month)
177
+
178
+ "#{month}#{year[-2..-1]}"
179
+ end
180
+
181
+ def add_invoice(xml, options)
182
+ xml.tag! "strOrderNumber", options[:order_id].to_s.slice(0, 25)
183
+ end
184
+
185
+ def add_amount(xml, money, tag = "strAmount")
186
+ xml.tag! tag, amount(money)
187
+ end
188
+
189
+ def add_reference(xml, reference)
190
+ xml.tag! "strReferenceCode", reference
191
+ end
192
+
193
+ def add_address(xml, options)
194
+ if address = options[:billing_address] || options[:address]
195
+ xml.tag! "strAVSStreetAddress", address[:address1]
196
+ xml.tag! "strAVSZipCode", address[:zip]
197
+ end
198
+ end
199
+
200
+ def add_credit_card(xml, credit_card)
201
+ xml.tag! "strPAN", credit_card.number
202
+ xml.tag! "strExpDate", expdate(credit_card)
203
+ xml.tag! "strCardHolder", credit_card.name
204
+ xml.tag! "strCVCode", credit_card.verification_value if credit_card.verification_value?
205
+ end
206
+
207
+ def split_reference(reference)
208
+ reference.to_s.split(";")
209
+ end
210
+
211
+ def parse(action, data)
212
+ response = {}
213
+ xml = REXML::Document.new(data)
214
+
215
+ root = REXML::XPath.first(xml, "//#{ACTIONS[action]}Response/#{ACTIONS[action]}Result")
216
+
217
+ root.elements.each do |element|
218
+ response[element.name] = element.text
219
+ end
220
+
221
+ status, code, message = response["ApprovalStatus"].split(";")
222
+ response[:status] = status
223
+
224
+ if response[:success] = status == "APPROVED"
225
+ response[:message] = status
226
+ else
227
+ response[:message] = message
228
+ response[:failure_code] = code
229
+ end
230
+
231
+ response
232
+ end
233
+
234
+ def parse_error(http_response)
235
+ response = {}
236
+ response[:http_code] = http_response.code
237
+ response[:http_message] = http_response.message
238
+ response[:success] = false
239
+
240
+ document = REXML::Document.new(http_response.body)
241
+
242
+ node = REXML::XPath.first(document, "//soap:Fault")
243
+
244
+ node.elements.each do |element|
245
+ response[element.name] = element.text
246
+ end
247
+
248
+ response[:message] = response["faultstring"].to_s.gsub("\n", " ")
249
+ response
250
+ rescue REXML::ParseException => e
251
+ response[:http_body] = http_response.body
252
+ response[:message] = "Failed to parse the failed response"
253
+ response
254
+ end
255
+
256
+ def commit(action, request)
257
+ begin
258
+ data = ssl_post(URL, request,
259
+ "Content-Type" => 'text/xml; charset=utf-8',
260
+ "SOAPAction" => "http://merchantwarehouse.com/MerchantWARE/Client/TransactionRetail/#{ACTIONS[action]}"
261
+ )
262
+ response = parse(action, data)
263
+ rescue ActiveMerchant::ResponseError => e
264
+ response = parse_error(e.response)
265
+ end
266
+
267
+ Response.new(response[:success], response[:message], response,
268
+ :test => test?,
269
+ :authorization => authorization_from(response),
270
+ :avs_result => { :code => response["AVSResponse"] },
271
+ :cvv_result => response["CVResponse"]
272
+ )
273
+ end
274
+
275
+ def authorization_from(response)
276
+ if response[:success]
277
+ [ response["ReferenceID"], response["OrderNumber"] ].join(";")
278
+ end
279
+ end
280
+ end
281
+ end
282
+ end
283
+