Sha256: 45e4259df6b5e8dcd4ee4df3d9bf5ff2fa40a5f40eedba4e146857eaa5d4bbb0

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

module ActiveMerchant
  module Billing
    class EncryptedNexioCard < CreditCard
      attr_accessor :encrypted_number, :own_form, :one_time_token

      attr_reader :brand

      def short_year
        year % 100 if year
      end

      private

      def validate_card_brand_and_number
        errors = []

        if empty?(brand)
          errors << [:brand, 'is required'] if own_form
        elsif !self.class.card_companies.include?(brand)
          errors << [:brand, 'is invalid']
        end

        errors << [:encrypted_number, 'is required'] if empty?(encrypted_number)

        errors
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nexio_activemerchant-0.2.3 lib/active_merchant/billing/encrypted_nexio_card.rb
nexio_activemerchant-0.2.2 lib/active_merchant/billing/encrypted_nexio_card.rb