# Daily Transactions Summary

For getting daily transactions summary on the merchant application, the **getTodayTransactionsSummary** method of the library should be called. This function is used to get daily transactions through the library. The function takes DailySummaryListener interfaces as parameters.

```kotlin
PayContactlessEmbed.getInstance().getTodayTransactionsSummary(
    listener: DailySummaryListener
)

```

### Method Parameters

| Field Name | Data Type            | Required | Description                                                                       |
| ---------- | -------------------- | -------- | --------------------------------------------------------------------------------- |
| listener   | DailySummaryListener | true     | Callback interface used to receive today’s transaction summary or error response. |

## **Daily Summary Listener**

```java
public interface DailySummaryListener {
    void onSuccess(Map<String, DailySummaryResult> dailySummaryResult);
    void onFailure(Error error);
}
```

Key of the map is **currency** value and the result object contains the details of the payments made in that currency.

A sample response in json format

```json
{
    "₦": {
        "creditAmount": 300.00,
        "creditMerchantUserBreakdown": {
            "Embed Test": 300.00
        },
        "debitAmount": 0,
        "debitMerchantUserBreakdown": {}
    },
    "CFA": {
        "creditAmount": 100.00,
        "creditMerchantUserBreakdown": {
            "Embed Test": 100.00
        },
        "debitAmount": 0,
        "debitMerchantUserBreakdown": {}
    }
}
```

## **Daily Summary Result Data**

```kotlin
data class DailySummaryResult (
    var creditAmount: Double? = null
    var creditMerchantUserBreakdown: Map<String, Double>? = null
    var debitAmount: Double? = null
    var debitMerchantUserBreakdown: Map<String, Double>? = null
)
```

<table><thead><tr><th width="305.3333333333333">Field Names</th><th>Descriptions</th><th>Sample Values</th></tr></thead><tbody><tr><td>creditAmount</td><td>total amount of credit transaction today </td><td>13.00</td></tr><tr><td>creditMerchantUserBreakdown</td><td>detail of mercant user and credit amount of this user </td><td>"Fatih Shop" : 10.00<br>"Ergul Shop" : 3.00</td></tr><tr><td>debitAmount</td><td>total amount of debit transaction today</td><td>8.00</td></tr><tr><td>debitMerchantUserBreakdown</td><td>udetail of mercant user and debit amount of this user </td><td>"Fatih Shop" : 5.00<br>"Ergul Shop" : 3.00</td></tr></tbody></table>

## **Send Daily Summary Report**

This function is used to send the daily transaction report to the merchant's defined mail address.

```kotlin
PayContactlessEmbed.getInstance().sendTodayTransactionsSummaryReport(
    listener: SendMailListener
)

```

### Method Parameters

| Field Name | Data Type        | Required | Description                                                                           |
| ---------- | ---------------- | -------- | ------------------------------------------------------------------------------------- |
| listener   | SendMailListener | true     | Callback interface used to receive the result of the summary report delivery request. |

## **Send  Mail Listener**

```java
public interface SendMailListener {
    void onSuccess();
    void onFailure(Error error);
}
```
