Sha256: b2d2fc60516af791326faf833c2aee8ac829a7f3703fa5a512d212d7a337ab36

Contents?: true

Size: 772 Bytes

Versions: 17

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

module SolidusNexio
  class OneTimeTokensController < BasePaymentController
    def create
      result = payment_method.generate_token(one_time_token_params)
      if result
        render json: { data: result }, status: 201
      else
        head 422
      end
    end

    private

    def one_time_token_params
      params.require(:data).permit(:currency,
                                   address: %i[address1 address2 city country phone zip state],
                                   billing_address: %i[address1 address2 city country phone zip state],
                                   customer: %i[first_name last_name email],
                                   order: %i[number date]).to_h.deep_symbolize_keys
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
solidus_nexio-0.4.5 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.4.4 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.4.3 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.4.2 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.4.1 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.4.0 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.3.5 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.3.4 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.3.3 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.3.2 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.3.0 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.2.3 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.2.2 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.2.1 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.2.0 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.1.1 app/controllers/solidus_nexio/one_time_tokens_controller.rb
solidus_nexio-0.1.0 app/controllers/solidus_nexio/one_time_tokens_controller.rb