Sha256: 8a586ae40f8c16fca75f0ef7bf9ed57a493c7e07c7de19ae5ff6d8fb765e54a7

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

module Spree
  class MollieTransaction < Spree::Base
    belongs_to :payment_method
    has_many :payment, as: :source

    def actions
      []
    end

    def method_type
      'mollie_transaction'
    end

    def name
      case payment_method_name
        when ::Mollie::Method::IDEAL then
          'iDEAL'
        when ::Mollie::Method::CREDITCARD then
          'Credit card'
        when ::Mollie::Method::MISTERCASH then
          'Bancontact'
        when ::Mollie::Method::SOFORT then
          'SOFORT Banking'
        when ::Mollie::Method::BANKTRANSFER then
          'Bank transfer'
        when ::Mollie::Method::BITCOIN then
          'Bitcoin'
        when ::Mollie::Method::PAYPAL then
          'PayPal'
        when ::Mollie::Method::KBC then
          'KBC/CBC Payment Button'
        when ::Mollie::Method::BELFIUS then
          'Belfius Pay Button'
        when ::Mollie::Method::PAYSAFECARD then
          'paysafecard'
        when ::Mollie::Method::PODIUMCADEAUKAART then
          'Podium Cadeaukaart'
        when ::Mollie::Method::GIFTCARD then
          'Giftcard'
        when ::Mollie::Method::INGHOMEPAY then
          'ING Home\'Pay'
        else
          'Mollie'
      end
    end

    def details
      api_key = payment_method.get_preference(:api_key)
      mollie_payment = ::Mollie::Payment.get(payment_id, api_key: api_key)
      mollie_payment.attributes
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_mollie_gateway-0.1.1 app/models/spree/mollie_transaction.rb
spree_mollie_gateway-0.1.0 app/models/spree/mollie_transaction.rb