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

    A MetCap ACH return settles from its bank transaction: its only key is the amount, so the operator picks the returned deposit and this cancels it.

    Index
    instance: (...args: []) => AchDebitDepositReturnService = ...

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

    • Claim the return for the deposit (DEPOSIT_RETURN), then cancel it. The amount is the only key, so the candidates are recomputed here, not trusted. Only a definite refusal releases the claim; an unconfirmed or interrupted cancel keeps it, so no other deposit can take the return while it may land.

      Parameters

      • __namedParameters: { bankTransactionId: string; depositId: string }

      Returns Promise<
          | { ok: true; value: { depositId: string } }
          | {
              error:
                  | ServiceError<"DEPOSIT_NOT_FOUND">
                  | ServiceError<"NOT_ACH">
                  | ServiceError<
                      "DEPOSIT_NOT_ACTIONABLE",
                      {
                          status: | "PENDING"
                          | "CANCELLED"
                          | "PROCESSING"
                          | "COMPLETED"
                          | "RETURNED";
                      },
                  >
                  | ServiceError<"ALREADY_MINTED">
                  | ServiceError<"DEPOSIT_SETTLING">
                  | ServiceError<"DEBIT_IN_FLIGHT">
                  | ServiceError<"CANCEL_NOT_CONFIRMED">
                  | ServiceError<"BANK_TRANSACTION_NOT_FOUND">
                  | ServiceError<"NOT_AN_ACH_RETURN">
                  | ServiceError<"BANK_TRANSACTION_RECONCILED">
                  | ServiceError<"DEPOSIT_RETURN_CLAIMED", { claimedByDepositId: string }>
                  | ServiceError<
                      "DEPOSIT_RETURN_CANCELLED_ANOTHER",
                      { cancelledDepositIds: string[] },
                  >
                  | ServiceError<"NOT_A_DEPOSIT_RETURN_CANDIDATE">
                  | ServiceError<"DEPOSIT_CANCEL_INTERRUPTED">;
              ok: false;
          },
      >

    • Same-amount ACH debit deposits whose batch went out in a NACHA file. fail refuses a live one whose hold ended, and a PENDING one bar a pre-patch run (DEBIT_IN_FLIGHT). cancelledByThis names this return; released minted.

      Parameters

      Returns Promise<
          {
              ok: true;
              value: {
                  cancelledByThis: (
                      {
                          createdAt: Date;
                          customerId: string;
                          entityId: string;
                          entityType: "IDENTITY"
                          | "ORGANIZATION";
                          feeSweepTxId: string | null;
                          feeSweepTxType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          history: {
                              createdAt: Date;
                              data:
                                  | {
                                      bankTransactionId?: (...)
                                      | (...);
                                      id?: (...) | (...);
                                      reason?: (...) | (...);
                                      transactionId?: (...) | (...);
                                  }
                                  | null;
                              depositId: string;
                              id: string;
                              status: | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          }[];
                          id: string;
                          idempotencyKey: string;
                          receiptId: string
                          | null;
                          receiptType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          sourceAmount: BigNumber;
                          sourceCurrency: string;
                          status:
                              | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          updatedAt: Date;
                      } & { type: "US_BANK_ACH" } & {
                          quote: {
                              aggregateQuote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              createdAt: Date;
                              customerId: string;
                              data?: | {
                                  address?: (...)
                                  | (...);
                                  barcodeNumber: string;
                                  barcodeStatus: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                                  expiresAt: string;
                                  firstName: string;
                                  greendotId: (...) | (...);
                                  lastName: string;
                                  phone?: (...) | (...);
                                  retailerId: string;
                                  retailerName: string;
                                  targetCurrency?: (...) | (...) | (...);
                                  zipcode: string;
                              }
                              | {
                                  ffc_memo?: (...)
                                  | (...);
                                  imad?: (...) | (...);
                                  omad?: (...) | (...);
                                  originating_fi?: (...) | (...);
                                  originator_address_line1?: (...) | (...);
                                  originator_address_line2?: (...) | (...);
                                  originator_address_line3?: (...) | (...);
                                  originator_info?: (...) | (...);
                                  sender_name?: (...) | (...);
                                  sending_fi?: (...) | (...);
                              }
                              | {
                                  achBatchId?: (...)
                                  | (...);
                                  achId: string;
                                  bankId?: (...) | (...);
                                  routeFusionIncomingTransferId?: (...) | (...);
                                  sourcePaymentInstrumentId: string;
                                  speed?: (...) | (...);
                                  vendorId?: (...) | (...);
                                  victorTransactionId?: (...) | (...);
                              }
                              | {
                                  providerId?: (...)
                                  | (...);
                                  providerTransactionId?: (...) | (...);
                              }
                              | { ffcMemo?: (...)
                              | (...) }
                              | {
                                  achId?: (...) | (...);
                                  achTraceId?: (...) | (...);
                                  addenda?: (...) | (...);
                                  companyDiscretionaryData?: (...) | (...);
                                  companyEntryDescription?: (...) | (...);
                                  companyId?: (...) | (...);
                                  companyName?: (...) | (...);
                                  effectiveEntryDate?: (...) | (...);
                                  ffcMemo?: (...) | (...);
                                  secCode?: (...) | (...);
                                  senderName?: (...) | (...);
                                  settlementDate?: (...) | (...);
                                  vendorId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  senderName?: (...) | (...);
                                  tchInstitutionId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  institutionId?: (...) | (...);
                                  senderName?: (...) | (...);
                              }
                              | null;
                              depositId?: string;
                              deviceIpAddress: string
                              | null;
                              deviceLocation?: { lat: number; long: number; source: "ip" };
                              entityId: string;
                              id: string;
                              metadata: {
                                  brand?: string;
                                  marketing?:
                                      | EmptyObject
                                      | {
                                          fbp?: ...;
                                          gclid?: ...;
                                          sub1?: ...;
                                          sub2?: ...;
                                          sub3?: ...;
                                          userAgent?: ...;
                                          utmCampaign?: ...;
                                          utmContent?: ...;
                                          utmMedium?: ...;
                                          utmSource?: ...;
                                      };
                              };
                              productQuoteId: string;
                              quote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              reference: string;
                              status: "ACTIVE"
                              | "EXPIRED"
                              | "ACCEPTED"
                              | "REJECTED";
                              updatedAt: Date;
                              walletAddress: Address;
                              walletBlockchain: string;
                          } & { type: "US_BANK_ACH" } & {
                              achBatchId?: string;
                              achId: string;
                              bankId?: "dart" | "fib";
                              routeFusionIncomingTransferId?: string;
                              sourcePaymentInstrumentId: string;
                              speed?: "same-day" | "next-day";
                              vendorId?: string;
                              victorTransactionId?: string;
                          };
                      }
                  )[];
                  live: (
                      {
                          createdAt: Date;
                          customerId: string;
                          entityId: string;
                          entityType: "IDENTITY"
                          | "ORGANIZATION";
                          feeSweepTxId: string | null;
                          feeSweepTxType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          history: {
                              createdAt: Date;
                              data:
                                  | {
                                      bankTransactionId?: (...)
                                      | (...);
                                      id?: (...) | (...);
                                      reason?: (...) | (...);
                                      transactionId?: (...) | (...);
                                  }
                                  | null;
                              depositId: string;
                              id: string;
                              status: | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          }[];
                          id: string;
                          idempotencyKey: string;
                          receiptId: string
                          | null;
                          receiptType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          sourceAmount: BigNumber;
                          sourceCurrency: string;
                          status:
                              | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          updatedAt: Date;
                      } & { type: "US_BANK_ACH" } & {
                          quote: {
                              aggregateQuote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              createdAt: Date;
                              customerId: string;
                              data?: | {
                                  address?: (...)
                                  | (...);
                                  barcodeNumber: string;
                                  barcodeStatus: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                                  expiresAt: string;
                                  firstName: string;
                                  greendotId: (...) | (...);
                                  lastName: string;
                                  phone?: (...) | (...);
                                  retailerId: string;
                                  retailerName: string;
                                  targetCurrency?: (...) | (...) | (...);
                                  zipcode: string;
                              }
                              | {
                                  ffc_memo?: (...)
                                  | (...);
                                  imad?: (...) | (...);
                                  omad?: (...) | (...);
                                  originating_fi?: (...) | (...);
                                  originator_address_line1?: (...) | (...);
                                  originator_address_line2?: (...) | (...);
                                  originator_address_line3?: (...) | (...);
                                  originator_info?: (...) | (...);
                                  sender_name?: (...) | (...);
                                  sending_fi?: (...) | (...);
                              }
                              | {
                                  achBatchId?: (...)
                                  | (...);
                                  achId: string;
                                  bankId?: (...) | (...);
                                  routeFusionIncomingTransferId?: (...) | (...);
                                  sourcePaymentInstrumentId: string;
                                  speed?: (...) | (...);
                                  vendorId?: (...) | (...);
                                  victorTransactionId?: (...) | (...);
                              }
                              | {
                                  providerId?: (...)
                                  | (...);
                                  providerTransactionId?: (...) | (...);
                              }
                              | { ffcMemo?: (...)
                              | (...) }
                              | {
                                  achId?: (...) | (...);
                                  achTraceId?: (...) | (...);
                                  addenda?: (...) | (...);
                                  companyDiscretionaryData?: (...) | (...);
                                  companyEntryDescription?: (...) | (...);
                                  companyId?: (...) | (...);
                                  companyName?: (...) | (...);
                                  effectiveEntryDate?: (...) | (...);
                                  ffcMemo?: (...) | (...);
                                  secCode?: (...) | (...);
                                  senderName?: (...) | (...);
                                  settlementDate?: (...) | (...);
                                  vendorId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  senderName?: (...) | (...);
                                  tchInstitutionId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  institutionId?: (...) | (...);
                                  senderName?: (...) | (...);
                              }
                              | null;
                              depositId?: string;
                              deviceIpAddress: string
                              | null;
                              deviceLocation?: { lat: number; long: number; source: "ip" };
                              entityId: string;
                              id: string;
                              metadata: {
                                  brand?: string;
                                  marketing?:
                                      | EmptyObject
                                      | {
                                          fbp?: ...;
                                          gclid?: ...;
                                          sub1?: ...;
                                          sub2?: ...;
                                          sub3?: ...;
                                          userAgent?: ...;
                                          utmCampaign?: ...;
                                          utmContent?: ...;
                                          utmMedium?: ...;
                                          utmSource?: ...;
                                      };
                              };
                              productQuoteId: string;
                              quote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              reference: string;
                              status: "ACTIVE"
                              | "EXPIRED"
                              | "ACCEPTED"
                              | "REJECTED";
                              updatedAt: Date;
                              walletAddress: Address;
                              walletBlockchain: string;
                          } & { type: "US_BANK_ACH" } & {
                              achBatchId?: string;
                              achId: string;
                              bankId?: "dart" | "fib";
                              routeFusionIncomingTransferId?: string;
                              sourcePaymentInstrumentId: string;
                              speed?: "same-day" | "next-day";
                              vendorId?: string;
                              victorTransactionId?: string;
                          };
                      }
                  )[];
                  released: (
                      {
                          createdAt: Date;
                          customerId: string;
                          entityId: string;
                          entityType: "IDENTITY"
                          | "ORGANIZATION";
                          feeSweepTxId: string | null;
                          feeSweepTxType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          history: {
                              createdAt: Date;
                              data:
                                  | {
                                      bankTransactionId?: (...)
                                      | (...);
                                      id?: (...) | (...);
                                      reason?: (...) | (...);
                                      transactionId?: (...) | (...);
                                  }
                                  | null;
                              depositId: string;
                              id: string;
                              status: | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          }[];
                          id: string;
                          idempotencyKey: string;
                          receiptId: string
                          | null;
                          receiptType: "SOLANA_TRANSACTION_SIGNATURE" | null;
                          sourceAmount: BigNumber;
                          sourceCurrency: string;
                          status:
                              | "PENDING"
                              | "CANCELLED"
                              | "PROCESSING"
                              | "COMPLETED"
                              | "RETURNED";
                          updatedAt: Date;
                      } & { type: "US_BANK_ACH" } & {
                          quote: {
                              aggregateQuote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              createdAt: Date;
                              customerId: string;
                              data?: | {
                                  address?: (...)
                                  | (...);
                                  barcodeNumber: string;
                                  barcodeStatus: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                                  expiresAt: string;
                                  firstName: string;
                                  greendotId: (...) | (...);
                                  lastName: string;
                                  phone?: (...) | (...);
                                  retailerId: string;
                                  retailerName: string;
                                  targetCurrency?: (...) | (...) | (...);
                                  zipcode: string;
                              }
                              | {
                                  ffc_memo?: (...)
                                  | (...);
                                  imad?: (...) | (...);
                                  omad?: (...) | (...);
                                  originating_fi?: (...) | (...);
                                  originator_address_line1?: (...) | (...);
                                  originator_address_line2?: (...) | (...);
                                  originator_address_line3?: (...) | (...);
                                  originator_info?: (...) | (...);
                                  sender_name?: (...) | (...);
                                  sending_fi?: (...) | (...);
                              }
                              | {
                                  achBatchId?: (...)
                                  | (...);
                                  achId: string;
                                  bankId?: (...) | (...);
                                  routeFusionIncomingTransferId?: (...) | (...);
                                  sourcePaymentInstrumentId: string;
                                  speed?: (...) | (...);
                                  vendorId?: (...) | (...);
                                  victorTransactionId?: (...) | (...);
                              }
                              | {
                                  providerId?: (...)
                                  | (...);
                                  providerTransactionId?: (...) | (...);
                              }
                              | { ffcMemo?: (...)
                              | (...) }
                              | {
                                  achId?: (...) | (...);
                                  achTraceId?: (...) | (...);
                                  addenda?: (...) | (...);
                                  companyDiscretionaryData?: (...) | (...);
                                  companyEntryDescription?: (...) | (...);
                                  companyId?: (...) | (...);
                                  companyName?: (...) | (...);
                                  effectiveEntryDate?: (...) | (...);
                                  ffcMemo?: (...) | (...);
                                  secCode?: (...) | (...);
                                  senderName?: (...) | (...);
                                  settlementDate?: (...) | (...);
                                  vendorId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  senderName?: (...) | (...);
                                  tchInstitutionId?: (...) | (...);
                              }
                              | {
                                  ffcMemo?: (...)
                                  | (...);
                                  institutionId?: (...) | (...);
                                  senderName?: (...) | (...);
                              }
                              | null;
                              depositId?: string;
                              deviceIpAddress: string
                              | null;
                              deviceLocation?: { lat: number; long: number; source: "ip" };
                              entityId: string;
                              id: string;
                              metadata: {
                                  brand?: string;
                                  marketing?:
                                      | EmptyObject
                                      | {
                                          fbp?: ...;
                                          gclid?: ...;
                                          sub1?: ...;
                                          sub2?: ...;
                                          sub3?: ...;
                                          userAgent?: ...;
                                          utmCampaign?: ...;
                                          utmContent?: ...;
                                          utmMedium?: ...;
                                          utmSource?: ...;
                                      };
                              };
                              productQuoteId: string;
                              quote?: {
                                  fees: (...)[];
                                  sourceAmount: BigNumber;
                                  sourceAmountAfterFees: BigNumber;
                                  sourceCurrency: string;
                                  targetAmount: BigNumber;
                                  targetAmountAfterFees: BigNumber;
                                  targetCurrency: string;
                              };
                              reference: string;
                              status: "ACTIVE"
                              | "EXPIRED"
                              | "ACCEPTED"
                              | "REJECTED";
                              updatedAt: Date;
                              walletAddress: Address;
                              walletBlockchain: string;
                          } & { type: "US_BANK_ACH" } & {
                              achBatchId?: string;
                              achId: string;
                              bankId?: "dart" | "fib";
                              routeFusionIncomingTransferId?: string;
                              sourcePaymentInstrumentId: string;
                              speed?: "same-day" | "next-day";
                              vendorId?: string;
                              victorTransactionId?: string;
                          };
                      }
                  )[];
              };
          },
      >