Sha256: e8ab510c7913424c99037aee39c5a6c3808bdcd55111aaaa8e824e3e03208519

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

module Effective
  module Providers
    module MarkAsPaid
      extend ActiveSupport::Concern

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

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

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

        order_purchased(
          details: 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: params[:purchased_url].presence || effective_orders.admin_order_path(@order),
          declined_url: params[:declined_url].presence || effective_orders.admin_order_path(@order)
        )
      end

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

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
effective_orders-3.2.3 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.2.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.2.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.2.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.1.7 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.1.6 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.1.4 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.1.3 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.1.0 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.0.4 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.0.3 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.0.2 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-4.0.0beta1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.0.1 app/controllers/effective/providers/mark_as_paid.rb
effective_orders-3.0.0 app/controllers/effective/providers/mark_as_paid.rb