Class: C2eCore::Drops::FinancialReportCreditTransferDrop
- Inherits:
-
BaseDrop
- Object
- Liquid::Drop
- BaseDrop
- C2eCore::Drops::FinancialReportCreditTransferDrop
- Includes:
- Helpers::FinancialReportConversions
- Defined in:
- /build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb
Instance Method Summary collapse
-
#balance_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
-
Array of statistics on the balance of credit funds transfers grouped by payment method.
-
-
#formatted_total_balance_credit_funds_transfers_value ⇒ String
-
Formatted sum of all credit funds transfers.
-
-
#formatted_total_refund_value ⇒ String
-
Formatted sum of all refund credit funds transfers.
-
-
#formatted_total_top_up_value ⇒ String
-
Formatted sum of all top up credit funds transfers.
-
-
#initialize(financial_report) ⇒ FinancialReportCreditTransferDrop
constructor
A new instance of FinancialReportCreditTransferDrop.
-
#refund_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
-
Array of refund credit funds transfer statistics grouped by payment method.
-
-
#top_up_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
-
Array of top up credit funds transfer statistics grouped by payment method.
-
-
#total_balance_credit_funds_transfers_value ⇒ Float
-
Sum of all credit funds transfers.
-
-
#total_refund_storno_count ⇒ Integer
-
The number of canceled refund transfers that belong to financial report.
-
-
#total_refund_transfers_count ⇒ Integer
-
The number of refund credit funds transfers that belong to financial report.
-
-
#total_refund_value ⇒ Float
-
Sum of all refund credit funds transfers.
-
-
#total_top_up_storno_count ⇒ Integer
-
The number of canceled top up transfers that belong to financial report.
-
-
#total_top_up_transfers_count ⇒ Integer
-
The number of top up credit funds transfers that belong to financial report.
-
-
#total_top_up_value ⇒ Float
-
Sum of all top up credit funds transfers.
-
Methods included from Helpers::FinancialReportConversions
#converted_price, #format_price
Constructor Details
#initialize(financial_report) ⇒ FinancialReportCreditTransferDrop
Returns a new instance of FinancialReportCreditTransferDrop.
8 9 10 11 12 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 8 def initialize(financial_report) super() @financial_report = financial_report @payment_types = PaymentType.all.map { |pt| [pt.id, pt] }.to_h end |
Instance Method Details
#balance_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
Returns - Array of statistics on the balance of credit funds transfers grouped by payment method.
88 89 90 91 92 93 94 95 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 88 def balance_credit_funds_transfers @financial_report.balance_credit_funds_transfers(paid: true).map do |item| payment_type = @payment_types[item[:payment_type]] value = item.dig(:transfers_value, :value) orders_count = item.dig(:transfers_count) FinancialReportPaymentTypeDrop.new(@financial_report, payment_type, value, orders_count) end end |
#formatted_total_balance_credit_funds_transfers_value ⇒ String
Returns - Formatted sum of all credit funds transfers. E.g.: "123,45 Kč"
.
105 106 107 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 105 def formatted_total_balance_credit_funds_transfers_value format_price(total_balance_credit_funds_transfers_value) end |
#formatted_total_refund_value ⇒ String
Returns - Formatted sum of all refund credit funds transfers. E.g.: "123,45 Kč"
.
70 71 72 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 70 def formatted_total_refund_value format_price(total_refund_value) end |
#formatted_total_top_up_value ⇒ String
Returns - Formatted sum of all top up credit funds transfers. E.g.: "123,45 Kč"
.
35 36 37 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 35 def formatted_total_top_up_value format_price(total_top_up_value) end |
#refund_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
Returns - Array of refund credit funds transfer statistics grouped by payment method.
53 54 55 56 57 58 59 60 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 53 def refund_credit_funds_transfers @financial_report.refund_credit_funds_transfers(paid: true).map do |item| payment_type = @payment_types[item[:payment_type]] value = item.dig(:transfers_value, :value) orders_count = item.dig(:transfers_count) FinancialReportPaymentTypeDrop.new(@financial_report, payment_type, value, orders_count) end end |
#top_up_credit_funds_transfers ⇒ Array[FinancialReportPaymentTypeDrop]
Returns - Array of top up credit funds transfer statistics grouped by payment method.
18 19 20 21 22 23 24 25 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 18 def top_up_credit_funds_transfers @financial_report.top_up_credit_funds_transfers(paid: true).map do |item| payment_type = @payment_types[item[:payment_type]] value = item.dig(:transfers_value, :value) orders_count = item.dig(:transfers_count) FinancialReportPaymentTypeDrop.new(@financial_report, payment_type, value, orders_count) end end |
#total_balance_credit_funds_transfers_value ⇒ Float
Returns - Sum of all credit funds transfers. E.g.: 78.
98 99 100 101 102 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 98 def total_balance_credit_funds_transfers_value stored_value __method__ do @financial_report.total_balance_credit_funds_transfers_value[:value] end end |
#total_refund_storno_count ⇒ Integer
Returns - The number of canceled refund transfers that belong to financial report. E.g.: 42.
80 81 82 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 80 def total_refund_storno_count @financial_report.total_refund_storno_count end |
#total_refund_transfers_count ⇒ Integer
Returns - The number of refund credit funds transfers that belong to financial report. E.g.: 42.
75 76 77 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 75 def total_refund_transfers_count @financial_report.total_refund_transfers_count end |
#total_refund_value ⇒ Float
Returns - Sum of all refund credit funds transfers. E.g.: 78.
63 64 65 66 67 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 63 def total_refund_value stored_value __method__ do @financial_report.total_refund_value[:value] end end |
#total_top_up_storno_count ⇒ Integer
Returns - The number of canceled top up transfers that belong to financial report. E.g.: 42.
45 46 47 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 45 def total_top_up_storno_count @financial_report.total_top_up_storno_count end |
#total_top_up_transfers_count ⇒ Integer
Returns - The number of top up credit funds transfers that belong to financial report. E.g.: 42.
40 41 42 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 40 def total_top_up_transfers_count @financial_report.total_top_up_transfers_count end |
#total_top_up_value ⇒ Float
Returns - Sum of all top up credit funds transfers. E.g.: 78.
28 29 30 31 32 |
# File '/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb', line 28 def total_top_up_value stored_value __method__ do @financial_report.total_top_up_value[:value] end end |