Sha256: bd7d257bcb6c3f584fa7df46e53ead9a2ede7f7bc7c108571ce25bed9b79de28

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

module Spree::Payment::ProcessingDecorator
  
  def process!
    if payment_method.is_a? Spree::Gateway::MollieGateway
      process_with_mollie
    else
      super
    end
  end

  def cancel!
    if payment_method.is_a? Spree::Gateway::MollieGateway
      cancel_with_mollie
    else
      super
    end
  end

  private

  def cancel_with_mollie
    response = payment_method.cancel(transaction_id)
    handle_response(response, :void, :failure)
  end

  def process_with_mollie
    amount ||= money.money
    started_processing!
    response = payment_method.process(
      amount,
      source,
      gateway_options
    )
    handle_response(response, :started_processing, :failure)
  end
end

Spree::Payment.include(Spree::Payment::ProcessingDecorator)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_mollie_gateway-4.0.1 app/models/spree/payment/processing_decorator.rb
spree_mollie_gateway-4.0.0 app/models/spree/payment/processing_decorator.rb