# Bunker Transactions

## **Prerequisites**

Before setting up and testing a bunker transaction integration other integrations need to be in place.

* [Transfer of voyage related data to the accounting system.](https://api.dataloy.com/user-guides/accounting-integration-api/voyages)
* [Synchronization of business partners between Dataloy VMS and the accounting system.](https://api.dataloy.com/user-guides/accounting-integration-api/business-partners)
* [Exchange rate transfer to Dataloy VMS.](https://api.dataloy.com/user-guides/accounting-integration-api/exchange-rates)

## **Integration Set-Up**

When a bunker transaction is posted in Dataloy VMS, the document status is set to Ready-for-Posting. Set up a scheduled task and use the request under Data Transaction to extract bunker transactions that are ready for posting. When a bunker transaction is transferred to accounting, update the status to Posted.

## **Test Data**

Test data for bunker transactions can be generated in Booking and Operations > Bunkers-FO tab > Bunker Transactions.

## **Data Transaction**

To get bunker transactions that are ready for posting in [Webhooks](https://api.dataloy.com/dataloy-rest-api/webhooks) the following subscription can be created:

```
{
    "eventType":"U",
    "user": the user code to be used in the subscription,
    "objectType":"Document",
    "expression": "dlpObject.getInvoicingStatus() != null && dlpObject.getInvoicingStatus().getStatusTypeCode().equals(\"RFP\") && (dlpObject.getDocumentType().getDocumentType().equals(\"ACC\"))",
    "url":"your webhook url"
}
```

Alternatively a scheduled job can be setup to use the following request:

**Get bunker transactions that are ready for posting to accounting**

| `GET /Document?filter=invoicingStatus.statusTypeCode(EQ)RFP&filter=documentType.documentType(EQ)ACC` |
| ---------------------------------------------------------------------------------------------------- |

### **Post Transaction**

When an invoice is successfully transferred to the accounting system, the document status has to be updated to *Posted* in Dataloy VMS. This is done in a PUT request:

**Update status to posted for a specific invoice**

```
PUT /Document/{key}
  
{
    "invoicingStatus": "POS"
}
```


---

# 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://api.dataloy.com/user-guides/accounting-integration-api/bunker-transactions.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.
