Class: C2eCore::Drops::FinancialReportCreditTransferDrop

Inherits:
BaseDrop
  • Object
show all
Includes:
Helpers::FinancialReportConversions
Defined in:
/build/app/mailers/c2e_core/drops/financial_report_credit_transfer_drop.rb

Instance Method Summary collapse

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_transfersArray[FinancialReportPaymentTypeDrop]

Returns - Array of statistics on the balance of credit funds transfers grouped by payment method.

Returns:



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_valueString

Returns - Formatted sum of all credit funds transfers. E.g.: "123,45 Kč".

Returns:

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

Returns - Formatted sum of all refund credit funds transfers. E.g.: "123,45 Kč".

Returns:

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

Returns - Formatted sum of all top up credit funds transfers. E.g.: "123,45 Kč".

Returns:

  • (String)
    • 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_transfersArray[FinancialReportPaymentTypeDrop]

Returns - Array of refund credit funds transfer statistics grouped by payment method.

Returns:



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_transfersArray[FinancialReportPaymentTypeDrop]

Returns - Array of top up credit funds transfer statistics grouped by payment method.

Returns:



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_valueFloat

Returns - Sum of all credit funds transfers. E.g.: 78.

Returns:

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

Returns - The number of canceled refund transfers that belong to financial report. E.g.: 42.

Returns:

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

Returns - The number of refund credit funds transfers that belong to financial report. E.g.: 42.

Returns:

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

Returns - Sum of all refund credit funds transfers. E.g.: 78.

Returns:

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

Returns - The number of canceled top up transfers that belong to financial report. E.g.: 42.

Returns:

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

Returns - The number of top up credit funds transfers that belong to financial report. E.g.: 42.

Returns:

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

Returns - Sum of all top up credit funds transfers. E.g.: 78.

Returns:

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