public class

FWSCloudConnector

extends Object
java.lang.Object
   ↳ org.mule.module.fws.FWSCloudConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

With Amazon FWS, merchants can directly integrate with the FBA system, allowing them to automatically process shipments to Amazon and then out to customers. This functionality is contained in three key APIs: the inbound service, the outbound service, and the inventory service.

Inbound Service

The inbound service allows merchants to create and send inbound shipments of inventory to Amazon’s fulfillment centers.

  • Create shipments of inventory to Amazon fulfillment centers
    Our tools make it easy for merchants to ship inventory to Amazon with everything from label creation to packing slips. Merchants in the U.S. can also take advantage of Amazon’s discounted UPS shipping rates.

Outbound Service

The outbound service allows merchants to use Amazon’s fulfillment processing for orders sold on the merchant’s website or other non-Amazon channels.

  • Submit fulfillment order/shipment requests
    By integrating the outbound service API into merchant software, customer orders are processed in real time, informing Amazon what to ship and where to ship it.
  • Track and manage shipment requests
    After orders leave our fulfillment centers, merchants can track shipments and keep their customers aware of arrival times.

Inventory Service

The inventory service allows merchants to stay up to date on the status of inventory in Amazon’s fulfillment centers.

  • Check Inventory Status
    Merchants can discover when inventory items change status and get the current availability status to keep product listing information up to date.

Summary

Fields
private String accessKey The Amazon AWS account public key
private FWSClient<RuntimeException> client The FWSClient.
private final MapObjectMapper mom
private String secretKey The Amazon AWS account private key
Public Constructors
FWSCloudConnector()
Public Methods
void cancelFulfillmentOrder(String orderId)
Requests Amazon not to fulfill an existing fulfillment order.
void createFulfillmentOrder(String orderId, String displayableOrderId, Map<String, Object> destinationAddress, String fulfillmentPolicy, String fulfillmentMethod, String shippingSpeedCategory, String displayableOrderComment, Date displayableOrderDate, List<String> emails, List<Map<String, Object>> items)
Generates a request for Amazon to ship items from the merchant's inventory to a destination address.
void deleteInboundShipmentItems(String merchantSku, String shipmentId)
Removes items from a pre-existing shipment specified by the ShipmentId.
String getAccessKey()
FWSClient<RuntimeException> getClient()
FulfillmentItem getFulfillmentIdentifier(String asin, ItemCondition itemCondition, String merchantSku)
Gets the Fulfillment Network SKU (FNSKU) for the supplied merchant item - creating it if needed.
FulfillmentItem getFulfillmentIdentifierForMsku(String merchantSku)
Gets the Fulfillment Network SKU (FNSKU) for the supplied merchant item - creating it if needed.
FulfillmentItem getFulfillmentItemByFnsku(String fulfillmentNetworkSku)
Gets fulfillment item data for the provided Fulfillment Network SKU (FNSKU).
FulfillmentItem getFulfillmentItemByMsku(String merchantSku)
Gets fulfillment item data for the provided Merchant SKU.
GetFulfillmentOrderResult getFulfillmentOrder(String orderId)
Gets the original fulfillment order request, the status of both the order and its items in the Amazon Fulfillment Network, and the shipments that have been generated to fulfill the order.
List<FulfillmentPreview> getFulfillmentPreview(Map<String, Object> address, List<GetFulfillmentPreviewItem> items, String shippingSpeedCategories, String orderItemId)
Answers estimated shipping dates and fees for a given set of merchant SKUs and quantities.
String getInboundServiceStatus()
Answers a brief status message from the service
InboundShipmentData getInboundShipment(String shipmentId)
Gets inbound shipment data without the item details for a given ShipmentId.
List<ShipmentPreview> getInboundShipmentPreview(List<MerchantSKUQuantityItem> items, Map<String, Object> address, LabelPreference labelPreference)
Gets the information needed to create a set of shipments for a given set of items and the ship from address.
String getInventoryServiceStatus()
Answers a brief status message from the service
MerchantSKUSupply getInventorySupply(String merchantSku, String responseGroup)
Gets information about the supply of merchant-owned inventory in Amazon's fulfillment network.
String getOutboundServiceStatus()
Answers a brief status message from the service
String getSecretKey()
void initialise()
Iterable<FulfillmentItem> listFulfillmentItems(boolean includeInactive)
Lazily lists fulfillment items registered.
Iterable<FulfillmentOrder> listFulfillmentOrders(Date startDate, List<String> fulfillmentMethods)
Lazily lists all the fulfillment orders
Iterable<InboundShipmentItem> listInboundShipmentItems(String shipmentId)
Lazily retrieved the all the inbound shipment items for the given shipmentId.
Iterable<InboundShipmentData> listInboundShipments(ShipmentStatus shipmentStatus, Date createdAfter, Date createdBefore)
Lazily lists the inbound shipments a merchant has created, according to the specified query parameters.
Iterable<MerchantSKUSupply> listUpdatedInventorySupply(Date startDateTime, String responseGroup)
Lazily retrieves all the information about the supply of merchant-owned inventory in Amazon's fulfillment network, for inventory items that may have had recent changes in inventory levels.
void putInboundShipment(String shipmentId, String shipmentName, String destinationFulfillmentCenter, Map<String, Object> shipFromAddress, LabelPreference labelPreference, List<MerchantSKUQuantityItem> itemQuantities)
Adds or replaces inbound shipment for a given shipmentId.
void putInboundShipmentData(String shipmentId, String shipmentName, String destinationFulfillmentCenter, Map<String, Object> shipFromAddress, LabelPreference labelPreference)
Adds or replaces the merchant's inbound shipment header information for the given ShipmentId.
void putInboundShipmentItems(String shipmentId, List<MerchantSKUQuantityItem> itemQuantities)
Adds line items to a pre-existing shipment that the ShipmentId specifies.
void setAccessKey(String accessKey)
void setClient(FWSClient<?> client)
void setInboundShipmentStatus(String shipmentId, ShipmentStatus shipmentStatus)
Sets the inbound shipment status to the specified ShipmentStatus.
void setSecretKey(String secretKey)
Protected Methods
static <T> T coalesce(T o1, T o2)
<T> List<T> toList(Class<T> componentType, List<Map<String, Object>> value)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private String accessKey

The Amazon AWS account public key

private FWSClient<RuntimeException> client

The FWSClient. You may change it for mocking purposes

private final MapObjectMapper mom

private String secretKey

The Amazon AWS account private key

Public Constructors

public FWSCloudConnector ()

Public Methods

public void cancelFulfillmentOrder (String orderId)

Requests Amazon not to fulfill an existing fulfillment order. This is just a hint, already shipped orders may not be canceled.

Parameters
orderId The mandatory order's id

public void createFulfillmentOrder (String orderId, String displayableOrderId, Map<String, Object> destinationAddress, String fulfillmentPolicy, String fulfillmentMethod, String shippingSpeedCategory, String displayableOrderComment, Date displayableOrderDate, List<String> emails, List<Map<String, Object>> items)

Generates a request for Amazon to ship items from the merchant's inventory to a destination address.

Parameters
orderId The mandatory fulfillment order id
displayableOrderId The order id displayed in the fulfillment. If not specified, the orderId is used.
destinationAddress The mandatory destination address of the fulfillment
fulfillmentPolicy The optional fulfillment policy
fulfillmentMethod The optional fulfillment method
shippingSpeedCategory The mandatory shipping speed category
displayableOrderComment The mandatory comment that will be displayed in the order
displayableOrderDate The mandatory order date displayed in the fulfillment
emails An optional list of email strings
items A mandatory list of CreateFulfillmentOrderItem. At least one item must be specified

public void deleteInboundShipmentItems (String merchantSku, String shipmentId)

Removes items from a pre-existing shipment specified by the ShipmentId. This operation removes the items specified in each MerchantSKU parameter from the shipment in their entirety, no matter the quantity. If the MerchantSKU is not currently a part of the shipment, then that particular line item is ignored, but others are still processed.

Parameters
merchantSku The msku of the items to delete
shipmentId The id of the shipment

public String getAccessKey ()

public FWSClient<RuntimeException> getClient ()

public FulfillmentItem getFulfillmentIdentifier (String asin, ItemCondition itemCondition, String merchantSku)

Gets the Fulfillment Network SKU (FNSKU) for the supplied merchant item - creating it if needed. This operation is idempotent in that it can be called multiple times without any adverse effects. This operation is required whenever you need to register items for Amazon fulfillment that require labeling and when you need to get the identifier prior to creating an offer. This operation is necessary to register items for Amazon fulfillment in order to send them to Amazon, but does not do the work of marking any offer for this item as Amazon fulfilled. A response does not imply that the item has an offer for which it can be fulfilled; only that the Amazon Fulfillment Network can track it. An inactive item can have a quantity in the fulfillment center, but will never be fulfilled. Use this operation instead of getFulfillmentIdentifierForMSKU if an offer does not already exist for the MerchantSKU.

Parameters
asin The mandatory Aamzon's identifier
itemCondition The mandatory item's condition
merchantSku The mandatory merchant's sku
Returns
  • a FulfillmentIdentier

public FulfillmentItem getFulfillmentIdentifierForMsku (String merchantSku)

Gets the Fulfillment Network SKU (FNSKU) for the supplied merchant item - creating it if needed. This operation is idempotent in that you can call it multiple times without any adverse effects. This operation is required whenever you need to register items for Amazon fulfillment that require labeling. This operation is necessary to register items for Amazon fulfillment in order to send them to Amazon, but doesn't mark any offer for this item as Amazon fulfilled. A response does not imply that the item has an offer for which it can be fulfilled; only that the Amazon Fulfillment Network can track it. An inactive item can have a quantity in the fulfillment center, but will never be fulfilled. Use this operation instead of GetFulfillmentIdentifier if an offer already exists for the SKU.

Parameters
merchantSku The merchant's sku
Returns
  • the FulfillmentItem

public FulfillmentItem getFulfillmentItemByFnsku (String fulfillmentNetworkSku)

Gets fulfillment item data for the provided Fulfillment Network SKU (FNSKU). Throws an FWSException if the fnsku is invalid. A response does not imply that the item has an offer for which it can be fulfilled; only that the Amazon Fulfillment Network can track it. An inactive item can have a quantity in the fulfillment center, but will never be fulfilled.

Parameters
fulfillmentNetworkSku The mandatory fulfillment network sku - aka nsku, aka fnsku
Returns
  • a FulfillmentItem

public FulfillmentItem getFulfillmentItemByMsku (String merchantSku)

Gets fulfillment item data for the provided Merchant SKU. Throws an FWSException if the msku is invalid. A response does not imply that the item has an offer for which it can be fulfilled; only that the Amazon Fulfillment Network can track it. An inactive item can have a quantity in the fulfillment center, but will never be fulfille

Parameters
merchantSku The mandatory merchant's sku
Returns
  • a FulfillmentItem

public GetFulfillmentOrderResult getFulfillmentOrder (String orderId)

Gets the original fulfillment order request, the status of both the order and its items in the Amazon Fulfillment Network, and the shipments that have been generated to fulfill the order.

Parameters
orderId The mandatory order id of the fulfillment
Returns
  • a GetFulfillmentOrderResult

public List<FulfillmentPreview> getFulfillmentPreview (Map<String, Object> address, List<GetFulfillmentPreviewItem> items, String shippingSpeedCategories, String orderItemId)

Answers estimated shipping dates and fees for a given set of merchant SKUs and quantities.

Parameters
address The mandatory destination address
items The mandatory items list of GetFulfillmentPreviewItem to preview. At least one item is required
shippingSpeedCategories The optional shipping categories
orderItemId The mandatory order item id
Returns
  • a list of fulfillment previews

public String getInboundServiceStatus ()

Answers a brief status message from the service

Returns
  • the status message

public InboundShipmentData getInboundShipment (String shipmentId)

Gets inbound shipment data without the item details for a given ShipmentId.

Parameters
shipmentId The mandatory shipment id
Returns
  • an InboundShipmentData

public List<ShipmentPreview> getInboundShipmentPreview (List<MerchantSKUQuantityItem> items, Map<String, Object> address, LabelPreference labelPreference)

Gets the information needed to create a set of shipments for a given set of items and the ship from address. You might need to create multiple shipments for various reasons, but the most common reason is when there are sortable and non-sortable items. In this case, there is one shipment for each of the shipment sets returned.

Parameters
items The mandatory items list of MerchantSkuItems to preview. At least one item is required
address The mandatory destination address
labelPreference The optional label preference
Returns
  • the list of previews

public String getInventoryServiceStatus ()

Answers a brief status message from the service

Returns
  • the status message

public MerchantSKUSupply getInventorySupply (String merchantSku, String responseGroup)

Gets information about the supply of merchant-owned inventory in Amazon's fulfillment network. Throws a FWSException if inventory is unsellable or is already bound to a customer order or bound to internal fulfillment center processing (for example, labeling).

Parameters
merchantSku The mandatory merchant's sku
responseGroup The optional response group
Returns
  • a merchant sku supply iterable

public String getOutboundServiceStatus ()

Answers a brief status message from the service

Returns
  • the status message

public String getSecretKey ()

public void initialise ()

Throws
InitialisationException

public Iterable<FulfillmentItem> listFulfillmentItems (boolean includeInactive)

Lazily lists fulfillment items registered. If IncludeInactive is set to True, the operation returns both active (available for fulfillment) and inactive (not available for fulfillment) mappings. This parameter defaults to False. You can use inactive mappings to track inventory in Amazon's fulfillment centers; however, inactive items can't be fulfilled.

Parameters
includeInactive Optional. Whether non available items for fulfillment should be listed
Returns
  • a FulfillmentItem iterable

public Iterable<FulfillmentOrder> listFulfillmentOrders (Date startDate, List<String> fulfillmentMethods)

Lazily lists all the fulfillment orders

Parameters
startDate The start date of the query
fulfillmentMethods Optional list of FWS fulfillment method strings
Returns
  • the orders iterable

public Iterable<InboundShipmentItem> listInboundShipmentItems (String shipmentId)

Lazily retrieved the all the inbound shipment items for the given shipmentId.

Parameters
shipmentId The mandatory shipment's id
Returns
  • a InboundShipmentItem items iterable

public Iterable<InboundShipmentData> listInboundShipments (ShipmentStatus shipmentStatus, Date createdAfter, Date createdBefore)

Lazily lists the inbound shipments a merchant has created, according to the specified query parameters.

Parameters
shipmentStatus The mandatory status of listed items
createdAfter Optional. The min creation date of listed shipment
createdBefore Optional. The max creation date of listed shipments
Returns
  • a shipment data iterable

public Iterable<MerchantSKUSupply> listUpdatedInventorySupply (Date startDateTime, String responseGroup)

Lazily retrieves all the information about the supply of merchant-owned inventory in Amazon's fulfillment network, for inventory items that may have had recent changes in inventory levels. The type of inventory data returned by this operation is the same as that returned by getInventorySupply. This operation provides the most efficient mechanism for clients to maintain local copies of inventory supply data.

Parameters
startDateTime The mandatory start date
responseGroup A response group string
Returns
  • a MerchantSKUSupply iterable

public void putInboundShipment (String shipmentId, String shipmentName, String destinationFulfillmentCenter, Map<String, Object> shipFromAddress, LabelPreference labelPreference, List<MerchantSKUQuantityItem> itemQuantities)

Adds or replaces inbound shipment for a given shipmentId. If the shipment does not exist, one will be created. Note, the merchant should call SetInboundShipmentStatus with a status of 'Shipped' when the shipment is picked up, or set the status to 'Cancelled' if the shipment is abandoned. The intial status of a shipment will be set to 'Working'. Once a shipment's status has been set to 'Shipped', the merchant may make no further changes except to update the status to 'Cancelled'. Any items not received at the time a shipment is 'Cancelled' will be sidelined if they arrive at the fulfillment center. NOTE: If you are experiencing time-outs due to too many items in the shipment, calling this operation with a subset of the items should work. You may add more items to the shipment by calling putInboundShipmentItems.

Parameters
shipmentId The mandatory shipment's id
shipmentName The mandatory shipment name
destinationFulfillmentCenter The mandatory Amazon's fulfillment center where the client's products are stored
shipFromAddress The mandatory source address of the shipment to amazon's centers
labelPreference The optional label preference
itemQuantities A mandatory list of MerchantSKUQuantityItem objects, with the amount of item for each merchant sku. At least one item must be passed

public void putInboundShipmentData (String shipmentId, String shipmentName, String destinationFulfillmentCenter, Map<String, Object> shipFromAddress, LabelPreference labelPreference)

Adds or replaces the merchant's inbound shipment header information for the given ShipmentId.

Parameters
shipmentId The mandatory shipment's id
shipmentName The mandatory shipment name
destinationFulfillmentCenter The mandatory Amazon's fulfillment center where the client's products are stored
shipFromAddress The mandatory source address of the shipment to amazon's centers
labelPreference The optional label preference

public void putInboundShipmentItems (String shipmentId, List<MerchantSKUQuantityItem> itemQuantities)

Adds line items to a pre-existing shipment that the ShipmentId specifies. If the MerchantSKU is already in the shipment, then that particular line item is replaced. Call PutInboundShipment to create a new shipment. This call returns an exception if you attempt to add line items to a shipment that is in a status other than Working.

Parameters
shipmentId The mandatory shipment's id
itemQuantities A mandatory list of MerchantSKUQuantityItem objects, with the amount of item for each merchant sku. At least one item must be passed

public void setAccessKey (String accessKey)

Parameters
accessKey

public void setClient (FWSClient<?> client)

Parameters
client

public void setInboundShipmentStatus (String shipmentId, ShipmentStatus shipmentStatus)

Sets the inbound shipment status to the specified ShipmentStatus. Once a shipment's status has been set to Shipped, you cannot make any further changes except to update the status to Cancelled. Any item not received at the time a shipment is cancelled is put into problem receive at the fulfillment center. This operation returns a RequestId upon success, otherwise an explicit error is returned.

Parameters
shipmentId The mandatory shipment's id
shipmentStatus The mandatory new status for the given shipment

public void setSecretKey (String secretKey)

Parameters
secretKey

Protected Methods

protected static T coalesce (T o1, T o2)

Parameters
o1
o2

protected List<T> toList (Class<T> componentType, List<Map<String, Object>> value)

Parameters
componentType
value