Skip to content

Instantly share code, notes, and snippets.

@marothstein
Created January 6, 2014 22:14
Show Gist options
  • Save marothstein/8290758 to your computer and use it in GitHub Desktop.
Save marothstein/8290758 to your computer and use it in GitHub Desktop.
SlidePay Gateway
module SpreeGateway
class Engine < Rails::Engine
engine_name 'spree_gateway'
config.autoload_paths += %W(#{config.root}/lib)
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app|
app.config.spree.payment_methods << Spree::Gateway::AuthorizeNetCim
app.config.spree.payment_methods << Spree::Gateway::AuthorizeNet
app.config.spree.payment_methods << Spree::Gateway::CardSave
app.config.spree.payment_methods << Spree::Gateway::Eway
app.config.spree.payment_methods << Spree::Gateway::Fatzebra
app.config.spree.payment_methods << Spree::Gateway::Linkpoint
app.config.spree.payment_methods << Spree::Gateway::Moneris
app.config.spree.payment_methods << Spree::Gateway::PayJunction
app.config.spree.payment_methods << Spree::Gateway::PayPalGateway
app.config.spree.payment_methods << Spree::Gateway::SagePay
app.config.spree.payment_methods << Spree::Gateway::Beanstream
app.config.spree.payment_methods << Spree::Gateway::BraintreeGateway
app.config.spree.payment_methods << Spree::Gateway::StripeGateway
app.config.spree.payment_methods << Spree::Gateway::Samurai
app.config.spree.payment_methods << Spree::Gateway::Worldpay
app.config.spree.payment_methods << Spree::Gateway::Banwire
app.config.spree.payment_methods << Spree::Gateway::UsaEpay
app.config.spree.payment_methods << Spree::BillingIntegration::Skrill::QuickCheckout
app.config.spree.payment_methods << Spree::Gateway::BalancedGateway
app.config.spree.payment_methods << Spree::Gateway::DataCash
app.config.spree.payment_methods << Spree::Gateway::UsaEpay
app.config.spree.payment_methods << Spree::Gateway::PinGateway
app.config.spree.payment_methods << Spree::Gateway::Paymill
app.config.spree.payment_methods << Spree::Gateway::PayflowPro
app.config.spree.payment_methods << Spree::Gateway::SecurePayAU
app.config.spree.payment_methods << Spree::Gateway::SlidepayGateway
end
end
end
module Spree
class Gateway::SlidepayGateway < Gateway
preference :token, :string
preference :api_key, :string
preference :endpoint, :string
def provider_class
ActiveMerchant::Billing::SlidepayGateway
end
def purchase(money, creditcard, gateway_options)
provider.purchase(money, creditcard, gateway_options)
end
def authorize(money, creditcard, gateway_options)
provider.authorize(money, creditcard, gateway_options)
end
# def capture(payment, creditcard, gateway_options)
# provider.capture(payment.id, gateway_options)
# end
# def credit(money, creditcard, response_code, gateway_options)
# provider.refund(money, response_code, {})
# end
# def void(response_code, creditcard, gateway_options)
# provider.void(response_code, {})
# end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment