Skip to content

Servis maydonlarini olish ​

Ushbu metod xizmat talab qiladigan field’larni qaytaradi.

Request example

Method: GET
URL: BASE_URL/servicePayment/fields/{service_id}/
Header:

http
Authorization: Bearer <ACCESS_TOKEN>
Path paramTypeDescription
service_idstringservicePayment/list/ orqali qaytgan Service ID

Response example

json
{
  "result": {
    "data": [
      {
        "service_id": "6ae5eaf5-9b70-4aa9-9260-2438e99affa0",
        "name": "Плата за электроэнергию",
        "category": {
          "id": 33,
          "name": "Переводы"
        },
        "amount": {
          "min": 500,
          "max": 5000000
        },
        "has_info_method": true,
        "can_cancel": false,
        "payment_available": true,
        "is_active": true,
        "logo": "https://cdn.paylov.uz/2024/12/05/mobi.png",
        "fields": [
          {
            "field_id": "9",
            "name": "region",
            "title": "region",
            "type": "select",
            "content": "text",
            "validation": null,
            "length": null,
            "required": true,
            "dependency_of": null,
            "values": [
              {
                "id": 7,
                "value": "1",
                "title": "г. Ташкент",
                "filter": null
              },
              {
                "id": 8,
                "value": "2",
                "title": "Ташкентская область",
                "filter": null
              }
            ]
          },
          {
            "field_id": "10",
            "name": "soato",
            "title": "soato",
            "type": "select",
            "content": "text",
            "validation": null,
            "length": null,
            "required": true,
            "dependency_of": "region",
            "values": [
              {
                "id": 48,
                "value": "26280",
                "title": "26280 - Алмазарский ЭСП",
                "filter": "1"
              },
              {
                "id": 49,
                "value": "26264",
                "title": "26264 - Бектемирский ЭСП",
                "filter": "1"
              }
            ]
          },
          {
            "field_id": "11",
            "name": "customer_code",
            "title": "customer_code",
            "type": "text",
            "content": "number",
            "validation": null,
            "length": null,
            "required": true,
            "values": []
          }
        ],
        "response_fields": [
          {
            "field_id": "1311",
            "name": "fio",
            "title": "fio",
            "postfix": null
          },
          {
            "field_id": "1314",
            "name": "last_paid_date",
            "title": "last_paid_date",
            "postfix": null
          },
          {
            "field_id": "1315",
            "name": "last_paid",
            "title": "last_paid",
            "postfix": "UZS"
          },
          {
            "field_id": "1313",
            "name": "saldo",
            "title": "balance",
            "postfix": "UZS"
          },
          {
            "field_id": "1343",
            "name": "tariff_price",
            "title": "tariff_price",
            "postfix": null
          },
          {
            "field_id": "1344",
            "name": "kwn",
            "title": "kVts xisoblangani",
            "postfix": null
          }
        ]
      }
    ]
  }
}

Explanation
Qaytgan field’larni type qiymatiga qarab 2 guruhga ajratish mumkin: text va select.

  • Agar type = select bo‘lsa, foydalanuvchi values ro‘yxatidan bittasini tanlashi kerak.
  • Agar type = text bo‘lsa va values bo‘sh bo‘lsa, bu foydalanuvchi tomonidan kiritiladigan maydon ekanini anglatadi. Masalan, xizmatdagi abonent yoki hisob raqami.

info va create metodlarida account field’ini generatsiya qilish uchun kerakli field’larni shu yerdan olishingiz kerak.
So‘ng uni quyidagi ko‘rinishda shakllantirasiz:

python
account = {}

for field in result['data']['fields']:

    if field['type'] == 'select':
        account[field['name']] = field['values'][0]['value']
    else:
        account[field['name']] = ''

# bu account field’ni to‘g‘ri yaratish uchun oddiy misol

response_fields — info, create va pay metodlari javobida chiqishi mumkin bo‘lgan field’lar ro‘yxatini bildiradi.