Sha256: 3ba55182ddb9e7bf71215d6cef8ddc000c5416ff80d00d35e2098a213fdefce0

Contents?: true

Size: 758 Bytes

Versions: 9

Compression:

Stored size: 758 Bytes

Contents

module Spree
  class PaymentMethod::PurchaseOrder < PaymentMethod
    def payment_source_class
      Spree::PurchaseOrder
    end

    def actions
      %w(complete void)
    end

    def can_complete?(payment)
      %w(checkout pending).include?(payment.state)
    end

    def can_void?(payment)
      payment.state != 'void'
    end

    def authorize(*args)
      ActiveMerchant::Billing::Response.new(true, 'Purchase Order: Success', {}, {})
    end

    def complete(*)
      ActiveMerchant::Billing::Response.new(true, 'Purchase Order: Success', {}, {})
    end

    def void(*args)
      ActiveMerchant::Billing::Response.new(true, '', {}, {})
    end

    def source_required?
      true
    end

    def auto_capture?
      false
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_purchase_order-3.2.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-3.1.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-3.0.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.4.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.3.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.2.0.beta2 app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.2.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.1.0.beta app/models/spree/payment_method/purchase_order.rb
spree_purchase_order-2.0.1 app/models/spree/payment_method/purchase_order.rb