@cfxlabsinc/b2b-services
    Preparing search index...

    Hierarchy

    • GirasolCardService
      • GirasolPhysicalCardService
    Index
    db: B2bDatabase
    girasolCardQueryService: GirasolCardQueryService
    girasolClient: GirasolClient
    • Parameters

      • input: Input

      Returns Promise<
          | {
              error: | ServiceError<
                  "CARD_ACCOUNT_NOT_FOUND"
                  | "CARD_ACCOUNT_NOT_ACTIVE",
              >
              | GirasolPhysicalCardValidateInputError;
              ok: false;
          }
          | {
              ok: true;
              value: {
                  createdAt: Date;
                  displayName: string;
                  expiryMonth?: string;
                  expiryYear?: string;
                  firstName: string;
                  girasolCardId: string;
                  id: string;
                  lastFourDigits?: string;
                  lastName: string;
                  phone: string;
                  shippingAddress?: {
                      city: string;
                      countryCode: string;
                      line1: string;
                      line2?: string;
                      postalCode: string;
                      region?: string;
                  };
                  status: GirasolCardStatus;
                  type: "PHYSICAL"
                  | "VIRTUAL";
                  updatedAt: Date;
              };
          },
      >

    • Fetches the active Girasol card account for the customer.

      Parameters

      • __namedParameters: { customerId: string }

      Returns Promise<
          | {
              ok: true;
              value: {
                  girasolAccountNumber: string;
                  id: number;
                  status: "ACTIVE"
                  | "INACTIVE"
                  | "DELETED"
                  | "UNKNOWN";
              };
          }
          | { error: ServiceError; ok: false },
      >

    • Returns auth token to fetch the card's data from Girasol. Consumer must implement their own logic to fetch the card data from Girasol using the token.

      Parameters

      • customerId: { customerId: string; id: string }

        The ID of the customer.

      Returns Promise<
          | { ok: true; value: { girasolCardId: string; token: string } }
          | { error: ServiceError; ok: false },
      >

      A promise that resolves to the auth token and Girasol card ID.

    • Unfreezes a card by its card ID via GirasolClient and updates the local DB status from 'FREEZED' to "ACTIVE".

      Parameters

      • __namedParameters: { customerId: string; id: string }

      Returns Promise<
          | { ok: true; value: GirasolCardStatus }
          | { error: ServiceError; ok: false },
      >