From 80ef15b162ba728213126d14f4ee7afd3817a902 Mon Sep 17 00:00:00 2001 From: B77Mills Date: Mon, 20 Oct 2025 15:55:39 -0500 Subject: [PATCH 1/3] correct map def when productId present --- services/graphql/src/resolvers/customer.js | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/services/graphql/src/resolvers/customer.js b/services/graphql/src/resolvers/customer.js index ce03387..be2c2e1 100644 --- a/services/graphql/src/resolvers/customer.js +++ b/services/graphql/src/resolvers/customer.js @@ -371,7 +371,7 @@ module.exports = { const promoCode = input.promoCode ? input.promoCode.trim() : null; if (promoCode && promoCode.length > 50) throw new UserInputError('The promo code must be 50 characters or fewer.'); - const productMap = new Map([[input.productId, true]]); + const productMap = new Map([...(input.productId ? [[input.productId, true]] : [])]); const deploymentTypeIdMap = input.deploymentTypeIds.reduce((map, id) => { map.set(id, true); @@ -433,16 +433,19 @@ module.exports = { if (faxNumber) phones.push({ Number: faxNumber, PhoneContactType: 240 }); const body = { RunProcessor: 1, - Products: [...productMap].map(([OmedaProductId, Receive]) => { - const subscription = subscriptions.find((obj) => obj.id === OmedaProductId); - return ({ - OmedaProductId, - Receive: Number(Receive), - ...(subscription && subscription.requestedVersion && { - RequestedVersion: subscription.requestedVersion, + ...((productMap && productMap.length) + && { + Products: [...productMap].map(([OmedaProductId, Receive]) => { + const subscription = subscriptions.find((obj) => obj.id === OmedaProductId); + return ({ + OmedaProductId, + Receive: Number(Receive), + ...(subscription && subscription.requestedVersion && { + RequestedVersion: subscription.requestedVersion, + }), + }); }), - }); - }), + }), Emails: [{ EmailAddress: email }], ...(phones.length && { Phones: phones }), ...(firstName && { FirstName: firstName }), From d7323f26c2c48d762103dde420ef51f347319e76 Mon Sep 17 00:00:00 2001 From: B77Mills Date: Mon, 20 Oct 2025 16:28:48 -0500 Subject: [PATCH 2/3] Ensure Products key is & default value --- services/graphql/src/resolvers/customer.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/services/graphql/src/resolvers/customer.js b/services/graphql/src/resolvers/customer.js index be2c2e1..bb460cd 100644 --- a/services/graphql/src/resolvers/customer.js +++ b/services/graphql/src/resolvers/customer.js @@ -433,19 +433,16 @@ module.exports = { if (faxNumber) phones.push({ Number: faxNumber, PhoneContactType: 240 }); const body = { RunProcessor: 1, - ...((productMap && productMap.length) - && { - Products: [...productMap].map(([OmedaProductId, Receive]) => { - const subscription = subscriptions.find((obj) => obj.id === OmedaProductId); - return ({ - OmedaProductId, - Receive: Number(Receive), - ...(subscription && subscription.requestedVersion && { - RequestedVersion: subscription.requestedVersion, - }), - }); + Products: [...productMap].map(([OmedaProductId, Receive]) => { + const subscription = subscriptions.find((obj) => obj.id === OmedaProductId); + return ({ + OmedaProductId, + Receive: Number(Receive), + ...(subscription && subscription.requestedVersion && { + RequestedVersion: subscription.requestedVersion, }), - }), + }); + }), Emails: [{ EmailAddress: email }], ...(phones.length && { Phones: phones }), ...(firstName && { FirstName: firstName }), From d36b2e61bdc48d428bf8e9600afed5c2f3cef1d0 Mon Sep 17 00:00:00 2001 From: B77Mills Date: Mon, 20 Oct 2025 18:17:45 -0500 Subject: [PATCH 3/3] Make productId optional --- services/graphql/src/definitions/customer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/graphql/src/definitions/customer.js b/services/graphql/src/definitions/customer.js index cd5f0cd..aa2e1bd 100644 --- a/services/graphql/src/definitions/customer.js +++ b/services/graphql/src/definitions/customer.js @@ -215,7 +215,7 @@ input CustomerExternalIdsInput { input RapidCustomerIdentificationMutationInput { "The product ID to associate with this rapid identification." - productId: Int! + productId: Int "The customer's email address." email: String! "First name of customer, up to 100 characters long"