# Customer Deal

One of the main focus points for orders is the customer deal per **each shop product**.

Each is financially tied to Gifthub ecosystem in three ways:

1. An amount that is directly debited from **customer wallet** when purchasing products.
2. An amount that is calculated based on each order and sent **as an invoice** to be paid by the customer at the **end of payment period**. It is normally in customer’s retail currency.
3. The **total profit** of **Gifthub** and **Customer** is also **shared.** (If applicatble)

To cater for these interactions, the following concepts are used in the ecosytem:&#x20;

1. Customer Wallet Deals
2. Customer Retail Deals



{% hint style="info" %}
Before diving into the deals, you need to get familiar with the [**Adjustment Amounts**](https://app.gitbook.com/o/rAHTXDKVzIOr4Jqk2SBF/s/bgpTyn5ehDgNS21U6ST7/~/changes/33/general/adjustment-amount)&#x20;
{% endhint %}

### Generic Deal

When we are talking about deals anywhere (either on wallet or retail), we are talking about an **Adjustment Amount** with a **type.** Each adjustment amount can have one of these three types:

* `commission`
* `dee`
* `discount`

We use this generic structure of deals in both retail deal and wallet deal.

**Generic Deal Example**

```json
{
    "adjustment": {
        "amount": 6,
        "adjustmentMode": "percentage"
    },
    "type": "commission"
}
```

### Customer Wallet Deal

The wallet deal **per shop item per customer** is a list of _Generic Deals_ that is applied to each item in the order. It is applied directly **after exchanging** the product to customer wallet and all **fixed** amounts are in **wallet currency**. This effect the amount that is reduced from **customer wallet.**



### Customer Retail Deal

Each customer has a [**retail currency** ](customer-information)attached to it upon creation. The retail deal **per shop item per customer** includes:

1. A list of _Generic Deals_ that is applied to each item in the order and it is applied directly after **exchanging** the **total** amount of that item **from wallet currency to the retail currency** in the **retail invoice.**
2. An object which defines the **percentage** of **profit sharing** between **Gifthub** and **the customer**

{% hint style="info" %}
To observe this deal in action, visit the [price calculation](https://app.gitbook.com/o/rAHTXDKVzIOr4Jqk2SBF/s/bgpTyn5ehDgNS21U6ST7/~/changes/33/shop/price-calculation) and [order invoice](https://app.gitbook.com/o/rAHTXDKVzIOr4Jqk2SBF/s/bgpTyn5ehDgNS21U6ST7/~/changes/33/orders/order-invoice) pages
{% endhint %}

{% hint style="warning" %}
The **adjustments** added to the **retail deal** are treated as post order payments however the **wallet deal adjustments** are debited from the customer wallet as soon as the purchased product is delivered.
{% endhint %}

#### **Example**

**CustomerA** has the below table as its deal with **Gifthub** for **Product1.**

* retailCurrency → IRT
* walletCurrency → EUR

**Wallet Deal**

| **Type**   | **Mode**       | **Amount** |
| ---------- | -------------- | ---------- |
| discount   | **percentage** | -2         |
| fee        | **fixed**      | 1          |
| commission | **percentage** | 6          |

**Retail Deal - deal items**

| **Type**   | **Mode**       | **Amount** |
| ---------- | -------------- | ---------- |
| fee        | **fixed**      | 45,000     |
| commission | **percentage** | 6          |

**Retail Deal - sharing**

| **Entity** | **share** |
| ---------- | --------- |
| Gifthub    | 50        |
| Customer   | 50        |

**Example Response for product1**

```json
{
    "walletDeal": [
        {
            "adjustment": {
                "amount": -2,
                "adjustmentMode": "percentage"
            },
            "type": "discount"
        },
        {
            "adjustment": {
                "amount": 1,
                "adjustmentMode": "fixed"
            },
            "type": "fee"
        },
        {
            "adjustment": {
                "amount": 6,
                "adjustmentMode": "percentage"
            },
            "type": "commission"
        }
    ],
    "retailDeal": {
        "sharing": {
            "gifthub": 50,
            "customer": 50        
        },
        "items": [
            {
                "adjustment": {
                    "amount": 6,
                    "adjustmentMode": "percentage"
                },
                "type": "commission"
            },
            {
                "adjustment": {
                    "amount": 45000,
                    "adjustmentMode": "fixed"
                },
                "type": "fee"
            }
        ]
    }
}
```
