Sha256: 9be2670e955d83bd686914008eb76e61deab30059c210a5338a5b94232726967

Contents?: true

Size: 870 Bytes

Versions: 15

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

module SolidusNexio
  class CreditCardsController < BasePaymentController
    def create
      token = payment_method.store(credit_card_params)

      if token
        render json: { data: { token: token } }, status: 201
      else
        head 422
      end
    end

    private

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

Version data entries

15 entries across 15 versions & 1 rubygems

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