Sha256: b1c8cb39beb24c83f5b8f1555936bd1cc5a32c3d30139a611a36c0cd8bf37a5d

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require "mollie/api/client"
module Spree
  class Gateway::MolliePaysafecard < Gateway
    preference :partner_id, :string

    def provider_class
      ::Mollie::API::Client
    end

    def payment_source_class
      nil
    end

    def method_type
      "mollie"
    end

    def provider
      unless @mollie
        @mollie = ::Mollie::API::Client.new
        @mollie.setApiKey preferred_partner_id
      end
      return @mollie
    end

    def purchase(amount, express_checkout, gateway_options={})
      puts amount.inspect
      puts express_checkout.inspect
      puts gateway_options.inspect

      provider.payment.create(
        amount: amount,
        description: "TODO something here",
        method:     Mollie::API::Object::Method::PAYSAFECARD,
        redirectUrl: "TODO redirect url here"
      )
    end

    def cancel response

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_mollie-0.0.2 app/models/spree/gateway/mollie_paysafecard.rb