Colleague Discount Infrastructure

The Infrastructure page lists and explains the Infra components which are required for the code to run properly.

Components

Component

Description

Activity

Ref

<<SSM Attribute>>

SSM keys for Discounts to protect the content

New

SSM Key

<<SSM Attribute>>

SSM keys for Ocean to protect the content

New

Ocean SSM Key

<<Config Service>>

New application configuration for Colleague Handler

New

Configuration(from config service)

<<Config Service>>

Application configuration for Club Leavers/Handlers

Existing

Configuration(from config service)

<<AWS Role>>

New AWS Role to CW log filter to work

New

AWS Role

<<AWS Lambda>>

New Lambda to handle each of the different endpoints

New

AWS Lambdas

<<AWS DynamoDB Table>>

New Table to store OCEAN customers

New

AWS DynamoDB Table

SSM Key

The security credentials will be stored in the following security credentials in the digital Jenkins. These credentials are used to populate the SSM key below in the respective environments. This secure attribute is created from the common-infrastructure repository.

storepick_discount_apikey

values

{
    "API_KEY": "my_api_key",
    "AUTHORISATION": "my_authorisation",
    "DECRYPTION_KEY": "WWWWWWWWWW",
    "GOOGLE_CREDENTIALS": {
        "type": "service_account",
        "project_id": "acn-morri-jml-dev",
        "private_key_id": "XXXXXXX",
        "private_key": "XXXXXXXXX",
        "client_email": "XXXXXX",
        "client_id": "XXXXXX",
        "auth_uri": "XXXXXX",
        "token_uri": "XXXXXXX",
        "auth_provider_x509_cert_url": "XXXXXX",
        "client_x509_cert_url": "XXXXXXXX"
    }
}

Ocean SSM Key

storepick_discount_ocean

values

{
    "API_KEY": "my_api_key",
    "AUTHORISATION": "my_authorisation",
    "OSP_SECRET": "WWWWWWWWWW",
    "OSP_SERVICE_ACCOUNT": "service_account_name",
    "OSP_APIKEY": "api",
    "OSP_AUTH_URL": "https://login.sandbox.osp.tech",
    "GOOGLE_CREDENTIALS": {
        "type": "service_account",
        "project_id": "morrisons-lm-bigdata",
        "private_key_id": "XXXXXXX",
        "private_key": "XXXXXXXXX",
        "client_email": "XXXXXX",
        "client_id": "XXXXXX",
        "auth_uri": "XXXXXX",
        "token_uri": "XXXXXXX",
        "auth_provider_x509_cert_url": "XXXXXX",
        "client_x509_cert_url": "XXXXXXXX"
    }
}

Configuration(from config service)

Attribute

Description

storepick-colleague-discount.json

Colleague Discount application configuration

{
    "MORI_BASE_URL": "https://api.morrisons.com",
    "MORI_BASE_URL_CUSTOMER": "https://api.morrisons.com",
    "MORI_BASE_URL_QUERYCOLLEAGUES": "https://api.morrisons.com",
    "OSP_BASE_URL": "https://api.mol.osp.tech/externalapi",
    "CUSTOMER_URL": "customer/v2/customers",
    "OSP_CUSTOMER_URL": "osp/v3/customers",
    "IS_SERVICE_ENABLED": "yes",
    "GET_COLLEAGE_JOB_ID_PROCESSING_TIMEOUT": 60,
    "QUERYCOLLEAGUES_URL": "colleague/v1/colleagues",
    "QUERYCOLLEAGUES_SCOPE_VALUE": "LEAVER",
    "DELETECOLLEAGUEDISCOUNT_URL": "colleaguediscount/v1/colleagues",
    "PUTCOLLEAGUEDISCOUNT_URL": "colleaguediscount/v1/colleagues",
    "GCP_BUCKET": "morrisons-incoming-feeds-prod",
    "GCP_UPLOAD_FILE_NAME": "ocean_colleague_discount_info.csv",
    "S3_BUCKET": "mprd.xxwmm.foodonline.staffdiscount.zzzzzzzzzz",
    "S3_SOURCE_FILE_PREFIX": "customer/ids/pending/staff-discounts-",
    "S3_TARGET_FILE_PREFIX": "customer/ids/archive/staff-discounts-"
}

Configuration(from config service)

Attribute

Description

storepick-nhs-discount.json

NHS Discount application configuration

{
    "MORI_BASE_URL": "https://api.morrisons.com",
    "OSP_BASE_URL": "https://api.mol.osp.tech/externalapi",
    "OSP_CUSTOMER_GROUPS_URL": "v3/morrisons/customer-groups/",
    "OSP_CUSTOMER_URL": "v3/customers",
    "BIG_QUERY_DATASET": "store_pick_discount",
    "BIG_QUERY_TABLE": "nhs_discount",
    "SF_PASS_DATA_S3_BUCKET_AND_DIR": 'mprd.hmdel.digital.strpck.sokczaiifq/nhsdiscount',
    "CONCURRENCY_CHUNK_SIZE" : 1000,
    "CLUBEVENTS_URL": "club/v1/events",
    "step_functions_arn_template": "arn:aws:states:eu-west-1:333073960552:stateMachine:stf-euw1-$ENV-stm-storepick_nhs_discount_workflow",
    "dynamodb_table_template": "$ENV.xxwmm.storepick.watermarks",
    "service_name": "clubevents",
    "group_mapping": [
        {
            "club_id": "5",
            "club_name": "NHS",
            "group_id": "example"
        },
        {
            "club_id": "6",
            "club_name": "Colleague",
            "group_id": "example"
        },
        {
            "club_id": "7",
            "club_name": "Additional members",
            "group_id": "example"
        }
    ],
    "IS_SERVICE_ENABLED": "yes",
    "COLLEAGUE_DISCOUNT_ENABLED": "yes",
    "MAX_NUMBER_OF_EVENTS": 1500,
    "MAX_NUMBER_OF_EVENTS_IN_ONE_CHUNK": 100,
    "SECONDS_TO_WAIT_FOR_CHUNK_PROCESSING": 5
}

AWS Role

Role Name

rol-glob-p-digital-restricted-lambda-001

AWS Lambdas

Colleague Leavers Handler Lambda

Environment

Aws Lambda

dev

lmb-euw1-dev-strpck-colleague_handler-001

sit

lmb-euw1-sit-strpck-colleague_handler-001

uat

lmb-euw1-uat-strpck-colleague_handler-001

prd

lmb-euw1-prd-strpck-colleague_handler-001

Create OSP Shell Account Lambda

Environment

Aws Lambda

dev

lmb-euw1-dev-strpck-create-osp-shell-account-001

sit

lmb-euw1-sit-strpck-create-osp-shell-account-001

uat

lmb-euw1-uat-strpck-create-osp-shell-account-001

prd

lmb-euw1-prd-strpck-create-osp-shell-account-001

Process Ocean Events Lambda

Environment

Aws Lambda

dev

lmb-euw1-dev-strpck-process_ocean_events-001

sit

lmb-euw1-sit-strpck-process_ocean_events-001

uat

lmb-euw1-uat-strpck-process_ocean_events-001

prd

lmb-euw1-prd-strpck-process_ocean_events-001

Ocean File Generator Lambda

Environment

Aws Lambda

dev

lmb-euw1-dev-strpck-ocean-file-generator-001

sit

lmb-euw1-sit-strpck-ocean-file-generator-001

uat

lmb-euw1-uat-strpck-ocean-file-generator-001

prd

lmb-euw1-prd-strpck-ocean-file-generator-001

AWS DynamoDB Table

Environment

Dynamo Table

dev

dev.xxwmm.storepick.ocean_colleague_discount

sit

sit.xxwmm.storepick.ocean_colleague_discount

uat

uat.xxwmm.storepick.ocean_colleague_discount

prd

prd.xxwmm.storepick.ocean_colleague_discount