Module: CountryEmailHelper
- Included in:
- Dashboard::V2::InventoriesController, StaffMailer, VendorsService::InventorySync::InventoryFetcherService
- Defined in:
- app/my_lib/country_email_helper.rb
Overview
CountryEmailHelper provides country-specific email routing functionality for merchant and finance emails based on restaurant country codes.
This module can be included in both controllers and mailers to provide consistent email routing logic across the application.
Instance Method Summary collapse
-
#merchant_email_for_country(restaurant) ⇒ String
Returns the appropriate merchant email based on the restaurant's country code.
Instance Method Details
#merchant_email_for_country(restaurant) ⇒ String
Returns the appropriate merchant email based on the restaurant's country code
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/my_lib/country_email_helper.rb', line 38 def merchant_email_for_country(restaurant) return MERCHANT_EMAIL if restaurant.blank? country_code = restaurant&.country&.alpha2 || restaurant&.city&.country&.alpha2 case country_code when 'SG' MERCHANT_SG_EMAIL when 'MY' MERCHANT_MY_EMAIL else # Default to Thailand merchant email for 'TH' and any other country MERCHANT_EMAIL end end |