Class: C2eCore::Drops::CreditsFundsTransferDrop

Inherits:
BaseDrop
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
/build/app/mailers/c2e_core/drops/credits_funds_transfer_drop.rb

Instance Method Summary collapse

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

#amountFloat

Returns - The transferred amount, e.g. 123.45 or -67.89.

Returns:

  • (Float)
    • 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_boxCashBoxDrop?

Returns - The cash register where the transfer was performed as a drop object, if present.

Returns:

  • (CashBoxDrop, nil)
    • 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_branchCompanyBranchDrop

Returns - Company branch to which the funds transfer belongs as a drop object.

Returns:

  • (CompanyBranchDrop)
    • 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

#currencyCurrencyDrop

Returns - The currency to which the funds transfer belongs to as a drop object.

Returns:

  • (CurrencyDrop)
    • 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_terminalString?

Returns - Data from the terminal about the last successful transaction related to the transfer, if present.

Returns:

  • (String, nil)
    • 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_amountString

Returns - The transferred amount formatted in its currency, e.g. "123,45 Kč" or "-67,89 Kč".

Returns:

  • (String)
    • 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

#idInteger

Returns - ID of the funds transfer in the database.

Returns:

  • (Integer)
    • 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

#orderOrderDrop?

Returns - The order the transfer is associate with as a drop object, if present.

Returns:

  • (OrderDrop, nil)
    • 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_methodPaymentMethodDrop?

Returns - The funds transfer payment method as a drop object, if present.

Returns:

  • (PaymentMethodDrop, nil)
    • 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

#userUserDrop

Returns - The user who created funds transfer as a drop object.

Returns:

  • (UserDrop)
    • 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

#walletCreditsWalletDrop?

Returns - The wallet to which the funds transfer belongs to as a drop object, if present.

Returns:

  • (CreditsWalletDrop, nil)
    • 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