Class: C2eCore::Drops::FinancialReportPaymentTypeDrop

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

Instance Method Summary collapse

Methods included from Helpers::FinancialReportConversions

#converted_price, #format_price

Constructor Details

#initialize(financial_report, payment_type, value, orders_count) ⇒ FinancialReportPaymentTypeDrop

Returns a new instance of FinancialReportPaymentTypeDrop.



8
9
10
11
12
13
14
# File '/build/app/mailers/c2e_core/drops/financial_report_payment_type_drop.rb', line 8

def initialize(financial_report, payment_type, value, orders_count)
  super()
  @financial_report = financial_report
  @payment_type = payment_type
  @value = value
  @orders_count = orders_count
end

Instance Method Details

#formatted_valueString

Returns - Total amount for this payment type converted to financial report’s currency and formatted. E.g.: "123,45 Kč".

Returns:

  • (String)
    • Total amount for this payment type converted to financial report’s currency and formatted.

    E.g.: "123,45 Kč".



32
33
34
# File '/build/app/mailers/c2e_core/drops/financial_report_payment_type_drop.rb', line 32

def formatted_value
  format_price @value
end

#orders_countInteger

Returns - Number of orders that have been paid by the current payment type. E.g.: 42.

Returns:

  • (Integer)
    • Number of orders that have been paid by the current payment type. E.g.: 42



37
38
39
# File '/build/app/mailers/c2e_core/drops/financial_report_payment_type_drop.rb', line 37

def orders_count
  @orders_count
end

#payment_typePaymentTypeDrop?

Returns - Payment type as drop object, if it is present.

Returns:

  • (PaymentTypeDrop, nil)
    • Payment type as drop object, if it is present.



17
18
19
20
21
22
23
# File '/build/app/mailers/c2e_core/drops/financial_report_payment_type_drop.rb', line 17

def payment_type
  stored_value __method__ do
    next if @payment_type.nil?

    PaymentTypeDrop.new @payment_type
  end
end

#valueFloat

Returns - Total amount for this payment type converted to financial report’s currency. E.g.: 78.

Returns:

  • (Float)
    • Total amount for this payment type converted to financial report’s currency. E.g.: 78



26
27
28
# File '/build/app/mailers/c2e_core/drops/financial_report_payment_type_drop.rb', line 26

def value
  @value
end