No description
This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Python 99.2%
  • Shell 0.6%
Find a file
Carla Gouws d5c66fbd2e
Some checks failed
ci / tests (push) Failing after 8m40s
ci / release_staging (push) Has been skipped
Add typing to some functions (#292)
* initial commit

* more typing
2024-04-15 10:13:27 +01:00
.github build: use azure as an explicit package source (#287) 2024-02-28 14:28:22 +00:00
app Add typing to some functions (#292) 2024-04-15 10:13:27 +01:00
docs change value to points in keys 2015-09-08 15:02:10 +01:00
gunicorn_log_filter MER-1699 - Added % to regex (#92) 2022-05-13 16:24:01 +01:00
scripts replace pipenv with poetry and upgrade to python 3.12 (#259) 2024-01-10 11:55:22 +00:00
.coveragerc Remove BPL callback auth and removed test cases from coverage (#249) 2023-11-02 11:55:25 +00:00
.coveragerc-withagents add coverage threashold 2016-02-02 10:11:56 +00:00
.dockerignore build: stop excluding .git from docker build (#264) 2024-01-15 12:14:52 +00:00
.env.example Add .env.example file (#267) 2024-02-12 17:38:50 +00:00
.gitignore Fix/mer 1479 bpl integration - code replaces error (#16) 2021-12-03 14:46:09 +00:00
alembic.ini Fixes for alembic failing to find migrations inside docker (#289) 2024-03-11 08:31:25 +00:00
consumer.py implement olympus-messaging and task queue for join 2021-09-20 11:52:06 +01:00
Dockerfile Fixes for alembic failing to find migrations inside docker (#289) 2024-03-11 08:31:25 +00:00
Justfile replace pipenv with poetry and upgrade to python 3.12 (#259) 2024-01-10 11:55:22 +00:00
poetry.lock build: use azure as an explicit package source (#287) 2024-02-28 14:28:22 +00:00
pyproject.toml build: use azure as an explicit package source (#287) 2024-02-28 14:28:22 +00:00
README.md replace pipenv with poetry and upgrade to python 3.12 (#259) 2024-01-10 11:55:22 +00:00
retry_worker.py add retry mechanism (#107) 2022-07-19 12:16:48 +01:00
sentry_utils.py add audit_payload to sentry filtered fields list (#174) 2023-06-02 12:07:52 +01:00
settings.py replace pipenv with poetry and upgrade to python 3.12 (#259) 2024-01-10 11:55:22 +00:00
TODO.md refactor encoder and rename views.py 2015-09-15 09:24:20 +01:00
wsgi.py implement olympus-messaging and task queue for join 2021-09-20 11:52:06 +01:00

Midas

pipeline status coverage report

Table of Contents generated with DocToc

Prerequisites

Dependencies

The following is a list of the important dependencies used in the project. You do not need to install these manually. See project setup for installation instructions.

  • Flask - API framework.
  • Redis - Key-value store used for storing system configuration and task queues.
  • Celery - Celery is distributed task queue.

Project Setup

Poetry is used for managing project dependencies and execution.

Virtual Environment

Allow Poetry to authenticate with Azure Artifacts, if you haven't already. Username and password can be obtained from the 'Azure DevOps - Feed - Read PAT' item in the Engineering 1Password vault.

poetry config http-basic.azure <username> <password>

Create a virtualenv and install required software packages:

poetry install

Project configuration is done through environment variables. A convenient way to set these is in a .env file in the project root. See settings.py for configuration options that can be set in this file.

For terminal usage this file can be automatically sourced with direnv or poetry-dotenv-plugin. Most editors and IDEs have built-in or plugin support for dotenv files.

To make a .env file from the provided example:

cp .env.example .env

The provided example is sufficient as a basic configuration, but modification may be required for specific use-cases.

Unit Tests

Testing is done with pytest.

To execute a full test run:

pytest --verbose --cov app --cov-report term-missing app/tests/unit

Deployment

There is a Dockerfile provided in the project root. Build an image from this to get a deployment-ready version of the project.

Implementation/Design Notes

New journey and handler type added for removed - 05/07/2023

Originally intended for Costa who require a report of when the last card is removed from a wallet. Details need to be worked out; it is believed this is for marketing purposes not to inform the retailer to remove/delete the card. We intend to report the card if Hermes sends the loyalty_card_removed message

In the agent class override the base method:

loyalty_card_removed(self) -> None:

This method will only be called if:

  1. Europa must be configured for the REMOVED_HANDLER
  2. The agent init must implement journey types by sending the handler to super().init:

       def __init__(self, retry_count, user_info, scheme_slug=None, config=None):
           super().__init__(
               retry_count,
               user_info,
               config_handler_type=JOURNEY_TYPE_TO_HANDLER_TYPE_MAPPING[user_info["journey_type"]],
               scheme_slug=scheme_slug,
               config=config,
           )