purchase-ack-service v1.0.0
Purchase Ack Service
Repo Purpose
Expose a GraphQL API to MongoDB collection called purchaseorder-ack-details
- Responsible for purchase order domain in zoro system (previously was coupled with order document aka sales orders)
- GraphQL mutation to add ackDetails to mongo collection
- GraphQL query to fetch ackDetails from mongo collection
- Publishes SNS message to
purchaseAck-sap-integration-service
after successful mutation to ackDetails.purchaseAck-sap-integration-service
downstream updates SAP with PO updates.
To play around with queries & mutations npm start
and visit the graphql explorer localhost/4001/graphql
Prerequisites
node version 14
Setup
WITHOUT Vault
1) Copy config.json.example
to config.json
WITH Vault
- Copy token from vault dashboard (https://vault.zorouk.co.uk/) by clicking the arrow on the right-top corner of you dashbaord, you will have an option there called Copy token
- Once you have your token copied to your clipboard, go in your IDE config.json file and in there you only need two object keys (vaultToken, secretPath). The vaultToken is the token that you have copied previously and api-services secret path should be: /local/dev.name/data/dev/ecs/api-services
- Ensure
npm run vault
scripts contains vaultZORO_CONFIG_SRC=VAULT
the env is used as flag to read local secrets from vault.
Once you have added a your config.json file in your project as in the following example, everything should work normally (as before):
{
"vaultToken": "token",
"secretPath": "/dev/data/dev/lambda/subscription-service"
}
Installing & Testing
To run this project locally, clone the repo and initialize the project.
$ git clone git@github.com:graingerglobalonline/purchase-acknowledgement-service.git
$ cd purchase-acknowledgement-service
$ npm install
$ npm start
To test:
npm run test
FAQ
How can I check logs?
Dev
index="zoro-lambda-dev" source="/aws/lambda/purchase-acknowledgement-service-apigateway_dev*"
Prod
index="zoro-lambda-prod" source="/aws/lambda/purchase-acknowledgement-service-apigateway_prod*"
What is a Purchase Order Acknowledgement?
An Purchase Order Acknowledgement is an transaction normally sent by a seller to Zoro marketplace in response to a sales order to say they've acknowledged the sales order.
Invalid data
A purchase acknowledgement cannot contain same supplierCode and MessageID when we receive data from supplier.
Data Structure
A typical document
{
"_id" : "627a7bffc3ec31d6825fe887",
"orderId" : "CD-670359-485108",
"ackDetails" : [
{
"messageId" : "uuid3943382425",
"supplierCode" : "V000116",
"orderDetails" : [
{
"supplierSalesOrderRef" : "49359439",
"products" : [
{
"sku" : "ZT1000976X",
"expectedDeliveryDate" : "2022-05-11T08:21:55+0000",
"quantity" : 3,
"unitPrice" : 3.4
}
]
}
]
},
{
"messageId" : "uuid3943382425",
"supplierCode" : "V000116",
"orderDetails" : [
{
"supplierSalesOrderRef" : "49359439",
"products" : [
{
"sku" : "ZT1000976X",
"expectedDeliveryDate" : "2022-05-11T08:21:55+0000",
"quantity" : 3,
"unitPrice" : 3.4
}
]
}
]
}
],
"updatedAt" : "2022-05-12T13:27:56.209+0000"
}
Architecture
Big picture overview of purchase-ack-service in broader purchase-acknowledgements flow
1 year ago