Class: Edi::Amazon::DeleteListingMessageProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::Amazon::DeleteListingMessageProcessor
- Defined in:
- app/services/edi/amazon/delete_listing_message_processor.rb
Constant Summary collapse
- Result =
Reuse the same Result type as ListingMessageProcessor for consistency
ListingMessageProcessor::Result
Constants included from Edi::AddressAbbreviator
Edi::AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Instance Method Summary collapse
Methods inherited from BaseEdiService
#duplicate_po_already_notified?, #initialize, #mark_duplicate_po_as_notified, #report_order_creation_issues, #safe_process_edi_communication_log
Methods included from Edi::AddressAbbreviator
#abbreviate_street, #collect_street_originals, #record_address_abbreviation_notes
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger
Constructor Details
This class inherits a constructor from Edi::BaseEdiService
Instance Method Details
#process(catalog_item_or_variation, http_method: 'DELETE', attribute_actions: nil, use_fba_sku: false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/edi/amazon/delete_listing_message_processor.rb', line 8 def process(catalog_item_or_variation, http_method: 'DELETE', attribute_actions: nil, use_fba_sku: false) # see: https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-reference#patchlistingsitem # see: https://developer-docs.amazon.com/sp-api/docs/building-listings-management-workflows-guide#should-i-submit-in-bulk-using-the-json_listings_feed-or-individually-with-the-listings-items-api # see: https://developer-docs.amazon.com/sp-api/docs/listings-feed-type-values#listings-feed ecl = nil EdiCommunicationLog.transaction do logger.info "Creating delete listing item message for partner #{orchestrator.partner}" ecl = EdiCommunicationLog.create_outbound_file_from_data( data: '', data_type: 'json', file_extension: 'cii', partner: orchestrator.partner, category: 'listing_data', resources: catalog_item_or_variation, file_info: {} ) end Result.ok(ecl) rescue StandardError => e catalog_item_id = catalog_item_or_variation.try(:id) || catalog_item_or_variation.try(:catalog_item_id) logger.error "DeleteListingMessageProcessor#process failed for catalog_item #{catalog_item_id}: #{e.class} - #{e.}" ErrorReporting.error(e, catalog_item_id: catalog_item_id, http_method: http_method, use_fba_sku: use_fba_sku) Result.fail("#{e.class}: #{e.}") end |