Class: Edi::InvoiceEventProcessor
- Inherits:
-
BaseService
- Object
- BaseService
- Edi::InvoiceEventProcessor
- Defined in:
- app/services/edi/invoice_event_processor.rb
Instance Method Summary collapse
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #process, #tagged_logger
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#load_orchestrator(customer_id) ⇒ Object
19 20 21 |
# File 'app/services/edi/invoice_event_processor.rb', line 19 def load_orchestrator(customer_id) Edi::BaseOrchestrator.orchestrator_for_customer_id(customer_id) end |
#process_creation(invoice, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/services/edi/invoice_event_processor.rb', line 5 def process_creation(invoice, = {}) return unless invoice.order&.edi_transaction_id return unless (o = load_orchestrator(invoice.customer_id)) if [:skip_if_exists] && invoice.edi_communication_logs.where(category: "invoice").exists? logger.info "Edi -> Skipping creation for invoice #{invoice.id}, EDI invoice message already exists" return end logger.info "Edi -> Processing creation event for invoice id #{invoice.id}" o..confirm_invoice(invoice) if o. o..create_invoice(invoice, { transmit_after: 30.minutes.from_now }) if o. end |