API mocks

On this page

Bank debit files (Colombia)

A mock of a bank's file desk for débito automático (automatic debits by bank file). The biller sends its bank a collection file of mandated debits. After the bank's processing cut-off, the bank answers with a response file: one line per debit, applied or rejected with the bank's code.

Every bank has its own fixed-width or delimited format, so the layout is data here too, in the shape billers already store it. Banks exchange the files by SFTP; this mock takes them over HTTPS. Testlie is not affiliated with any bank, and no money moves.

Connect

Create a Bank debit files (Colombia) under Banking, and send Authorization: Bearer <API key> (BANK_DEBIT_FILES_API_KEY). Set a webhook URL to hear when a response file is ready.

Layout

PUT /v1/layout with { layout, rejectionCodes? }. GET /v1/layout reads it back.

layout.collectionFile:

  • format: FIXED or DELIMITED (with a delimiter);
  • lineEnding: CRLF or LF;
  • fileNamePattern, where {date} is the collection date;
  • header, detail and trailer records;
  • accountTypeCodes (SAVINGS, CHECKING);
  • minorDigits.

Each record is a list of fields. A field is either a literal or a source:

  • batch sources: batch.collectionDate, batch.generatedDate, batch.itemCount, batch.totalAmount;
  • item sources: item.sequence, item.reference, item.amount, item.bankCode, item.accountType, item.accountNumber, item.holderName, item.holderDocumentType, item.holderDocumentNumber.

A field can also set width, align, pad (SPACE or ZERO), dateFormat and amountFormat (MINOR, MAJOR_DOT, MAJOR_COMMA).

layout.responseFile:

  • format and delimiter;
  • skipLeading and skipTrailing, the header and trailer records;
  • reference, amount and status columns: { start, length } in a fixed file, { index } in a delimited one;
  • appliedCodes;
  • amountFormat and minorDigits.

rejectionCodes are the bank's codes for INSUFFICIENT_FUNDS, ACCOUNT_CLOSED, NO_AUTHORIZATION and ACCOUNT_NOT_FOUND. They default to R01 to R04, and must not also be applied codes.

Files

Call
POST /v1/collection-files JSON { fileName, contentBase64 } (the file's bytes in base64; ASCII, UTF-8 or ISO-8859-1), or the file's text as the body with its name in X-File-Name. Every record is checked against the layout (literals, widths, record lengths, amounts, dates, account types), and the header's and trailer's count and total against the details. A file that doesn't follow it answers 422 INVALID_FILE with lineErrors. Otherwise 202, with id and status: "PROCESSING".
GET /v1/collection-files/{id} The summary, with each debit's outcome once the bank has answered. Each debit keeps the account's last four digits only.
GET /v1/collection-files/{id}/response The response file, written in the layout's response format, with placeholder header and trailer records. 409 NOT_READY until the cut-off has passed.

The cut-off is the mock's async delay. When it passes, the webhook URL receives response_file.ready with the file's id and responseUrl.

Outcomes: debits are decided by the account number's last two digits:

  • 13: insufficient funds;
  • 14: account closed;
  • 15: no authorisation (mandate);
  • 16: account not found;
  • anything else: applied (the first applied code).

The Outcome scenario "decline" rejects every debit with the chosen reason, and "requires action" keeps every file processing. Account numbers are masked to their last four digits in the call log.