georgschlenkhoff
georgschlenkhoff

Reputation: 105

Integration of activemerchant offsite payment Directebanking in Spree

I am about to integrate that activemerchant offsite payment method into spree: https://github.com/Shopify/offsite_payments/blob/master/lib/offsite_payments/integrations/directebanking.rb

I have created a Spree::Gateway class in app/models/gateway, so that I can configure the method in my admin panel:

class Spree::Gateway::Directebanking < Spree::Gateway
    preference :credential1, :string
    preference :credential2, :string
    preference :credential3, :string
    preference :credential4, :string

    def provider_class
        ActiveMerchant::Billing::Integrations::Directebanking
    end
end

Also I have added these lines to config/application.rb:

config.after_initialize do  
    Rails.configuration.spree.payment_methods << Spree::Gateway::SofortUeberweisung
end

However, now I am stuck with three things:

  1. I am not sure if I have added the correct preferences in the Spree::Gateway class. How do I find out which preferences I need to add for the directebanking module?

  2. What is the payment workflow? I get 'undefined method new' for ActiveMerchant::Billing::Integrations::Directebanking:Module' error if I try to check out with the payment method.

  3. How can I disable the default Javascript behaviour of showing credit card fields, such as name, credit card number, cvc, etc? I want the application to redirect to the Directebanking.service_url with click on 'Checkout'.

Upvotes: 2

Views: 647

Answers (1)

lulalala
lulalala

Reputation: 17981

Not really answering your question, but here you go.

offsite_payment gem was only recently extracted from ActiveMerchant. It is better for you to use ActiveMerchant only for now.

If you want to use offsite_payment, I think you should use the newly renamed classes:

def provider_class
    OffsitePayments::Integrations::Directebanking
end

Upvotes: 1

Related Questions