Skip to content

First-creation-of-Virtual-Card

Virtual Card Creation Flow

This document outlines the process for creating a virtual card after the account is first created, detailing the key components and interactions across different projects.

1. Event Trigger

  • Source: Wallet Service.
  • Event: AddCardMessage event handler.
  • Action: Sends a request to ICardIssuerGateway.AddVirtualCard.
  • Action: Saves the new card into the Card table.
  • Action: Sends CardChangedEvent event
  • Action: Saves the card to firebase
  • Action: Updates Card restrictions based default card restrictions
  • Action: Publishes AccountAndCardAddedEvent

The ICardIssuerGateway contract is defined in the Minority.Cde.CardIssuer.Contract project.

2. Contract Implementation

  • Implementations: Both Lithic and Galileo implement the ICardIssuerGateway contract.
  • Lithic Flow:
    • After validation, the Lithic implementation calls the _lithicProxyService.AddCard endpoint.
    • Lithic service saves the created card in it's database

This endpoint is defined by the ILithicProxyService contract, which is part of the Minority.CardData.Service.Contract project.

3. Service Delegation

  • Service: LithicProxyService (located in the Minority.CardData.Service project).
  • Operation: The AddCard method processes the request.
  • API Call: It calls _lithicCdeAccountsApi.PostCardsAsync to handle the actual card creation on the Lithic platform.

This endpoint _lithicCdeAccountsApi.PostCardsAsync is defined by the ILithicCdeAccountsApi contract, which is part of the Minority.Lithic.Cde.Client.Contract, in Minority.Lithic project.

Summary Diagram

sequenceDiagram
    participant Wallet as Wallet (Minority.Wallet) 
    participant ICardIssuerGateway as ICardIssuerGateway (Minority.Cde.CardIssuer.Contract)
    participant LithicImpl as LithicCardIssuerGateway (Minority.Lithic)
    participant LithicProxyService as LithicProxyService (Minority.CardData.Service)
    participant LithicAPI as Lithic CDE Accounts API (Minority.Lithic)

    Wallet->>ICardIssuerGateway: AddCardMessage event triggers AddVirtualCard request
    ICardIssuerGateway->>LithicImpl: Route to Lithic implementation (after contract validation)
    LithicImpl->>LithicProxyService: Call _lithicProxyService.AddCard
    LithicProxyService->>LithicAPI: Call _lithicCdeAccountsApi.PostCardsAsync