Storepick Colleague Handler¶
Overview¶
Previously the discount journey that a Morrisons Colleague goes through differs based on the platform on which he is registering viz. Ocado’s OCEAN or OSP.
To make this journey more straight-forward, an improved Colleague Discount process is introduced through the use of this Colleague Handler application wherein once the Colleague registers on portal he should get added to both OSP and OCEAN. He should have discount automatically applied at checkout without needing to add voucher codes etc. OSP uses an API while OCEAN uses file based integration.
Similarly when a Collegue is Leaving, he should get removed from the OSP and OCEAN discount groups.
Following things will happen when a Colleague Leaves or Joins.
Colleague Joins
When Colleague registers on the portal, the portal makes sure the Colleague is in service (using Colleague v1) and fetches his customerId based on emailId (using Customer v2)
Portal calls Discount v1 API with employee Id, customer Id and up to 2 additional member Ids (friends & family)
Discount v1 adds these details to DynamoDb and Club v1. Refer to documentation for Discount API.
Club service creates separate entries and generates individual events. These events are collected and added to OSP Promotion Group every 15 mins where Customer exists in OSP. Refer to documentation for Club Leavers/Joiners.
If customer does not exist in OSP, it is deemed as OCEAN customer but still an account is created in OSP in order to support the click and collect in Dordon initiative. Refer Create OSP Shell Account Lambda
For OCEAN customers, the existing staff discount file generation process will be used in that the file will be downloaded from the AWS bucket, merged with the DynamoDB Colleague records and then sent to the google bucket in OCEAN using the GCP APIs. Refer Process Ocean Events Lambda and Ocean File Generator Lambda
Colleague Leaves
Leavers handler calls the Colleague v1 batch API endpoint to get colleagues that have been terminated/ceased. File from the google bucket needs to be downloaded and decrypted. The list of Leaver Colleagues is sent to Discount v1. Refer Colleague Leavers Handler Lambda
Discount v1 will remove the Colleague and additional discount members from Club v1 and DynamoDb table. Refer documentation for Discount API
Club service generates individual Leavers events. These events are collected and removed from the OSP Promotion Group every 15 mins where Customer exists in OSP. Refer documentation for Club Leavers/Joiners
For OCEAN customers, the existing staff discount file generation process will be used in that the file will be downloaded from the AWS bucket, merged with the DynamoDB Colleague records and then sent to the google bucket in OCEAN using the GCP APIs. Refer Process Ocean Events Lambda and Ocean File Generator Lambda
References¶
Document |
Ref |
|---|---|
Architecture Document |
|
Jira Epic |
Colleague Leavers Handler: SPDP-2613. |
Bitbucket Repository |
Components¶
Diagrams¶
Colleague Discount Overview
The image below shows the flow of the full Colleague Discount process, with several processes that are done as part of this Colleague Handler repository. Step 7 shows the Colleague Leavers Handler Lambda. This repository also contains the Ocean File Generator Lambda process shown in this diagram. The other 2 lambdas used in this repository are shown and explained in Colleague Discount Code.
Colleague Handler process
The below diagram shows the processes triggered by club leavers/joiners lambda, including those held within this repository. The lambdas held within this repository are focused on allowing OCEAN customers to be processed through to OSP and into Colleague Discount, including creating OSP shell accounts.
Colleague Discount Components
Below is components in Colleague Discount .. image:: ./diagrams/colleague-discount-components.png