@quenty/gameproductservice 14.66.7 → 14.66.9
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,20 @@
|
|
|
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.9](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.8...@quenty/gameproductservice@14.66.9) (2026-08-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Server validation gate ([90ee99b](https://github.com/Quenty/NevermoreEngine/commit/90ee99be70cb20ddb01dc8cc43ed12974405d22e))
|
|
11
|
+
|
|
12
|
+
## [14.66.8](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.7...@quenty/gameproductservice@14.66.8) (2026-08-08)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- Check if alive ([b90db63](https://github.com/Quenty/NevermoreEngine/commit/b90db636b620e939929d64803e40aaa2de63616f))
|
|
17
|
+
- Check if remoting is alive ([59b14cf](https://github.com/Quenty/NevermoreEngine/commit/59b14cff7b327cdab7e3510d593879a6cb0bf259))
|
|
18
|
+
- Validate game pass ownership on server ([c89a788](https://github.com/Quenty/NevermoreEngine/commit/c89a788eee031ff955f1310902c5cf92bad76686))
|
|
19
|
+
|
|
6
20
|
## [14.66.7](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@14.66.6...@quenty/gameproductservice@14.66.7) (2026-08-07)
|
|
7
21
|
|
|
8
22
|
**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.
|
|
3
|
+
"version": "14.66.9",
|
|
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": "
|
|
67
|
+
"gitHead": "c4c918a9cf651111332b65b3d01fe094b719dc8b"
|
|
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
|
|
|
@@ -309,6 +309,17 @@ end
|
|
|
309
309
|
rejects); prompts must be initiated from the server, where the developer can validate
|
|
310
310
|
the asset id. Defaults to disabled.
|
|
311
311
|
|
|
312
|
+
Enabling this also makes the server verify gamepass purchases against the marketplace
|
|
313
|
+
before granting them, instead of trusting the client's report that the prompt
|
|
314
|
+
succeeded. The two travel together deliberately: a game that has moved prompting to
|
|
315
|
+
the server is one that wants purchases established server-side.
|
|
316
|
+
|
|
317
|
+
Be aware of what that verification costs. `UserOwnsGamePassAsync` answers from a cache
|
|
318
|
+
held per server, so immediately after a real purchase it can still report the player
|
|
319
|
+
does not own the pass -- and a purchase that fails to verify is granted nothing. Games
|
|
320
|
+
whose flows depend on the pass being usable the instant the prompt closes should leave
|
|
321
|
+
this disabled until they can tolerate that delay.
|
|
322
|
+
|
|
312
323
|
@param enabled boolean
|
|
313
324
|
]=]
|
|
314
325
|
function GameProductService.SetServerOnlyPromptingEnabled(self: GameProductService, enabled: boolean)
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
a mock, and a client-initiated accept replicates to the server over the production remoting
|
|
13
13
|
path (session purchase, ownership, and both realms' purchase signals).
|
|
14
14
|
|
|
15
|
+
Server-side verification of a client's gamepass purchase claim is gated on server-only prompting
|
|
16
|
+
(see [GameProductService.SetServerOnlyPromptingEnabled]), so it is covered from both sides: with
|
|
17
|
+
the flag off the server takes the client's word, and with it on an unconfirmed claim grants
|
|
18
|
+
nothing while a confirmed one grants the pass.
|
|
19
|
+
|
|
15
20
|
@class GameProductService.spec.lua
|
|
16
21
|
]]
|
|
17
22
|
|
|
@@ -286,7 +291,7 @@ describe("GameProductServiceClient ownership for the designated mock", function(
|
|
|
286
291
|
end)
|
|
287
292
|
|
|
288
293
|
describe("client-initiated gamepass prompt", function()
|
|
289
|
-
it("
|
|
294
|
+
it("grants server ownership once the marketplace confirms the client's purchase", function()
|
|
290
295
|
local controller = setup()
|
|
291
296
|
PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.PromptGamePassPurchase", GAME_PASS_ID, true)
|
|
292
297
|
|
|
@@ -295,8 +300,18 @@ describe("client-initiated gamepass prompt", function()
|
|
|
295
300
|
controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
|
|
296
301
|
table.insert(serverFired, { player = player, gamePassId = gamePassId })
|
|
297
302
|
end)
|
|
303
|
+
-- The pass is not owned when the prompt opens, so the client genuinely prompts. Model the
|
|
304
|
+
-- purchase going through by marking the marketplace as owning it the instant the client reports
|
|
305
|
+
-- success -- the same false-before / true-after transition a real purchase produces, and what
|
|
306
|
+
-- the server's verification then reads.
|
|
298
307
|
controller.gameProductServiceClient.GamePassPurchased:Connect(function(gamePassId)
|
|
299
308
|
table.insert(clientFired, gamePassId)
|
|
309
|
+
PlayerMock.writeLookup(
|
|
310
|
+
controller.playerMock,
|
|
311
|
+
"MarketplaceService.UserOwnsGamePassAsync",
|
|
312
|
+
GAME_PASS_ID,
|
|
313
|
+
true
|
|
314
|
+
)
|
|
300
315
|
end)
|
|
301
316
|
|
|
302
317
|
expect(
|
|
@@ -337,6 +352,46 @@ describe("client-initiated gamepass prompt", function()
|
|
|
337
352
|
controller:destroy()
|
|
338
353
|
end)
|
|
339
354
|
|
|
355
|
+
it("takes the client's word for a purchase the marketplace never confirms", function()
|
|
356
|
+
local controller = setup()
|
|
357
|
+
-- Server-only prompting is off (the default), so the server has not been asked to establish
|
|
358
|
+
-- purchases itself and grants on the client's report. This is a known trust gap, kept because
|
|
359
|
+
-- verifying here would read UserOwnsGamePassAsync's per-server cache, which can still answer
|
|
360
|
+
-- `false` for a purchase that just completed and would lose a pass the player paid for. Games
|
|
361
|
+
-- that want the claim checked enable server-only prompting; see the verification describe below.
|
|
362
|
+
PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.PromptGamePassPurchase", GAME_PASS_ID, true)
|
|
363
|
+
|
|
364
|
+
local serverFired = {}
|
|
365
|
+
controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
|
|
366
|
+
table.insert(serverFired, { player = player, gamePassId = gamePassId })
|
|
367
|
+
end)
|
|
368
|
+
|
|
369
|
+
expect(
|
|
370
|
+
controller.awaitBool(
|
|
371
|
+
controller.gameProductServiceClient:PromisePromptPurchase(
|
|
372
|
+
controller.playerMock,
|
|
373
|
+
GameConfigAssetTypes.PASS,
|
|
374
|
+
GAME_PASS_ID
|
|
375
|
+
)
|
|
376
|
+
)
|
|
377
|
+
).toEqual(true)
|
|
378
|
+
|
|
379
|
+
PromiseTestUtils.awaitValue(function()
|
|
380
|
+
return #serverFired > 0
|
|
381
|
+
end, 10)
|
|
382
|
+
|
|
383
|
+
expect(#serverFired).toEqual(1)
|
|
384
|
+
expect(
|
|
385
|
+
controller.gameProductService:HasPlayerPurchasedThisSession(
|
|
386
|
+
controller.playerMock,
|
|
387
|
+
GameConfigAssetTypes.PASS,
|
|
388
|
+
GAME_PASS_ID
|
|
389
|
+
)
|
|
390
|
+
).toEqual(true)
|
|
391
|
+
|
|
392
|
+
controller:destroy()
|
|
393
|
+
end)
|
|
394
|
+
|
|
340
395
|
it("resolves false on reject and marks nothing purchased on either realm", function()
|
|
341
396
|
local controller = setup()
|
|
342
397
|
|
|
@@ -379,6 +434,109 @@ describe("client-initiated gamepass prompt", function()
|
|
|
379
434
|
end)
|
|
380
435
|
end)
|
|
381
436
|
|
|
437
|
+
describe("gamepass purchase verification under server-only prompting", function()
|
|
438
|
+
-- With server-only prompting enabled the client may no longer prompt, so these drive the client's
|
|
439
|
+
-- prompt-finished handler directly. That is the same entry point the engine's
|
|
440
|
+
-- PromptGamePassPurchaseFinished reaches, and the one an exploiter reaches by firing the remote
|
|
441
|
+
-- themselves -- which is exactly the claim under test.
|
|
442
|
+
local function claimPurchaseFromClient(controller: any, gamePassId: number)
|
|
443
|
+
local clientBinder = controller.clientBag:GetService((require :: any)("PlayerProductManagerClient"))
|
|
444
|
+
|
|
445
|
+
PromiseTestUtils.awaitValue(function()
|
|
446
|
+
return clientBinder:Get(controller.playerMock) ~= nil
|
|
447
|
+
end, 10)
|
|
448
|
+
|
|
449
|
+
local manager: any = clientBinder:Get(controller.playerMock)
|
|
450
|
+
manager:_handleGamePassPromptFinished(gamePassId, true)
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
it("grants nothing for a claim the marketplace does not confirm", function()
|
|
454
|
+
local controller = setup()
|
|
455
|
+
controller.gameProductService:SetServerOnlyPromptingEnabled(true)
|
|
456
|
+
|
|
457
|
+
-- UserOwnsGamePassAsync stays at its false default: the player never bought this pass. Any
|
|
458
|
+
-- client can fire this remote for any gamepass id, so on its own the claim must grant nothing.
|
|
459
|
+
local serverFired = {}
|
|
460
|
+
controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
|
|
461
|
+
table.insert(serverFired, { player = player, gamePassId = gamePassId })
|
|
462
|
+
end)
|
|
463
|
+
|
|
464
|
+
claimPurchaseFromClient(controller, GAME_PASS_ID)
|
|
465
|
+
|
|
466
|
+
-- Awaiting the ownership query also lets the server's verification settle first.
|
|
467
|
+
expect(
|
|
468
|
+
controller.awaitBool(
|
|
469
|
+
controller.gameProductService:PromisePlayerOwnership(
|
|
470
|
+
controller.playerMock,
|
|
471
|
+
GameConfigAssetTypes.PASS,
|
|
472
|
+
GAME_PASS_ID
|
|
473
|
+
)
|
|
474
|
+
)
|
|
475
|
+
).toEqual(false)
|
|
476
|
+
expect(#serverFired).toEqual(0)
|
|
477
|
+
expect(
|
|
478
|
+
controller.gameProductService:HasPlayerPurchasedThisSession(
|
|
479
|
+
controller.playerMock,
|
|
480
|
+
GameConfigAssetTypes.PASS,
|
|
481
|
+
GAME_PASS_ID
|
|
482
|
+
)
|
|
483
|
+
).toEqual(false)
|
|
484
|
+
|
|
485
|
+
controller:destroy()
|
|
486
|
+
end)
|
|
487
|
+
|
|
488
|
+
it("grants the pass for a claim the marketplace confirms", function()
|
|
489
|
+
local controller = setup()
|
|
490
|
+
controller.gameProductService:SetServerOnlyPromptingEnabled(true)
|
|
491
|
+
|
|
492
|
+
-- The marketplace shows the player owning the pass, as it would after a real purchase.
|
|
493
|
+
PlayerMock.writeLookup(controller.playerMock, "MarketplaceService.UserOwnsGamePassAsync", GAME_PASS_ID, true)
|
|
494
|
+
|
|
495
|
+
local serverFired = {}
|
|
496
|
+
controller.gameProductService.GamePassPurchased:Connect(function(player, gamePassId)
|
|
497
|
+
table.insert(serverFired, { player = player, gamePassId = gamePassId })
|
|
498
|
+
end)
|
|
499
|
+
|
|
500
|
+
claimPurchaseFromClient(controller, GAME_PASS_ID)
|
|
501
|
+
|
|
502
|
+
PromiseTestUtils.awaitValue(function()
|
|
503
|
+
return #serverFired > 0
|
|
504
|
+
end, 10)
|
|
505
|
+
|
|
506
|
+
expect(#serverFired).toEqual(1)
|
|
507
|
+
expect(serverFired[1].player).toBe(controller.playerMock)
|
|
508
|
+
expect(serverFired[1].gamePassId).toEqual(GAME_PASS_ID)
|
|
509
|
+
expect(
|
|
510
|
+
controller.gameProductService:HasPlayerPurchasedThisSession(
|
|
511
|
+
controller.playerMock,
|
|
512
|
+
GameConfigAssetTypes.PASS,
|
|
513
|
+
GAME_PASS_ID
|
|
514
|
+
)
|
|
515
|
+
).toEqual(true)
|
|
516
|
+
|
|
517
|
+
controller:destroy()
|
|
518
|
+
end)
|
|
519
|
+
|
|
520
|
+
it("still refuses a client-initiated prompt", function()
|
|
521
|
+
local controller = setup()
|
|
522
|
+
controller.gameProductService:SetServerOnlyPromptingEnabled(true)
|
|
523
|
+
|
|
524
|
+
-- Verification and the prompting restriction ship together: a game cannot take one without
|
|
525
|
+
-- the other, so this records what enabling the flag costs the client realm.
|
|
526
|
+
local outcome = PromiseTestUtils.awaitOutcome(
|
|
527
|
+
controller.gameProductServiceClient:PromisePromptPurchase(
|
|
528
|
+
controller.playerMock,
|
|
529
|
+
GameConfigAssetTypes.PASS,
|
|
530
|
+
GAME_PASS_ID
|
|
531
|
+
),
|
|
532
|
+
10
|
|
533
|
+
)
|
|
534
|
+
expect(outcome).toEqual("rejected")
|
|
535
|
+
|
|
536
|
+
controller:destroy()
|
|
537
|
+
end)
|
|
538
|
+
end)
|
|
539
|
+
|
|
382
540
|
describe("server-initiated gamepass prompt", function()
|
|
383
541
|
it("resolves true on accept and marks the session purchase", function()
|
|
384
542
|
local controller = setup()
|
|
@@ -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")
|
|
@@ -30,6 +32,7 @@ export type PlayerProductManager =
|
|
|
30
32
|
{} :: {
|
|
31
33
|
_serviceBag: ServiceBag.ServiceBag,
|
|
32
34
|
_receiptProcessingService: any, -- ReceiptProcessingService.ReceiptProcessingService
|
|
35
|
+
_gameProductDataService: any, -- GameProductDataService.GameProductDataService
|
|
33
36
|
_remoting: any,
|
|
34
37
|
},
|
|
35
38
|
{} :: typeof({ __index = PlayerProductManager })
|
|
@@ -49,6 +52,7 @@ function PlayerProductManager.new(player: Player, serviceBag: ServiceBag.Service
|
|
|
49
52
|
|
|
50
53
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
51
54
|
self._receiptProcessingService = self._serviceBag:GetService(ReceiptProcessingService) :: any
|
|
55
|
+
self._gameProductDataService = self._serviceBag:GetService(GameProductDataService) :: any
|
|
52
56
|
|
|
53
57
|
-- Route internal setup through an `any` view: resolving these heavy-`self` method
|
|
54
58
|
-- calls against the intersected type otherwise overwhelms the old solver.
|
|
@@ -65,7 +69,7 @@ function PlayerProductManager.new(player: Player, serviceBag: ServiceBag.Service
|
|
|
65
69
|
|
|
66
70
|
-- Initialize attributes
|
|
67
71
|
|
|
68
|
-
local serverOnlyPrompting = self.
|
|
72
|
+
local serverOnlyPrompting = self._gameProductDataService:GetServerOnlyPromptingValue()
|
|
69
73
|
self._maid:GiveTask(serverOnlyPrompting:Observe():Subscribe(function(value)
|
|
70
74
|
self._obj:SetAttribute(GameProductDataService.ServerOnlyPromptingAttribute, value)
|
|
71
75
|
end))
|
|
@@ -136,9 +140,48 @@ function PlayerProductManager._setupPassTracker(self: PlayerProductManager): ()
|
|
|
136
140
|
assert(type(gamePassId) == "number", "Bad gamePassId")
|
|
137
141
|
assert(type(isPurchased) == "boolean", "Bad isPurchased")
|
|
138
142
|
|
|
139
|
-
--
|
|
143
|
+
-- Closing the prompt is safe to take on the client's word: it only unblocks pending prompt
|
|
144
|
+
-- state and grants nothing.
|
|
140
145
|
tracker:HandlePromptClosedEvent(gamePassId)
|
|
141
|
-
|
|
146
|
+
|
|
147
|
+
if not isPurchased then
|
|
148
|
+
tracker:HandlePurchaseEvent(gamePassId, false)
|
|
149
|
+
return
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
-- Verification rides on server-only prompting rather than a switch of its own. Enabling it is a
|
|
153
|
+
-- game saying the server drives purchases, which is also what makes the ownership check safe to
|
|
154
|
+
-- pay for. Left off, this stays on the client's word -- knowingly, because
|
|
155
|
+
-- UserOwnsGamePassAsync answers from a per-server cache that can still read `false` for the
|
|
156
|
+
-- purchase that just completed, and denying on that stale read loses a pass the player paid for.
|
|
157
|
+
-- See [GameProductService.SetServerOnlyPromptingEnabled].
|
|
158
|
+
if not self._gameProductDataService:GetServerOnlyPromptingValue().Value then
|
|
159
|
+
tracker:HandlePurchaseEvent(gamePassId, true)
|
|
160
|
+
return
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
-- The purchase itself is not. This event is fired by the client, so `isPurchased == true` is an
|
|
164
|
+
-- unverified claim -- a client can fire it for any gamepass id without ever paying, and granting
|
|
165
|
+
-- ownership on it hands the pass out for free. Confirm against the marketplace before it counts,
|
|
166
|
+
-- so only a pass the player genuinely owns is recorded as purchased.
|
|
167
|
+
local userId = if PlayerMock.isMock(self._obj) then PlayerMock.read(self._obj, "UserId") else self._obj.UserId
|
|
168
|
+
|
|
169
|
+
self._maid:GivePromise(MarketplaceUtils.promiseUserOwnsGamePass(userId, gamePassId)):Then(function(ownsPass)
|
|
170
|
+
tracker:HandlePurchaseEvent(gamePassId, ownsPass == true)
|
|
171
|
+
end, function(err)
|
|
172
|
+
-- The ownership check could not answer (a marketplace hiccup, not a purchase). Grant nothing
|
|
173
|
+
-- on the failure, and resolve the pending prompt as unbought so a server-initiated caller is
|
|
174
|
+
-- not left waiting forever.
|
|
175
|
+
warn(
|
|
176
|
+
string.format(
|
|
177
|
+
"[PlayerProductManager] - Failed to verify gamepass %d ownership for %s: %s",
|
|
178
|
+
gamePassId,
|
|
179
|
+
tostring(self._obj),
|
|
180
|
+
tostring(err)
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
tracker:HandlePurchaseEvent(gamePassId, false)
|
|
184
|
+
end)
|
|
142
185
|
end))
|
|
143
186
|
end
|
|
144
187
|
|