diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 436348c..48a6bde 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -20,7 +20,7 @@ jobs: with: node-version: 16.x - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: yarn-cache with: path: '**/node_modules' diff --git a/services/graphql/src/definitions/customer.js b/services/graphql/src/definitions/customer.js index 87be62b..cd5f0cd 100644 --- a/services/graphql/src/definitions/customer.js +++ b/services/graphql/src/definitions/customer.js @@ -18,6 +18,12 @@ extend type Mutation { rapidCustomerIdentification(input: RapidCustomerIdentificationMutationInput!): RapidCustomerIdentification! } +enum RequestedVersionEnum { + B + D + P +} + type ChangedCustomer { id: Int! @apiValue dateChanged: DateTime! @apiValue @@ -271,6 +277,8 @@ input RapidCustomerIdentificationSubscriptionInput { id: Int! "Whether the customer should receive this subscription." receive: Boolean! + "Which print version is requested - B (Both), D (Digital) or P (Print)" + requestedVersion: RequestedVersionEnum } input RapidCustomerIdentificationDemographicInput { diff --git a/services/graphql/src/resolvers/customer.js b/services/graphql/src/resolvers/customer.js index 27e24ed..048e39c 100644 --- a/services/graphql/src/resolvers/customer.js +++ b/services/graphql/src/resolvers/customer.js @@ -431,13 +431,18 @@ module.exports = { if (phoneNumber) phones.push({ Number: phoneNumber, PhoneContactType: 200 }); if (mobileNumber) phones.push({ Number: mobileNumber, PhoneContactType: 230 }); if (faxNumber) phones.push({ Number: faxNumber, PhoneContactType: 240 }); - const body = { RunProcessor: 1, - Products: [...productMap].map(([OmedaProductId, Receive]) => ({ - OmedaProductId, - Receive: Number(Receive), - })), + Products: [...productMap].map(([OmedaProductId, Receive]) => { + const product = subscriptions.find((obj) => obj.id === OmedaProductId); + return ({ + OmedaProductId, + Receive: Number(Receive), + ...(product && product.requestedVersion && { + RequestedVersion: product.requestedVersion, + }), + }); + }), Emails: [{ EmailAddress: email }], ...(phones.length && { Phones: phones }), ...(firstName && { FirstName: firstName }),