Sha256: 42cf0136dca56c74e4505c4d5a6d936994db6445ba9f2539f1b61706e71b67d9

Contents?: true

Size: 966 Bytes

Versions: 5

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

module IssuerResponseCodes
  # 3D Secure reject reason code.
  class TdsCode < Code
    # @return [String]
    def humanize
      "#{reason} #{behaviour}"
    end

    alias description humanize

    # @return [String]
    def reason
      LOCALE_LIBRARY[
        path: id,
        scope: "tds_status_codes.targeted.#{target}",
        locale: locale,
        default: :unknown
      ]
    end

    # @return [String]
    def behaviour
      behaviour_str = LOCALE_LIBRARY[
        path: id,
        scope: 'tds_status_codes.behaviour',
        locale: locale,
        default: :unknown
      ]

      return behaviour_str unless fraud_notice && fraudulent_code?

      "#{behaviour_str} #{LOCALE_LIBRARY[path: 'tds_status_codes.fraud_notice']}"
    end

    # @return [Boolean]
    def fraudulent_code?
      @fraudulent_code ||= LOCALE_LIBRARY[path: id, scope: 'tds_status_codes.fraudulent_codes', locale: locale]
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
issuer_response_codes-0.3.4 lib/issuer_response_codes/tds_code.rb
issuer_response_codes-0.3.3 lib/issuer_response_codes/tds_code.rb
issuer_response_codes-0.3.2 lib/issuer_response_codes/tds_code.rb
issuer_response_codes-0.3.1 lib/issuer_response_codes/tds_code.rb
issuer_response_codes-0.3.0 lib/issuer_response_codes/tds_code.rb