npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

purchase-ack-service

v1.0.0

Published

## Repo Purpose

Downloads

5

Readme

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

  1. 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
  2. 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
  3. Ensure npm run vault scripts contains vault ZORO_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 [email protected]: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

purchase-acknowledgement-flow drawio