Sha256: 696da92c69c290c4b891a0e5ecfc800660058c1da27045f14e0d25fce2c79634

Contents?: true

Size: 1.16 KB

Versions: 24

Compression:

Stored size: 1.16 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_provider, :payment_card))

        order_purchased(
          payment: 'mark as paid',
          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),
          current_user: nil # Admin action, we don't want to assign current_user to the order
        )
      end

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

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
effective_orders-6.9.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.9.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.9.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.8.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.8.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.8.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.7.3 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.7.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.7.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.7.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.6.3 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.6.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.6.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.6.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.9 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.8 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.7 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.6 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.5 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-6.5.4 app/controllers/effective/providers/mark_as_paid.rb