Class: DPay::PayoutDetails
- Inherits:
-
Object
- Object
- DPay::PayoutDetails
- Defined in:
- lib/dpay/payout/payout_details.rb,
sig/dpay/payout/payout_details.rbs
Instance Attribute Summary collapse
-
#creation_date ⇒ String?
readonly
Returns the value of attribute creation_date.
-
#decline_reason ⇒ String?
readonly
Returns the value of attribute decline_reason.
-
#decline_status ⇒ String?
readonly
Returns the value of attribute decline_status.
-
#fee ⇒ Money
readonly
Returns the value of attribute fee.
-
#gross ⇒ Money
readonly
Returns the value of attribute gross.
-
#id ⇒ Integer
readonly
Returns the value of attribute id.
-
#net ⇒ Money
readonly
Returns the value of attribute net.
-
#nrb ⇒ String?
readonly
Returns the value of attribute nrb.
-
#raw ⇒ Hash[String, untyped]
readonly
Returns the value of attribute raw.
-
#receiver ⇒ PayoutReceiver?
readonly
Returns the value of attribute receiver.
-
#state ⇒ Integer?
readonly
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #declined? ⇒ Boolean
- #direct_settlement? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(data) ⇒ PayoutDetails
constructor
A new instance of PayoutDetails.
- #processed? ⇒ Boolean
- #waiting? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ PayoutDetails
Returns a new instance of PayoutDetails.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dpay/payout/payout_details.rb', line 12 def initialize(data) @raw = data @id = Internal::Coerce.integer(data["id"]) @state = Internal::Coerce.optional_integer(data["state"]) @net = Internal::Coerce.money(data["net"]) @fee = Internal::Coerce.money(data["fee"]) @gross = Internal::Coerce.money(data["gross"]) @creation_date = data["creation_date"].is_a?(String) ? data["creation_date"] : nil @direct_settlement = Internal::Coerce.integer(data["direct_settlement"]) == 1 @nrb = data["nrb"].is_a?(String) ? data["nrb"] : nil @declined = Internal::Coerce.integer(data["declined"]) == 1 @decline_reason = data["decline_reason"].is_a?(String) ? data["decline_reason"] : nil @decline_status = data["decline_status"].is_a?(String) ? data["decline_status"] : nil @receiver = data["receiver"].is_a?(Hash) ? PayoutReceiver.from_api(data["receiver"]) : nil freeze end |
Instance Attribute Details
#creation_date ⇒ String? (readonly)
Returns the value of attribute creation_date.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def creation_date @creation_date end |
#decline_reason ⇒ String? (readonly)
Returns the value of attribute decline_reason.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def decline_reason @decline_reason end |
#decline_status ⇒ String? (readonly)
Returns the value of attribute decline_status.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def decline_status @decline_status end |
#fee ⇒ Money (readonly)
Returns the value of attribute fee.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def fee @fee end |
#gross ⇒ Money (readonly)
Returns the value of attribute gross.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def gross @gross end |
#id ⇒ Integer (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def id @id end |
#net ⇒ Money (readonly)
Returns the value of attribute net.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def net @net end |
#nrb ⇒ String? (readonly)
Returns the value of attribute nrb.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def nrb @nrb end |
#raw ⇒ Hash[String, untyped] (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def raw @raw end |
#receiver ⇒ PayoutReceiver? (readonly)
Returns the value of attribute receiver.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def receiver @receiver end |
#state ⇒ Integer? (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/dpay/payout/payout_details.rb', line 5 def state @state end |
Class Method Details
.from_api(data) ⇒ PayoutDetails
8 9 10 |
# File 'lib/dpay/payout/payout_details.rb', line 8 def self.from_api(data) new(data) end |
Instance Method Details
#declined? ⇒ Boolean
46 47 48 |
# File 'lib/dpay/payout/payout_details.rb', line 46 def declined? @declined end |
#direct_settlement? ⇒ Boolean
42 43 44 |
# File 'lib/dpay/payout/payout_details.rb', line 42 def direct_settlement? @direct_settlement end |
#failed? ⇒ Boolean
38 39 40 |
# File 'lib/dpay/payout/payout_details.rb', line 38 def failed? @state == -1 end |
#processed? ⇒ Boolean
34 35 36 |
# File 'lib/dpay/payout/payout_details.rb', line 34 def processed? @state == 1 end |
#waiting? ⇒ Boolean
29 30 31 32 |
# File 'lib/dpay/payout/payout_details.rb', line 29 def waiting? state = @state !state.nil? && state.zero? end |