Sha256: 1993473217c4e3915312a6f05615ab9eb4477349acf24cc1469c209d7caabc47

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

# typed: strict
# frozen_string_literal: true

module EML
  module UK
    class Payload
      module Card
        class Unload < ::EML::UK::Payload
          REQUIRED_CONFIG =
            T.let(%i[merchant_group].freeze, T::Array[Symbol])
          REQUIRED_VALUES =
            T.let(%i[amount location.country note].freeze, T::Array[Symbol])

          sig { params(payload: T::Hash[Symbol, T.untyped]).void }
          def initialize(payload)
            super

            @location = T.let(nil, T.nilable(EML::UK::Payload::Location))
          end

          private

          sig { returns(T.nilable(Numeric)) }
          attr_accessor :amount

          # While client_time is sent to EML as a JSON DateTime, there are many
          # classes that could be used which causes a typing challenge. For
          # example, if Rails is in use, we will probably receive a
          # ActiveSupport::TimeWithZone
          sig { returns(T.nilable(T.untyped)) }
          attr_accessor :client_time

          sig { params(location: T::Hash[T.untyped, T.untyped]).void }
          def location=(location)
            @location = EML::UK::Payload::Location.new(location)
          end

          sig { returns(T.nilable(String)) }
          attr_accessor :merchant_group

          sig { returns(T.nilable(String)) }
          attr_accessor :note
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eml-3.0.0 lib/eml/uk/payload/card/unload.rb
eml-2.2.0 lib/eml/uk/payload/card/unload.rb