# Program Service

Overview

The Program Service is constructed using iFIX specifications and serves as an extensive platform aimed at simplifying program creation, sanction management, fund allocation, and disbursement execution. It equips organizations with essential tools to effectively oversee available funds and guarantee transparent and accountable distribution to designated beneficiaries.

## Functional Overview

#### Funds Summary

1. IFMS adapter manages funds summary based on the head of accounts and SSU codes. It creates sanctions for each head of accounts and SSU details based on ULB tenant ID.
2. Three types of transactions can be received from the JIT VA API -
   * Initial Allotment - A new sanction will be created only if AllotmentTxnType is Initial Allotment.
   * Additional allotment - For this type of transaction it will update the amount of existing sanction.
   * Allotment withdrawal - It deducts the transaction amount from the sanction for this type of transaction.

#### Payment Instructions

* When a bill is approved this service creates payment using the expense service.
* Some consumers keep listening to the payment create Kafka topic and generate payment instructions (PI) using payment and bill details and post the PI to the IFMS system using JIT API.
* A new PI will be generated when enough funds are available for any head of accounts for that tenantId.
* Before posting the PI there were multiple enrichments like bank account details, org and individual details, etc.
* After creating the PI it deducts the available balance from the funds summary.
* If a PI is created for any payment then the user can not generate a PI again till the PI fails.
* It keeps a log of each status call of PI and saves it in the DB

Program Service takes care of Program, Sanction, Allocation and Disbursement using the standardized exchange interface.&#x20;

## iFIX API Specification

API spec [YAML is here.](https://raw.githubusercontent.com/egovernments/DIGIT-Specs/refs/heads/ifix-v2.2/data%20exchange/ifix.yaml) Click below to view it in Swagger Editor.

{% embed url="<https://editor-next.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Specs/refs/heads/ifix-v2.2/data+exchange/ifix.yaml>" %}

## Implemented API Specifications

**Base Path:** /program-service/

### API Contract Link

API spec [YAML is here.](https://raw.githubusercontent.com/egovernments/DIGIT-Specs/refs/heads/ifix-v2.2/Domain%20Services/program-service.yaml) Click below to view it in Swagger Editor.

{% embed url="<https://editor-next.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-Specs/refs/heads/ifix-v2.2/Domain+Services/program-service.yaml>" %}

## APIs

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/program" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-program" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/estimate" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-estimate" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/sanction" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-sanction" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/allocation" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-allocation" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/disburse" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-disburse" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/demand" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-demand" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/receipt" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

{% openapi src="<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>" path="/on-receipt" method="post" %}
<https://raw.githubusercontent.com/egovernments/DIGIT-Specs/ifix-v2.2/data%20exchange/ifix.yaml>
{% endopenapi %}

## Data Model

### DB Schema

<figure><img src="/files/R11yPgOkaouVqSWYZbbU" alt=""><figcaption></figcaption></figure>

### Web Sequence Diagrams

#### Program&#x20;

{% tabs %}
{% tab title="Create Program" %}

<figure><img src="/files/6UJm3egQU28OoxDir3Aw" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Update Program" %}

<figure><img src="/files/UhusbpV2tbvJQEzllyFZ" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

#### Sanction

{% tabs %}
{% tab title="Sanction Create" %}

<figure><img src="/files/uCMdZJUhSLlbCyFHaK9h" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Allocation

{% tabs %}
{% tab title="Allocation Create" %}

<figure><img src="/files/tsFldZanc2aKwpfLLWr9" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

#### Disbursal

{% tabs %}
{% tab title="Disbursal Create" %}

<figure><img src="/files/74F3UHQXXQkeeJ1GOtxV" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Disbursal Update" %}

<figure><img src="/files/5JUqu5lCo2qcDKD8DWYT" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.digit.org/public-finance/technology/architecture/low-level-design/program-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
