Sha256: 13b2dee00a0bbbed4c877878184ab96b9df2bccee277484c5e1c22887b46be2a
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
Spree::Order.class_eval do money_methods :order_adjustment_total, :shipping_discount # Make sure the order confirmation is delivered when the order has been paid for. def finalize! # lock all adjustments (coupon promotions, etc.) all_adjustments.each(&:close) # update payment and shipment(s) states, and save updater.update_payment_state shipments.each do |shipment| shipment.update!(self) shipment.finalize! if paid? || authorized? end updater.update_shipment_state save! updater.run_hooks touch :completed_at if !confirmation_delivered? && (paid? || authorized?) deliver_order_confirmation_email end consider_risk end def is_paid_with_mollie? payments.any? && payments.last&.payment_method&.type == 'Spree::Gateway::MollieGateway' end def send_confirmation_email! if !confirmation_delivered? && (paid? || authorized?) deliver_order_confirmation_email end end def mollie_order Spree::Mollie::Order.new(self) end def successful_payment paid? || payments.any? {|p| p.after_pay_method? && p.authorized?} end alias paid_or_authorized? successful_payment def authorized? payments.last.authorized? end def order_adjustment_total adjustments.eligible.sum(:amount) end def has_order_adjustments? order_adjustment_total.abs > 0 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_mollie_gateway-3.2.1 | app/models/spree/order_decorator.rb |