> For the complete documentation index, see [llms.txt](https://host2host.onibonje.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://host2host.onibonje.com/docs/25-ack-nack-framework.md).

# ACK/NACK Framework

## 1. Overview

**Module:** `h2h-ack-nack`

Generates and delivers **acknowledgement** (ACK) and **negative acknowledgement** (NACK) files/responses after batch processing. Driven by `ack_template` in database.

***

## 2. Outcomes

| Outcome           | ACK type      | File naming                            |
| ----------------- | ------------- | -------------------------------------- |
| All lines posted  | FULL\_SUCCESS | `ACK_{partner}_{date}_{batchId}.csv`   |
| Some lines failed | PARTIAL       | `ACK_PARTIAL_*` + error codes per line |
| File rejected     | NACK          | `NACK_{partner}_{date}_{reason}.csv`   |
| Duplicate file    | NACK          | `NACK_DUPLICATE_*` (`IDEM_002`)        |

***

## 3. Flow

```mermaid
sequenceDiagram
  participant Camel
  participant Ack as h2h-ack-nack
  participant Transform
  participant File as File Management

  Camel->>Ack: generate(batch, results)
  Ack->>Ack: resolve ack_template
  Ack->>Transform: apply ACK transform spec
  Transform-->>Ack: ACK body
  Ack->>File: deliver (SFTP or signed URL)
  File-->>Camel: DELIVERED
```

***

## 4. ACK Template (`ack_template`)

| Field                    | Example                                       |
| ------------------------ | --------------------------------------------- |
| `format`                 | CSV                                           |
| `filename_pattern`       | `ACK_{partner}_{date:yyyyMMdd}_{batchId}.csv` |
| `transform_spec_id`      | ACK\_CSV\_V1                                  |
| `nack_transform_spec_id` | NACK\_CSV\_V1                                 |
| `include_line_detail`    | true                                          |
| `pgp_encrypt`            | true                                          |

***

## 5. Line-Level ACK Record

| Column            | Source                                    |
| ----------------- | ----------------------------------------- |
| instructionId     | canonical                                 |
| customerReference | partner ref                               |
| status            | SUCCESS / FAILED                          |
| bankReference     | Finacle                                   |
| errorCode         | [catalog](/docs/31-error-code-catalog.md) |
| amount            | instruction                               |

***

## 6. API ACK

REST payments return synchronous JSON ACK:

```json
{
  "correlationId": "...",
  "status": "SUCCESS",
  "bankReference": "BNK123456",
  "errorCode": null
}
```

Same [error codes](/docs/31-error-code-catalog.md).

***

## 7. Camel Component

```
ack-nack:generate
ack-nack:generate-partial
ack-nack:generate-nack
```

***

## 8. Related Documents

* [31 Error Code Catalog](/docs/31-error-code-catalog.md)
* [15 File Management System](/docs/15-file-management-system.md)
* [29 Canonical Data Model](/docs/29-canonical-data-model.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://host2host.onibonje.com/docs/25-ack-nack-framework.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
