Sha256: 4a5c8528697cda0b1f086351618ac5fe3b94bba442c1c618f5b4ec6d32b4d0ad

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 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

3 entries across 3 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-1.0.0.beta2 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.beta1 lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb
solidus_paypal_commerce_platform-0.6.0 app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb