Sha256: 749b15edfa771fd279f05f026f8dba52ab92ec812ae6513095b14b4d5c3b0497
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Payments class BaseController < ApplicationController include ActiveMerchant::Billing::Integrations layout 'payments' # skip before filter if you chosen POST request for callbacks skip_before_action :verify_authenticity_token prepend_before_action :reset_cache, :set_account before_action :find_payment_type before_action :find_payment, only: [:new] respond_to :html protected def find_payment @payment = if params[:token].present? begin TranslationCms::Api::Payment.find(URI.encode(params[:token])).first rescue JsonApiClient::Errors::ApiError nil end end raise ActiveRecord::RecordNotFound, "Payment #{params[:token]} not found" if @payment.nil? end def find_payment_type type_code = params[:provider].to_sym @payment_type = PaymentType.visible.detect { |t| t.code == type_code } raise ActiveRecord::RecordNotFound, "Payment type #{params[:provider]} not found" if @payment_type.nil? end def find_structure(slug) @structure = Structure.with_type(StructureType.page).where(slug: slug).first end def set_account @account = current_account end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/controllers/payments/base_controller.rb |