Sha256: bf8a6ae4915ac2aa91a73d1eab46295117f9112791d86328a1a5bfd8555d6956

Contents?: true

Size: 583 Bytes

Versions: 9

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module SolidusPaypalCommercePlatform
  class PaypalOrdersController < ::Spree::Api::BaseController
    before_action :load_payment_method
    skip_before_action :authenticate_user

    def show
      authorize! :show, @order, order_token
      order_request = @payment_method.gateway.create_order(@order, @payment_method.auto_capture)

      render json: order_request, status: order_request.status_code
    end

    private

    def load_payment_method
      @payment_method = ::Spree::PaymentMethod.find(params[:payment_method_id])
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-0.5.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.4.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.3.2 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.3.1 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.3.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.2.2 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.2.1 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.2.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.1.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb