Sha256: cb01d157ac989a27e99f46f08e553c5474e706f1865d487551ff30c075d2bb0b

Contents?: true

Size: 973 Bytes

Versions: 9

Compression:

Stored size: 973 Bytes

Contents

module Effective
  module Providers
    module AppCheckout
      extend ActiveSupport::Concern

      included do
        if defined?(CanCan)
          skip_authorization_check only: [:app_checkout]
        end
      end

      def app_checkout
        @order = Order.find(params[:id])
        checkout = EffectiveOrders.app_checkout[:service].call(order: @order)
        if checkout.success?
          order_purchased(details: payment_details(checkout), provider: 'app_checkout', card: 'none')
        else
          flash = EffectiveOrders.app_checkout[:declined_flash]
          order_declined(details: payment_details(checkout), message: flash, provider: 'app_checkout', card: 'none')
        end
      end

      private

      def payment_details(checkout)
        default = 'App Checkout'
        if checkout.respond_to?(:payment_details)
          checkout.payment_details.presence || default
        else
          default
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
effective_orders-2.1.6 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.5 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.4 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.3 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.2 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.1 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.1.0 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.0.1 app/controllers/effective/providers/app_checkout.rb
effective_orders-2.0.0 app/controllers/effective/providers/app_checkout.rb