From 3abe9bd7ce9b6ca1de91c28135866cbcadb8a45d Mon Sep 17 00:00:00 2001 From: Tom Wadeson <3607811+tomwadeson@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:01:36 +0000 Subject: [PATCH] Android promotion info is pulled through --- typescript/src/pubsub/google.ts | 23 +++++++++++++++++++---- typescript/src/services/google-play.ts | 4 +++- typescript/tests/pubsub/pubsub.test.ts | 6 +++--- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/typescript/src/pubsub/google.ts b/typescript/src/pubsub/google.ts index ab8df031a..5312066d8 100644 --- a/typescript/src/pubsub/google.ts +++ b/typescript/src/pubsub/google.ts @@ -23,7 +23,9 @@ interface SubscriptionNotification { } interface MetaData { - freeTrial: boolean + freeTrial: boolean, + promotionType: number | null, + promotionCode: string | null } export function parsePayload(body: Option): Error | DeveloperNotification { @@ -62,8 +64,11 @@ async function fetchMetadata(notification: DeveloperNotification): Promise { diff --git a/typescript/tests/pubsub/pubsub.test.ts b/typescript/tests/pubsub/pubsub.test.ts index d9870e373..baa58bd0f 100644 --- a/typescript/tests/pubsub/pubsub.test.ts +++ b/typescript/tests/pubsub/pubsub.test.ts @@ -23,7 +23,7 @@ describe("The google pubsub", () => { const mockSqsFunction: Mock, [string, {purchaseToken: string}]> = jest.fn((queurl, event) => Promise.resolve({})); - const mockFetchMetadataFunction: Mock> = jest.fn(event => Promise.resolve({freeTrial: true})); + const mockFetchMetadataFunction: Mock> = jest.fn(event => Promise.resolve({freeTrial: true, promotionType: 1, promotionCode: "100"})); const receivedEvent = { "version":"1.0", @@ -89,8 +89,8 @@ describe("The google pubsub", () => { }, null, 1582319167, - null, - null, + "100", + "VANITY_CODE", undefined, undefined, undefined