Sha256: 586c81df6b73f54e519488ea6926affa1bb8ccf27128d75f238081c1d52cfea4
Contents?: true
Size: 1.08 KB
Versions: 9
Compression:
Stored size: 1.08 KB
Contents
module Spree module CheckoutWithMollie # If we're currently in the checkout def update if payment_params_valid? && paying_with_mollie? if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env) payment = @order.payments.last payment.process! mollie_payment_url = payment.payment_source.payment_url MollieLogger.debug("For order #{@order.number} redirect user to payment URL: #{mollie_payment_url}") redirect_to mollie_payment_url else render :edit end else super end end end CheckoutController.class_eval do prepend CheckoutWithMollie private def payment_method_id_param params[:order][:payments_attributes].first[:payment_method_id] end def paying_with_mollie? payment_method = PaymentMethod.find(payment_method_id_param) payment_method.is_a? Gateway::MollieGateway end def payment_params_valid? (params[:state] === 'payment') && params[:order][:payments_attributes] end end end
Version data entries
9 entries across 9 versions & 1 rubygems