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

    Maintain the account and beneficiary details for sending US wires via Fedwire network.

    Hierarchy (View Summary)

    Index
    cache: ServiceCache<CachedSearchPage<PaymentInstrumentSearchItem>>
    instance: (...args: []) => UsWirePaymentInstrumentService = ...

    The process default: built from each dependency's own instance().

    • update for an operator, whoever owns the row: skips only the capability check.

      Parameters

      • input: { data: UsWireUpdateData; id: string }

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  beneficiary: {
                      address: {
                          city: string;
                          countryCode: string;
                          line1: string;
                          line2?: string;
                          postalCode: string;
                          region?: string;
                      };
                      email?: string;
                      phone?: string;
                      reference?: string;
                  } & (
                      | { name: string; type: "BUSINESS" }
                      | {
                          firstName: string;
                          lastName: string;
                          middleName?: string;
                          type: "PERSON";
                      }
                  );
                  beneficiaryName: string
                  | null;
                  beneficiaryTypeDescription: string;
                  createdAt: Date;
                  deletedAt: Date | null;
                  financialInstitution: {
                      address: {
                          city: string;
                          line1?: string;
                          postalCode?: string;
                          state: string;
                      };
                      name: string;
                  };
                  id: string;
                  provider: | "MX_CLABE"
                  | `chn_${string}`
                  | "LEDGER_ACCOUNT"
                  | "WIRE_DEPOSIT"
                  | "ACH_PUSH_DEPOSIT"
                  | "YELLOWCARD"
                  | "QUILTT"
                  | "VICTOR"
                  | "CFX";
                  providerId: string;
                  referenceId?: string;
                  routeFusionBeneficiaryId?: string;
                  routingNumber: string;
                  sendEnabled: boolean;
                  status: | "DELETED"
                  | "PENDING_VERIFICATION"
                  | "ACTION_REQUIRED"
                  | "APPROVED"
                  | "BLOCKED";
                  statusDescription: string;
                  type: "US_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
                  victorCounterpartyId?: string;
              };
          }
          | { error: UsWireUpdateError; ok: false },
      >

    • Parameters

      • request: {
            accountNumber: string;
            accountType?: "CHECKING" | "SAVING" | null;
            beneficiary:
                | {
                    address: {
                        city: string;
                        countryCode: string;
                        line1: string;
                        line2?: string
                        | null;
                        postalCode: string;
                        region?: string | null;
                    };
                    email?: string
                    | null;
                    name: string;
                    phone?: string | null;
                    reference?: string | null;
                    type: "BUSINESS";
                }
                | {
                    address: {
                        city: string;
                        countryCode: string;
                        line1: string;
                        line2?: string
                        | null;
                        postalCode: string;
                        region?: string | null;
                    };
                    email?: string
                    | null;
                    firstName: string;
                    lastName: string;
                    middleName?: string | null;
                    phone?: string | null;
                    reference?: string | null;
                    type: "PERSON";
                };
            customerId: string;
            entityId: string;
            referenceId?: string
            | null;
            routingNumber: string;
            victorCounterpartyId?: string | null;
        }
        • accountNumber: string
        • OptionalaccountType?: "CHECKING" | "SAVING" | null

          Deposit account type — total here, optional in storage and on the create request. See UsWireDbInstrumentData.accountType.

        • beneficiary:
              | {
                  address: {
                      city: string;
                      countryCode: string;
                      line1: string;
                      line2?: string
                      | null;
                      postalCode: string;
                      region?: string | null;
                  };
                  email?: string
                  | null;
                  name: string;
                  phone?: string | null;
                  reference?: string | null;
                  type: "BUSINESS";
              }
              | {
                  address: {
                      city: string;
                      countryCode: string;
                      line1: string;
                      line2?: string
                      | null;
                      postalCode: string;
                      region?: string | null;
                  };
                  email?: string
                  | null;
                  firstName: string;
                  lastName: string;
                  middleName?: string | null;
                  phone?: string | null;
                  reference?: string | null;
                  type: "PERSON";
              }
        • customerId: string
        • entityId: string
        • OptionalreferenceId?: string | null
        • routingNumber: string

          ABA routing number

        • OptionalvictorCounterpartyId?: string | null

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  beneficiary: {
                      address: {
                          city: string;
                          countryCode: string;
                          line1: string;
                          line2?: string;
                          postalCode: string;
                          region?: string;
                      };
                      email?: string;
                      phone?: string;
                      reference?: string;
                  } & (
                      | { name: string; type: "BUSINESS" }
                      | {
                          firstName: string;
                          lastName: string;
                          middleName?: string;
                          type: "PERSON";
                      }
                  );
                  beneficiaryName: string
                  | null;
                  beneficiaryTypeDescription: string;
                  createdAt: Date;
                  deletedAt: Date | null;
                  financialInstitution: {
                      address: {
                          city: string;
                          line1?: string;
                          postalCode?: string;
                          state: string;
                      };
                      name: string;
                  };
                  id: string;
                  provider: | "MX_CLABE"
                  | `chn_${string}`
                  | "LEDGER_ACCOUNT"
                  | "WIRE_DEPOSIT"
                  | "ACH_PUSH_DEPOSIT"
                  | "YELLOWCARD"
                  | "QUILTT"
                  | "VICTOR"
                  | "CFX";
                  providerId: string;
                  referenceId?: string;
                  routeFusionBeneficiaryId?: string;
                  routingNumber: string;
                  sendEnabled: boolean;
                  status: | "DELETED"
                  | "PENDING_VERIFICATION"
                  | "ACTION_REQUIRED"
                  | "APPROVED"
                  | "BLOCKED";
                  statusDescription: string;
                  type: "US_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
                  victorCounterpartyId?: string;
              };
          }
          | {
              error: | ServiceError<"PAYMENT_INSTRUMENT_DUPLICATE">
              | ServiceError<"BENEFICIARY_EMAIL_REQUIRED">
              | ServiceError<
                  "PAYMENT_INSTRUMENT_PROFILE_REJECTED",
                  { cause: AiPriseProfileError },
              >
              | PaymentInstrumentVerificationFailed<
                  {
                      accountNumber: string;
                      accountType: "CHECKING"
                      | "SAVING";
                      beneficiary: {
                          address: {
                              city: string;
                              countryCode: string;
                              line1: string;
                              line2?: string;
                              postalCode: string;
                              region?: string;
                          };
                          email?: string;
                          phone?: string;
                          reference?: string;
                      } & (
                          | { name: string; type: "BUSINESS" }
                          | {
                              firstName: string;
                              lastName: string;
                              middleName?: string;
                              type: "PERSON";
                          }
                      );
                      beneficiaryName: string
                      | null;
                      beneficiaryTypeDescription: string;
                      createdAt: Date;
                      deletedAt: Date | null;
                      financialInstitution: {
                          address: {
                              city: string;
                              line1?: string;
                              postalCode?: string;
                              state: string;
                          };
                          name: string;
                      };
                      id: string;
                      provider: | "MX_CLABE"
                      | `chn_${string}`
                      | "LEDGER_ACCOUNT"
                      | "WIRE_DEPOSIT"
                      | "ACH_PUSH_DEPOSIT"
                      | "YELLOWCARD"
                      | "QUILTT"
                      | "VICTOR"
                      | "CFX";
                      providerId: string;
                      referenceId?: string;
                      routeFusionBeneficiaryId?: string;
                      routingNumber: string;
                      sendEnabled: boolean;
                      status: | "DELETED"
                      | "PENDING_VERIFICATION"
                      | "ACTION_REQUIRED"
                      | "APPROVED"
                      | "BLOCKED";
                      statusDescription: string;
                      type: "US_WIRE";
                      typeDescription: string;
                      updatedAt: Date;
                      verificationProfileId?: string;
                      victorCounterpartyId?: string;
                  },
              >
              | UsWirePaymentInstrumentValidateError;
              ok: false;
          },
      >

    • Also clears payment-instrument.text. Every writer busts by customer alone, which reaches no field tag, yet each write may change the text a cached transaction q page matched on.

      Parameters

      • args: {
            customerIds: readonly string[];
            keys?: readonly CacheKey[];
            records?: readonly string[];
        }

      Returns Promise<void>

    • Tags for a page: the scope its query searched (each customer's membership tag, else the collection tag), so an empty page is bustable too, plus the records it projects and the fields that chose or ordered its rows.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[] | undefined;
            fields?: readonly string[];
            records?: readonly string[];
        }

      Returns string[]

    • Merge data into an existing instrument. Every field is optional — an absent key is left untouched.

      beneficiary is the exception: it is replaced wholesale, never merged field-by-field. It is a BUSINESS | PERSON discriminated union, and a per-field merge could assemble a member that satisfies neither arm (a BUSINESS carrying a firstName). Its type is immutable for the same reason the dashboard's edit form locks that radio group.

      The owning entity is read off the row, not supplied: it is what the capability check and the derived providerId are built from, and an instrument cannot move between entities.

      Parameters

      • input: { customerId: string; data: UsWireUpdateData; id: string }

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  beneficiary: {
                      address: {
                          city: string;
                          countryCode: string;
                          line1: string;
                          line2?: string;
                          postalCode: string;
                          region?: string;
                      };
                      email?: string;
                      phone?: string;
                      reference?: string;
                  } & (
                      | { name: string; type: "BUSINESS" }
                      | {
                          firstName: string;
                          lastName: string;
                          middleName?: string;
                          type: "PERSON";
                      }
                  );
                  beneficiaryName: string
                  | null;
                  beneficiaryTypeDescription: string;
                  createdAt: Date;
                  deletedAt: Date | null;
                  financialInstitution: {
                      address: {
                          city: string;
                          line1?: string;
                          postalCode?: string;
                          state: string;
                      };
                      name: string;
                  };
                  id: string;
                  provider: | "MX_CLABE"
                  | `chn_${string}`
                  | "LEDGER_ACCOUNT"
                  | "WIRE_DEPOSIT"
                  | "ACH_PUSH_DEPOSIT"
                  | "YELLOWCARD"
                  | "QUILTT"
                  | "VICTOR"
                  | "CFX";
                  providerId: string;
                  referenceId?: string;
                  routeFusionBeneficiaryId?: string;
                  routingNumber: string;
                  sendEnabled: boolean;
                  status: | "DELETED"
                  | "PENDING_VERIFICATION"
                  | "ACTION_REQUIRED"
                  | "APPROVED"
                  | "BLOCKED";
                  statusDescription: string;
                  type: "US_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
                  victorCounterpartyId?: string;
              };
          }
          | { error: UsWireUpdateError; ok: false },
      >

    • Upserts currently-persisted beneficiary into AiPrise and runs a verification

      Parameters

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

      Returns Promise<
          | { error: ServiceError; ok: false }
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING" | "SAVING";
                  beneficiary: {
                      address: {
                          city: string;
                          countryCode: string;
                          line1: string;
                          line2?: string;
                          postalCode: string;
                          region?: string;
                      };
                      email?: string;
                      phone?: string;
                      reference?: string;
                  } & (
                      | { name: string; type: "BUSINESS" }
                      | {
                          firstName: string;
                          lastName: string;
                          middleName?: string;
                          type: "PERSON";
                      }
                  );
                  beneficiaryName: string
                  | null;
                  beneficiaryTypeDescription: string;
                  createdAt: Date;
                  deletedAt: Date | null;
                  financialInstitution: {
                      address: {
                          city: string;
                          line1?: string;
                          postalCode?: string;
                          state: string;
                      };
                      name: string;
                  };
                  id: string;
                  provider: | "MX_CLABE"
                  | `chn_${string}`
                  | "LEDGER_ACCOUNT"
                  | "WIRE_DEPOSIT"
                  | "ACH_PUSH_DEPOSIT"
                  | "YELLOWCARD"
                  | "QUILTT"
                  | "VICTOR"
                  | "CFX";
                  providerId: string;
                  referenceId?: string;
                  routeFusionBeneficiaryId?: string;
                  routingNumber: string;
                  sendEnabled: boolean;
                  status: | "DELETED"
                  | "PENDING_VERIFICATION"
                  | "ACTION_REQUIRED"
                  | "APPROVED"
                  | "BLOCKED";
                  statusDescription: string;
                  type: "US_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
                  victorCounterpartyId?: string;
              };
          },
      >