Sha256: d5994d3f7e6ddc978b3b3a0dbef52c2e2ba2e71da5e0af557d5734d9f9f028d6

Contents?: true

Size: 592 Bytes

Versions: 7

Compression:

Stored size: 592 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.require(:payment_method_id))
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-1.0.3 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-1.0.2 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.7.1 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-1.0.1 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-1.0.0 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.7.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-1.0.0.beta3 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb