Module: SolidusBactracs::ExportHelper
- Defined in:
- app/helpers/solidus_bactracs/export_helper.rb
Constant Summary collapse
- DATE_FORMAT =
'%m/%d/%Y %H:%M'
- BACTRACS_DATE_FORMAT =
'%Y-%m-%dT%H:%M:%S'
Class Method Summary collapse
-
.address(xml, order, type) ⇒ Object
rubocop:disable all.
- .bactracs_address(xml, order, type) ⇒ Object
Class Method Details
.address(xml, order, type) ⇒ Object
rubocop:disable all
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/solidus_bactracs/export_helper.rb', line 11 def self.address(xml, order, type) name = "#{type.to_s.titleize}To" address = order.send("#{type}_address") xml.__send__(name) { xml.Name address.respond_to?(:name) ? address.name : address.full_name xml.Company address.company if type == :ship xml.Address1 address.address1 xml.Address2 address.address2 xml.City address.city xml.State address.state ? address.state.abbr : address.state_name xml.PostalCode address.zipcode xml.Country address.country.iso end xml.Phone address.phone } end |
.bactracs_address(xml, order, type) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/solidus_bactracs/export_helper.rb', line 32 def self.bactracs_address(xml, order, type) address = order.send("#{type}_address") if address.present? name = "#{type.to_s.titleize}To" xml.__send__(name) { xml.CompanyName address.company ? address.company : address.name xml.Contact address.name xml.ContactEmail order.email xml.Address1 address.address1 xml.Address2 address.address2 xml.City address.city xml.State address.state ? address.state.abbr : address.state_name xml.Zip address.zipcode xml.Phone address.phone.present? ? address.phone : "000-000-0000" xml.PhoneAlt address.phone.present? ? address.phone : "000-000-0000" xml.Country address.country.iso } else Rails.logger.info({ message: 'missing address type', order: order.id, type: type }.to_s) end end |