Class: C2eCore::Drops::CreditsFundsTransferDrop
- Includes:
- ActionView::Helpers::NumberHelper
- Defined in:
- /build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb
Instance Method Summary collapse
-
#amount ⇒ Float
-
The transferred amount, e.g.
-
-
#cash_box ⇒ CashBoxDrop?
-
The cash register where the transfer was performed as a drop object, if present.
-
-
#company_branch ⇒ CompanyBranchDrop
-
Company branch to which the funds transfer belongs as a drop object.
-
-
#currency ⇒ CurrencyDrop
-
The currency to which the funds transfer belongs to as a drop object.
-
-
#data_from_terminal ⇒ String?
-
Data from the terminal about the last successful transaction related to the transfer, if present.
-
-
#formatted_amount ⇒ String
-
The transferred amount formatted in its currency, e.g.
-
-
#id ⇒ Integer
-
ID of the funds transfer in the database.
-
-
#initialize(funds_transfer) ⇒ CreditsFundsTransferDrop
constructor
A new instance of CreditsFundsTransferDrop.
-
#order ⇒ OrderDrop?
-
The order the transfer is associate with as a drop object, if present.
-
-
#payment_method ⇒ PaymentMethodDrop?
-
The funds transfer payment method as a drop object, if present.
-
-
#user ⇒ UserDrop
-
The user who created funds transfer as a drop object.
-
-
#wallet ⇒ CreditsWalletDrop?
-
The wallet to which the funds transfer belongs to as a drop object, if present.
-
Constructor Details
#initialize(funds_transfer) ⇒ CreditsFundsTransferDrop
Returns a new instance of CreditsFundsTransferDrop.
8 9 10 11 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 8 def initialize(funds_transfer) super() @funds_transfer = funds_transfer end |
Instance Method Details
#amount ⇒ Float
Returns - The transferred amount, e.g. 123.45
or -67.89
.
43 44 45 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 43 def amount @funds_transfer.amount end |
#cash_box ⇒ CashBoxDrop?
Returns - The cash register where the transfer was performed as a drop object, if present.
70 71 72 73 74 75 76 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 70 def cash_box stored_value __method__ do next if @funds_transfer.cash_box.nil? CashBoxDrop.new(@funds_transfer.cash_box) end end |
#company_branch ⇒ CompanyBranchDrop
Returns - Company branch to which the funds transfer belongs as a drop object.
26 27 28 29 30 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 26 def company_branch stored_value __method__ do CompanyBranchDrop.new(@funds_transfer.company_branch) end end |
#currency ⇒ CurrencyDrop
Returns - The currency to which the funds transfer belongs to as a drop object.
54 55 56 57 58 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 54 def currency stored_value __method__ do CurrencyDrop.new @funds_transfer.currency end end |
#data_from_terminal ⇒ String?
Returns - Data from the terminal about the last successful transaction related to the transfer, if present.
89 90 91 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 89 def data_from_terminal @funds_transfer.terminal_transaction_records.successful.last&.data end |
#formatted_amount ⇒ String
Returns - The transferred amount formatted in its currency, e.g. "123,45 Kč"
or "-67,89 Kč"
.
49 50 51 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 49 def formatted_amount number_to_currency(amount, unit: @funds_transfer.currency.to_s) end |
#id ⇒ Integer
Returns - ID of the funds transfer in the database.
14 15 16 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 14 def id @funds_transfer.id end |
#order ⇒ OrderDrop?
Returns - The order the transfer is associate with as a drop object, if present.
79 80 81 82 83 84 85 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 79 def order stored_value __method__ do next if @funds_transfer.order.nil? OrderDrop.new(@funds_transfer.order) end end |
#payment_method ⇒ PaymentMethodDrop?
Returns - The funds transfer payment method as a drop object, if present.
61 62 63 64 65 66 67 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 61 def payment_method stored_value __method__ do next if @funds_transfer.payment_method.nil? PaymentMethodDrop.new(@funds_transfer.payment_method) end end |
#user ⇒ UserDrop
Returns - The user who created funds transfer as a drop object.
19 20 21 22 23 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 19 def user stored_value __method__ do UserDrop.new(@funds_transfer.user) end end |
#wallet ⇒ CreditsWalletDrop?
Returns - The wallet to which the funds transfer belongs to as a drop object, if present.
34 35 36 37 38 39 40 |
# File '/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb', line 34 def wallet stored_value __method__ do next if @funds_transfer.wallet.nil? CreditsWalletDrop.new(@funds_transfer.wallet) end end |