forked from Yara724/api
third party update , optional body is done
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from "@nestjs/common";
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
ApiBody,
|
||||
ApiOperation,
|
||||
ApiParam,
|
||||
ApiQuery,
|
||||
@@ -57,7 +58,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Preview Fanavaran base claim create payload",
|
||||
description:
|
||||
"Builds the GEN.03 payload from local claim/blame data. Fanavaran-sourced PolicyId is resolve-once: first call may inquire and caches on the claim; later calls reuse the cache. Auth token is shared until Asia/Tehran midnight. Pass forceRefreshPolicy=true to re-inquire.",
|
||||
"GET has no request body. Always rebuilds GEN.03 from live policy + VIN/vehicle inquiries. Does not reuse fanavaranSync lastPayload / PolicyId / UsedId cache. Auth token is still shared until Asia/Tehran midnight.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -76,34 +77,30 @@ export class FanavaranController {
|
||||
@ApiQuery({
|
||||
name: "forceRefreshPolicy",
|
||||
required: false,
|
||||
description:
|
||||
"When true, ignores cached PolicyId and performs a live Fanavaran policy inquiry again. Do not pass this from normal UI loads.",
|
||||
deprecated: true,
|
||||
description: "Ignored. Preview always re-inquires PolicyId.",
|
||||
})
|
||||
@ApiQuery({
|
||||
name: "resolvePolicy",
|
||||
required: false,
|
||||
deprecated: true,
|
||||
description:
|
||||
"Deprecated. Ignored for cache-busting. PolicyId is resolve-once from fanavaranSync.baseClaim.policyId; use forceRefreshPolicy=true only to re-inquire.",
|
||||
description: "Ignored. Preview always re-inquires PolicyId.",
|
||||
})
|
||||
async preview(
|
||||
@Param("client") client: string,
|
||||
@Param("claimCaseId") claimCaseId: string,
|
||||
@Query("debug") debug?: string,
|
||||
@Query("forceRefreshPolicy") forceRefreshPolicy?: string,
|
||||
@Query("forceRefreshPolicy") _forceRefreshPolicy?: string,
|
||||
@Query("resolvePolicy") _resolvePolicy?: string,
|
||||
) {
|
||||
const clientKey = this.parseClientParam(client);
|
||||
// IMPORTANT: resolvePolicy must NOT force a live inquiry. Older UI clients
|
||||
// send resolvePolicy=true on every preview load; that used to defeat the
|
||||
// PolicyId cache and re-Login Fanavaran on every click.
|
||||
return await this.claimRequestManagementService.previewFanavaranSubmitV2(
|
||||
claimCaseId,
|
||||
clientKey,
|
||||
{
|
||||
debug: debug === "1" || debug === "true",
|
||||
forceRefreshPolicy:
|
||||
forceRefreshPolicy === "1" || forceRefreshPolicy === "true",
|
||||
forceRefreshPolicy: true,
|
||||
forceRefreshUsedId: true,
|
||||
requirePolicyId: false,
|
||||
},
|
||||
);
|
||||
@@ -113,7 +110,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Submit Fanavaran base claim create request",
|
||||
description:
|
||||
"Authenticates with the selected tenant credentials and submits the GEN.03 base claim create request. Stores returned Id as claimId and ClaimNo when present.",
|
||||
"Swagger JSON body is optional. Always rebuilds GEN.03 from live inquiries, then POSTs that rebuilt payload. Pasting a previous preview JSON does not skip inquiry. Only user-entry keys are applied from the body (EstimateAmount, licence, dates, address, police report). PolicyId and AccidentVehicleUsedId in pasted JSON are ignored.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -124,6 +121,12 @@ export class FanavaranController {
|
||||
name: "claimCaseId",
|
||||
description: "Claim case MongoDB ObjectId",
|
||||
})
|
||||
@ApiBody({
|
||||
required: false,
|
||||
description:
|
||||
"Optional. Paste previous preview JSON if you want to tweak user-entry fields. Lookup ids in that JSON are ignored.",
|
||||
schema: { type: "object", additionalProperties: true, example: {} },
|
||||
})
|
||||
async submit(
|
||||
@Param("client") client: string,
|
||||
@Param("claimCaseId") claimCaseId: string,
|
||||
@@ -141,7 +144,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Preview Fanavaran damage-case payload",
|
||||
description:
|
||||
"Builds the GEN.12 damaged vehicle/person case payload without calling Fanavaran. Requires selected damaged parts; submit requires a Fanavaran claimId.",
|
||||
"GET has no request body. Always rebuilds GEN.12 from live VIN/vehicle/driver inquiries. Does not reuse lastPayload / plaqueKindId / DriverId cache.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -167,7 +170,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Submit Fanavaran damage-case request",
|
||||
description:
|
||||
"Submits the GEN.12 dmg-cases request. If base claim (claimId) is missing, soft-ensures GEN.03 base claim first, then submits damage. Skips when dmgCaseId already exists.",
|
||||
"Swagger JSON body is optional. Always rebuilds GEN.12 from live VIN/vehicle/driver inquiries, then POSTs that rebuilt payload. Pasting a previous preview JSON does not skip inquiry. Only Desc, EstimateAmount, LicenceNo, LicenceIssuDate, DriverIsOwner are taken from the body. PlaqueKindId, PlaqueSampleId, VehicleKindId, DriverId, InsuranceCorpId in pasted JSON are ignored.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -178,6 +181,12 @@ export class FanavaranController {
|
||||
name: "claimCaseId",
|
||||
description: "Claim case MongoDB ObjectId",
|
||||
})
|
||||
@ApiBody({
|
||||
required: false,
|
||||
description:
|
||||
"Optional. Paste previous preview JSON if you want to tweak Desc / licence / estimate. Lookup-filter ids in that JSON are ignored.",
|
||||
schema: { type: "object", additionalProperties: true, example: {} },
|
||||
})
|
||||
async submitDamageCase(
|
||||
@Param("client") client: string,
|
||||
@Param("claimCaseId") claimCaseId: string,
|
||||
@@ -247,7 +256,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Preview Fanavaran expertise payload",
|
||||
description:
|
||||
"Builds the GEN.08 expertise payload from the active damage expert reply, price-drop data, and Fanavaran lookup mappings without calling Fanavaran.",
|
||||
"GET has no request body. Rebuilds GEN.08 from the active expert reply and lookups on every call. Does not reuse lastPayload cache.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -273,7 +282,7 @@ export class FanavaranController {
|
||||
@ApiOperation({
|
||||
summary: "Submit Fanavaran expertise request",
|
||||
description:
|
||||
"Submits the GEN.08 expertise payload for a claim with existing Fanavaran claimId and dmgCaseId. Stores returned Id as local expertiseId.",
|
||||
"Swagger JSON body is optional. Always rebuilds GEN.08 from the local expert reply and lookups, then POSTs that rebuilt payload. Pasting a previous preview JSON does not skip rebuild. Only money/date fields are taken from the body. DmgCaseId, ClaimExpertId, and DmgSections in pasted JSON are ignored.",
|
||||
})
|
||||
@ApiParam({
|
||||
name: "client",
|
||||
@@ -284,6 +293,12 @@ export class FanavaranController {
|
||||
name: "claimCaseId",
|
||||
description: "Claim case MongoDB ObjectId",
|
||||
})
|
||||
@ApiBody({
|
||||
required: false,
|
||||
description:
|
||||
"Optional. Paste previous preview JSON if you want to tweak money/date fields. DmgCaseId / ClaimExpertId / DmgSections in that JSON are ignored.",
|
||||
schema: { type: "object", additionalProperties: true, example: {} },
|
||||
})
|
||||
async submitExpertise(
|
||||
@Param("client") client: string,
|
||||
@Param("claimCaseId") claimCaseId: string,
|
||||
|
||||
Reference in New Issue
Block a user