குறிப்பு

Pain001 தொழில்நுட்பக் குறிப்பு: CLI, Python API, REST

pain001 v0.0.90-ன் ஒவ்வொரு ஃபிளாக், எண்ட்பாயிண்ட், நடத்தை, வெளியிடப்பட்ட நிரலிலிருந்து எடுக்கப்பட்டவை, எதிர்பார்ப்புகளிலிருந்து அல்ல.

இந்தக் குறிப்பு pain001 v0.0.90-ன் கட்டளை-வரி இடைமுகம், Python API, REST நுண்சேவை, சரிபார்ப்புத் தொடர்வரிசை ஆகியவற்றை ஆவணப்படுத்துகிறது. இங்கு பட்டியலிடப்பட்டுள்ள ஒவ்வொரு ஃபிளாக், எண்ட்பாயிண்ட், நடத்தையும் வெளியிடப்பட்ட நிரலிலிருந்து எடுக்கப்பட்டவை, எதிர்பார்ப்புகளிலிருந்து அல்ல.

Pain001 13 ISO 20022 செய்தி வரையறைகளை ஆதரிக்கிறது: pain.001.001.03 முதல் pain.001.001.13 வரை (Customer Credit Transfer Initiation, பதினொரு பதிப்புகள்) மற்றும் pain.008.001.02 / pain.008.001.08 (Customer Direct Debit Initiation).


1. கட்டளை-வரி இடைமுகம்#

pain001 இயங்குகோப்பு தனது செயல்பாடுகளைத் துணைக்கட்டளைகளாகத் தொகுக்கிறது. உருவாக்க ஃபிளாக்குகளை மட்டும் கொடுத்து இயக்கினால் generate தானாகவே செயல்படுத்தப்படுகிறது; எனவே தற்போதைய தன்னியக்கமுறைகள் தொடர்ந்து இயங்கும்.

துணைக்கட்டளை நோக்கம்
generate தரவுக் கோப்பை ஸ்கீமா-சரிபார்க்கப்பட்ட ISO 20022 XML ஆக மாற்றுகிறது (இயல்புநிலைக் கட்டளை).
validate XML எழுதாமலேயே உள்ளீட்டுத் தரவைச் சரிபார்க்கிறது.
check <file>... [--scheme] [--format] Check pain.001 or pain.008 files you already have: the XSD of the message type each file declares, the message definition's cross-element rules, and any scheme profiles, policy or Schematron rulebook you name.
verify-signature <file>... --cert <PEM> Verify the XML-DSig signature on each file against the signer's certificate or public key; --trust-embedded-cert checks integrity only (requires the sign extra).
versions [--format json] ஆதரிக்கப்படும் 13 செய்தி வரையறைகளையும் பட்டியலிடுகிறது.
inspect <type> [--format json] ஒரு செய்தி வகைக்கு உடன்வரும் வார்ப்புரு, ஸ்கீமா, எடுத்துக்காட்டுத் தரவு மற்றும் ஏற்கப்படும் உள்ளீட்டு வடிவங்களைக் காட்டுகிறது.
init <type> [-o FILE] ஒரு செய்தி வகைக்கான தொடக்க CSV வார்ப்புருவை உருவாக்குகிறது.
serve [--host] [--port] [--reload] FastAPI REST நுண்சேவையைத் தொடங்குகிறது (api கூடுதல் தேவை).
mcp மைய நூலகத்தின் உள்ளமைந்த Model Context Protocol சேவையகத்தை stdio வழியாகத் தொடங்குகிறது (mcp கூடுதல் தேவை); முழுச் சேவையகம் pain001-mcp ஆக வழங்கப்படுகிறது.
plugins list / show / disable கண்டறியப்பட்ட ஏற்றி, சரிபார்ப்பி, ஸ்கீம் மற்றும் எழுதி செருகுநிரல்களைப் பட்டியலிடுகிறது, ஒன்றைக் காட்டுகிறது, அல்லது மூன்றாம் தரப்புச் செருகுநிரல் கண்டறிதலை எப்படி முடக்குவது என்று அச்சிடுகிறது.
face <file> [--face] [--bindings] [-o] [--loss-report] Project a pain.001 XML file into another standard's JSON shape, with a report of every element not carried.
upload [<file>] --sftp <url> Deliver a file atomically to an SFTP server you trust explicitly (requires the upload extra).

generate விருப்பங்கள்

ஃபிளாக் விவரம்
-t, --xml-message-type <TYPE> செய்தி வரையறை, எடுத்துக்காட்டாக pain.001.001.09.
-d, --data <FILE> உள்ளீட்டுத் தரவு: .csv, .json, .jsonl, .db / .sqlite, .parquet, அல்லது PGP-குறியாக்கப்பட்ட .gpg / .asc.
-o, --output-dir <DIR> உருவாக்கப்பட்ட XML சேமிக்கப்படும் அடைவு.
-m, --template <FILE> / -s, --schema <FILE> உள்ளடக்கப்பட்ட Jinja2 வார்ப்புரு அல்லது XSD ஸ்கீமாவை மேலெழுதுகிறது.
-c, --config <FILE> கட்டமைப்புச் சுயவிவரத்திலிருந்து இயல்புநிலை மதிப்புகளை ஏற்றுகிறது (--profile, --show-config).
--dry-run (மாற்றுப்பெயர் --validate-only) வெளியீட்டை எழுதாமல் JSON Schema, XSD, திட்ட விதிநூல் ஆகியவற்றுக்கு எதிராக உள்ளீட்டைச் சரிபார்க்கிறது.
--scheme <NAME[,NAME]> காற்புள்ளியால் பிரிக்கப்பட்ட ஒன்று அல்லது அதற்கு மேற்பட்ட ஸ்கீம் விதிப்புத்தகங்களைச் செயல்படுத்துகிறது. pain001 plugins list நிறுவப்பட்ட ஒவ்வொரு விதிப்புத்தகத்தையும் பெயரிடுகிறது.
--explain / --format json --scheme உடன், ஒவ்வொரு மீறலுக்கும் ஒரு திருத்தக் குறிப்பை உரையாகவோ JSON ஆகவோ அச்சிடுகிறது.
--rules <FILE> Enforce a private YAML CEL policy before generation (requires the rules extra).
--schematron <PRESET or FILE> Apply Schematron business rules: the sepa, fednow or cbpr preset, or your own .sch file.
--decrypt-key <FILE> / --decrypt-passphrase-env <VAR> Import a GPG private key, and name the variable that holds its passphrase, for .gpg / .asc input (requires the gpg extra).
--streaming / --chunk-size <N> பெரிய தொகுதிகளுக்கான நினைவக-வரம்புடைய துண்டு வாரியான செயலாக்கம் (இயல்புநிலையாக ஒரு துண்டுக்கு 1,000 பரிவர்த்தனைகள்; ஒவ்வொரு துண்டும் மறுகணக்கிடப்பட்ட NbOfTxs மற்றும் CtrlSum உடன் தனித் XML கோப்பாக மாறுகிறது).
--emit-metrics கண்காணிப்புத் தொடர்வரிசைகளுக்காக இயந்திரம் படிக்கக்கூடிய இயக்க அளவீடுகளை வெளியிடுகிறது.
--envelop-bah Wrap generated payment XML into an ISO 20022 Business Application Header (head.001.001.03) and BizData (head.003.001.01) envelope.
--bah-sender <BIC/ID> Sender financial institution BIC or organisation identifier for BAH <Fr>.
--bah-receiver <BIC/ID> Receiver financial institution BIC or organisation identifier for BAH <To>.
--bah-msg-id <ID> Business Message Identifier for BAH <BizMsgIdr> (defaults to generated UUID).
--xml-sign-key <FILE> PEM private key (RSA, or EC P-256/P-384) for a W3C XML Digital Signature (XML-DSig); the algorithm follows the key.
--xml-sign-cert <FILE> Optional PEM X.509 certificate to embed in XML-DSig <ds:KeyInfo>.
--xml-sign-alg <ALG> rsa-sha256, rsa-pss-sha256, ecdsa-sha256 or ecdsa-sha384; by default an RSA key signs rsa-sha256.
--xml-sign-passphrase-env <VAR> Environment variable holding the passphrase for --xml-sign-key.
--list-templates / --show-template <TYPE> List the bundled templates, or show one template's metadata, and exit.

வெளியேற்றக் குறியீடுகள் CI-நட்பானவை: 0 வெற்றி, 1 சரிபார்ப்புத் தோல்வி, 2 பயன்பாட்டுப் பிழை.

XML signing and verify-signature need the sign extra (pip install "pain001[sign]", which installs cryptography and lxml).

Signatures: pain001 verify-signature

pain001 verify-signature checks the signature on files you received or wrote. Pass the signer's certificate or public key with --cert; that is the trust anchor. --trust-embedded-cert verifies with each file's own certificate instead, which proves the file is unchanged since it was signed but not who signed it. It exits 0 when every file verifies, 1 when any does not, and 2 when it cannot run; --format json prints one report per file. Verification uses exclusive C14N 1.0 and accepts only RSA-SHA256, RSA-PSS and ECDSA signatures with SHA-256 to SHA-512 digests over the whole document; the certificate's chain and validity dates are not checked.

Faces: pain001 face

A face projects a validated pain.001 document into another standard's JSON request body. --face uk_open_banking targets the Open Banking Read/Write API v4.0.1 domestic payment, --face berlin_group targets NextGenPSD2 v1.3.16 payment initiation, and --face iso_2018 renames every element to its ISO 20022 name in snake_case. A face refuses a document that lacks an element its target requires instead of inventing a value; --loss-report lists every source element it did not carry. Faces are outbound only.

Delivery: pain001 upload

pain001 upload sends a finished file to an SFTP server you name, and only after you have trusted its host key: from a known_hosts file (--known-hosts) or an OpenSSH SHA256 fingerprint you verified independently (--accept-host-key). --print-host-key shows the server's fingerprint without logging in. It logs in with a private key (--identity-file, with --passphrase-env), a password read from an environment variable (--password-env), or your SSH agent. The file is written under a temporary name and renamed on the server, so the receiving side never sees a partial file.


2. Python API#

from pain001.core.core import process_files

# Generate a validated pain.001.001.09 file from CSV
process_files(
    xml_message_type="pain.001.001.09",
    xml_template_file_path="template.xml",
    xsd_schema_file_path="schema.xsd",
    data_file_path="payments.csv",
    output_path="out/payments.xml",
)

உருவாக்கப்படும் ஒவ்வொரு ஆவணமும் எழுதப்படுவதற்கு முன் மூன்று அடுக்குகளைக் கடக்கிறது:

  1. உள்ளீட்டுச் சரிபார்ப்பு: ஒவ்வொரு பதிவும் அந்தச் செய்தி வகையின் JSON Schema-க்கு எதிராகச் சோதிக்கப்படுகிறது; உடன் புல-மாற்றுப்பெயர் இயல்பாக்கமும் IBAN/BIC தொடரியல் சோதனைகளும் நடைபெறுகின்றன.
  2. திட்ட விதிநூல் (விருப்பத்தேர்வு): நீங்கள் குறிப்பிடும் கட்டண அமைப்பின் விதிகள், SEPA (SCT, Instant, SDD Core, B2B) முதல் UK Faster Payments, CHAPS மற்றும் Bacs, அமெரிக்க ACH மற்றும் வயர் போன்ற தேசிய அமைப்புகள் மற்றும் Swift CBPR+ வரை; pain001 plugins list அனைத்தையும் பெயரிடுகிறது.
  3. XSD சரிபார்ப்பு: வட்டில் ஒரு பைட் கூட எழுதப்படுவதற்கு முன், உருவாக்கப்பட்ட XML xmlschema வழியாக அதிகாரப்பூர்வ ISO 20022 ஸ்கீமாவுக்கு எதிராகச் சரிபார்க்கப்படுகிறது. விருப்பத்தேர்வான fast கூடுதல் (lxml) நிறுவப்பட்டிருந்தால், libxml2 செல்லுபடியான ஆவணங்களை விரைவாக ஏற்கிறது; அது நிராகரிக்கும் ஆவணத்தை xmlschema மீண்டும் சரிபார்க்கிறது, அதன் தீர்ப்பே இறுதியானது.

XML உருவாக்கம் மற்றும் திட்டச் சரிபார்ப்பின் போது பணத் தொகைகள் decimal.Decimal ஆகவே கையாளப்படுகின்றன (ஒருபோதும் IEEE 754 ஃப்ளோட்டுகளாக அல்ல), மேலும் NbOfTxs / CtrlSum கட்டுப்பாட்டு மொத்தங்கள் உள்ளீட்டை நம்பாமல், சரிபார்க்கப்பட்ட பதிவுகளிலிருந்து மறுகணக்கிடப்படுகின்றன.

pain.001 உருவாக்கத்தைத் தாண்டி, மைய நூலகம் ஒரு pain.002 நிலை-அறிக்கைப் பாகுபடுத்தியையும் உருவாக்கியையும் (வங்கியின் ஏற்பு/நிராகரிப்புப் பதிலை நீங்கள் படிக்கும் வகையில்) மற்றும் நாள் இறுதி ஒப்புரவுக்கான camt.053 அறிக்கைப் பாகுபடுத்தியையும் உருவாக்கியையும் வழங்குகிறது; உடன், செய்திப் பதிப்புகளுக்கு இடையே பதிவுகளை இடம்பெயர்க்கும் VersionMapper-ஐயும் வழங்குகிறது.

pain001.faces.project_face is the Python entry point for faces. sign_xml_document signs a document with XML-DSig, and verify_signature(signed_xml, trust_anchor=cert_pem) verifies one and returns a SignatureReport (valid, trust, algorithm, signer, reason); both need the sign extra. verify_xml_signature without a key or certificate still trusts the certificate inside the document, with a DeprecationWarning; pain001 0.0.90 refuses it.

Runnable, self-checking scripts for the public API and the CLI live in the library's examples/ directory.


3. REST நுண்சேவை#

pip install "pain001[api]"
pain001 serve --host 0.0.0.0 --port 8000

அனைத்து எண்ட்பாயிண்ட்களும் /api/v1-ன் கீழ் இணைக்கப்பட்டுள்ளன (பதிப்பு இல்லாத /api மாற்றுப்பெயருடன்):

முறை மற்றும் பாதை நோக்கம்
GET /api/v1/health இயங்குநிலைச் சோதனை.
POST /api/v1/validate பதிவுகளைச் சரிபார்க்கிறது; புல அளவிலான பிழைகளைத் திருப்பி அளிக்கிறது.
POST /api/v1/generate ஒத்திசைவான XML உருவாக்கம்.
POST /api/v1/generate/async பின்னணி உருவாக்கத்திற்காக ஒரு பெரிய தொகுதியை வரிசையில் சேர்க்கிறது.
GET /api/v1/status/{job_id} ஒத்திசைவற்ற பணியின் நிலையை வினவுகிறது.
GET /api/v1/download/{job_id} முடிக்கப்பட்ட XML-ஐப் பதிவிறக்குகிறது.
DELETE /api/v1/jobs/{job_id} முடிந்த பணியை அகற்றுகிறது.
GET /api/v1/faces List the faces and the binding keys each accepts.
POST /api/v1/faces/{face} Project a pain.001 document sent as XML text; returns the payload and the loss report, or 422 with the reason the face refused it.
GET /metrics Prometheus அளவீடுகள்.

ஊடாடும் ஆவணங்கள் /api/docs (Swagger UI), /api/redoc, /api/reference (Scalar) ஆகியவற்றில் வழங்கப்படுகின்றன; OpenAPI ஆவணம் /openapi.json-இல் உள்ளது.

When the PAIN001_API_KEY environment variable is set, every endpoint except /health and /metrics requires it as a bearer token; when it is unset, the API is open. pain001 serve binds to 127.0.0.1 unless you pass --host.


4. உள்ளீட்டு இயல்பாக்கம்#

சரிபார்ப்புக்கு முன்பே Pain001 நிஜ உலக ஏற்றுமதிகளைச் செல்லுபடியாகும் பதிவுகளாக மாற்றுகிறது:

  • புல மாற்றுப்பெயர்கள்: வழக்கமான ERP நெடுவரிசைப் பெயர்கள் நியமப் புலங்களுடன் பொருத்தப்படுகின்றன (எடுத்துக்காட்டாக amount → payment_amount).
  • IBAN / BIC இயல்பாக்கம்: இடைவெளிகள் நீக்கப்பட்டு, எழுத்து வடிவம் ஒருங்கிணைக்கப்பட்டு, பின் சோதிக்கப்படுகிறது (IBAN-க்கு ISO 13616 mod-97, BIC-க்கு ISO 9362 அமைப்பு).
  • தேதிகள்: செயல்படுத்தும் தேதிகளுக்கு ISO 8601 YYYY-MM-DD பாகுபடுத்தல்.
  • தொகைகள்: decimal.Decimal வழியாகக் கையாளப்படுகின்றன; தவறான வடிவிலான தொகைகள் அமைதியாக வட்டமிடப்படாமல் சரிபார்ப்பில் தோல்வியடைகின்றன.
  • எழுத்துத் தொகுப்பு: ஒலிபெயர்ப்பு உதவிகள் உள்ளடக்கத்தை SWIFT மற்றும் SEPA ஏற்கும் ISO 20022 லத்தீன் எழுத்துத் தொகுப்புக்குள் சுருக்குகின்றன.
  • Formula cells: CSV cells that start with =, +, - or @ are kept as supplied by default, so phone numbers and references survive; load_csv_data(path, sanitize_formula=True) escapes them with a leading quote instead.

5. செருகுநிரல் கட்டமைப்பு#

நான்கு நுழைவுப்புள்ளிக் குழுக்கள் வழியாக இந்தத் தொகுப்பை விரிவாக்கலாம்: pain001.loaders, pain001.validators, pain001.schemes, pain001.writers. pain001-loader-xlsx இதே வழிமுறையில் பதிவு செய்யப்பட்டு, நிறுவும்போதே தானாகக் கண்டறியப்படுகிறது; pain001-loader-mt101 என்பது நேரடியாகப் பயன்படுத்தப்படும் தனித்த பாகுபடுத்தல் நூலகம் (MCP சேவையகத்தின் convert_mt101 கருவியாலும் பயன்படுத்தப்படுகிறது). ஒரு நிறுத்த சுவிட்ச், PAIN001_DISABLE_PLUGINS=1, கடுமையாகக் கட்டுப்படுத்தப்பட்ட சூழல்களில் மூன்றாம் தரப்புச் செருகுநிரல் கண்டறிதலை முற்றிலுமாக முடக்குகிறது.


6. தர நுழைவாயில்கள்#

மைய நூலகம் கடுமையான, சரிபார்க்கக்கூடிய நுழைவாயில்களுக்கு எதிராக உருவாக்கப்படுகிறது: CI-இல் கட்டாயமாக்கப்பட்ட 100% வரி மற்றும் கிளை கவரேஜ் (--cov-fail-under=100), கடுமையான mypy வகைப்படுத்தல், 100% டாக்ஸ்ட்ரிங் கவரேஜ், பாதுகாப்பு லிண்டிங் (Bandit, pip-audit). ஒவ்வொரு வெளியீட்டு பில்டுக்கும் ஒரு CycloneDX SBOM உருவாக்கப்படுகிறது.

அடுத்ததாக நிறுவல் வழிகாட்டி, AI முகவர்களுக்கான MCP சேவையகம், அல்லது பணப்பரிவர்த்தனை சொற்களஞ்சியம் ஆகியவற்றைத் தொடரவும்.