Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/graphql/src/definitions/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 13 additions & 10 deletions services/graphql/src/resolvers/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] : [])]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spread is redundant, and could be

const productMap = new Map(input.productId ? [input.productId, true] : []);

But ultimately doesn't matter :)


const deploymentTypeIdMap = input.deploymentTypeIds.reduce((map, id) => {
map.set(id, true);
Expand Down Expand Up @@ -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 }],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the above section when the product map is initialized to include the product id only if one is set. L374

-  const productMap = new Map([[input.productId, true]]);
+  const productMap = new Map([...(input.productId ? [input.productId, true] : [])]);

...(phones.length && { Phones: phones }),
...(firstName && { FirstName: firstName }),
Expand Down