Sha256: a1ca66e369e78bf31d7943cfaca0ee925f50a101e87b99bc3daf3f7617fe19a2
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
module Spree module CashOnDelivery class PaymentMethod < Spree::PaymentMethod def payment_profiles_supported? false # we want to show the confirm step. end def create_adjustment(payment) adjustment = Spree::Adjustment.create( amount: Spree::CashOnDelivery::Config.charge.to_f, order: payment.order, adjustable: payment.order, source: self, :mandatory => true, :included => true, label: "Cash On Delivery Fee" ) payment.order.adjustments << adjustment payment.update_attribute(:amount, payment.amount + Spree::CashOnDelivery::Config.charge.to_f) payment.order.updater.update_adjustment_total payment.order.updater.update_order_total payment.order.persist_totals # end end def authorize(*args) ActiveMerchant::Billing::Response.new(true, "", {}, {}) end def capture(payment, source, gateway_options) ActiveMerchant::Billing::Response.new(true, "", {}, {}) end def void(*args) ActiveMerchant::Billing::Response.new(true, "", {}, {}) end def actions %w{capture void} end def can_capture?(payment) payment.state == 'pending' || payment.state == 'checkout' end def can_void?(payment) payment.state != 'void' end def source_required? false end #def provider_class # self.class #end def payment_source_class nil end def method_type 'cash_on_delivery' end def auto_capture? true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_pay_cash_on_delivery-0.1.1 | app/models/spree/cash_on_delivery/payment_method.rb |
spree_pay_cash_on_delivery-0.1.0 | app/models/spree/cash_on_delivery/payment_method.rb |