Skip to content

Instantly share code, notes, and snippets.

@justinxreese
Created February 26, 2013 20:54
Show Gist options
  • Save justinxreese/5042085 to your computer and use it in GitHub Desktop.
Save justinxreese/5042085 to your computer and use it in GitHub Desktop.
spree setup
module Spree
class PaymentMethod::Accpac < PaymentMethod
attr_accessible :preferred_client_id, :preferred_client_secret
#preference :client_id, :integer
#preference :client_secret, :string
def payment_profiles_supported?
false
end
def actions
%w{capture void}
end
# Indicates whether its possible to capture the payment
def can_capture?(payment)
['checkout', 'pending'].include?(payment.state)
end
# Indicates whether its possible to void the payment.
def can_void?(payment)
payment.state != 'void'
end
def capture(*args)
ActiveMerchant::Billing::Response.new(true, "", {}, {})
end
def void(*args)
ActiveMerchant::Billing::Response.new(true, "", {}, {})
end
end
end
# Configure Spree Preferences
#
# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
# If you would like users to be able to update a setting with the Admin it should NOT be set here.
#
# In order to initialize a setting do:
# config.setting_name = 'new value'
Spree.config do |config|
# Example:
# Uncomment to override the default site name.
# config.site_name = "Spree Demo Site"
end
Spree.user_class = "Spree::User"
Rails.application.config.spree.payment_methods = [Spree::PaymentMethod::Accpac]
require 'pry'; binding.pry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment