Amazon Integration

From Opentaps Wiki
Revision as of 19:50, 21 September 2007 by Cliberty (talk | contribs)
Jump to navigationJump to search

Basic Workflow

  • Pending order documents are downloaded from Amazon and stored periodically (opentaps.amazon.storePendingOrderDocuments service)
  • Acknowledgement is posted to Amazon of downloaded order documents (opentaps.amazon.acknowledgeOrderDocumentDownload service)
  • Amazon orders are extracted from stored order documents (opentaps.amazon.extractOrdersForImport service)
  • Extracted orders are imported into the Opentaps data model (opentaps.amazon.importOrders service)
  • Acknowledgement is posted to Amazon of imported orders (opentaps.amazon.acknowledgeImportedOrders service)

There are no execution dependencies - these steps will all run independently from one another by scheduled jobs and will operate on whatever data is available in the right condition at each runtime.

Services

opentaps.amazon.storePendingOrderDocuments

This service requests all pending order documents from Amazon and stores each document in the AmazonOrderDocument entity. The service will fail only if there is a database error or a communication error with Amazon. Each document is treated separately - if the download of one document fails, the AmazonOrderDocument record will reflect the error and reason, but other documents in the same batch won't be affected. If a document download fails, the service will keep trying to download it from Amazon at each run. Documents will also fail if they consist of invalid or unparseable XML.

opentaps.amazon.acknowledgeOrderDocumentDownload

This service finds any AmazonOrderDocuments in the database which have been successfully downloaded, but for which download acknowledgement has not yet been posted back to Amazon, and posts that acknowledgement. The service will fail only in the case of a database error. If there is an error posting acknowledgement, each of the affected AmazonOrderDocuments will reflect the failure and the reason.

opentaps.amazon.extractOrdersForImport

This service finds any AmazonOrderDocuments in the database which have been successfully downloaded *and* successfully acknowledged, and attempts to parse each document in order to extract information about Amazon orders. The service will fail only in the case of a database error. Order documents are dealt with in an atomic fashion - if a document is unparseable or there is a problem extracting or storing order information into the import tables for any order in an order document, the entire order document will be marked as a failure and no orders will be extracted from it.

opentaps.amazon.importOrders service

opentaps.amazon.acknowledgeImportedOrders

Entities

AmazonOrder

AmazonOrderDocument

AmazonOrderImport

AmazonOrderItem

AmazonOrderItemFee

AmazonOrderItemImport

AmazonOrderItemPriceComp

AmazonOrderItemPromo

AmazonOrderItemTaxAmount

AmazonOrderItemTaxJurisdtn

AmazonOrderItemTaxRate

AmazonParty

Configuration Properties

opentaps.amazon.createdByAmazonApplication

opentaps.amazon.import.approveOrders

opentaps.amazon.import.carrierPartyId.Expedited

opentaps.amazon.import.carrierPartyId.Standard

opentaps.amazon.import.decimalPrecision

opentaps.amazon.import.decimalRounding

opentaps.amazon.import.maxDaysToShip.Expedited

opentaps.amazon.import.maxDaysToShip.Standard

opentaps.amazon.import.organizationPartyId

opentaps.amazon.import.phone.regexp

opentaps.amazon.import.phone.regexp.group.areaCode

opentaps.amazon.import.phone.regexp.group.countryCode

opentaps.amazon.import.phone.regexp.group.extension

opentaps.amazon.import.phone.regexp.group.phoneNumber

opentaps.amazon.import.productStoreId

opentaps.amazon.import.salesChannel

opentaps.amazon.import.shipmentMethodTypeId.Expedited

opentaps.amazon.import.shipmentMethodTypeId.Standard

opentaps.amazon.merchantIdentifier

opentaps.amazon.merchantName

opentaps.amazon.password

opentaps.amazon.url

opentaps.amazon.userName

Assumptions

  • Amazon customers are defined uniquely by email address

To Do

  • How to handle tax authority lookup
  • Service to post shipping acknowledgement back to Amazon (charge-when-ship)
  • Email notification of errors