Payment Intelligence

v0.3.2
io.github.Raafet57/payment-intelligence Checked 2 days ago Published 1 month ago

Offline ISO 20022 payment tools: explain and scrub pacs/camt, CBPR+, SSI checks, IBAN and BIC.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

validate_iban Validate IBAN

Validate an IBAN offline against the bundled SWIFT IBAN Registry snapshot: country, length, BBAN structure and MOD-97 check digits. Does not confirm the account exists.

ParameterTypeDescription
iban *stringIBAN, with or without spaces.

build_iban Build IBAN

Build an IBAN from its BBAN fields and compute the MOD-97 check digits. Call without `fields` first to get the country's field template.

ParameterTypeDescription
country_code *stringISO 3166 alpha-2 country code, e.g. DE.
fieldsobjectMap of template field id to value, e.g. { bank: '37040044', account: '0532013000' }.

check_bic Check BIC syntax

ISO 9362 BIC syntax and ISO 3166 country-code checks. No bank directory is bundled. With `reference_path` (or the PAYMENT_INTELLIGENCE_REFERENCE_PATH setting), also looks the BIC up in the user's own BIC Directory, Payments Directory, BIC Plus or other provider export: name, location, current or expired, successor BIC, and service participation. A directory record does not prove reachability for a specific payment; never use it alone for routing or compliance decisions.

ParameterTypeDescription
bic *string8- or 11-character BIC.
as_ofstringDate for current or expired, YYYY-MM-DD. Defaults to today.
reference_pathstringOptional: the user's reference data, read locally. An unzipped SWIFTRef BIC Directory or Payments Directory folder, one of its files, a legacy SWIFTRef product file (BIC Plus, Bank Directory Plus, ...…

lookup_reference_data Look up identifiers in your reference data

Look up BICs (BIC8 or BIC11), national clearing codes (sort codes, ABA, IFSC, CNAPS, ...) and LEIs in the user's own reference files, read locally: SWIFTRef BIC Directory and Payments Directory folders (IDENTIFIERS, including historical, PARTICIPANTS and RELATIONSHIPS files; layouts come from the STRUCTURES file), legacy SWIFTRef products (BIC Plus, BIC Directory 2018, Bank Directory Plus, IBAN Plus, SEPA routing, Reach Plus, gpi), or a CSV/TSV export from any provider or in-house system. Returns per identifier: directory records (name, town, country, current or expired, successor), national I…

ParameterTypeDescription
ids *arrayIdentifiers to look up, up to 50 per call.
as_ofstringDate for current or expired, YYYY-MM-DD. Defaults to today.
column_mapobjectFor a CSV/TSV whose headers are not recognised: map fields to header names, for example {"id": "Swift Code", "name": "Bank"}. Fields: id, idType, name, town, country, status, modification, start, stop…
pathstringThe reference data: a folder (for example an unzipped SWIFTRef download) or one file. Defaults to the PAYMENT_INTELLIGENCE_REFERENCE_PATH setting.

explain_payment_message Explain payment message

Explain an ISO 20022 payment message. pacs.008, pacs.009 and camt.053 get a plain-language narrative; pacs.002, pacs.004, camt.052 and camt.054 get a structured field projection. Case messages (camt.056 cancellation request, camt.029 resolution, camt.110 investigation request, camt.111 investigation response, the older camt.026, camt.027, camt.028 and camt.087, and the Swift Tracker messages trck.003 alert and trck.005 case status) get the projection plus a `case` field: case id, investigation type, status, reason, the underlying payment's UETR and references, camt.111 answer details (booking…

ParameterTypeDescription
pathstringPath to a local XML file. Prefer this for real data so it never enters the chat.
xmlstringThe ISO 20022 XML message, inline.

scrub_payment_message Scrub payment message

Replace names, IBANs, account ids, UETRs and references in a pacs/camt message with consistent pseudonyms. With `path` + `output_path`, writes the scrubbed copy to disk and returns only masked statistics, so the original data never enters the conversation. Never overwrites an existing file.

ParameterTypeDescription
optionsobject
output_pathstringWhere to write the scrubbed XML. Must not exist yet and must differ from `path`.
pathstringPath to a local XML file. Prefer this for real data so it never enters the chat.
xmlstringThe ISO 20022 XML message, inline.

check_cbpr_readiness Check CBPR+ readiness

Local CBPR+ readiness hints: AppHdr/Document namespaces, schema-profile coverage, UETR, BIC and IBAN syntax. Readiness hints, not usage-rule validation.

ParameterTypeDescription
pathstringPath to a local XML file. Prefer this for real data so it never enters the chat.
xmlstringThe ISO 20022 XML message, inline.

analyze_payment_lifecycle Analyze payment lifecycle

Group a set of ACK/NACK, pacs and camt files by shared identifiers (UETR, EndToEndId, TxId) into threads with a timeline and warnings. Case messages (camt.026, camt.027, camt.028, camt.029, camt.056, camt.087, camt.110, camt.111) and Tracker messages (trck.003, trck.005) join the thread of the payment they quote; a camt.111 or trck.005 joins its camt.110 by EIR. Works only on the files given.

ParameterTypeDescription
documentsarrayInline documents.
pathsarrayLocal file paths.

validate_ssi_file Validate SSI file

Validate a standing settlement instruction (SSI) file: a SWIFTRef SSI Plus V3 extract or a CSV/TSV export. Checks BIC, ISO country, ISO 4217 currency and SSI asset-category formats, required fields, preferred flags, lifecycle dates, staleness, and conflicts (two preferred correspondents, overlapping active instructions). Rule ids match SSI Control Tower. Accounts are masked in the output.

ParameterTypeDescription
as_ofstringDate to judge active and stale instructions, YYYY-MM-DD. Defaults to today.
column_mapobjectFor an export whose headers are not recognised (any provider, for example LexisNexis or an in-house system): map SSI fields to header names, for example {"ownerBic": "Bank SWIFT", "accountHolderBic":…
max_findingsintegerMaximum findings to list (default 50, max 500).
ssi_contentstringThe SSI file content, inline (small files only).
ssi_pathstringPath to the local SSI file: SWIFTRef SSI Plus, a SWIFTRef Payments Directory RELATIONSHIPS file, or a CSV/TSV from any provider. Prefer this: the file never enters the chat.

check_payment_against_ssi Check payment against SSI file

Check that a payment pays the beneficiary institution through the correspondent and account in the user's own SSI file. Reads the route from a pacs.008 (creditor agent, last intermediary, CdtrAgtAcct) or pacs.009 (creditor, creditor agent, CdtrAcct), or from explicit fields, then looks up owner BIC + currency + asset category and compares with the preferred SSI effective on the value date. Returns MATCH, ACCOUNT_MISMATCH, AGENT_MISMATCH, NOT_PREFERRED, AMBIGUOUS_SSI, NO_EFFECTIVE_SSI or NO_SSI per transaction. Accounts are masked.

ParameterTypeDescription
accountstringAccount at the correspondent used by the payment. Overrides the message.
account_holder_bicstringCorrespondent (account-holding institution) BIC used by the payment. Overrides the message.
asset_categorystringSSI asset category such as COPA, CASH, FOEX, SECU. Overrides the default for the message type.
column_mapobjectFor an export whose headers are not recognised (any provider, for example LexisNexis or an in-house system): map SSI fields to header names, for example {"ownerBic": "Bank SWIFT", "accountHolderBic":…
currencystringISO 4217 currency. Overrides the message.
owner_bicstringBeneficiary institution BIC (the SSI owner). Overrides the message.
pathstringPath to a local XML file. Prefer this for real data so it never enters the chat.
ssi_contentstringThe SSI file content, inline (small files only).
ssi_pathstringPath to the user's SSI file: SWIFTRef SSI Plus V3, a SWIFTRef Payments Directory RELATIONSHIPS file, or a CSV/TSV from any provider.
value_datestringValue date, YYYY-MM-DD. Defaults to the message settlement date, else today.
xmlstringThe ISO 20022 XML message, inline.

decode_reason_code Decode status or reason code

Explain an ISO 20022 status or reason code such as RJCT, AC01 or MD07. Omit `code` to list the curated set.

ParameterTypeDescription
codestringStatus or reason code.