Class: Worldline::Connect::SDK::V1::Domain::TokenResponse

Inherits:
Domain::DataObject show all
Defined in:
lib/worldline/connect/sdk/v1/domain/token_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#cardWorldline::Connect::SDK::V1::Domain::TokenCard

Returns the current value of card.

Returns:



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def card
  @card
end

#e_walletWorldline::Connect::SDK::V1::Domain::TokenEWallet

Returns the current value of e_wallet.

Returns:



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def e_wallet
  @e_wallet
end

#idString

Returns the current value of id.

Returns:

  • (String)

    the current value of id



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def id
  @id
end

#non_sepa_direct_debitWorldline::Connect::SDK::V1::Domain::TokenNonSepaDirectDebit

Returns the current value of non_sepa_direct_debit.

Returns:



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def non_sepa_direct_debit
  @non_sepa_direct_debit
end

#original_payment_idString

Returns the current value of original_payment_id.

Returns:

  • (String)

    the current value of original_payment_id



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def original_payment_id
  @original_payment_id
end

#payment_product_idInteger

Returns the current value of payment_product_id.

Returns:

  • (Integer)

    the current value of payment_product_id



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def payment_product_id
  @payment_product_id
end

#sepa_direct_debitWorldline::Connect::SDK::V1::Domain::TokenSepaDirectDebit

Returns the current value of sepa_direct_debit.

Returns:



23
24
25
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 23

def sepa_direct_debit
  @sepa_direct_debit
end

Instance Method Details

#from_hash(hash) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 52

def from_hash(hash)
  super
  if hash.has_key? 'card'
    raise TypeError, "value '%s' is not a Hash" % [hash['card']] unless hash['card'].is_a? Hash
    @card = Worldline::Connect::SDK::V1::Domain::TokenCard.new_from_hash(hash['card'])
  end
  if hash.has_key? 'eWallet'
    raise TypeError, "value '%s' is not a Hash" % [hash['eWallet']] unless hash['eWallet'].is_a? Hash
    @e_wallet = Worldline::Connect::SDK::V1::Domain::TokenEWallet.new_from_hash(hash['eWallet'])
  end
  if hash.has_key? 'id'
    @id = hash['id']
  end
  if hash.has_key? 'nonSepaDirectDebit'
    raise TypeError, "value '%s' is not a Hash" % [hash['nonSepaDirectDebit']] unless hash['nonSepaDirectDebit'].is_a? Hash
    @non_sepa_direct_debit = Worldline::Connect::SDK::V1::Domain::TokenNonSepaDirectDebit.new_from_hash(hash['nonSepaDirectDebit'])
  end
  if hash.has_key? 'originalPaymentId'
    @original_payment_id = hash['originalPaymentId']
  end
  if hash.has_key? 'paymentProductId'
    @payment_product_id = hash['paymentProductId']
  end
  if hash.has_key? 'sepaDirectDebit'
    raise TypeError, "value '%s' is not a Hash" % [hash['sepaDirectDebit']] unless hash['sepaDirectDebit'].is_a? Hash
    @sepa_direct_debit = Worldline::Connect::SDK::V1::Domain::TokenSepaDirectDebit.new_from_hash(hash['sepaDirectDebit'])
  end
end

#to_hHash

Returns:

  • (Hash)


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/worldline/connect/sdk/v1/domain/token_response.rb', line 40

def to_h
  hash = super
  hash['card'] = @card.to_h unless @card.nil?
  hash['eWallet'] = @e_wallet.to_h unless @e_wallet.nil?
  hash['id'] = @id unless @id.nil?
  hash['nonSepaDirectDebit'] = @non_sepa_direct_debit.to_h unless @non_sepa_direct_debit.nil?
  hash['originalPaymentId'] = @original_payment_id unless @original_payment_id.nil?
  hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
  hash['sepaDirectDebit'] = @sepa_direct_debit.to_h unless @sepa_direct_debit.nil?
  hash
end