> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.bienport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ERP → API Gateway Push Notifications

> Domain events pushed from ERP to the Api Gateway via AMQP for customer or subscription information change

<Note>
  This is a private API and requires secure connection with ERP software!
</Note>

<Info>
  **Transport:** AMQP (pub/sub). The platform publishes notifications to broker queues.
</Info>

## Message Envelope (Common)

Notifications are published as **domain payloads** (no extra wrapper) to the queues listed below.

* **Content-Type:** `application/json`
* **Delivery:** at-least-once (consumer should ack after successful processing)
* **Idempotency hint:** use the top-level `id` and event-specific keys to de‑duplicate if your consumer is retried.

***

# 1) Customer Change Push Notification

> Emitted when a customer is created/updated/deactivated in ERP.

**Queue:** `secom-customer-queue`

### Notes

* `id` corresponds to **customerId** in the ERP.
* `status` can be `Active` or `Passive`.

### Example Payload (with address/contact fields)

```json theme={null}
{
  "id": "134719",
  "status": "Active",
  "name": "Customer Name Here",
  "contactMedium": [
    {
      "characteristic": {
        "city": "İSTANBUL(Anadolu)",
        "country": "Türkiye",
        "phoneNumber": "5xxxxxxxxx",
        "socialNetworkId": "11111111111",
        "street1": "içerenköy"
        }
    }
  ]
}
```

<Tip>
  The object MAY include additional customer attributes and arrays (e.g., addresses, contacts) depending on ERP mapping. Treat unknown properties as forward‑compatible.
</Tip>

***

# 2) Subscription Change Push Notification

> Emitted when a subscription/agreement changes state or details in ERP.

**Queue:** `secom-subscriptions-queue`

### Notes

* `id` corresponds to **subscriptionId** in the ERP.
* `engagedParty` corresponds to `customerId` in the ERP.

### Example Payload (with ERP property bag)

```json theme={null}
{
   "id":"123462",
   "agreementType":"Kiralama",
   "documentNumber":"108999",
   "name":"RAMAZAN ÖZEKİNCİ",
   "status":"Active",
   "characteristic":[
      {
         "name":"CAMPAIGN",
         "valueType":"String",
         "value":"24 AY TAAHHÜTLÜ"
      },
      {
         "name":"MONTAGEADRESS",
         "valueType":"String",
         "value":"PINAR MAH. ONDOKUZ MAYIS BLV. AK TOWERS NO:42 İÇ KAPI NO:84"
      },
      {
         "name":"MONTAGECOUNTY",
         "valueType":"String",
         "value":"ESENYURT"
      },
      {
         "name":"MONTAGECITY",
         "valueType":"String",
         "value":"İSTANBUL(Avrupa)"
      },
      {
         "name":"MONTAGE_DATE",
         "valueType":"Date",
         "value":"2021-08-16"
      },
      {
         "name":"TOTAL_PAST_DUE_INSTALMENT",
         "valueType":"Float",
         "value":"0.0"
      },
      {
         "name":"PANELBRAND",
         "valueType":"String",
         "value":"EBS"
      },
      {
         "name":"PANELMODEL",
         "valueType":"String",
         "value":"CPX-300W"
      },
      {
         "name":"PANELNO",
         "valueType":"String",
         "value":"1065885"
      },
      {
         "name":"SALESEMP","valueType":"String","value":"ÜMİT"
      },
      {
         "name":"STAGE","valueType":"String","value":"6 - Sinyal Alımı Gerçekleşti"
      }
   ],
   "completionDate":{"endDateTime":"2023-08-16","startDateTime":"2021-08-13"},
   "engagedParty":[ { "id" : "134719" } ]
 }
```

<Warning>
  **Schema variance:** The ERP may send additional key/value tuples inside `properties` (triplets of `name`, `valueType`, `value`). Consumers should parse this bag defensively.
</Warning>

***

## Consumer Guidance

* **Ack/Nack:** use your AMQP client’s normal ack flow; only ack after persisting/processing.
* **Retries:** if your app crashes before ack, the message will be re‑delivered. Make handlers idempotent.
* **Ordering:** do not rely on strict global ordering across queues.

<Examples>
  Client libraries: any AMQP 0‑9‑1 compatible client, or STOMP‑over‑WebSocket (e.g., `/topic/secom-customer-queue`) / MQTT bridge topics as configured in your broker.
</Examples>
