Difference between revisions of "Amazon Integration"

From Opentaps Wiki
Jump to navigationJump to search
m
m
Line 44: Line 44:
 
== Entities ==
 
== Entities ==
  
'''AmazonOrder'''
+
{|border=1
 
+
|-bgcolor=grey
'''AmazonOrderDocument'''
+
!Entity!!Holds
 
+
|-
'''AmazonOrderImport'''
+
|AmazonOrder||
 
+
|-
'''AmazonOrderItem'''
+
|AmazonOrderDocument||
 
+
|-
'''AmazonOrderItemFee'''
+
|AmazonOrderImport||
 
+
|-
'''AmazonOrderItemFulfillment'''
+
|AmazonOrderItem||
 
+
|-
'''AmazonOrderItemImport'''
+
|AmazonOrderItemFee||
 
+
|-
'''AmazonOrderItemPriceComp'''
+
|AmazonOrderItemFulfillment||
 
+
|-
'''AmazonOrderItemPromo'''
+
|AmazonOrderItemImport||
 
+
|-
'''AmazonOrderItemTaxAmount'''
+
|AmazonOrderItemPriceComp||
 
+
|-
'''AmazonOrderItemTaxJurisdtn'''
+
|AmazonOrderItemPromo||
 
+
|-
'''AmazonOrderItemTaxRate'''
+
|AmazonOrderItemTaxAmount||
 
+
|-
'''AmazonParty'''
+
|AmazonOrderItemTaxJurisdtn||
 +
|-
 +
|AmazonOrderItemTaxRate||
 +
|-
 +
|AmazonParty||
 +
|}
  
 
== Configuration Properties ==
 
== Configuration Properties ==

Revision as of 20:32, 26 September 2007

Setting Up Amazon Integration

To enable integration with Amazon.com, uncomment the line for the Amazon.com component in hot-deploy/component-load.xml

Basic Workflow

  • Product Importing
    • The Amazon integration component disallows the changing of the ASIN and SKU GoodIdentification numbers in the catalog manager.
  • Customer Matching
    • Amazon uses email address as the unique identifier of a customer.
    • Amazon sends phone numbers which are parsed with regex into separate area code and phone numbers
    • Amazon sends state and country codes which are matched against the Geo and GeoAssoc entities in opentaps.
  • Order Importing
    • 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)
    • Acknowledgement is posted to Amazon of fulfilled (shipped) order items. This is accomplished by two independent services: opentaps.amazon.queueShippedItemsForFulfillmentPost, which is responsible for detecting shipment of order items related to Amazon orders (currently via an entity-ECA triggered by the update of a ShipmentRouteSegment.carrierServiceStatusId to SHRSCS_ACCEPTED) and queueing them for fulfillment acknowledgement; and opentaps.amazon.acknowledgeFulfilledOrderItems which posts the fulfillment acknowledgement to Amazon of any order items in the acknowledgement queue.
    • 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

opentaps.amazon.queueShippedItemsForFulfillmentPost

opentaps.amazon.acknowledgeFulfilledOrderItems

Entities

Entity Holds
AmazonOrder
AmazonOrderDocument
AmazonOrderImport
AmazonOrderItem
AmazonOrderItemFee
AmazonOrderItemFulfillment
AmazonOrderItemImport
AmazonOrderItemPriceComp
AmazonOrderItemPromo
AmazonOrderItemTaxAmount
AmazonOrderItemTaxJurisdtn
AmazonOrderItemTaxRate
AmazonParty

Configuration Properties

Property Controls
opentaps.amazon.createdByAmazonApplication
opentaps.amazon.error.email.errorEmailLocale
opentaps.amazon.error.email.errorEmailScreenUri
opentaps.amazon.error.email.fromAddress
opentaps.amazon.error.email.sendErrorEmails
opentaps.amazon.error.email.toAddress
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.document.retry.threshold.acknowledge
opentaps.amazon.import.document.retry.threshold.download
opentaps.amazon.import.document.retry.threshold.extract
opentaps.amazon.import.maxDaysToShip.Expedited
opentaps.amazon.import.maxDaysToShip.Standard
opentaps.amazon.import.order.retry.threshold.acknowledge
opentaps.amazon.import.order.retry.threshold.import
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.shipmentMethodTypeId.Expedited
opentaps.amazon.import.shipmentMethodTypeId.Standard
opentaps.amazon.merchantIdentifier
opentaps.amazon.merchantName
opentaps.amazon.password
opentaps.amazon.shipping.carrierPartyId.fedEx
opentaps.amazon.shipping.carrierPartyId.ups
opentaps.amazon.shipping.carrierPartyId.usps
opentaps.amazon.url
opentaps.amazon.userName

To Do

  • Relation of Amazon taxLocationCode to Opentaps taxAuthorityId
  • Order cancellation prior to import
  • Order cancellation after import
  • Order refund


Test Cases

Order Item Fulfillment (Charge-When-Ship)

Test Case Action Result
1 Order an item on Amazon.com and wait until the order has been imported into Opentaps. Pack the full order and schedule the shipment with a carrier. Wait until the scheduled job for the opentaps.amazon.queueShippedItemsForFulfillmentPost and opentaps.amazon.acknowledgeFulfilledOrderItems services have both run, in that order (or run them manually). Result: There should be AmazonOrderItemFulfillment records representing the fulfilled order items, for which the ackStatusId field should be AMZN_SHIP_ACK_ERR. The orders should be marked 'Confirmed' in the Amazon Seller Central site's 'Manage Orders' screen.
2 Place a multiple-item order on Amazon.com and wait until the order has been imported. Pack part of the order and schedule the shipment with a carrier. Wait until the two services have run as above. The order should not be marked confirmed in Seller Central, since it hasn't all been shipped.
3 Pack the rest of the order from case 2 and schedult the shipment. Wait until the two services have run as above. The order should be marked confirmed in Seller Central, since it has been fully shipped.