Reject Premium

# Prim Teklifi Reddetme API Dokümantasyonu Bu dokümantasyon, offline iş akışı kapsamında prim teklifi reddetme endpoint'inin teknik kullanım kılavuzudur. Endpoint aracılığıyla sigorta şirketi API kullanıcıları; acentelerden gelen teklif taleplerini red nedeni ve açıklama mesajı ile reddedebilir, gerektiğinde destekleyici PDF dokümanlar ekleyebilir. --- ## Endpoint Bilgisi | Özellik | Değer | | --- | --- | | **HTTP Metodu** | `PUT` | | **URL** | `/api/offline/jobs/{jobId}/premiums/reject` | | **Content-Type** | `application/json` | | **Yetkilendirme** | `Authorization: Bearer {token}` | ### Yetkilendirme Rolleri Çağıranın aşağıdaki rollerden birine sahip olması gerekir: | Rol | Erişim Kapsamı | | --- | --- | | `InsuranceCompanyAPIUser` | Sadece kendi işlerine erişebilir | | `InsuranceCompanyAPIAdmin` | Şirketin tüm işlerine erişebilir | | `Supervizor` | Şirketin tüm işlerine erişebilir | ### Beklenen Yanıtlar | Senaryo | HTTP Durumu | Body | | --- | --- | --- | | Başarılı red | `204 No Content` | *(boş)* | | Eksik zorunlu alanlar | `400 Bad Request` | Doğrulama hata detayları | | Geçersiz red nedeni | `400 Bad Request` | `JobRejectReason` alan hatası | | Geçersiz veya süresi dolmuş token | `401 Unauthorized` | — | | Farklı kullanıcının job'ı | `403 Forbidden` | `OfflineJobs.JobOwnershipDenied` | | Var olmayan job ID | `404 Not Found` | `OfflineJobs.JobNotFound` | | Platform senkronizasyon hatası | `500 Internal Server Error` | `JobState.ActionNotSentToPlatform` | ### Route Parametreleri | Parametre | Tip | Zorunlu | Açıklama | | --- | --- | --- | --- | | `jobId` | `integer` | Evet | Reddedilecek işin benzersiz tanımlayıcısı | --- ## İstek Modeli ### Ana İstek — `RejectPremiumRequest` | Alan | Tip | Zorunlu | Açıklama | Doğrulama Kuralları | | --- | --- | --- | --- | --- | | `JobRejectReason` | `integer` | Evet | Önceden tanımlı listeden red nedeni ID'si. Nedenler sigorta şirketine göre yapılandırılır. | Zorunlu: `"JobRejectReason is required."` <br>0'dan büyük olmalı: `"JobRejectReason must be greater than 0."` <br>Veritabanındaki `JobRejectReason` tablosunda mevcut olmalı <br>Red nedeninin `ReasonCategory` değeri `Proposal` olmalı | | `Message` | `string` | Evet | Teklif talebinin neden reddedildiğini açıklayan not. Platform üzerinden acente tarafından görülebilir. Saklamadan önce HTML-encoded yapılır. | Zorunlu: `"Message is required."` <br>Boş olamaz: `"Message must not be empty."` <br>Maks. 500 karakter: `"Message must not exceed 500 characters."` | | `Attachments` | `PremiumFileRequest[]` | Hayır | Reddetmeye eklenecek destekleyici PDF dokümanların isteğe bağlı listesi | Sağlanırsa her eleman `PremiumFileRequest` doğrulamasından geçer | ### JobRejectReason Değerleri Aşağıdaki tablo `JobRejectReason` alanı için kullanılabilecek geçerli red nedeni ID'lerini listeler. `ReasonCategory` değeri `0` olan nedenler `Proposal` kategorisine aittir. | ID | Açıklama | Şirket Kısıtlaması | ReasonCategory | | --- | --- | --- | --- | | `1` | Eksik Bilgi/Belge | Tüm şirketler | `0` (Proposal) | | `4` | Risk Kabul Kriterleri | Tüm şirketler | `0` (Proposal) | | `9` | Başka Şirketten Teklif Alınamaz - Risk Kabul Kriterleri | Sadece şirket ID: `61` | `0` (Proposal) | | `17` | Başka Şirketten Teklif Alınabilir - Risk Kabul Kriterleri | Sadece şirket ID: `61` | `0` (Proposal) | > **Not:** Bazı red nedenleri belirli sigorta şirketlerine özeldir. Şirket kısıtlaması olmayan nedenler tüm şirketler tarafından kullanılabilir. --- ### PDF Dosyası — `PremiumFileRequest` > Aşağıdaki alanlar yalnızca `Attachments` listesi içinde eleman gönderildiğinde zorunludur. | Alan | Tip | Zorunlu | Açıklama | Doğrulama Kuralları | | --- | --- | --- | --- | --- | | `FileName` | `string` | Evet* | Dosya adı | Boş olamaz: `"FileName must not be empty."` <br>`.pdf` uzantısı olmalı (büyük/küçük harf duyarsız): `"Only PDF files are allowed."` | | `ContentType` | `string` | Hayır | MIME türü | — | | `Base64Content` | `string` | Evet* | Base64 kodlu dosya içeriği | Boş olamaz: `"Base64Content must not be empty."` <br>Geçerli Base64 olmalı: `"Base64Content must be a valid base64 encoded string."` <br>İçerik geçerli bir PDF olmalı (PDF magic bytes `%PDF` kontrolü): `"File content is not a valid PDF."` | --- ## İstek Örnekleri ### Minimal İstek (ek yok) ```json { "JobRejectReason": 5, "Message": "Risk değerlendirmesi underwriting kurallarımızı aşıyor." } ``` ### Ekli İstek (PDF dokümanlarla) ```json { "JobRejectReason": 12, "Message": "Talep edilen gayrimenkul tipi mevcut kriterlerimize göre kapsama uygun değil. Lütfen underwriting kriterlerimizi inceleyin.", "Attachments": [ { "FileName": "underwriting-guidelines.pdf", "ContentType": "application/pdf", "Base64Content": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgL1BhZ2VNVQgzIC9QYWdlU2l6ZXMgWyAzIDAgUiBdID4+PlN0cmVhbQpCVAplYm9va2MwCgo..." }, { "FileName": "coverage-explanation.pdf", "ContentType": "application/pdf", "Base64Content": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMSBSIC9QYWdlTVQgMiAvUGFnZVNpemVzIFsgMiAwIFIgXSA+Pj5TdHJlYW0KQlQKZWJvb2tjMQoK..." } ] } ``` ### Sınır Testi İsteği (500 karakter mesaj) ```json { "JobRejectReason": 1, "Message": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Pelle", "Attachments": [] } ``` --- ## Yanıt Formatı ### Başarılı Yanıt **HTTP Durumu:** `204 No Content` Yanıt gövdesi boştur. **Başarılı Red Sonuçları:** - Job stage'i `PremiumRequestRejected` (2) olarak güncellenir - Red bilgisi platforma senkronize edilir - Acente için email notification kuyruğa alınır - Attachment'lar (varsa) document storage'a kaydedilir ### Hata Yanıtı ```json { "Status": false, "Code": "Error.Code", "Message": "Error description", "Response": null } ``` Doğrulama hatalarında `Response` alanı detayları içerir: ```json { "Status": false, "Code": "Validation.General", "Message": "One or more validation errors occurred", "Response": [ { "Field": "FieldName", "Message": "Error message description" } ] } ``` --- ## HTTP Durum Kodları | Durum | Açıklama | | --- | --- | | `204 No Content` | Prim teklifi başarıyla reddedildi | | `400 Bad Request` | Doğrulama hatası veya geçersiz red nedeni | | `401 Unauthorized` | Eksik, geçersiz veya süresi dolmuş token | | `403 Forbidden` | Yetersiz yetki veya iş sahipliği reddedildi | | `404 Not Found` | İş veya platform kullanıcısı bulunamadı | | `500 Internal Server Error` | Platform servisi hatası veya beklenmeyen hata | --- ## Hata Kodları Referansı | Kod | HTTP Durumu | Mesaj | | --- | --- | --- | | `Validation.General` | 400 | One or more validation errors occurred | | `OfflineJobs.InsuranceCompanyNotFound` | 403 | No valid insurance company assignment found in token. | | `OfflineJobs.UserNotFound` | 403 | User identity could not be resolved from token. | | `OfflineJobs.JobNotFound` | 404 | No job found for the requested JobId. | | `OfflineJobs.JobOwnershipDenied` | 403 | You do not have permission to access this job. | | `JobState.PlatformUserNotFound` | 404 | Platform user not found for job {jobId}. | | `JobState.SenderUserNotFound` | 404 | Sender user not found in the system. | | `JobState.ActionNotSentToPlatform` | 500 | Failed to synchronize rejection action to the platform. | | `JobState.UnknownBusinessRule` | 500 | An unexpected business rule violation occurred. | | `JobState.TransitionError` | 500 | An unexpected error occurred during job state transition. | --- ## Hata Yanıt Örnekleri ### Doğrulama Hatası (birden fazla alan) ```json { "Status": false, "Code": "Validation.General", "Message": "One or more validation errors occurred", "Response": [ { "Field": "JobRejectReason", "Message": "JobRejectReason must be greater than 0." }, { "Field": "Message", "Message": "Message must not be empty." }, { "Field": "Attachments[0].FileName", "Message": "Only PDF files are allowed." }, { "Field": "Attachments[0].Base64Content", "Message": "Base64Content must be a valid base64 encoded string." } ] } ``` ### Red Nedeni Bulunamadı ```json { "Status": false, "Code": "Validation.General", "Message": "One or more validation errors occurred", "Response": [ { "Field": "JobRejectReason", "Message": "The specified reject reason does not exist." } ] } ``` ### Red Nedeni Yanlış Kategori ```json { "Status": false, "Code": "Validation.General", "Message": "One or more validation errors occurred", "Response": [ { "Field": "JobRejectReason", "Message": "The specified reject reason is not in the Proposal category." } ] } ``` ### İş Bulunamadı ```json { "Status": false, "Code": "OfflineJobs.JobNotFound", "Message": "No job found for the requested JobId.", "Response": null } ``` ### Erişim Reddedildi ```json { "Status": false, "Code": "OfflineJobs.JobOwnershipDenied", "Message": "You do not have permission to access this job.", "Response": null } ``` ### Platform Kullanıcısı Bulunamadı ```json { "Status": false, "Code": "JobState.PlatformUserNotFound", "Message": "Platform user not found for job 12345.", "Response": null } ``` ### Platform Senkronizasyon Hatası ```json { "Status": false, "Code": "JobState.ActionNotSentToPlatform", "Message": "Failed to synchronize rejection action to the platform.", "Response": null } ``` --- ---

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.

Response

Successful response