Bonus tariflari
Mijozlar bonus dasturi darajalari (10 tagacha): keshbek foizi, bonus bilan to‘lashning maksimal ulushi va darajaga kirish uchun minimal xaridlar summasi.
| Metod | Manzil | Vazifasi |
|---|---|---|
| GET | /company/bonus/tariff | Bonus tariflari ro‘yxati |
| PUT | /company/bonus/tariff | Bonus tariflarini saqlash |
Bonus tariflari ro‘yxati
Foydalanuvchi kompaniyasining barcha tariflari tartib bo‘yicha (sort_index, kirish summasi o‘sishi bo‘yicha), har biridagi mijozlar soni (clients_count) va oxirgi o‘zgartirgan xodim bilan. Sahifalashsiz.
/company/bonus/tariffSarlavhalar (headers)
| Sarlavha | Qiymat | Tavsif |
|---|---|---|
Authorization | Bearer {token} | POST /common/auth/login dan olingan token |
Accept | application/json | Javob JSON da |
Accept-Language | ru | Xabarlar va nomlar tili: ru, uz, oz |
Javob · 200
Javob maydonlari
| Maydon | Turi | Tavsif |
|---|---|---|
[].id | integer | ID |
[].updater_id | integer | Yangilovchi |
[].company_id | integer | Kompaniya |
[].name | string | Nomlanish |
[].cashback_percent | integer | Cashback (foizlarda) |
[].max_percent_for_sale | integer | Buyurtmani to‘lash uchun maksimal cashback (foizlarda) |
[].min_entry | integer | Minimal chegara |
[].comment | string | Izoh |
[].color | null | Rang |
[].is_discounted_excluded | boolean | Chegirmali savdoda hisoblanmaydi |
[].is_stepped_cashback | boolean | Bosqichli keshbek |
[].cashback_steps | array | Keshbek bosqichlari |
[].sort_index | integer | |
[].updated_at | string | Yangilangan |
[].clients_count | integer | Mijozlar soni |
[].updater | object | |
[].updater.id | integer | ID |
[].updater.type | string | Turi |
[].updater.role_id | integer | Roli |
[].updater.company_id | integer | Kompaniya |
[].updater.partner_id | null | Hamkor |
[].updater.username | string | Login |
[].updater.pinfl | null | PINFL |
[].updater.phone | string | Telefon |
[].updater.sipuni_sip_number | string | Sipuni (SIP-raqam) |
[].updater.is_confirmed | boolean | |
[].updater.are_all_companies_available | boolean | |
[].updater.last_login_at | null | Oxirgi kirish |
[].updater.created_at | string | Yaratilgan |
[].updater.updated_at | string | Yangilangan |
[].updater.is_deleted | boolean | O‘chirilgan |
[].updater.profile | object | |
[].updater.profile.first_name | null | Ism |
[].updater.profile.last_name | null | Familiya |
[].updater.profile.position | null | Lavozim |
[].updater.profile.birth_date | null | Tug'ilgan kuni |
[].updater.profile.gender | null | Jinsi |
[].updater.profile.is_discount_limited | boolean | |
[].updater.profile.max_item_discount_percent | null | |
[].updater.profile.max_check_discount_percent | null | |
[].updater.profile.is_device_limited | boolean | |
[].updater.profile.max_devices | integer | |
[].updater.profile.is_mobile_login_allowed | boolean | |
[].updater.profile.last_device_number | integer | |
[].updater.profile.full_name | string | FISH |
[
{
"id": 1,
"updater_id": 2,
"company_id": 1,
"name": "Tariff 1",
"cashback_percent": 10,
"max_percent_for_sale": 30,
"min_entry": 1000,
"comment": "Comment 1",
"color": null,
"is_discounted_excluded": false,
"is_stepped_cashback": false,
"cashback_steps": [],
"sort_index": 0,
"updated_at": "2026-11-25 16:42:00",
"clients_count": 1,
"updater": {
"id": 2,
"type": "director",
"role_id": 2,
"company_id": 1,
"partner_id": null,
"username": "director_1@local.host",
"pinfl": null,
"phone": "998020000001",
"sipuni_sip_number": "210",
"is_confirmed": true,
"are_all_companies_available": false,
"last_login_at": null,
"created_at": "2026-11-25 16:42:00",
"updated_at": "2026-11-25 16:42:00",
"is_deleted": false,
"profile": {
"first_name": null,
"last_name": null,
"position": null,
"birth_date": null,
"gender": null,
"is_discount_limited": false,
"max_item_discount_percent": null,
"max_check_discount_percent": null,
"is_device_limited": true,
"max_devices": 2,
"is_mobile_login_allowed": true,
"last_device_number": 0,
"full_name": " "
}
}
},
{
"id": 2,
"updater_id": 2,
"company_id": 1,
"name": "Tariff 2",
"cashback_percent": 20,
"max_percent_for_sale": 50,
"min_entry": 2000,
"comment": "Comment 2",
"color": null,
"is_discounted_excluded": false,
"is_stepped_cashback": false,
"cashback_steps": [],
"sort_index": 1,
"updated_at": "2026-11-25 16:42:00",
"clients_count": 0,
"updater": {
"id": 2,
"type": "director",
"role_id": 2,
"company_id": 1,
"partner_id": null,
"username": "director_1@local.host",
"pinfl": null,
"phone": "998020000001",
"sipuni_sip_number": "210",
"is_confirmed": true,
"are_all_companies_available": false,
"last_login_at": null,
"created_at": "2026-11-25 16:42:00",
"updated_at": "2026-11-25 16:42:00",
"is_deleted": false,
"profile": {
"first_name": null,
"last_name": null,
"position": null,
"birth_date": null,
"gender": null,
"is_discount_limited": false,
"max_item_discount_percent": null,
"max_check_discount_percent": null,
"is_device_limited": true,
"max_devices": 2,
"is_mobile_login_allowed": true,
"last_device_number": 0,
"full_name": " "
}
}
}
]Bonus tariflarini saqlash
Kompaniyaning barcha tariflarini yuborilgan records bilan almashtiradi (10 tagacha; nomlar va min_entry takrorlanmaydi): yozuvlar min_entry bo‘yicha saralanadi, ortiqcha eski tariflar o‘chiriladi. Saqlangandan so‘ng kompaniyaning barcha mijozlari xaridlar summasiga ko‘ra tariflarga qayta taqsimlanadi. Bo‘sh records barcha tariflarni o‘chiradi.
/company/bonus/tariffFormadan (
multipart/form-data)PUTmetodiPOST+?_method=PUTparametri bilan yuboriladi.
Sarlavhalar (headers)
| Sarlavha | Qiymat | Tavsif |
|---|---|---|
Authorization | Bearer {token} | POST /common/auth/login dan olingan token |
Accept | application/json | Javob JSON da |
Accept-Language | ru | Xabarlar va nomlar tili: ru, uz, oz |
So‘rov tanasi
| Maydon | Turi | Majburiy | Tavsif |
|---|---|---|---|
records | object[] | Yo‘q | Kamida 0 ta element. Maks. 10 ta element |
records[].name | string | Ha | Nomlanish. Takrorlanmasin. Maks. 255 belgi |
records[].cashback_percent | integer | Ha | Cashback (foizlarda). Kamida 0. 100 dan oshmasin |
records[].max_percent_for_sale | integer | Ha | Buyurtmani to‘lash uchun maksimal cashback (foizlarda). Kamida 0. 100 dan oshmasin |
records[].min_entry | number | Ha | Minimal chegara. Verguldan keyin 2 tagacha raqam. Kamida 0.01. 999999999999.99 dan oshmasin. Takrorlanmasin |
records[].comment | string | Yo‘q | Izoh. Maks. 1000 belgi |
records[].color | string | Yo‘q | Tarif rangi #RRGGBB formatida. Shablon /^#[0-9A-Fa-f]{6}$/ |
records[].is_discounted_excluded | boolean | Yo‘q | «Chegirmali savdoda hisoblanmaydi»: chegirmali chek qatorlari (tovarga yoki chekka chegirma ulushi) keshbek bermaydi. Standart false |
records[].is_stepped_cashback | boolean | Yo‘q | «Bosqichli keshbek»: bosqichlar bitta chek summasi bilan solishtiriladi. Birinchi bosqich summasidan boshlab bo‘lgan birinchi chek mijozni tarifga butunlay kiritadi — keyin uning har qanday cheki birinchi bosqich foizini oladi; o‘zi yuqoriroq bosqichga yetgan chek shu bosqich foizini bir martalik oladi. Kirishgacha cashback_percent amal qiladi. Standart false |
records[].cashback_steps | object[] | Yo‘q | Bosqichlar (is_stepped_cashback yoqilganda majburiy, 20 tagacha); amount_from bo‘yicha saralanib saqlanadi, is_stepped_cashback o‘chiq bo‘lsa saqlanmaydi. Maks. 20 ta element |
records[].cashback_steps[].amount_from | number | Ha | Chek summasi (dan), so‘m. Bitta tarifda takrorlanmaydi. Verguldan keyin 2 tagacha raqam. Kamida 0. 999999999999.99 dan oshmasin |
records[].cashback_steps[].percent | integer | Ha | Bosqich keshbegi, %. Kamida 0. 100 dan oshmasin |
{
"records": [
{
"name": "Tariff 1",
"cashback_percent": 10,
"max_percent_for_sale": 10,
"min_entry": 100,
"comment": "Comment 1",
"color": "#22C55E"
},
{
"name": "Tariff 2",
"cashback_percent": 20,
"max_percent_for_sale": 20,
"min_entry": 200,
"comment": "Comment 2",
"color": null
},
{
"name": "Tariff 3",
"cashback_percent": 30,
"max_percent_for_sale": 30,
"min_entry": 300,
"comment": "Comment 3",
"color": null
}
]
}curl -X PUT "https://api.wasyt.uz/company/bonus/tariff" \
-H "Accept: application/json" \
-H "Accept-Language: ru" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"records":[{"name":"Tariff 1","cashback_percent":10,"max_percent_for_sale":10,"min_entry":100,"comment":"Comment 1","color":"#22C55E"},{"name":"Tariff 2","cashback_percent":20,"max_percent_for_sale":20,"min_entry":200,"comment":"Comment 2","color":null},{"name":"Tariff 3","cashback_percent":30,"max_percent_for_sale":30,"min_entry":300,"comment":"Comment 3","color":null}]}'Javob · 200
Javob maydonlari
| Maydon | Turi | Tavsif |
|---|---|---|
message | string | Xabar |
{
"message": "Success"
}
