From 4864c7533dfd85fea9a939faf36863d641b3301d Mon Sep 17 00:00:00 2001 From: Morry Date: Sat, 28 Sep 2024 20:55:39 -0500 Subject: [PATCH] process QB and custom field values --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4f54fa0..58a3b4c 100644 --- a/index.js +++ b/index.js @@ -715,10 +715,21 @@ class Plugin { puInfo, doInfo, notes, + QB, directHeaderPayload, directLinePayload, + customFieldValues = [], }, }) { + const cfvPerService = customFieldValues.filter(f => f.isPerService && f.value) + .reduce((acc, f) => { + if (f.type === 'extended-option') { + acc[f.id] = f.value.value || f.value; + } else { + acc[f.id] = f.value; + } + return acc; + }, {}); const model = { AddServiceRequest: { AgentID: hostConnectAgentID, @@ -728,7 +739,7 @@ class Plugin { } : { NewBookingInfo: { Name: this.escapeInvalidXmlChars(quoteName), - QB: 'Q', + QB: QB || 'Q', ...(directHeaderPayload || {}), }, }), @@ -769,6 +780,7 @@ class Plugin { AgentRef: reference, RoomConfigs: this.getRoomConfigs(paxConfigs), ...(directLinePayload || {}), + ...(cfvPerService || {}), }, }; const replyObj = await this.callTourplan({