Class: SixSaferpay::RequestPaymentMeans

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/request_payment_means.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card: nil, bank_account: nil, fd_alias: nil, saferpay_fields: nil) ⇒ RequestPaymentMeans

Returns a new instance of RequestPaymentMeans.



10
11
12
13
14
15
16
17
18
19
# File 'lib/six_saferpay/models/request_payment_means.rb', line 10

def initialize(card: nil,
               bank_account: nil,
               fd_alias: nil,
               saferpay_fields: nil
              )
  @card = SixSaferpay::RequestCard.new(**card.to_h) if card
  @bank_account = SixSaferpay::BankAccount.new(**.to_h) if 
  @fd_alias = SixSaferpay::PaymentMeansAlias.new(**fd_alias.to_h) if fd_alias
  @saferpay_fields = SixSaferpay::SaferpayFields.new(**saferpay_fields.to_h) if saferpay_fields
end

Instance Attribute Details

#bank_accountObject

Returns the value of attribute bank_account.



4
5
6
# File 'lib/six_saferpay/models/request_payment_means.rb', line 4

def 
  @bank_account
end

#cardObject

Returns the value of attribute card.



4
5
6
# File 'lib/six_saferpay/models/request_payment_means.rb', line 4

def card
  @card
end

#fd_aliasObject

Returns the value of attribute fd_alias.



4
5
6
# File 'lib/six_saferpay/models/request_payment_means.rb', line 4

def fd_alias
  @fd_alias
end

#saferpay_fieldsObject

Returns the value of attribute saferpay_fields.



4
5
6
# File 'lib/six_saferpay/models/request_payment_means.rb', line 4

def saferpay_fields
  @saferpay_fields
end

Instance Method Details

#to_hashObject Also known as: to_h



21
22
23
24
25
26
27
28
# File 'lib/six_saferpay/models/request_payment_means.rb', line 21

def to_hash
  hash = Hash.new
  hash.merge!(card: @card.to_h) if @card
  hash.merge!(bank_account: @bank_account.to_h) if @bank_account
  hash.merge!(fd_alias: @fd_alias.to_h) if @fd_alias
  hash.merge!(saferpay_fields: @saferpay_fields.to_h) if @saferpay_fields
  hash
end