Module: SpreeCmCommissioner::PinCodeSenderHelper

Included in:
PinCodeMailer, PinCodeSender, TelegramDebugPinCodeSenderJob
Defined in:
app/helpers/spree_cm_commissioner/pin_code_sender_helper.rb

Instance Method Summary collapse

Instance Method Details

#logo_url(tenant) ⇒ Object



15
16
17
18
19
20
# File 'app/helpers/spree_cm_commissioner/pin_code_sender_helper.rb', line 15

def logo_url(tenant)
  vendor_or_store = tenant.nil? || tenant.active_vendor.nil? ? Spree::Store.default : tenant.active_vendor
  return unless vendor_or_store&.&.attachment&.attached?

  main_app.cdn_image_url(vendor_or_store..attachment.variant(resize_to_limit: [244, 104]))
end

#sender_email(tenant) ⇒ Object



9
10
11
12
13
# File 'app/helpers/spree_cm_commissioner/pin_code_sender_helper.rb', line 9

def sender_email(tenant)
  return Spree::Store.default.mail_from_address if tenant.nil?

  tenant.active_vendor&.notification_email
end

#sender_name(tenant) ⇒ Object



3
4
5
6
7
# File 'app/helpers/spree_cm_commissioner/pin_code_sender_helper.rb', line 3

def sender_name(tenant)
  return Spree::Store.default&.name if tenant.nil?

  tenant.active_vendor&.name
end