Skip to content

Card data flows MermaidJS POC

A POC of using Mermaidjs instead of PlantUML for diagrams.

Get Majority Card Data flows

This covers how majority card data flows....

sequenceDiagram
    title Get Card Data11
    participant AppUser as client
    participant CardDataApi as minority-carddata-api
    participant CardDataService as minority-carddata-service
    participant CardDataDB as minority-carddata-sqldb
    participant WalletCardService as minority-wallet-service
    participant AzKV as Azure KeyVault
    participant Elastic

    AppUser ->> CardDataApi : Create Access Token
    CardDataApi ->> AppUser : Access Token
    AppUser ->> CardDataApi : Get (CardId)
    CardDataApi ->> CardDataApi : Verify Access Token
    CardDataApi ->> CardDataService : Get (CardId, UserId)
    CardDataApi -x Elastic : Log Service Request (Truncated)
    CardDataService ->> CardDataDB : Get encrypted card data by CardId GetByCardId
    CardDataDB ->> CardDataService : Response


    alt If card data was null
        CardDataService ->> WalletCardService : GetCardById(userId, cardId) to get CardIssuer
        WalletCardService ->> CardDataService : Response (Card Issuer information)
        CardDataService -x CardDataService : Save card data (Refer **Save Majority Card Data** file)
    else If card data was not null
        CardDataService ->> CardDataDB : Get encrypted card data by CardId GetByCardId
        CardDataDB ->> CardDataService : Response
        CardDataService ->> AzKV : Get encrypted DEK from Secrets storage
        AzKV ->> CardDataService : Encrypted DEK
        CardDataService -x AzKV : Decrypt DEK with Master Key in HSM
        AzKV -x CardDataService : DEK in clear text
        CardDataService -x CardDataService : Decrypt Card Data

        alt If decrypted data does not contain card number or cvv or expiry date
            CardDataService -x CardDataService : Save card data (Refer **Save Majority Card Data** file)
        end
    end

    CardDataService -x CardDataService : Decrypt With Master HSM and Encrypt with Client PK (refer **Decrypt and Return Card Data** file)
    CardDataApi -x Elastic : Log Service Response (Truncated)
    CardDataService ->> CardDataApi: Get Card Data Response (Encrypted Card Data, CardId, UserId)
    CardDataApi ->> AppUser: Get Card Data Response (Encrypted Card Data, CardId, UserId)