Sha256: f6e0e536b688ad084dc7f9b099d1e399dfef597bd701a117652d9f6685233ffb

Contents?: true

Size: 1.09 KB

Versions: 45

Compression:

Stored size: 1.09 KB

Contents

module Effective
  module Providers
    module MarkAsPaid
      extend ActiveSupport::Concern

      def mark_as_paid
        raise('mark_as_paid provider is not available') unless EffectiveOrders.mark_as_paid?

        @order ||= Order.find(params[:id])

        EffectiveResources.authorize!(self, :update, @order)
        EffectiveResources.authorize!(self, :admin, :effective_orders)

        @order.assign_attributes(mark_as_paid_params.except(:payment, :payment_provider, :payment_card))

        order_purchased(
          payment: mark_as_paid_params[:payment],
          provider: mark_as_paid_params[:payment_provider],
          card: mark_as_paid_params[:payment_card],
          email: @order.send_mark_as_paid_email_to_buyer?,
          skip_buyer_validations: true,
          purchased_url: effective_orders.admin_order_path(@order)
        )
      end

      def mark_as_paid_params
        params.require(:effective_order).permit(
          :purchased_at, :payment, :payment_provider, :payment_card,
          :note_to_buyer, :send_mark_as_paid_email_to_buyer
        )
      end

    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
effective_orders-5.4.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.4.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.4.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.3.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.3.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.3.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.17 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.16 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.15 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.14 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.13 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.12 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.11 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.10 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.9 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.8 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.7 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.6 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.5 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-5.2.4 app/controllers/effective/providers/mark_as_paid.rb