Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename EPaymentPlan to EPaymentPlans

  • Loading branch information...
commit 192231f842e53fc720f863505033f5eb0bf7f518 1 parent 7856811
@Soleone Soleone authored
View
6 ...nt/billing/integrations/e_payment_plan.rb → ...t/billing/integrations/e_payment_plans.rb
@@ -1,9 +1,9 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
- module EPaymentPlan
- autoload :Helper, File.dirname(__FILE__) + '/e_payment_plan/helper.rb'
- autoload :Notification, File.dirname(__FILE__) + '/e_payment_plan/notification.rb'
+ module EPaymentPlans
+ autoload :Helper, File.dirname(__FILE__) + '/e_payment_plans/helper.rb'
+ autoload :Notification, File.dirname(__FILE__) + '/e_payment_plans/notification.rb'
mattr_accessor :production_url
self.production_url = 'https://www.epaymentplans.com'
View
2  ...ing/integrations/e_payment_plan/helper.rb → ...ng/integrations/e_payment_plans/helper.rb
@@ -1,7 +1,7 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
- module EPaymentPlan
+ module EPaymentPlans
class Helper < ActiveMerchant::Billing::Integrations::Helper
mapping :account, 'order[account]'
mapping :amount, 'order[amount]'
View
14 ...tegrations/e_payment_plan/notification.rb → ...egrations/e_payment_plans/notification.rb
@@ -3,7 +3,7 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
- module EPaymentPlan
+ module EPaymentPlans
class Notification < ActiveMerchant::Billing::Integrations::Notification
include ActiveMerchant::PostsData
def complete?
@@ -44,14 +44,14 @@ def status
params['status'].capitalize
end
- # Acknowledge the transaction to EPaymentPlan. This method has to be called after a new
- # apc arrives. EPaymentPlan will verify that all the information we received are correct and will return a
- # ok or a fail.
+ # Acknowledge the transaction to EPaymentPlans. This method has to be called after a new
+ # apc arrives. EPaymentPlans will verify that all the information we received are correct
+ # and will return ok or a fail.
#
# Example:
#
# def ipn
- # notify = EPaymentPlanNotification.new(request.raw_post)
+ # notify = EPaymentPlans.notification(request.raw_post)
#
# if notify.acknowledge
# ... process order ... if notify.complete?
@@ -61,10 +61,10 @@ def status
def acknowledge
payload = raw
- response = ssl_post(payload)
+ response = ssl_post(EPaymentPlans.notification_confirmation_url, payload)
# Replace with the appropriate codes
- raise StandardError.new("Faulty EPaymentPlan result: #{response}") unless ["AUTHORISED", "DECLINED"].include?(response)
+ raise StandardError.new("Faulty EPaymentPlans result: #{response}") unless ["AUTHORISED", "DECLINED"].include?(response)
response == "AUTHORISED"
end
View
10 ...ntegrations/e_payment_plan_module_test.rb → ...tegrations/e_payment_plans_module_test.rb
@@ -1,24 +1,24 @@
require 'test_helper'
-class EPaymentPlanModuleTest < Test::Unit::TestCase
+class EPaymentPlansModuleTest < Test::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def test_notification_method
- assert_instance_of EPaymentPlan::Notification, EPaymentPlan.notification('name=cody')
+ assert_instance_of EPaymentPlans::Notification, EPaymentPlans.notification('name=cody')
end
def test_test_mode
ActiveMerchant::Billing::Base.integration_mode = :test
- assert_equal 'https://test.epaymentplans.com/order/purchase', EPaymentPlan.service_url
+ assert_equal 'https://test.epaymentplans.com/order/purchase', EPaymentPlans.service_url
end
def test_production_mode
ActiveMerchant::Billing::Base.integration_mode = :production
- assert_equal 'https://www.epaymentplans.com/order/purchase', EPaymentPlan.service_url
+ assert_equal 'https://www.epaymentplans.com/order/purchase', EPaymentPlans.service_url
end
def test_invalid_mode
ActiveMerchant::Billing::Base.integration_mode = :coolmode
- assert_raise(StandardError){ EPaymentPlan.service_url }
+ assert_raise(StandardError){ EPaymentPlans.service_url }
end
end
View
8 ...tions/e_payment_plan_notification_test.rb → ...ions/e_payment_plans_notification_test.rb
@@ -1,10 +1,10 @@
require 'test_helper'
-class EPaymentPlanNotificationTest < Test::Unit::TestCase
+class EPaymentPlansNotificationTest < Test::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def setup
- @e_payment_plan = EPaymentPlan::Notification.new(http_raw_data)
+ @e_payment_plan = EPaymentPlans::Notification.new(http_raw_data)
end
def test_accessors
@@ -20,10 +20,10 @@ def test_accessors
end
def test_acknowledgement
- EPaymentPlan::Notification.any_instance.stubs(:ssl_post).returns('AUTHORISED')
+ EPaymentPlans::Notification.any_instance.stubs(:ssl_post).returns('AUTHORISED')
assert @e_payment_plan.acknowledge
- EPaymentPlan::Notification.any_instance.stubs(:ssl_post).returns('DECLINED')
+ EPaymentPlans::Notification.any_instance.stubs(:ssl_post).returns('DECLINED')
assert !@e_payment_plan.acknowledge
end
Please sign in to comment.
Something went wrong with that request. Please try again.