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

    Constructors

    Properties

    Methods

    Constructors

    Properties

    dbHelper: DbHelper
    girasolClient: GirasolClient

    Methods

    • Get card by ID for the customer.

      Parameters

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

        The ID of the card. Example: card_1234567890.

      Returns Promise<
          {
              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: "VIRTUAL"
                  | "PHYSICAL";
                  updatedAt: Date;
              }
              | null;
          },
      >

      A promise that resolves to the card record.

    • Search cards for the customer.

      Parameters

      • customerId: {
            createdAt?: DbTimestampCriteria;
            customerId: string;
            girasolCardIds?: string[];
            ids?: string[];
            orderBy?: DbOrderByCriterion<
                Omit<
                    PgTableWithColumns<
                        {
                            columns: {
                                createdAt: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgTimestamp";
                                        data: Date;
                                        dataType: "date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "createdAt";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                customerId: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgInteger";
                                        data: number;
                                        dataType: "number";
                                        driverParam: (...)
                                        | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "customerId";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                data: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgJsonb";
                                        data: {
                                            displayName: ...;
                                            expiryMonth?: ...;
                                            expiryYear?: ...;
                                            firstName: ...;
                                            lastFourDigits?: ...;
                                            lastName: ...;
                                            phone: ...;
                                            shippingAddress?: ...;
                                        };
                                        dataType: "json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "data";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {
                                        $type: {
                                            displayName: ...;
                                            expiryMonth?: ...;
                                            expiryYear?: ...;
                                            firstName: ...;
                                            lastFourDigits?: ...;
                                            lastName: ...;
                                            phone: ...;
                                            shippingAddress?: ...;
                                        };
                                    },
                                >;
                                externalId: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgText";
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: [(...), ...(...)[]];
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: true;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "externalId";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                girasolAccountId: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgInteger";
                                        data: number;
                                        dataType: "number";
                                        driverParam: (...)
                                        | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "girasolAccountId";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                girasolCardId: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgText";
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: [(...), ...(...)[]];
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "girasolCardId";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                id: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgInteger";
                                        data: number;
                                        dataType: "number";
                                        driverParam: (...)
                                        | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: "byDefault";
                                        isAutoincrement: false;
                                        isPrimaryKey: true;
                                        name: "id";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                                type: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgText";
                                        data: (...)
                                        | (...);
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: [(...), ...(...)[]];
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "type";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    { $type: (...)
                                    | (...) },
                                >;
                                updatedAt: PgColumn<
                                    {
                                        baseColumn: never;
                                        columnType: "PgTimestamp";
                                        data: Date;
                                        dataType: "date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: "updatedAt";
                                        notNull: true;
                                        tableName: "girasol_card";
                                    },
                                    {},
                                    {},
                                >;
                            };
                            dialect: "pg";
                            name: "girasol_card";
                            schema: "b2b";
                        },
                    >,
                    "enableRLS",
                >,
                "createdAt"
                | "updatedAt",
            >[];
            page?: number;
            pageSize?: number;
            types?: ("VIRTUAL" | "PHYSICAL")[];
            updatedAt?: DbTimestampCriteria;
        }

        The ID of the customer.

        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • OptionalgirasolCardIds?: string[]
        • Optionalids?: string[]
        • OptionalorderBy?: DbOrderByCriterion<
              Omit<
                  PgTableWithColumns<
                      {
                          columns: {
                              createdAt: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgTimestamp";
                                      data: Date;
                                      dataType: "date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "createdAt";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              customerId: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgInteger";
                                      data: number;
                                      dataType: "number";
                                      driverParam: (...)
                                      | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "customerId";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              data: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgJsonb";
                                      data: {
                                          displayName: ...;
                                          expiryMonth?: ...;
                                          expiryYear?: ...;
                                          firstName: ...;
                                          lastFourDigits?: ...;
                                          lastName: ...;
                                          phone: ...;
                                          shippingAddress?: ...;
                                      };
                                      dataType: "json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "data";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {
                                      $type: {
                                          displayName: ...;
                                          expiryMonth?: ...;
                                          expiryYear?: ...;
                                          firstName: ...;
                                          lastFourDigits?: ...;
                                          lastName: ...;
                                          phone: ...;
                                          shippingAddress?: ...;
                                      };
                                  },
                              >;
                              externalId: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgText";
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: [(...), ...(...)[]];
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: true;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "externalId";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              girasolAccountId: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgInteger";
                                      data: number;
                                      dataType: "number";
                                      driverParam: (...)
                                      | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "girasolAccountId";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              girasolCardId: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgText";
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: [(...), ...(...)[]];
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "girasolCardId";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              id: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgInteger";
                                      data: number;
                                      dataType: "number";
                                      driverParam: (...)
                                      | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: "byDefault";
                                      isAutoincrement: false;
                                      isPrimaryKey: true;
                                      name: "id";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                              type: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgText";
                                      data: (...)
                                      | (...);
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: [(...), ...(...)[]];
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "type";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  { $type: (...)
                                  | (...) },
                              >;
                              updatedAt: PgColumn<
                                  {
                                      baseColumn: never;
                                      columnType: "PgTimestamp";
                                      data: Date;
                                      dataType: "date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: "updatedAt";
                                      notNull: true;
                                      tableName: "girasol_card";
                                  },
                                  {},
                                  {},
                              >;
                          };
                          dialect: "pg";
                          name: "girasol_card";
                          schema: "b2b";
                      },
                  >,
                  "enableRLS",
              >,
              "createdAt"
              | "updatedAt",
          >[]
        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 10

        • Optionaltypes?: ("VIRTUAL" | "PHYSICAL")[]
        • OptionalupdatedAt?: DbTimestampCriteria

      Returns Promise<
          {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: {
                      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: "VIRTUAL"
                      | "PHYSICAL";
                      updatedAt: Date;
                  }[];
              };
          },
      >

      A promise that resolves to the card records.