Доступ к оплатам

Доступ к оплатам по АПИ

Структура моделей, назначение полей

Модель Payment — Оплаты

* @property integer $id
* @property double $amount //Сумма
* @property enum('exec', 'save', 'deleted') $status // Статус
* @property integer $cassa_id // ID кассы
* @property integer $cassaclose_id // Связь с документом закрытия кассы
* @property string $create_date // Создание счет
* @property integer $payed_user // Оплативший пользователь
* @property string $description // Описание
* @property string (‘cash’, ‘cashless’) $payment_type // Тип оплаты
* @property string $invoice_id // ИД Счёта

Модель ClosingOfInvoices — связь счетов с оплатами

@property integer $id
* @property integer $client_id //ID клиента
* @property integer $plus_amount // Сумма документа увеличивающего баланс клиента
* @property string $plus_type_document // Тип документа увеличивающего баланс клиента ('invoice', 'payment', 'add_balance', 'return_good', 'start_balance' )
* @property string $plus_document_id // ИД документа увеличивающего баланс клиента
* @property integer $minus_amount // Сумма документа уменьшающего баланс клиента
* @property string $minus_type_document // Тип документа уменьшающего баланс клиента
* @property string $minus_document_id // ИД документа уменьшающего баланс клиента
* @property string $status
* @property string $create_date
* Связанные документы
* @property Client $client - клиент
* @property Invoice $invoice - Счета
* @property Payment $minus_payment - Отрицательные оплаты
* @property Payment $plus_payment - Положительные оплаты

Примеры запросов

Пример Payment

curl --location --request GET 'http://{DOMAIN NAME}/rest/api/payment/1' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'

Ответ сервера

{
     "success": true,
     "message": "Record Retrieved Successfully",
     "data": {
          "totalCount": 1,
          "payment": {
               "id": "1",
               "amount": "500.0000000000",
               "status": "exec",
               "cassa_id": "2",
               "cassaclose_id": null,
               "create_date": "2021-09-22 13:14:25",
               "payed_user": "1",
               "description": "",
               "payment_type": "cash",
               "invoice_id": "1",
               "parent_id": "0",
               "cassa": {
                    "id": "2",
                    "title": "Новая касса",
                    "assigned_user_id": "1",
                    "inventarization_date": "2021-06-22 16:20:22",
                    "client_cass": "1",
                    "main_cassa": "0",
                    "is_blocked": "0",
                    "has_unfinished_docs": "0",
                    "status": "active",
                    "clinic_id": "1",
                    "summa_cash": "0.0000000000",
                    "summa_cashless": "0.0000000000",
                    "is_system": "0",
                    "show_in_cashflow": "1"
               }
          }
     }
}


Пример ClosingOfInvoices

curl --location -g --request GET 'http://{DOMAIN NAME}/rest/api/ClosingOfInvoices?filter=[{"property":"client_id","value":6,"operator":"="}]' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'

Ответ сервера

{
     "success": true,
     "message": "Records Retrieved Successfully",
     "data": {
          "totalCount": "2",
          "closingOfInvoices": [
             {
               "id": "1",
               "client_id": "6",
               "create_date": "2021-09-22 13:14:25",
               "plus_type_document": "payment",
               "plus_document_id": "1",
               "plus_amount": "500.0000000000",
               "minus_type_document": "invoice",
               "minus_document_id": "1",
               "minus_amount": "500.0000000000",
               "client": {
                    "id": "6",
                    "address": "",
                    "home_phone": "",
                    "work_phone": "",
                    "note": "",
                    "type_id": null,
                    "how_find": null,
                    "balance": "0.0000000000",
                    "email": "sergey.laytaruk@gmail.com",
                    "city": "",
                    "city_id": "145",
                    "date_register": "2021-09-22 09:25:39",
                    "cell_phone": "0957778899",
                    "zip": "",
                    "registration_index": null,
                    "vip": "0",
                    "last_name": "Client001",
                    "first_name": "Client001",
                    "middle_name": "Client001",
                    "status": "ACTIVE",
                    "discount": "0",
                    "passport_series": "",
                    "lab_number": "",
                    "street_id": "0",
                    "apartment": "",
                    "unsubscribe": "0",
                    "in_blacklist": "0",
                    "last_visit_date": "2021-09-23 10:18:54",
                    "number_of_journal": "",
                    "phone_prefix": "38"
               },
               "invoice": {
                    "id": "1",
                    "doctor_id": "1",
                    "client_id": "6",
                    "pet_id": "3",
                    "description": "Счет сформирован на основании медкарты №2 от 2021-09-22 13:14:17.",
                    "percent": "0.0000000000",
                    "amount": "500.0000000000",
                    "status": "exec",
                    "invoice_date": "2021-09-22 13:14:25",
                    "old_id": null,
                    "night": "0",
                    "increase": "0.0000000000",
                    "discount": "0.0000000000",
                    "call": "0",
                    "paid_amount": "500.0000000000",
                    "create_date": "2021-09-22 13:14:17",
                    "payment_status": "full",
                    "clinic_id": "1",
                    "creator_id": "1",
                    "fiscal_section_id": "0"
               },
               "plus_payment": {
                    "id": "1",
                    "amount": "500.0000000000",
                    "status": "exec",
                    "cassa_id": "2",
                    "cassaclose_id": null,
                    "create_date": "2021-09-22 13:14:25",
                    "payed_user": "1",
                    "description": "",
                    "payment_type": "cash",
                    "invoice_id": "1",
                    "parent_id": "0"
               }
               },
          {
               "id": "2",
               "client_id": "6",
               "create_date": "2021-09-23 10:19:05",
               "plus_type_document": "payment",
               "plus_document_id": "2",
               "plus_amount": "31.0000000000",
               "minus_type_document": "invoice",
               "minus_document_id": "2",
               "minus_amount": "31.0000000000",
               "client": {
                    "id": "6",
                    "address": "",
                    "home_phone": "",
                    "work_phone": "",
                    "note": "",
                    "type_id": null,
                    "how_find": null,
                    "balance": "0.0000000000",
                    "email": "sergey.laytaruk@gmail.com",
                    "city": "",
                    "city_id": "145",
                    "date_register": "2021-09-22 09:25:39",
                    "cell_phone": "0957778899",
                    "zip": "",
                    "registration_index": null,
                    "vip": "0",
                    "last_name": "Client001",
                    "first_name": "Client001",
                    "middle_name": "Client001",
                    "status": "ACTIVE",
                    "discount": "0",
                    "passport_series": "",
                    "lab_number": "",
                    "street_id": "0",
                    "apartment": "",
                    "unsubscribe": "0",
                    "in_blacklist": "0",
                    "last_visit_date": "2021-09-23 10:18:54",
                    "number_of_journal": "",
                    "phone_prefix": "38"
               },
               "invoice": {
                     "id": "2",
                     "doctor_id": "1",
                     "client_id": "6",
                     "pet_id": "3",
                     "description": "",
                     "percent": "0.0000000000",
                     "amount": "31.0000000000",
                     "status": "exec",
                     "invoice_date": "2021-09-23 10:19:05",
                     "old_id": null,
                     "night": "0",
                     "increase": "0.0000000000",
                     "discount": "0.0000000000",
                     "call": "0",
                     "paid_amount": "31.0000000000",
                     "create_date": "2021-09-23 10:18:54",
                     "payment_status": "full",
                     "clinic_id": "1",
                     "creator_id": "1",
                     "fiscal_section_id": "0"
               },
               "plus_payment": {
                    "id": "2",
                    "amount": "31.0000000000",
                    "status": "exec",
                    "cassa_id": "2",
                    "cassaclose_id": null,
                    "create_date": "2021-09-23 10:19:05",
                    "payed_user": "1",
                    "description": "",
                    "payment_type": "cash",
                    "invoice_id": "2",
                    "parent_id": "0"
                   }
              }
         ]
     }
}




👆 На этом пока всё