Class: Zaala::API::Token

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/zaala/api/types.rb

Overview

Contains token information for authorizations with payment method ONACCOUNT.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_message(h) ⇒ Object



447
448
449
450
451
452
453
# File 'lib/zaala/api/types.rb', line 447

def self.from_message(h)
  Token.new({
    id: h[:tokenId],
    secret: h[:tokenSecret],
    expiry_date: h[:tokenExpiryDate],
  })
end

Instance Method Details

#to_messageObject



455
456
457
458
459
460
461
462
# File 'lib/zaala/api/types.rb', line 455

def to_message
  m = {
    tokenId: id,
    tokenSecret: secret,
  }
  m[:tokenExpiryDate] = expiry_date unless expiry_date.nil?
  m
end