stand_socotra_policy_transformer 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stand_socotra_policy_transformer",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Stands internal javascript module for executing underwriting",
5
5
  "main": "dist/stand_underwriter.js",
6
6
  "scripts": {
@@ -78,8 +78,14 @@ class SocotraPayloadConverter {
78
78
  let dwelling_exposure_locator = old_quote.exposures.find(obj => obj.name === 'dwelling')["locator"]
79
79
  let payload = SocotraEntry.socotra_create_update_template(dwelling_exposure_locator)
80
80
  this.entries.forEach(entry => {
81
- if (Object.keys(retool_payload).includes(entry.retool_id)) {
82
- if(entry instanceof SocotraGroupEntry){
81
+ // Check if the entry's retool_id is in the retool_payload keys
82
+ // For nested keys (e.g., "additional_insured_data.additionalInterest"), check if the parent key exists
83
+ const retool_id_parts = entry.retool_id ? entry.retool_id.split('.') : [];
84
+ const parent_key = retool_id_parts[0];
85
+
86
+ if (Object.keys(retool_payload).includes(entry.retool_id) ||
87
+ (parent_key && Object.keys(retool_payload).includes(parent_key))) {
88
+ if(entry instanceof SocotraGroupEntry){
83
89
  entry.socotra_update(retool_payload, payload, old_payload)
84
90
  } else{
85
91
  entry.socotra_update(retool_payload, payload)