Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBC-3110 Added description of data mapping between quote/order objects on Spryker side and Vertex API. #2252

Merged
merged 13 commits into from
Oct 30, 2023
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,53 @@ class ProductOfferStockDependencyProvider extends SprykerProductOfferStockDepend
}

```


---


## Appendix A

### Quote/Order object to Vertex API mapping

Mapping of Spryker Quote/Order transfer object to Vertex API request format is described in the following table:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bohdan-turchyk-spryker can you please provide a few words with the context of why we have this mapping, e.g. when to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow this data mapping format defined here if you need to implement any custom expander plugins for Vertex integration.

I can add this line in the doc if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation, please check.

| QuoteTransfer/OrderTransfer object properties | Vertex API field | Comment |
|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| Current date (Y-m-d) | documentDate | |
| QuoteTransfer.uuid / OrderTransfer.orderReference / new Uuid4 (if quote.uuid is not present) | documentNumber | |
| QuoteTransfer.uuid / OrderTransfer.orderReference / new Uuid4 (if quote.uuid is not present) | transactionId | |
| - | transactionType | Always `SALE` |
| - | saleMessageType | Depends on the type of operation, `INVOICE` or `QUOTATION` |
| taxMetadata | **Mapped over the final request 1:1** | Metadata is supposed to follow the structure of Vertex API request |
| taxMetadata.seller.company | seller.company | Required by Vertex from legal point of view |
| items[].sku | lineItems[].lineItemId; lineItems[].product.value; lineItems[].vendorSku | lineItems[].lineItemId can be changed if there are multiple items with the same SKU in the request |
| items[].shipment.shippingAddress | lineItems[].customer.destination | |
| billingAddress | lineItems[].customer.administrativeDestination | |
| items[].merchantStockAddresses | lineItems[].seller.physicalOrigin | Multiple addresses are mapped to multiple items in Vertex PBC and Vertex API lineItems[]. |
| items[].merchantProfileAddress | lineItems[].seller.administrativeOrigin | |
| items[].unitDiscountAmountFullAggregation | lineItems[].discount.discountValue | Prices are converted from Spryker’s cent-based format to Vertex decimal format |
| - | lineItems[].discount.discountType | Always `DiscountAmount`. Spryker stores discount based on amount, so there is no need for percentage-based discounts. |
| items[].unitPrice (either GROSS or NET depending on the currently selected mode) | lineItems[].unitPrice | Prices are converted from Spryker’s cent-based format to Vertex decimal format |
| items[].merchantStockAddresses.quantityToShip | lineItems[].quantity.value | If quantityToShip is less than quantity requested in cart - in this case this item will be mapped to multiple items in Vertex API |
| - | lineItems[].quantity.unitOfMeasure | Always `EA` (“each”). Other units of measure are not supported yet. |
| items[].taxMetadata | Mapped over specific lineItem 1:1 | Metadata is supposed to follow the structure of Vertex API request. For lineItems it is mapped over each corresponding item based on lineItemId |
| items[].taxMetadata.seller.company | lineItems[].seller.company | Required by Vertex from legal point of view |
| expenses (only for expenses with type `SHIPMENT_EXPENSE_TYPE`) | lineItems | Shipments are treated just like products in Vertex - it’s all a line item |
| expenses.hash | lineItems[].lineItemId | |
| expenses.shipment.shipmentAddress | lineItems[].customer.destination | |
| billingAddress | lineItems[].customer.administrativeDestination | |
| expenses.sumPrice (either GROSS or NET depending on currently selected mode) | lineItems[].extendedPrice | |
| expenses.sumDiscountAmountAggregation | lineItems[].discount.discountValue | Prices are converted from Spryker’s cent-based format to Vertex decimal format |
| - | lineItems[].discount.discountType | Always `DiscountAmount`. Spryker stores discount based on amount, so there is no need to use percentage-based discounts here. |

##### Location mapping

| Spryker | Vertex | Comment |
|------------------|----------------|------------------------------------|
| address1 | streetAddress1 | |
| address2 | streetAddress2 | Should be either not empty or null |
| city | city | |
| state | mainDivision | Should be either not empty or null |
| zipCode | postalCode | |
| country.iso2Code | country | |
Loading