Class: DPay::PayoutPosition

Inherits:
Object
  • Object
show all
Defined in:
lib/dpay/payment/payout_position.rb,
sig/dpay/payment/payout_position.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iban, title, amount) ⇒ PayoutPosition

Returns a new instance of PayoutPosition.

Parameters:

  • iban (String)
  • title (String)
  • amount (Money)

Raises:



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dpay/payment/payout_position.rb', line 7

def initialize(iban, title, amount)
  raise InvalidArgumentError, "Payout IBAN must not be empty" unless iban.is_a?(String) && !iban.empty?
  unless title.is_a?(String) && !title.empty? && title.length <= 255
    raise InvalidArgumentError, "Payout title must be 1-255 characters"
  end

  @iban = iban
  @title = title
  @amount = amount
  freeze
end

Instance Attribute Details

#amountMoney (readonly)

Returns the value of attribute amount.

Returns:



5
6
7
# File 'lib/dpay/payment/payout_position.rb', line 5

def amount
  @amount
end

#ibanString (readonly)

Returns the value of attribute iban.

Returns:

  • (String)


5
6
7
# File 'lib/dpay/payment/payout_position.rb', line 5

def iban
  @iban
end

#titleString (readonly)

Returns the value of attribute title.

Returns:

  • (String)


5
6
7
# File 'lib/dpay/payment/payout_position.rb', line 5

def title
  @title
end

Instance Method Details

#to_hHash[String, untyped]

Returns:

  • (Hash[String, untyped])


19
20
21
# File 'lib/dpay/payment/payout_position.rb', line 19

def to_h
  { "iban" => @iban, "title" => @title, "amount" => @amount.to_decimal.to_f }
end