@mpgd/adapter-devvit 0.9.13 → 0.9.15

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.
@@ -35,10 +35,12 @@ function normalizeDevvitOrder(input, expectedStatus) {
35
35
  }
36
36
  const product = requireRecord(record.products[0], 'Devvit payment product');
37
37
  const orderId = requireString(record.id, 'order.id');
38
- // The order must carry the purchasing user so the server-side binding to the
39
- // authenticated context is always enforced; an order without userId cannot be
40
- // attributed and must not be fulfilled or refunded.
41
- if (requireString(record.userId, 'order.userId') !== playerId) {
38
+ // Devvit's payment handler request (`PaymentHandlerRequest` in @devvit/payments
39
+ // 0.14) has no userId: Devvit runs the handler in the purchasing user's request
40
+ // context, which is the authenticated playerId. When an order does carry a
41
+ // userId, it must still match that context.
42
+ if (record.userId !== undefined
43
+ && requireString(record.userId, 'order.userId') !== playerId) {
42
44
  throw new TypeError('Devvit payment order userId must match the authenticated context playerId.');
43
45
  }
44
46
  const platformSku = requireString(product.sku, 'order.products[0].sku');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/adapter-devvit",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
4
4
  "description": "Reddit Devvit Web platform adapter for mpgd games.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,9 +55,9 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@devvit/web": "0.14.1",
58
- "@mpgd/bridge": "0.10.0",
59
- "@mpgd/game-services": "0.17.1",
60
- "@mpgd/platform": "0.14.0"
58
+ "@mpgd/platform": "0.15.0",
59
+ "@mpgd/game-services": "0.18.0",
60
+ "@mpgd/bridge": "0.11.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "ttsc": "0.30.4",