Sha256: 90c3a26126bc2a06125cd78415c202553e24dae9e51a2e58bc2c7598405d2a38
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Spree class MollieController < BaseController skip_before_action :verify_authenticity_token, :only => [:update_payment_status] # When the user is redirected from Mollie back to the shop, we can check the # mollie transaction status and set the Spree order state accordingly. def validate_payment order = Spree::Order.find_by_number(params[:order_number]) payment = order.payments.last mollie = Spree::PaymentMethod.find_by_type('Spree::Gateway::MollieGateway') mollie.update_payment_status(payment) redirect_to order.reload.paid? ? order_path(order) : checkout_state_path(:payment) end # Mollie might send us information about a transaction through the webhook. # We should update the payment state accordingly. def update_payment_status payment = Spree::Payment.find_by_response_code(params[:id]) mollie = Spree::PaymentMethod.find_by_type('Spree::Gateway::MollieGateway') mollie.update_payment_status(payment) render json: 'OK' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_mollie_gateway-0.1.1 | app/controllers/spree/mollie_controller.rb |
spree_mollie_gateway-0.1.0 | app/controllers/spree/mollie_controller.rb |