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

    Constructors

    Methods

    Constructors

    Methods

    • Starts the top-level cancelLedgerAccountWithdrawalWorkflow which voids the redemption (skipped for batched ACH-credit), undoes any virtual account sweep, and refunds the user's ledger account to flip the withdrawal to RETURNED. skipReturn retains the funds and marks the withdrawal FAILED instead; skipSweepUndo leaves a performed virtual account sweep in place. Uses a distinct workflow id (cancel-<id>) so it doesn't collide with the still-pending initiate workflow handle that owns <id>.

      Parameters

      • __namedParameters: Pick<
            {
                createdAt: Date;
                customerId: string;
                data: {
                    imad?: string;
                    methodTransactionId?: string;
                    omad?: string;
                    signedTransaction?: string;
                    victorTransactionId?: string;
                };
                entityId: string;
                entityType: "IDENTITY"
                | "ORGANIZATION";
                feeSweepTxId: string | null;
                feeSweepTxType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                history: WithdrawalStatusUpdateHistory[];
                id: string;
                quote: {
                    createdAt: Date;
                    customerId: string;
                    deviceIpAddress: string | null;
                    deviceLocation: { lat: number; long: number; source: "ip" } | null;
                    entityId: string;
                    expiresAt: Date;
                    fees: (
                        {
                            amount: BigNumber;
                            receiver: "CUSTOMER"
                            | "CFX"
                            | "PROVIDER";
                            type: "FIXED" | "VARIABLE";
                        } & { currency: "MOVEUSD"
                        | "USDC" }
                    )[];
                    id: string;
                    metadata: {
                        brand?: string;
                        marketing?: {
                            fbp?: string;
                            gclid?: string;
                            sub1?: string;
                            sub2?: string;
                            sub3?: string;
                            userAgent?: string;
                            utmCampaign?: string;
                            utmContent?: string;
                            utmMedium?: string;
                            utmSource?: string;
                        };
                    };
                    methodData: | {
                        achBatchId?: string;
                        bankId?: string;
                        sourceLedgerAccountId?: string;
                        speed?: "same-day"
                        | "next-day";
                        type: "US_ACH";
                    }
                    | {
                        achId: string;
                        bankId?: string;
                        sourceLedgerAccountId?: string;
                        type: "ACH_PULL";
                    }
                    | {
                        bankId?: string;
                        beneficiaryReference?: string;
                        purpose: WireWithdrawalPurpose;
                        senderMessage?: string;
                        sourceLedgerAccountId: string;
                        type: "US_WIRE"
                        | "SWIFT_WIRE";
                        wireBatchId?: string;
                    }
                    | {
                        country: string;
                        type: "AF_WITHDRAWAL";
                        withdrawalType: "bank"
                        | "momo";
                    }
                    | { sourceLedgerAccountId: string; type: "BLOCKCHAIN" }
                    | { bankId?: string; sourceLedgerAccountId?: string; type: "US_INSTANT" }
                    | {
                        bankId?: string;
                        drawdownId: string;
                        sourceAccountId: string;
                        type: "US_WIRE_DRAWDOWN";
                    }
                    | null;
                    methodId: | "US_WIRE"
                    | "SWIFT_WIRE"
                    | "US_ACH"
                    | "US_INSTANT"
                    | "MX_SPEI"
                    | "US_WIRE_DRAWDOWN"
                    | "AF_WITHDRAWAL"
                    | "ACH_PULL"
                    | "BLOCKCHAIN";
                    paymentInstrumentId: string;
                    productQuoteId: string;
                    providerQuoteId: string
                    | null;
                    sourceAmount: BigNumber;
                    sourceAmountAfterFees: BigNumber;
                    sourceCurrency: string;
                    status: "ACTIVE" | "ACCEPTED" | "EXPIRED" | "REJECTED";
                    targetAmount: BigNumber;
                    targetAmountAfterFees: BigNumber;
                    targetCurrency: string;
                    unsignedWithdrawalTransaction: string;
                    updatedAt: Date;
                    walletAddress: Address;
                    walletBlockchain: string;
                };
                receiptId: string
                | null;
                receiptType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                returnReceiptId: string | null;
                status: "CREATED" | "PENDING" | "FAILED" | "COMPLETED" | "RETURNED";
                sweepTxId: string | null;
                sweepTxType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                type:
                    | "US_WIRE"
                    | "SWIFT_WIRE"
                    | "US_ACH"
                    | "US_INSTANT"
                    | "MX_SPEI"
                    | "US_WIRE_DRAWDOWN"
                    | "AF_WITHDRAWAL"
                    | "ACH_PULL"
                    | "BLOCKCHAIN";
                updatedAt: Date;
            },
            "id",
        > & { reason?: string; skipReturn?: boolean; skipSweepUndo?: boolean }
        • Optionalreason?: string

          Operator-entered reason, recorded on the FAILED/RETURNED transition.

        • OptionalskipReturn?: boolean
        • OptionalskipSweepUndo?: boolean

      Returns Promise<{ ok: true; value: void }>

    • Re-kicks the rail-appropriate initiate*WithdrawalWorkflow for a withdrawal that's stuck in CREATED/PENDING. Idempotent: skips the start if the existing workflow handle (workflowId = withdrawalId) is still RUNNING, mirroring LedgerAccountTransferWorkflowService.create.

      Parameters

      Returns Promise<
          | { ok: true; value: void }
          | {
              error:
                  | ServiceError<"WITHDRAWAL_NOT_FOUND", { id: string }>
                  | ServiceError<
                      "WITHDRAWAL_RETRY_UNSUPPORTED",
                      {
                          methodId: | "US_WIRE"
                          | "SWIFT_WIRE"
                          | "US_ACH"
                          | "US_INSTANT"
                          | "MX_SPEI"
                          | "US_WIRE_DRAWDOWN"
                          | "AF_WITHDRAWAL"
                          | "ACH_PULL"
                          | "BLOCKCHAIN";
                      },
                  >;
              ok: false;
          },
      >