Sha256: 469bc91508dec7d4d68e1f6a98340831e489393e5f3b13f9c13c7c01e77bf0d2

Contents?: true

Size: 869 Bytes

Versions: 29

Compression:

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

29 entries across 29 versions & 1 rubygems

Version Path
solidus_nexio-1.0.1 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-1.0.0 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.12 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.11 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.10 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.9 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.8 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.7 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.6 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.5 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.4 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.3 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.1 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.7.0 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.9 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.8 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.7 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.6 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.5 app/controllers/solidus_nexio/credit_cards_controller.rb
solidus_nexio-0.6.4 app/controllers/solidus_nexio/credit_cards_controller.rb