Colleague Leavers Handler Lambda¶
Overview¶
This lambda fetches list of Leavers from Colleague v1 and calls DELETE endpoint on Discount v1 so that discount is revoked for those Colleagues.
Sequence Diagram¶
Dependencies¶
Configuration(from config service)¶
Code¶
-
lambdas.storepick_colleague_handler.lambda_handler(event, context)[source]¶ This Lambda queries customer lists of leavers since yesterday and delete them using DELETE endpoint of colleague discount api (DELETE /colleaguediscount/v1/colleagues)
- Input:
event (dict) - can be empty json {} but CANNOT be None
- Output:
resp (dict): HTTP response - 200 on success and 500 on failure / exception
- Additionally function post CHECK status to DataDog API:
metric name: colleague_discount_check
app name: storepick_colleague_discount
- It sends:
value 0 (SUCCESS) when this function returns 200
value 2 (ERROR) when this function throws exception + exception is handled and processed in build_response_or_throw decorator and error response with 500 or 4xx is sent.
Example body:
resp = { 'statusCode': 200, 'headers': { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' }, 'body': { "status": "success", "message": "Today colleage leavers deleted successfully", "body": [] } }
- Raises:
MoriException: MoriException for timeout of retrieving file from QueryColleagues endpoint