@quenty/gameproductservice 14.66.7 → 14.66.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [14.66.8](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.7...@quenty/gameproductservice@14.66.8) (2026-08-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ - Check if alive ([b90db63](https://github.com/Quenty/NevermoreEngine/commit/b90db636b620e939929d64803e40aaa2de63616f))
11
+ - Check if remoting is alive ([59b14cf](https://github.com/Quenty/NevermoreEngine/commit/59b14cff7b327cdab7e3510d593879a6cb0bf259))
12
+ - Validate game pass ownership on server ([c89a788](https://github.com/Quenty/NevermoreEngine/commit/c89a788eee031ff955f1310902c5cf92bad76686))
13
+
6
14
  ## [14.66.7](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.6...@quenty/gameproductservice@14.66.7) (2026-08-07)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/gameproductservice
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/gameproductservice",
3
- "version": "14.66.7",
3
+ "version": "14.66.8",
4
4
  "description": "Generalized monetization system for handling products and purchases correctly.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -64,5 +64,5 @@
64
64
  "@quenty/valueobject": "13.36.1",
65
65
  "@quentystudios/jest-lua": "3.10.0-quenty.2"
66
66
  },
67
- "gitHead": "bdaa2ef921dcbfa0f48d3469f9788e87df357bcd"
67
+ "gitHead": "4e0025faa5102babf56713d741b96fcec319ce14"
68
68
  }
@@ -265,6 +265,10 @@ function PlayerProductManagerClient._handleGamePassPromptFinished(
265
265
  ): ()
266
266
  PlayerProductManagerBase._handleGamePassPromptFinished(self, gamePassId, isPurchased)
267
267
 
268
+ if not self._remoting.Destroy then
269
+ return
270
+ end
271
+
268
272
  self._remoting.PromptGamePassPurchaseFinished:FireServer(gamePassId, isPurchased)
269
273
  end
270
274
 
@@ -286,7 +286,7 @@ describe("GameProductServiceClient ownership for the designated mock", function(
286
286
  end)
287
287
 
288
288
  describe("client-initiated gamepass prompt", function()
289
- it("resolves true on accept, replicates to the server, and fires both realms' purchase signals", function()
289
+ it("grants server ownership once the marketplace confirms the client's purchase", function()
290
290
  local controller = setup()
291
291
  PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.PromptGamePassPurchase", GAME_PASS_ID, true)
292
292
 
@@ -295,8 +295,18 @@ describe("client-initiated gamepass prompt", function()
295
295
  controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
296
296
  table.insert(serverFired, { player = player, gamePassId = gamePassId })
297
297
  end)
298
+ -- The pass is not owned when the prompt opens, so the client genuinely prompts. Model the
299
+ -- purchase going through by marking the marketplace as owning it the instant the client reports
300
+ -- success -- the same false-before / true-after transition a real purchase produces, and what
301
+ -- the server's verification then reads.
298
302
  controller.gameProductServiceClient.GamePassPurchased:Connect(function(gamePassId)
299
303
  table.insert(clientFired, gamePassId)
304
+ PlayerMock.writeLookup(
305
+ controller.playerMock,
306
+ "MarketplaceService.UserOwnsGamePassAsync",
307
+ GAME_PASS_ID,
308
+ true
309
+ )
300
310
  end)
301
311
 
302
312
  expect(
@@ -337,6 +347,53 @@ describe("client-initiated gamepass prompt", function()
337
347
  controller:destroy()
338
348
  end)
339
349
 
350
+ it("does not grant server ownership for a purchase the marketplace never confirms", function()
351
+ local controller = setup()
352
+ -- The client reports the prompt succeeded, but the marketplace never shows the player owning the
353
+ -- pass (UserOwnsGamePassAsync stays at its false default). A client saying "I bought it" is an
354
+ -- unverified claim -- on its own it must grant nothing, or any client could fire this remote for
355
+ -- any gamepass id and be handed the pass for free.
356
+ PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.PromptGamePassPurchase", GAME_PASS_ID, true)
357
+
358
+ local serverFired = {}
359
+ controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
360
+ table.insert(serverFired, { player = player, gamePassId = gamePassId })
361
+ end)
362
+
363
+ -- The client still resolves its own prompt as accepted: its local UX is not the trust boundary.
364
+ expect(
365
+ controller.awaitBool(
366
+ controller.gameProductServiceClient:PromisePromptPurchase(
367
+ controller.playerMock,
368
+ GameConfigAssetTypes.PASS,
369
+ GAME_PASS_ID
370
+ )
371
+ )
372
+ ).toEqual(true)
373
+
374
+ -- The server rejects the unverified claim: no ownership, no session purchase, no purchase signal.
375
+ -- Awaiting the ownership query also lets the server's verification settle first.
376
+ expect(
377
+ controller.awaitBool(
378
+ controller.gameProductService:PromisePlayerOwnership(
379
+ controller.playerMock,
380
+ GameConfigAssetTypes.PASS,
381
+ GAME_PASS_ID
382
+ )
383
+ )
384
+ ).toEqual(false)
385
+ expect(#serverFired).toEqual(0)
386
+ expect(
387
+ controller.gameProductService:HasPlayerPurchasedThisSession(
388
+ controller.playerMock,
389
+ GameConfigAssetTypes.PASS,
390
+ GAME_PASS_ID
391
+ )
392
+ ).toEqual(false)
393
+
394
+ controller:destroy()
395
+ end)
396
+
340
397
  it("resolves false on reject and marks nothing purchased on either realm", function()
341
398
  local controller = setup()
342
399
 
@@ -14,7 +14,9 @@ local Players = game:GetService("Players")
14
14
  local EnumUtils = require("EnumUtils")
15
15
  local GameConfigAssetTypes = require("GameConfigAssetTypes")
16
16
  local GameProductDataService = require("GameProductDataService")
17
+ local MarketplaceUtils = require("MarketplaceUtils")
17
18
  local PlayerBinder = require("PlayerBinder")
19
+ local PlayerMock = require("PlayerMock")
18
20
  local PlayerProductManagerBase = require("PlayerProductManagerBase")
19
21
  local PlayerProductManagerInterface = require("PlayerProductManagerInterface")
20
22
  local ReceiptProcessingService = require("ReceiptProcessingService")
@@ -136,9 +138,37 @@ function PlayerProductManager._setupPassTracker(self: PlayerProductManager): ()
136
138
  assert(type(gamePassId) == "number", "Bad gamePassId")
137
139
  assert(type(isPurchased) == "boolean", "Bad isPurchased")
138
140
 
139
- -- TODO: Validate in purchased scenario
141
+ -- Closing the prompt is safe to take on the client's word: it only unblocks pending prompt
142
+ -- state and grants nothing.
140
143
  tracker:HandlePromptClosedEvent(gamePassId)
141
- tracker:HandlePurchaseEvent(gamePassId, isPurchased)
144
+
145
+ if not isPurchased then
146
+ tracker:HandlePurchaseEvent(gamePassId, false)
147
+ return
148
+ end
149
+
150
+ -- The purchase itself is not. This event is fired by the client, so `isPurchased == true` is an
151
+ -- unverified claim -- a client can fire it for any gamepass id without ever paying, and granting
152
+ -- ownership on it hands the pass out for free. Confirm against the marketplace before it counts,
153
+ -- so only a pass the player genuinely owns is recorded as purchased.
154
+ local userId = if PlayerMock.isMock(self._obj) then PlayerMock.read(self._obj, "UserId") else self._obj.UserId
155
+
156
+ self._maid:GivePromise(MarketplaceUtils.promiseUserOwnsGamePass(userId, gamePassId)):Then(function(ownsPass)
157
+ tracker:HandlePurchaseEvent(gamePassId, ownsPass == true)
158
+ end, function(err)
159
+ -- The ownership check could not answer (a marketplace hiccup, not a purchase). Grant nothing
160
+ -- on the failure, and resolve the pending prompt as unbought so a server-initiated caller is
161
+ -- not left waiting forever.
162
+ warn(
163
+ string.format(
164
+ "[PlayerProductManager] - Failed to verify gamepass %d ownership for %s: %s",
165
+ gamePassId,
166
+ tostring(self._obj),
167
+ tostring(err)
168
+ )
169
+ )
170
+ tracker:HandlePurchaseEvent(gamePassId, false)
171
+ end)
142
172
  end))
143
173
  end
144
174