# ISO 20022 to DBIS Nostro/Vostro API Mapping ## Overview This document provides mapping guidance for converting ISO 20022 messages to DBIS Nostro/Vostro API requests and vice versa. ## Message Types ### pacs.008 (Credit Transfer) **ISO 20022 Structure**: ```xml MSG123 2024-01-15T10:30:00Z INSTR123 E2E123 1000.00 2024-01-15 US64SVBKUS6S3300958879 GB82WEST12345698765432 ``` **DBIS API Request**: ```json { "fromAccountId": "US64SVBKUS6S3300958879", "toAccountId": "GB82WEST12345698765432", "amount": "1000.00", "currency": "USD", "valueDate": "2024-01-15", "reference": "E2E123", "metadata": { "iso20022MessageId": "MSG123", "instructionId": "INSTR123" } } ``` ### pacs.009 (Direct Debit) Similar mapping to pacs.008, with reversed debit/credit roles. ### camt.053 (Bank Statement) **ISO 20022 Structure**: ```xml US64SVBKUS6S3300958879 CLBD 1000000.00 CRDT
2024-01-15
``` **DBIS API Response**: ```json { "accountId": "ACC-123", "currentBalance": "1000000.00", "availableLiquidity": "950000.00", "holdAmount": "50000.00", "currency": "USD", "lastUpdatedAt": "2024-01-15T00:00:00Z" } ``` ## Field Mappings | ISO 20022 Field | DBIS API Field | Notes | |----------------|----------------|-------| | `GrpHdr.MsgId` | `metadata.iso20022MessageId` | Message identifier | | `PmtId.InstrId` | `metadata.instructionId` | Instruction ID | | `PmtId.EndToEndId` | `reference` | End-to-end reference | | `IntrBkSttlmAmt.value` | `amount` | Transfer amount | | `IntrBkSttlmAmt.Ccy` | `currency` | Currency code | | `IntrBkSttlmDt` | `valueDate` | Value date | | `DbtrAcct.Id.IBAN` | `fromAccountId` | Debit account | | `CdtrAcct.Id.IBAN` | `toAccountId` | Credit account | | `DbtrAgt.FinInstnId.BICFI` | `fromParticipantId` | Debit institution | | `CdtrAgt.FinInstnId.BICFI` | `toParticipantId` | Credit institution | ## Implementation Use the `Iso20022Adapter` class: ```typescript import { Iso20022Adapter } from '@/integration/plugins/iso20022-adapter'; const adapter = new Iso20022Adapter(); const message = await adapter.parseMessage(iso20022Xml); const transferRequest = adapter.mapTransfer(message); ``` ## Error Handling ISO 20022 errors map to DBIS error codes: | ISO 20022 Error | DBIS Error Code | |----------------|-----------------| | Invalid message format | `VALIDATION_ERROR` | | Account not found | `NOT_FOUND` | | Insufficient funds | `UNPROCESSABLE_ENTITY` |