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

    Maintain the account and beneficiary details for sending international wires via SWIFT network.

    Hierarchy (View Summary)

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

    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: SwiftWireUpdateData; id: string }

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  bankAddress?: Partial<
                      Omit<
                          {
                              city: string;
                              countryCode: string;
                              line1: string;
                              postalCode: string;
                              region?: string;
                          },
                          "countryCode",
                      >,
                  >;
                  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;
                  currency: string;
                  deletedAt: Date | null;
                  financialInstitution: Bic;
                  iban?: string;
                  id: string;
                  intermediaryFinancialInstitution?: Bic;
                  intermediaryRoutingNumber?: string;
                  localAccountNumber?: string;
                  localBankCode?: 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: "SWIFT_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
              };
          }
          | { error: SwiftWireUpdateError; ok: false },
      >

    • Parameters

      • request: {
            accountNumber?: string | null;
            accountType?: "CHECKING" | "SAVING" | null;
            bankAddress?:
                | {
                    city?: string
                    | null;
                    line1?: string | null;
                    postalCode?: string | null;
                    region?: string | null;
                }
                | 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";
            };
            currency?: string
            | null;
            customerId: string;
            entityId: string;
            iban?: string | null;
            intermediaryRoutingNumber?: string | null;
            localAccountNumber?: string | null;
            localBankCode?: string | null;
            referenceId?: string | null;
            routingNumber?: string | null;
        }
        • OptionalaccountNumber?: string | null
        • OptionalaccountType?: "CHECKING" | "SAVING" | null

          Deposit account type, defaulting to "CHECKING". Total here, optional in storage and on the create request — see SwiftWireDbInstrumentData.accountType.

        • OptionalbankAddress?:
              | {
                  city?: string
                  | null;
                  line1?: string | null;
                  postalCode?: string | null;
                  region?: string | null;
              }
              | null

          The bank's address as the customer entered it. Each field wins over the directories; its country is the BIC's.

        • 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";
              }
        • Optionalcurrency?: string | null

          ISO-4217 currency the payout settles in, defaulting to SWIFT_WIRE_DEFAULT_CURRENCY. Immutable after create — see SwiftWireDbInstrumentData.

        • customerId: string
        • entityId: string
        • Optionaliban?: string | null
        • OptionalintermediaryRoutingNumber?: string | null

          Intermediary bank BIC/SWIFT code, if any

        • OptionallocalAccountNumber?: string | null

          The Local Account Number (e.g. Cuenta Cliente in Costa Rica) in the beneficiary's bank.

        • OptionallocalBankCode?: string | null

          Local Bank Code For Account Number (e.g. BSB for AU, IFSC for IN, NCC for EU, institution-transit (CRN) for CA)

        • OptionalreferenceId?: string | null
        • OptionalroutingNumber?: string | null

          BIC/SWIFT code

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  bankAddress?: Partial<
                      Omit<
                          {
                              city: string;
                              countryCode: string;
                              line1: string;
                              postalCode: string;
                              region?: string;
                          },
                          "countryCode",
                      >,
                  >;
                  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;
                  currency: string;
                  deletedAt: Date | null;
                  financialInstitution: Bic;
                  iban?: string;
                  id: string;
                  intermediaryFinancialInstitution?: Bic;
                  intermediaryRoutingNumber?: string;
                  localAccountNumber?: string;
                  localBankCode?: 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: "SWIFT_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
              };
          }
          | {
              error: | ServiceError<"PAYMENT_INSTRUMENT_DUPLICATE">
              | ServiceError<"BENEFICIARY_EMAIL_REQUIRED">
              | ServiceError<
                  "PAYMENT_INSTRUMENT_PROFILE_REJECTED",
                  { cause: AiPriseProfileError },
              >
              | ServiceError<
                  "PAYMENT_INSTRUMENT_PAYOUT_REJECTED",
                  { cause: RouteFusionError },
              >
              | PaymentInstrumentVerificationFailed<
                  {
                      accountNumber: string;
                      accountType: "CHECKING"
                      | "SAVING";
                      bankAddress?: Partial<
                          Omit<
                              {
                                  city: string;
                                  countryCode: string;
                                  line1: string;
                                  postalCode: string;
                                  region?: (...)
                                  | (...);
                              },
                              "countryCode",
                          >,
                      >;
                      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;
                      currency: string;
                      deletedAt: Date | null;
                      financialInstitution: Bic;
                      iban?: string;
                      id: string;
                      intermediaryFinancialInstitution?: Bic;
                      intermediaryRoutingNumber?: string;
                      localAccountNumber?: string;
                      localBankCode?: 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: "SWIFT_WIRE";
                      typeDescription: string;
                      updatedAt: Date;
                      verificationProfileId?: string;
                  },
              >
              | SwiftWirePaymentInstrumentResolveError
              | SwiftWirePaymentInstrumentValidateError;
              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>

    • The bank a BIC names, with the address an entity's instrument would store for it and the bankAddress.* fields a customer must still supply. ok(null) for a code the SWIFT directory does not know.

      Parameters

      • __namedParameters: { customerId: string; entityId: string; swiftBic: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | {
              ok: true;
              value:
                  | {
                      bank: Bic;
                      requiredFields: (
                          | "bankAddress.city"
                          | "bankAddress.line1"
                          | "bankAddress.postalCode"
                          | "bankAddress.region"
                      )[];
                  }
                  | null;
          },
      >

    • 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 replaced wholesale rather than merged field-by-field, and its type is immutable — it is a BUSINESS | PERSON discriminated union, and a partial merge could assemble a member that satisfies neither arm.

      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: SwiftWireUpdateData; id: string }

      Returns Promise<
          | {
              ok: true;
              value: {
                  accountNumber: string;
                  accountType: "CHECKING"
                  | "SAVING";
                  bankAddress?: Partial<
                      Omit<
                          {
                              city: string;
                              countryCode: string;
                              line1: string;
                              postalCode: string;
                              region?: string;
                          },
                          "countryCode",
                      >,
                  >;
                  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;
                  currency: string;
                  deletedAt: Date | null;
                  financialInstitution: Bic;
                  iban?: string;
                  id: string;
                  intermediaryFinancialInstitution?: Bic;
                  intermediaryRoutingNumber?: string;
                  localAccountNumber?: string;
                  localBankCode?: 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: "SWIFT_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
              };
          }
          | { error: SwiftWireUpdateError; 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";
                  bankAddress?: Partial<
                      Omit<
                          {
                              city: string;
                              countryCode: string;
                              line1: string;
                              postalCode: string;
                              region?: string;
                          },
                          "countryCode",
                      >,
                  >;
                  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;
                  currency: string;
                  deletedAt: Date | null;
                  financialInstitution: Bic;
                  iban?: string;
                  id: string;
                  intermediaryFinancialInstitution?: Bic;
                  intermediaryRoutingNumber?: string;
                  localAccountNumber?: string;
                  localBankCode?: 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: "SWIFT_WIRE";
                  typeDescription: string;
                  updatedAt: Date;
                  verificationProfileId?: string;
              };
          },
      >