Class: Liquid::InvoiceDrop
- Inherits:
-
Drop
- Object
- Drop
- Liquid::InvoiceDrop
- Includes:
- Memery
- Defined in:
- app/models/liquid/invoice_drop.rb
Overview
Helper class scoped to Liquid.
Instance Attribute Summary collapse
-
#invoice ⇒ Object
readonly
Returns the value of attribute invoice.
Delegated Instance Attributes collapse
-
#customer ⇒ Object
Alias for Invoice#customer.
-
#funded_by_cod? ⇒ Object
Alias for Invoice#funded_by_cod?.
-
#funded_by_rma? ⇒ Object
Alias for Invoice#funded_by_rma?.
-
#not_rma? ⇒ Object
Alias for Invoice#not_rma?.
-
#public_pay_link ⇒ Object
Alias for Invoice#public_pay_link.
-
#public_pay_link_has_auth_token? ⇒ Object
Alias for Invoice#public_pay_link_has_auth_token?.
-
#reference_number ⇒ Object
Alias for Invoice#reference_number.
-
#rma_awaiting_return? ⇒ Object
Alias for Invoice#rma_awaiting_return?.
-
#state ⇒ Object
Alias for Invoice#state.
Instance Method Summary collapse
-
#balance_formatted ⇒ Object
Methods that are only used in Liquid templates - implemented directly in drop.
- #fully_funded_by_rma? ⇒ Boolean
-
#has_return_instructions? ⇒ Boolean
Alias methods for template compatibility.
- #has_return_labels? ⇒ Boolean
-
#initialize(invoice) ⇒ InvoiceDrop
constructor
A new instance of InvoiceDrop.
- #public_pay_link_account_email ⇒ Object
- #return_instructions? ⇒ Boolean
- #return_labels? ⇒ Boolean
-
#rma_number ⇒ Object
Safe wrapper methods for potentially problematic calls.
Constructor Details
#initialize(invoice) ⇒ InvoiceDrop
Returns a new instance of InvoiceDrop.
34 35 36 |
# File 'app/models/liquid/invoice_drop.rb', line 34 def initialize(invoice) @invoice = invoice end |
Instance Attribute Details
#invoice ⇒ Object (readonly)
Returns the value of attribute invoice.
7 8 9 |
# File 'app/models/liquid/invoice_drop.rb', line 7 def invoice @invoice end |
Instance Method Details
#balance_formatted ⇒ Object
Methods that are only used in Liquid templates - implemented directly in drop
39 40 41 42 43 |
# File 'app/models/liquid/invoice_drop.rb', line 39 def balance_formatted return '0.00' unless invoice.respond_to?(:balance) && invoice.balance ActionController::Base.helpers.number_to_currency(invoice.balance).to_s end |
#customer ⇒ Object
Alias for Invoice#customer
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#fully_funded_by_rma? ⇒ Boolean
28 29 30 31 32 |
# File 'app/models/liquid/invoice_drop.rb', line 28 def fully_funded_by_rma? invoice.fully_funded_by_rma? rescue StandardError false end |
#funded_by_cod? ⇒ Object
Alias for Invoice#funded_by_cod?
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#funded_by_rma? ⇒ Object
Alias for Invoice#funded_by_rma?
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#has_return_instructions? ⇒ Boolean
Alias methods for template compatibility
58 59 60 |
# File 'app/models/liquid/invoice_drop.rb', line 58 def has_return_instructions? return_instructions? end |
#has_return_labels? ⇒ Boolean
62 63 64 |
# File 'app/models/liquid/invoice_drop.rb', line 62 def has_return_labels? return_labels? end |
#not_rma? ⇒ Object
Alias for Invoice#not_rma?
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#public_pay_link ⇒ Object
Alias for Invoice#public_pay_link
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#public_pay_link_account_email ⇒ Object
66 67 68 69 70 |
# File 'app/models/liquid/invoice_drop.rb', line 66 def public_pay_link_account_email return nil unless invoice.order&.customer && invoice.order.customer.account.present? invoice.order.customer.account.email end |
#public_pay_link_has_auth_token? ⇒ Object
Alias for Invoice#public_pay_link_has_auth_token?
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#reference_number ⇒ Object
Alias for Invoice#reference_number
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#return_instructions? ⇒ Boolean
45 46 47 48 49 |
# File 'app/models/liquid/invoice_drop.rb', line 45 def return_instructions? return false unless invoice.order&.rma invoice.order.rma.return_instructions.present? end |
#return_labels? ⇒ Boolean
51 52 53 54 55 |
# File 'app/models/liquid/invoice_drop.rb', line 51 def return_labels? return false unless invoice.order&.rma invoice.order.rma.return_label_required? end |
#rma_awaiting_return? ⇒ Object
Alias for Invoice#rma_awaiting_return?
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |
#rma_number ⇒ Object
Safe wrapper methods for potentially problematic calls
22 23 24 25 26 |
# File 'app/models/liquid/invoice_drop.rb', line 22 def rma_number invoice.rma_number rescue StandardError nil end |
#state ⇒ Object
Alias for Invoice#state
10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/liquid/invoice_drop.rb', line 10 delegate :reference_number, :customer, :state, :public_pay_link, :public_pay_link_has_auth_token?, :not_rma?, :funded_by_rma?, :funded_by_cod?, :rma_awaiting_return?, to: :invoice |