Class: C2eCore::Drops::InvoicePromoDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
/build/app/mailers/c2e_core/drops/invoice_promo_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(invoice_promo) ⇒ InvoicePromoDrop

Returns a new instance of InvoicePromoDrop.



6
7
8
9
# File '/build/app/mailers/c2e_core/drops/invoice_promo_drop.rb', line 6

def initialize(invoice_promo)
  super()
  @invoice_promo = invoice_promo
end

Instance Method Details

#descriptionString?

  • Description in the Order Language or CompanyBranch’s default language. null is

returned when description is not configured.

Returns:

  • (String, nil)
    • Description in the Order Language or CompanyBranch’s default language. null is

    returned when description is not configured.



24
25
26
# File '/build/app/mailers/c2e_core/drops/invoice_promo_drop.rb', line 24

def description
  @invoice_promo[:description]
end

#qr_codeString?

Returns - QR code as a data URL, e.g.: "data:image/png;base64,iVBO...", with a width of 400px. null is returned when QR code link is not configured.

Returns:

  • (String, nil)
    • QR code as a data URL, e.g.: "data:image/png;base64,iVBO...", with a width of

    400px. null is returned when QR code link is not configured.



13
14
15
16
17
18
19
20
# File '/build/app/mailers/c2e_core/drops/invoice_promo_drop.rb', line 13

def qr_code
  return unless @invoice_promo[:qr_code_url].present?

  RQRCode::QRCode
    .new(@invoice_promo[:qr_code_url])
    .as_png(size: 400, border_modules: 0)
    .to_data_url
end