منو
shell php java .Net javascript

بیمه شخص ثالث (Third-Party Insurance API)

این بخش وب‌سرویس‌های صدور بیمه شخص ثالث خودرو و موتورسیکلت برای کسب‌وکارهای همکار را شرح می‌دهد؛ شامل استعلام پلاک از سنهاب، ثبت درخواست، انتخاب محصول، ثبت پرداخت، تکمیل اطلاعات بیمه‌گذار و مدارک، الحاقیه و دریافت بیمه‌نامه.

https://api.mydigipay.com/digipay/api/business/v1/insurance/ آدرس پایه
v1 نسخه API

۱. روند کلی صدور بیمه‌نامه

  1. استعلام اطلاعات خودرو و بیمه قبلی از سنهاب (merchant/vehicle-plates/plaque-info).
  2. ثبت درخواست بیمه با اطلاعات استعلام‌شده و شماره همراه مشتری (merchant/applications).
  3. دریافت محصولات قابل ارائه (merchant/applications/{id}/available-insurance) و انتخاب محصول (merchant/applications/draft).
  4. ثبت اطلاعات پرداخت (merchant/applications/{id}/payment-info).
  5. تکمیل اطلاعات بیمه‌گذار (insured-party)، آدرس (address) و بارگذاری مدارک (documents) و بررسی تکمیل مدارک (documents/check).
  6. پس از تکمیل همه موارد، درخواست به Provisioning و پس از صدور به Issued می‌رسد و بیمه‌نامه قابل دانلود است (merchant/application-forms/{id}/download-policy).

۲. هدرهای مشترک

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان String (UUID) بله user-id
application/json یا multipart/form-data (برای بارگذاری فایل) String در صورت داشتن بدنه Content-Type

۳. ساختار خطای اعتبارسنجی (HTTP 400)

توضیحات نوع داده نام فیلد
کد وضعیت HTTP (پیش‌فرض 400) Integer statusCode
پیام کلی خطا String message
خطاها به تفکیک نام فیلد؛ هر کلید آرایه‌ای از پیام‌ها Object<String, Array<String>> errors
{
  "statusCode": 400,
  "message": "One or more errors occurred!",
  "errors": {
    "fieldName": [
      "error message"
    ]
  }
}

۴. مقادیر شمارشی (Enums)

نوع محصول بیمه (InsuranceProductType)

مقدار
Car
Motor

نوع بیمه مدرک (DocumentInsuranceType)

مقدار
Car
Motor

وضعیت‌های درخواست (ApplicationFormStatesEnum)

مقدار
InsuredAsset
Draft
Checkout
PendingPayment
Paid
UserInfoCompleted
DocumentsUploaded
AddressInserted
DeliveryMethodInserted
Refused
Provisioning
PendingReview
Reviewed
DocumentsConflict
PriceConflict
PendingIssuance
Issued
Cancelled
Expired
WaitingForPostalCode
VerifyPostalCode

نوع مدرک (ApplicationDocumentType)

مقدار
Other
VehicleDocument
DriverLicenseForeImage
DriverLicenseBackImage
VehicleCardForeImage
VehicleCardBackImage
PolicyDocument
PreviousPolicyImage
AccidentPolicyDocument
BodyVisitFile
BodyVideoFile
GreenPaper
DocumentConflict

نوع محدودیت جستجو (ApplicationPartyRestrictionType)

مقدار
Simple
Range
Collection

۵. کانال کسب‌وکار (Merchant)

سرویس‌های این بخش برای کسب‌وکارهای همکار است. هدر user-id در این سرویس‌ها کسب‌وکار فراخوان را مشخص می‌کند و تنها درخواست‌ها، مدارک و بیمه‌نامه‌های متعلق به همان کسب‌وکار قابل دسترسی هستند. مشتری با mobileNumber شناسایی می‌شود.

۱-۵. دانلود سند الحاقیه (کسب‌وکار)

تنها درخواست‌های متعلق به کسب‌وکار فراخوان مجاز هستند. نیازمند endorsementId است. مقدار outputType=url یک آدرس موقت (پیش‌فرض) برمی‌گرداند.

/merchant/application-forms/{id}/download-endorsement آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-endorsement' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-endorsement');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-endorsement"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-endorsement");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-endorsement', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق (HTTP 200):

توضیحات نوع داده نام فیلد
نوع خروجی String type
آدرس موقت فایل String url
مدت اعتبار آدرس (ثانیه) Integer expiresIn
{
  "type": "string",
  "url": "string",
  "expiresIn": 1
}

۲-۵. دانلود بیمه‌نامه صادرشده (کسب‌وکار)

تنها درخواست‌های متعلق به کسب‌وکار فراخوان مجاز هستند. مقدار outputType=url یک آدرس موقت (پیش‌فرض) برمی‌گرداند و هر مقدار دیگر فایل PDF را به‌صورت Stream ارسال می‌کند.

/merchant/application-forms/{id}/download-policy آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-policy' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-policy');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-policy"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-policy");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6/download-policy', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق (HTTP 200):

توضیحات نوع داده نام فیلد
نوع خروجی String type
آدرس موقت فایل String url
مدت اعتبار آدرس (ثانیه) Integer expiresIn
{
  "type": "string",
  "url": "string",
  "expiresIn": 1
}

۳-۵. دریافت فرم درخواست با شناسه (کسب‌وکار)

تنها درخواست‌های متعلق به کسب‌وکار فراخوان بازگردانده می‌شوند. پارامتر اختیاری productType جستجو را محدود می‌کند.

/merchant/application-forms/{id} آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id
نوع محصول (اختیاری)؛ قابل تهی String (Enum) Query خیر productType

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6?productType=Car' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6?productType=Car');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6?productType=Car"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6?productType=Car");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/3fa85f64-5717-4562-b3fc-2c963f66afa6?productType=Car', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۴-۵. فهرست فرم‌های درخواست فروخته‌شده توسط کسب‌وکار

بدون mobileNumber همه درخواست‌های خودرو/موتورسیکلت کسب‌وکار فراخوان را برمی‌گرداند. با mobileNumber تنها درخواست‌های همان مشتری در همین کسب‌وکار بازگردانده می‌شوند.

/merchant/application-forms/list آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
نوع محصول (اختیاری)؛ قابل تهی String (Enum) Query خیر productType
شماره صفحه، شروع از ۱ (پیش‌فرض ۱) Integer Query بله page
اندازه صفحه (پیش‌فرض ۲۰، حداکثر ۱۰۰) Integer Query بله size

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
شماره همراه مشتری؛ حداقل ۱ کاراکتر String بله mobileNumber
مرتب‌سازی؛ قابل تهی Array<Object> خیر orders
نام فیلد String خیر orders[].field
جهت مرتب‌سازی String خیر orders[].order
محدودیت‌های جستجو Array<Object> خیر restrictions
نوع String (Enum) خیر restrictions[].type
نام فیلد String خیر restrictions[].field
عنوان String خیر restrictions[].title
عملگر String خیر restrictions[].operation
حداقل مقدار؛ قابل تهی Long خیر restrictions[].minValue
حداکثر مقدار؛ قابل تهی Long خیر restrictions[].maxValue
مقدار String خیر restrictions[].value
مقادیر Array<String> خیر restrictions[].values

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/list?productType=Car&page=1&size=20' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "mobileNumber": "09121234567",
  "orders": [
    {
      "field": "string",
      "order": "string"
    }
  ],
  "restrictions": [
    {
      "type": "Simple",
      "field": "string",
      "title": "string",
      "operation": "string",
      "minValue": 1,
      "maxValue": 1,
      "value": "string",
      "values": [
        "string"
      ]
    }
  ]
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/list?productType=Car&page=1&size=20');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "mobileNumber": "09121234567",
  "orders": [
    {
      "field": "string",
      "order": "string"
    }
  ],
  "restrictions": [
    {
      "type": "Simple",
      "field": "string",
      "title": "string",
      "operation": "string",
      "minValue": 1,
      "maxValue": 1,
      "value": "string",
      "values": [
        "string"
      ]
    }
  ]
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "mobileNumber": "09121234567",
  "orders": [
    {
      "field": "string",
      "order": "string"
    }
  ],
  "restrictions": [
    {
      "type": "Simple",
      "field": "string",
      "title": "string",
      "operation": "string",
      "minValue": 1,
      "maxValue": 1,
      "value": "string",
      "values": [
        "string"
      ]
    }
  ]
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/list?productType=Car&page=1&size=20"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/list?productType=Car&page=1&size=20");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""mobileNumber"": ""09121234567"",
  ""orders"": [
    {
      ""field"": ""string"",
      ""order"": ""string""
    }
  ],
  ""restrictions"": [
    {
      ""type"": ""Simple"",
      ""field"": ""string"",
      ""title"": ""string"",
      ""operation"": ""string"",
      ""minValue"": 1,
      ""maxValue"": 1,
      ""value"": ""string"",
      ""values"": [
        ""string""
      ]
    }
  ]
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/application-forms/list?productType=Car&page=1&size=20', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "mobileNumber": "09121234567",
    "orders": [
      {
        "field": "string",
        "order": "string"
      }
    ],
    "restrictions": [
      {
        "type": "Simple",
        "field": "string",
        "title": "string",
        "operation": "string",
        "minValue": 1,
        "maxValue": 1,
        "value": "string",
        "values": [
          "string"
        ]
      }
    ]
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۵-۵. دریافت بیمه‌نامه صادرشده با شناسه (کسب‌وکار)

بیمه‌نامه صادرشده‌ای را که توسط کسب‌وکار فراخوان فروخته شده است برمی‌گرداند.

/merchant/policies/{id} آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۶-۵. فهرست بیمه‌نامه‌های فروخته‌شده توسط کسب‌وکار

شناسه، شماره بیمه‌نامه، نوع، وضعیت، تاریخ انقضا و بیمه‌گر را برمی‌گرداند. بدون mobileNumber همه بیمه‌نامه‌های کسب‌وکار و با ارسال آن، بیمه‌نامه‌های یک مشتری بازگردانده می‌شوند.

/merchant/policies آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
نوع محصول (اختیاری)؛ قابل تهی String (Enum) Query خیر type
وضعیت درخواست/بیمه‌نامه (اختیاری)؛ قابل تهی String (Enum) Query خیر state
شماره همراه مشتری (اختیاری)؛ در صورت عدم ارسال یا خالی بودن، همه بیمه‌نامه‌های کسب‌وکار بازگردانده می‌شوند؛ قابل تهی String Query خیر mobileNumber

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies?type=Car&state=InsuredAsset&mobileNumber=09121234567' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies?type=Car&state=InsuredAsset&mobileNumber=09121234567');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies?type=Car&state=InsuredAsset&mobileNumber=09121234567"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies?type=Car&state=InsuredAsset&mobileNumber=09121234567");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/policies?type=Car&state=InsuredAsset&mobileNumber=09121234567', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۷-۵. استعلام اطلاعات خودرو و بیمه از سنهاب (کسب‌وکار)

مشتری با mobileNumber شناسایی می‌شود و در صورت ناشناخته بودن در دیجی‌پی ثبت‌نام می‌شود. همیشه سنهاب را فراخوانی می‌کند، نتیجه را به ثابت‌های داخلی نگاشت می‌کند، SanhubInsuranceInfo را ذخیره کرده و اطلاعات خودرو و بیمه نگاشت‌شده را برمی‌گرداند. ارسال vehiclePlateId اختیاری است.

/merchant/vehicle-plates/plaque-info آدرس سرویس
POST متد سرویس

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
شناسه پلاک خودرو؛ حداقل ۱ کاراکتر String (UUID) بله vehiclePlateId
شماره پلاک؛ حداکثر ۳۲ کاراکتر String بله plateNumber
کد ملی؛ دقیقاً ۱۰ کاراکتر؛ الگو ^\d{10}$ String بله nationalCode
شماره همراه مشتری؛ حداقل ۱ کاراکتر String بله mobileNumber

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/vehicle-plates/plaque-info' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "mobileNumber": "09121234567"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/vehicle-plates/plaque-info');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "mobileNumber": "09121234567"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "mobileNumber": "09121234567"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/vehicle-plates/plaque-info"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/vehicle-plates/plaque-info");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""vehiclePlateId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""plateNumber"": ""12B34567"",
  ""nationalCode"": ""0012345678"",
  ""mobileNumber"": ""09121234567""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/vehicle-plates/plaque-info', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "plateNumber": "12B34567",
    "nationalCode": "0012345678",
    "mobileNumber": "09121234567"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۸-۵. لغو درخواست بیمه (کسب‌وکار)

{id} شناسه درخواست است. درخواست را به وضعیت Cancelled منتقل می‌کند. درخواست‌های Issued، Cancelled، Expired و Refused قابل لغو نیستند. پس از لغو، سرویس‌های تغییر درخواست، عملیات بعدی را رد می‌کنند.

/merchant/applications/{id}/cancel آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/cancel' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/cancel');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/cancel"))
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/cancel");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/cancel', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۹-۵. بررسی بارگذاری همه مدارک لازم (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. در صورت true بودن نتیجه و documentConflict=false، درخواست به DocumentsUploaded و در صورت تکمیل اطلاعات کاربر و آدرس پستی به Provisioning منتقل می‌شود. در صورت documentConflict=true، مغایرت مدارک رفع می‌شود.

/merchant/applications/{applicationFormId}/documents/check آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه فرم درخواست String Path بله applicationFormId
بررسی در حالت مغایرت مدارک؛ قابل تهی Boolean Query خیر documentConflict

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents/check?documentConflict=false' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents/check?documentConflict=false');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents/check?documentConflict=false"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents/check?documentConflict=false");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents/check?documentConflict=false', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۰-۵. بررسی بارگذاری مدارک مغایرت الحاقیه (کسب‌وکار)

{id} شناسه جزئیات الحاقیه است و درخواست والد باید متعلق به کسب‌وکار فراخوان باشد. تنها در وضعیت DocumentsConflict مجاز است. در صورت true بودن نتیجه، الحاقیه به PendingReview منتقل شده و فایل‌ها به بیمه ارسال می‌شوند.

/merchant/applications/{id}/endorsement/documents/check آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents/check' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents/check"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents/check");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents/check', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۱-۵. ثبت درخواست الحاقیه (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. یک الحاقیه با وضعیت Provisioning برای درخواست صادرشده (Issued) ایجاد کرده و به بیمه ارسال می‌کند.

/merchant/applications/{id}/endorsement/create آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
شناسه درخواست؛ حداقل ۱ کاراکتر String بله applicationIdId
شناسه گروه الحاقیه؛ بزرگ‌تر از ۰ Long خیر groupId
توضیحات؛ حداکثر ۱۰۰۰ کاراکتر؛ قابل تهی String خیر description

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/create' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "applicationIdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "groupId": 1,
  "description": "string"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "applicationIdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "groupId": 1,
  "description": "string"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "applicationIdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "groupId": 1,
  "description": "string"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/create"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/create");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""applicationIdId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""groupId"": 1,
  ""description"": ""string""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/create', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "applicationIdId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "groupId": 1,
    "description": "string"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۲-۵. ثبت درخواست بیمه شخص ثالث (کسب‌وکار)

هدر user-id کسب‌وکار فراخوان را مشخص می‌کند و به‌عنوان businessId درخواست ذخیره می‌شود. مشتری با mobileNumber شناسایی می‌شود و در صورت ناشناخته بودن در دیجی‌پی ثبت‌نام می‌شود. مقادیر plateNumber و vehiclePlateId می‌توانند تهی باشند؛ در این صورت مدیریت پلاک و استعلام سنهاب انجام نمی‌شود و پلاک را می‌توان بعداً در مرحله پیش‌نویس (merchant/applications/draft) ارسال کرد.

/merchant/applications آدرس سرویس
POST متد سرویس

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
نوع String (Enum) خیر type
شناسه پلاک خودرو؛ حداقل ۱ کاراکتر String (UUID) بله vehiclePlateId
شماره پلاک؛ حداکثر ۳۲ کاراکتر String بله plateNumber
کد ملی؛ دقیقاً ۱۰ کاراکتر؛ الگو ^\d{10}$ String بله nationalCode
اطلاعات خودرو Object بله vehicleInfo
شناسه برند Integer بله vehicleInfo.brandId
عنوان مدل؛ حداکثر ۶۴ کاراکتر String بله vehicleInfo.modelTitle
شناسه دسته خودرو Integer بله vehicleInfo.vehicleCategoriyId
شناسه مدل Integer بله vehicleInfo.modelId
شناسه سال ساخت Integer بله vehicleInfo.productionYearId
تاریخ ترخیص String (DateTime) بله vehicleInfo.releaseDate
شناسه نوع کاربری Integer بله vehicleInfo.usingTypeId
وارداتی Boolean بله vehicleInfo.imported
سال ساخت Integer بله vehicleInfo.productionYear
برند؛ حداکثر ۶۴ کاراکتر String بله vehicleInfo.brand
نوع؛ حداکثر ۶۴ کاراکتر String بله vehicleInfo.type
نوع کاربری؛ حداکثر ۶۴ کاراکتر String بله vehicleInfo.usageType
عنوان پلاک؛ حداکثر ۶۴ کاراکتر String بله vehicleInfo.plateName
اطلاعات بیمه Object بله insuranceInfo
شناسه وضعیت بیمه قبلی Integer بله insuranceInfo.previousInsuranceStatusId
شناسه شرکت بیمه قبلی؛ حداقل ۱ کاراکتر String (UUID) بله insuranceInfo.previousCompanyId
تاریخ انقضای بیمه قبلی String (DateTime) بله insuranceInfo.previousExpirationDate
شناسه تخفیف ثالث Integer بله insuranceInfo.thirdPartyDiscountId
شناسه تخفیف راننده Integer بله insuranceInfo.driverDiscountId
شناسه مدت بیمه Integer بله insuranceInfo.durationId
شناسه خسارت جانی Integer بله insuranceInfo.lifeLossId
شناسه خسارت مالی Integer بله insuranceInfo.propertyLossId
شناسه خسارت راننده Integer بله insuranceInfo.driverLossId
شناسه نوع پوشش Integer بله insuranceInfo.coverageTypeId
شناسه مدت بیمه قبلی Integer بله insuranceInfo.previousDurationId
پلاک رمزنگاری‌شده؛ حداکثر ۲۰۰۰ کاراکتر String بله insuranceInfo.encryptedPlaque
دارای الحاقیه Boolean بله insuranceInfo.hasEndorsement
شماره همراه مشتری؛ حداقل ۱ کاراکتر String بله mobileNumber

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "type": "Car",
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "vehicleInfo": {
    "brandId": 1,
    "modelTitle": "string",
    "vehicleCategoriyId": 1,
    "modelId": 1,
    "productionYearId": 1,
    "releaseDate": "2026-10-03T00:00:00Z",
    "usingTypeId": 1,
    "imported": false,
    "productionYear": 1400,
    "brand": "string",
    "type": "string",
    "usageType": "string",
    "plateName": "string"
  },
  "insuranceInfo": {
    "previousInsuranceStatusId": 1,
    "previousCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "previousExpirationDate": "2026-10-03T00:00:00Z",
    "thirdPartyDiscountId": 1,
    "driverDiscountId": 1,
    "durationId": 1,
    "lifeLossId": 1,
    "propertyLossId": 1,
    "driverLossId": 1,
    "coverageTypeId": 1,
    "previousDurationId": 1,
    "encryptedPlaque": "string",
    "hasEndorsement": false
  },
  "mobileNumber": "09121234567"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "type": "Car",
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "vehicleInfo": {
    "brandId": 1,
    "modelTitle": "string",
    "vehicleCategoriyId": 1,
    "modelId": 1,
    "productionYearId": 1,
    "releaseDate": "2026-10-03T00:00:00Z",
    "usingTypeId": 1,
    "imported": false,
    "productionYear": 1400,
    "brand": "string",
    "type": "string",
    "usageType": "string",
    "plateName": "string"
  },
  "insuranceInfo": {
    "previousInsuranceStatusId": 1,
    "previousCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "previousExpirationDate": "2026-10-03T00:00:00Z",
    "thirdPartyDiscountId": 1,
    "driverDiscountId": 1,
    "durationId": 1,
    "lifeLossId": 1,
    "propertyLossId": 1,
    "driverLossId": 1,
    "coverageTypeId": 1,
    "previousDurationId": 1,
    "encryptedPlaque": "string",
    "hasEndorsement": false
  },
  "mobileNumber": "09121234567"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "type": "Car",
  "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567",
  "nationalCode": "0012345678",
  "vehicleInfo": {
    "brandId": 1,
    "modelTitle": "string",
    "vehicleCategoriyId": 1,
    "modelId": 1,
    "productionYearId": 1,
    "releaseDate": "2026-10-03T00:00:00Z",
    "usingTypeId": 1,
    "imported": false,
    "productionYear": 1400,
    "brand": "string",
    "type": "string",
    "usageType": "string",
    "plateName": "string"
  },
  "insuranceInfo": {
    "previousInsuranceStatusId": 1,
    "previousCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "previousExpirationDate": "2026-10-03T00:00:00Z",
    "thirdPartyDiscountId": 1,
    "driverDiscountId": 1,
    "durationId": 1,
    "lifeLossId": 1,
    "propertyLossId": 1,
    "driverLossId": 1,
    "coverageTypeId": 1,
    "previousDurationId": 1,
    "encryptedPlaque": "string",
    "hasEndorsement": false
  },
  "mobileNumber": "09121234567"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""type"": ""Car"",
  ""vehiclePlateId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""plateNumber"": ""12B34567"",
  ""nationalCode"": ""0012345678"",
  ""vehicleInfo"": {
    ""brandId"": 1,
    ""modelTitle"": ""string"",
    ""vehicleCategoriyId"": 1,
    ""modelId"": 1,
    ""productionYearId"": 1,
    ""releaseDate"": ""2026-10-03T00:00:00Z"",
    ""usingTypeId"": 1,
    ""imported"": false,
    ""productionYear"": 1400,
    ""brand"": ""string"",
    ""type"": ""string"",
    ""usageType"": ""string"",
    ""plateName"": ""string""
  },
  ""insuranceInfo"": {
    ""previousInsuranceStatusId"": 1,
    ""previousCompanyId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
    ""previousExpirationDate"": ""2026-10-03T00:00:00Z"",
    ""thirdPartyDiscountId"": 1,
    ""driverDiscountId"": 1,
    ""durationId"": 1,
    ""lifeLossId"": 1,
    ""propertyLossId"": 1,
    ""driverLossId"": 1,
    ""coverageTypeId"": 1,
    ""previousDurationId"": 1,
    ""encryptedPlaque"": ""string"",
    ""hasEndorsement"": false
  },
  ""mobileNumber"": ""09121234567""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "type": "Car",
    "vehiclePlateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "plateNumber": "12B34567",
    "nationalCode": "0012345678",
    "vehicleInfo": {
      "brandId": 1,
      "modelTitle": "string",
      "vehicleCategoriyId": 1,
      "modelId": 1,
      "productionYearId": 1,
      "releaseDate": "2026-10-03T00:00:00Z",
      "usingTypeId": 1,
      "imported": false,
      "productionYear": 1400,
      "brand": "string",
      "type": "string",
      "usageType": "string",
      "plateName": "string"
    },
    "insuranceInfo": {
      "previousInsuranceStatusId": 1,
      "previousCompanyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "previousExpirationDate": "2026-10-03T00:00:00Z",
      "thirdPartyDiscountId": 1,
      "driverDiscountId": 1,
      "durationId": 1,
      "lifeLossId": 1,
      "propertyLossId": 1,
      "driverLossId": 1,
      "coverageTypeId": 1,
      "previousDurationId": 1,
      "encryptedPlaque": "string",
      "hasEndorsement": false
    },
    "mobileNumber": "09121234567"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۳-۵. دانلود مدرک درخواست با شناسه (کسب‌وکار)

درخواستِ مدرک باید متعلق به کسب‌وکار فراخوان باشد. مدارک بدنه و الحاقیه پشتیبانی نمی‌شوند.

/merchant/documents/{id}/download آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه Long Path بله id
نوع بیمه مدرک؛ قابل تهی String (Enum) Query خیر documentInsuranceType

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/1/download?documentInsuranceType=Car' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/1/download?documentInsuranceType=Car');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/1/download?documentInsuranceType=Car"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/1/download?documentInsuranceType=Car");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/1/download?documentInsuranceType=Car', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

۱۴-۵. دانلود مدرک درخواست (کسب‌وکار)

درخواستِ مدرک باید متعلق به کسب‌وکار فراخوان باشد. مدارک بدنه و الحاقیه پشتیبانی نمی‌شوند.

/merchant/documents/download آدرس سرویس
POST متد سرویس

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
شناسه Long خیر id
نوع بیمه مدرک String (Enum) خیر documentInsuranceType

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/download' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": 1,
  "documentInsuranceType": "Car"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/download');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "id": 1,
  "documentInsuranceType": "Car"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "id": 1,
  "documentInsuranceType": "Car"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/download"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/download");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""id"": 1,
  ""documentInsuranceType"": ""Car""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/download', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "id": 1,
    "documentInsuranceType": "Car"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

۱۵-۵. انتخاب محصول و پیش‌نویس درخواست (کسب‌وکار)

مشتری از applicationId موجود در بدنه تعیین می‌شود که باید توسط همین کسب‌وکار ایجاد شده باشد. در صورتی که درخواست بدون پلاک ایجاد شده باشد، plateNumber اختیاری ذخیره می‌شود.

/merchant/applications/draft آدرس سرویس
POST متد سرویس

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
شناسه درخواست؛ حداقل ۱ کاراکتر String بله applicationId
شناسه محصول بیمه؛ حداقل ۱ کاراکتر String (UUID) بله insuranceId
شماره پلاک (اختیاری)؛ حداکثر ۳۲ کاراکتر؛ قابل تهی String خیر plateNumber

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/draft' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "applicationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "insuranceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/draft');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "applicationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "insuranceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "applicationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "insuranceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "plateNumber": "12B34567"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/draft"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/draft");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""applicationId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""insuranceId"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""plateNumber"": ""12B34567""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/draft', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "applicationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "insuranceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "plateNumber": "12B34567"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۶-۵. دریافت محصولات بیمه شخص ثالث قابل ارائه (کسب‌وکار)

درخواست باید توسط همین کسب‌وکار ایجاد شده باشد.

/merchant/applications/{id}/available-insurance آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/available-insurance' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/available-insurance');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/available-insurance"))
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/available-insurance");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/available-insurance', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۷-۵. دریافت تنظیمات بارگذاری مدارک (کسب‌وکار)

حداکثر حجم مجاز فایل (کیلوبایت) و پسوندهای پشتیبانی‌شده را برمی‌گرداند.

/merchant/documents/settings آدرس سرویس
GET متد سرویس

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/settings' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/settings');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/settings"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/settings");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/settings', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

۱۸-۵. دریافت الحاقیه با شناسه (کسب‌وکار)

{id} شناسه جزئیات الحاقیه است و درخواست والد باید متعلق به کسب‌وکار فراخوان باشد.

/merchant/applications/{id}/endorsement آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۱۹-۵. دریافت فرم درخواست بیمه با شناسه (کسب‌وکار)

درخواست‌های ایجادشده توسط کسب‌وکار دیگر رد می‌شوند.

/merchant/applications/{id} آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۰-۵. دریافت مدارک لازم برای بارگذاری (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. در صورت وجود پیش‌سفارش بیمه و نبود مدرک ذخیره‌شده، مدارک لازم از بیمه دریافت می‌شوند.

/merchant/applications/{id}/required-files آدرس سرویس
GET متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request GET 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/required-files' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/required-files');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/required-files"))
    .GET()
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/required-files");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/required-files', {
  method: 'GET',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۱-۵. ثبت اطلاعات پرداخت (کسب‌وکار)

{id} شناسه درخواست است. تایید خرید دیجی‌پی انجام نمی‌شود. یک ApplicationPaymentLog تاییدشده با ProviderId = trackingCode ذخیره می‌کند، Pricing.PayableAmount و Pricing.TemporaryPrice را از payableAmount و finalAmount تنظیم می‌کند، درخواست را به Paid منتقل می‌کند و مانند Callback پرداخت دیجی‌پی، پیش‌سفارش و مارکتینگ را در صف قرار می‌دهد. پیامکی ارسال نمی‌شود.

/merchant/applications/{id}/payment-info آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
کد رهگیری؛ حداقل ۱ کاراکتر String (UUID) بله trackingCode
مبلغ قابل پرداخت؛ بزرگ‌تر از ۰ Decimal خیر payableAmount
مبلغ نهایی؛ بزرگ‌تر از ۰ Decimal خیر finalAmount

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/payment-info' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "trackingCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "payableAmount": 5000000,
  "finalAmount": 5000000
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/payment-info');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "trackingCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "payableAmount": 5000000,
  "finalAmount": 5000000
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "trackingCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "payableAmount": 5000000,
  "finalAmount": 5000000
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/payment-info"))
    .method("POST", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/payment-info");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""trackingCode"": ""3fa85f64-5717-4562-b3fc-2c963f66afa6"",
  ""payableAmount"": 5000000,
  ""finalAmount"": 5000000
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/payment-info', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "trackingCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "payableAmount": 5000000,
    "finalAmount": 5000000
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۲-۵. حذف مدرک بارگذاری‌شده (کسب‌وکار)

درخواستِ مدرک باید متعلق به کسب‌وکار فراخوان باشد. مدارک بدنه و الحاقیه پشتیبانی نمی‌شوند.

/merchant/documents/remove/{id} آدرس سرویس
DELETE متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه Long Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
نوع بیمه مدرک String (Enum) خیر documentInsuranceType

نمونه درخواست

curl --location --request DELETE 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/remove/1' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "documentInsuranceType": "Car"
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/remove/1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "documentInsuranceType": "Car"
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "documentInsuranceType": "Car"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/remove/1"))
    .method("DELETE", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Delete, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/remove/1");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""documentInsuranceType"": ""Car""
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/documents/remove/1', {
  method: 'DELETE',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "documentInsuranceType": "Car"
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

۲۳-۵. رفع مغایرت قیمت الحاقیه (کسب‌وکار)

{id} شناسه جزئیات الحاقیه است و درخواست والد باید متعلق به کسب‌وکار فراخوان باشد. تنها در وضعیت PriceConflict با تعدیل گزارش‌شده مجاز است. تایید پرداخت دیجی‌پی انجام نمی‌شود؛ الحاقیه در بیمه اعتبارسنجی شده، تایید پرداخت الحاقیه ارسال می‌شود و در صورت موفقیت، الحاقیه به PendingReview منتقل می‌شود. پیامکی ارسال نمی‌شود.

/merchant/applications/{id}/endorsement/price-conflict/resolve آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/price-conflict/resolve' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/price-conflict/resolve');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/price-conflict/resolve"))
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/price-conflict/resolve");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/price-conflict/resolve', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۴-۵. ثبت آدرس و کد پستی درخواست (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. آدرس را ذخیره کرده و درخواست را به AddressInserted منتقل می‌کند. تنها در صورت تکمیل اطلاعات کاربر، مدارک و آدرس پستی به Provisioning منتقل می‌شود.

/merchant/applications/{id}/address آدرس سرویس
PUT متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
آدرس Object بله address
آدرس؛ قابل تهی String خیر address.address
واحد؛ قابل تهی String خیر address.apt
پلاک؛ قابل تهی String خیر address.number
شناسه استان؛ بزرگ‌تر از ۰؛ قابل تهی Long خیر address.provinceId
شناسه شهر؛ بزرگ‌تر از ۰؛ قابل تهی Long خیر address.cityId
کد پستی؛ قابل تهی String خیر address.postalCode

نمونه درخواست

curl --location --request PUT 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/address' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/address');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/address"))
    .method("PUT", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/address");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""address"": {
    ""address"": ""string"",
    ""apt"": ""string"",
    ""number"": ""string"",
    ""provinceId"": 1,
    ""cityId"": 1,
    ""postalCode"": ""1234567890""
  }
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/address', {
  method: 'PUT',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "address": {
      "address": "string",
      "apt": "string",
      "number": "string",
      "provinceId": 1,
      "cityId": 1,
      "postalCode": "1234567890"
    }
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۵-۵. ثبت اطلاعات بیمه‌گذار (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. هویت بیمه‌گذار را ذخیره کرده و در وضعیت Paid، درخواست را به UserInfoCompleted منتقل می‌کند. تنها در صورت تکمیل اطلاعات کاربر، مدارک و آدرس پستی به Provisioning منتقل می‌شود.

/merchant/applications/{id}/insured-party آدرس سرویس
PUT متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
اطلاعات بیمه‌گذار Object بله insuredPartyDetail
نام؛ قابل تهی String خیر insuredPartyDetail.firstName
نام خانوادگی؛ قابل تهی String خیر insuredPartyDetail.lastName
کد ملی؛ دقیقاً ۱۰ کاراکتر؛ قابل تهی String خیر insuredPartyDetail.nationalCode
شماره همراه؛ قابل تهی String خیر insuredPartyDetail.mobile
تاریخ تولد (Epoch میلی‌ثانیه)؛ قابل تهی Long خیر insuredPartyDetail.birthDate
ایمیل؛ قابل تهی String خیر insuredPartyDetail.email
اطلاعات درخواست‌دهنده؛ قابل تهی Object خیر requesterPartyDetail
نام؛ قابل تهی String خیر requesterPartyDetail.firstName
نام خانوادگی؛ قابل تهی String خیر requesterPartyDetail.lastName
کد ملی؛ دقیقاً ۱۰ کاراکتر؛ قابل تهی String خیر requesterPartyDetail.nationalCode
شماره همراه؛ قابل تهی String خیر requesterPartyDetail.mobile
تاریخ تولد (Epoch میلی‌ثانیه)؛ قابل تهی Long خیر requesterPartyDetail.birthDate
ایمیل؛ قابل تهی String خیر requesterPartyDetail.email

نمونه درخواست

curl --location --request PUT 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/insured-party' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "insuredPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  },
  "requesterPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  }
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/insured-party');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "insuredPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  },
  "requesterPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  }
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "insuredPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  },
  "requesterPartyDetail": {
    "firstName": "string",
    "lastName": "string",
    "nationalCode": "0012345678",
    "mobile": "09121234567",
    "birthDate": 631152000000,
    "email": "user@example.com"
  }
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/insured-party"))
    .method("PUT", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/insured-party");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""insuredPartyDetail"": {
    ""firstName"": ""string"",
    ""lastName"": ""string"",
    ""nationalCode"": ""0012345678"",
    ""mobile"": ""09121234567"",
    ""birthDate"": 631152000000,
    ""email"": ""user@example.com""
  },
  ""requesterPartyDetail"": {
    ""firstName"": ""string"",
    ""lastName"": ""string"",
    ""nationalCode"": ""0012345678"",
    ""mobile"": ""09121234567"",
    ""birthDate"": 631152000000,
    ""email"": ""user@example.com""
  }
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/insured-party', {
  method: 'PUT',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "insuredPartyDetail": {
      "firstName": "string",
      "lastName": "string",
      "nationalCode": "0012345678",
      "mobile": "09121234567",
      "birthDate": 631152000000,
      "email": "user@example.com"
    },
    "requesterPartyDetail": {
      "firstName": "string",
      "lastName": "string",
      "nationalCode": "0012345678",
      "mobile": "09121234567",
      "birthDate": 631152000000,
      "email": "user@example.com"
    }
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۶-۵. بارگذاری مدرک درخواست (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. مدرک خودرو یا موتورسیکلت را بارگذاری می‌کند. فیلد type الزامی است و باید یک ApplicationDocumentType معتبر باشد. بارگذاری مدارک بدنه و الحاقیه پشتیبانی نمی‌شود.

/merchant/applications/{applicationFormId}/documents آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه فرم درخواست String Path بله applicationFormId

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
multipart/form-data String بله Content-Type

فیلدهای درخواست (multipart/form-data)

توضیحات نوع فیلد اجباری نام فیلد
شناسه؛ قابل تهی Long خیر id
نوع String (Enum) بله type
فایل File بله file
نام فایل؛ قابل تهی String خیر filename
عنوان؛ قابل تهی String خیر title
نوع بیمه مدرک String (Enum) خیر documentInsuranceType

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--form 'type="VehicleCardForeImage"' \
--form 'file=@"/path/to/vehicle-card.jpg"' \
--form 'filename="vehicle-card.jpg"' \
--form 'title="کارت خودرو"' \
--form 'documentInsuranceType="Car"'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'type' => 'VehicleCardForeImage',
    'file' => new CURLFile('/path/to/vehicle-card.jpg'),
    'filename' => 'vehicle-card.jpg',
    'title' => 'کارت خودرو',
    'documentInsuranceType' => 'Car',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String boundary = "----DigipayFormBoundary";
ByteArrayOutputStream body = new ByteArrayOutputStream();
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nVehicleCardForeImage\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"file\"; filename=\"vehicle-card.jpg\"\r\n"
    + "Content-Type: image/jpeg\r\n\r\n").getBytes(StandardCharsets.UTF_8));
body.write(Files.readAllBytes(Path.of("/path/to/vehicle-card.jpg")));
body.write("\r\n".getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\nvehicle-card.jpg\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"title\"\r\n\r\nکارت خودرو\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"documentInsuranceType\"\r\n\r\nCar\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "--\r\n").getBytes(StandardCharsets.UTF_8));

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents"))
    .method("POST", HttpRequest.BodyPublishers.ofByteArray(body.toByteArray()))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "multipart/form-data; boundary=" + boundary)
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.IO;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

MultipartFormDataContent form = new MultipartFormDataContent();
form.Add(new StringContent("VehicleCardForeImage"), "type");
form.Add(new StreamContent(File.OpenRead("/path/to/vehicle-card.jpg")), "file", "vehicle-card.jpg");
form.Add(new StringContent("vehicle-card.jpg"), "filename");
form.Add(new StringContent("کارت خودرو"), "title");
form.Add(new StringContent("Car"), "documentInsuranceType");
request.Content = form;

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const form = new FormData();
form.append('type', 'VehicleCardForeImage');
form.append('file', fileInput.files[0]); // <input type="file">
form.append('filename', 'vehicle-card.jpg');
form.append('title', 'کارت خودرو');
form.append('documentInsuranceType', 'Car');

const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/documents', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
  body: form,
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۷-۵. بارگذاری مدرک مغایرت الحاقیه (کسب‌وکار)

{id} شناسه جزئیات الحاقیه است و درخواست والد باید متعلق به کسب‌وکار فراخوان باشد. تنها در وضعیت DocumentsConflict مجاز است.

/merchant/applications/{id}/endorsement/documents آدرس سرویس
POST متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
multipart/form-data String بله Content-Type

فیلدهای درخواست (multipart/form-data)

توضیحات نوع فیلد اجباری نام فیلد
نوع String (Enum) بله type
فایل File بله file
نام فایل؛ قابل تهی String خیر filename
عنوان؛ قابل تهی String خیر title

نمونه درخواست

curl --location --request POST 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--form 'type="VehicleCardForeImage"' \
--form 'file=@"/path/to/vehicle-card.jpg"' \
--form 'filename="vehicle-card.jpg"' \
--form 'title="کارت خودرو"'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'type' => 'VehicleCardForeImage',
    'file' => new CURLFile('/path/to/vehicle-card.jpg'),
    'filename' => 'vehicle-card.jpg',
    'title' => 'کارت خودرو',
]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String boundary = "----DigipayFormBoundary";
ByteArrayOutputStream body = new ByteArrayOutputStream();
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"type\"\r\n\r\nVehicleCardForeImage\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"file\"; filename=\"vehicle-card.jpg\"\r\n"
    + "Content-Type: image/jpeg\r\n\r\n").getBytes(StandardCharsets.UTF_8));
body.write(Files.readAllBytes(Path.of("/path/to/vehicle-card.jpg")));
body.write("\r\n".getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\nvehicle-card.jpg\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "\r\nContent-Disposition: form-data; name=\"title\"\r\n\r\nکارت خودرو\r\n")
    .getBytes(StandardCharsets.UTF_8));
body.write(("--" + boundary + "--\r\n").getBytes(StandardCharsets.UTF_8));

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents"))
    .method("POST", HttpRequest.BodyPublishers.ofByteArray(body.toByteArray()))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "multipart/form-data; boundary=" + boundary)
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.IO;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

MultipartFormDataContent form = new MultipartFormDataContent();
form.Add(new StringContent("VehicleCardForeImage"), "type");
form.Add(new StreamContent(File.OpenRead("/path/to/vehicle-card.jpg")), "file", "vehicle-card.jpg");
form.Add(new StringContent("vehicle-card.jpg"), "filename");
form.Add(new StringContent("کارت خودرو"), "title");
request.Content = form;

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const form = new FormData();
form.append('type', 'VehicleCardForeImage');
form.append('file', fileInput.files[0]); // <input type="file">
form.append('filename', 'vehicle-card.jpg');
form.append('title', 'کارت خودرو');

const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/endorsement/documents', {
  method: 'POST',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
  },
  body: form,
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.

۲۸-۵. تایید کد پستی و ارسال مجدد آدرس به بیمه (کسب‌وکار)

درخواست باید متعلق به کسب‌وکار فراخوان باشد. تنها در وضعیت WaitingForPostalCode مجاز است. آدرس را ذخیره کرده، به VerifyPostalCode منتقل می‌کند و سپس آدرس را در بیمه به‌روزرسانی و ثبت می‌کند.

/merchant/applications/{id}/verify-postal-code آدرس سرویس
PUT متد سرویس

پارامترها

توضیحات نوع داده محل اجباری نام فیلد
شناسه String Path بله id

هدرهای سرویس

توضیحات نوع داده اجباری نام هدر
شناسه کسب‌وکار فراخوان که توسط API Gateway ارسال می‌شود String (UUID) بله user-id
application/json String بله Content-Type

فیلدهای درخواست

توضیحات نوع فیلد اجباری نام فیلد
آدرس Object بله address
آدرس؛ قابل تهی String خیر address.address
واحد؛ قابل تهی String خیر address.apt
پلاک؛ قابل تهی String خیر address.number
شناسه استان؛ بزرگ‌تر از ۰؛ قابل تهی Long خیر address.provinceId
شناسه شهر؛ بزرگ‌تر از ۰؛ قابل تهی Long خیر address.cityId
کد پستی؛ قابل تهی String خیر address.postalCode

نمونه درخواست

curl --location --request PUT 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/verify-postal-code' \
--header 'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b' \
--header 'Content-Type: application/json' \
--data-raw '{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}'
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/verify-postal-code');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'user-id: 6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type: application/json',
]);
$body = <<<'JSON'
{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}
JSON;
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$response = curl_exec($ch);

curl_close($ch);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newBuilder()
    .followRedirects(HttpClient.Redirect.NORMAL)
    .build();

String jsonBody = """
{
  "address": {
    "address": "string",
    "apt": "string",
    "number": "string",
    "provinceId": 1,
    "cityId": 1,
    "postalCode": "1234567890"
  }
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/verify-postal-code"))
    .method("PUT", HttpRequest.BodyPublishers.ofString(jsonBody))
    .setHeader("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b")
    .setHeader("Content-Type", "application/json")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
using System.Net.Http;
using System.Text;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, "https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/verify-postal-code");

request.Headers.Add("user-id", "6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b");

string jsonBody = @"{
  ""address"": {
    ""address"": ""string"",
    ""apt"": ""string"",
    ""number"": ""string"",
    ""provinceId"": 1,
    ""cityId"": 1,
    ""postalCode"": ""1234567890""
  }
}";
request.Content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
const response = await fetch('https://api.mydigipay.com/digipay/api/business/v1/insurance/merchant/applications/3fa85f64-5717-4562-b3fc-2c963f66afa6/verify-postal-code', {
  method: 'PUT',
  headers: {
    'user-id': '6f1c2b7e-9d3a-4c1e-8b2f-0a1d2e3f4a5b',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "address": {
      "address": "string",
      "apt": "string",
      "number": "string",
      "provinceId": 1,
      "cityId": 1,
      "postalCode": "1234567890"
    }
  }),
});

const data = await response.json();

پاسخ سرویس

پاسخ موفق HTTP 200 با بدنه JSON بازگردانده می‌شود.

در صورت نامعتبر بودن ورودی، پاسخ HTTP 400 با ساختار خطای اعتبارسنجی بازگردانده می‌شود.