Club Leavers/Joiners Technical Design¶
Overview¶
This repository is not just for NHS discount, but any process that requires a customer adding/removing from an OSP group. This repository contains the code for lambdas and Step function required to Add or Remove the Club Joiners or Leavers respectively from OSP. Hence we will refer to it as Club Leavers/Joiners hereon instead of NHS Discount repo.
Leavers or Joiners are fetched from Club events on scheduled basis for NHS DISCOUNT, COLLEAGUE DISCOUNT and ADDITIONAL MEMBER DISCOUNT clubs and those are then POSTed or DELETEd from the OSP/OCEAN systems if those customers are Online customers too.
Updates in Ocado’s OSP happen through API endpoints while that in Ocado’s OCEAN happen through CSV file uploads.
In a nutshell, following important steps are performed by the lambdas and step function present in this repository. Please refer to the Architecture Document below for more details.
Fetch events from Club service based on EventId water-mark triggered by CloudWatch scheduled job
Water-mark is stored in dynamodb, updated after events are fetched
Check whether Customers fetched in the events are OSP customers or not
For OSP customers decide Add/Remove action based on operation in Club event (JOINER or LEAVER) and call respective lambda accordingly
Log response coming from OSP into BigQuery (using SNS)
Swaggers¶
All swaggers are maintained in Pymorri for Integration testing. Paths below
References¶
Document |
Ref |
|---|---|
Architecture Document |
|
Main Jira Story |
NHS Discount Workflow: SPDP-2137. |
Components¶
Diagrams¶
Flow Diagram¶
AWS Step Function¶
Below is the AWS Step function which is triggered by Step Function Trigger Lambda and gets the Club service events as input so that those can be processed for Adding or Removing customers from OSP Customer group.
Event Pattern¶
Pattern 2 shown in below diagram has been used to follow the event based triggering approach.
Sequence Diagrams¶