[commerce] Add the purchase restriction contract (#123)

This commit is contained in:
dukedotdev
2026-10-12 14:22:46 -04:00
committed by GitHub
parent 58a9b08548
commit aa5e83764e
2 changed files with 19 additions and 0 deletions
+12
View File
@@ -72,6 +72,18 @@ const app = new Hono<App>()
(c) => c.json(false) (c) => c.json(false)
) )
.get(
'/purchaseRestriction/isplayerrestricted',
describeRoute({
tags: ['Purchase'],
summary: 'Player purchase restriction status',
description:
'No external payment restrictions are configured. The 2026 client expects a bare boolean.',
responses: { 200: json(BareBoolean, 'No purchase restriction') },
}),
(c) => c.json(false)
)
// Begin a purchase. The client asks for a transaction handle before it takes the // Begin a purchase. The client asks for a transaction handle before it takes the
// player to the platform store; nothing is charged or recorded here, so the id is a // player to the platform store; nothing is charged or recorded here, so the id is a
// fixed placeholder and the posted body is ignored. // fixed placeholder and the posted body is ignored.
@@ -18,6 +18,12 @@ describe('commerce endpoints', () => {
expect(await res.json()).toBe(false) expect(await res.json()).toBe(false)
}) })
it('2026 purchase restriction response is a bare boolean', async () => {
const res = await SELF.fetch(`${ORIGIN}/purchaseRestriction/isplayerrestricted`)
expect(res.status).toBe(200)
expect(await res.json()).toBe(false)
})
it('POST /purchase/v1/initiatepurchase returns a transaction id', async () => { it('POST /purchase/v1/initiatepurchase returns a transaction id', async () => {
const res = await SELF.fetch(`${ORIGIN}/purchase/v1/initiatepurchase`, { const res = await SELF.fetch(`${ORIGIN}/purchase/v1/initiatepurchase`, {
method: 'POST', method: 'POST',
@@ -88,6 +94,7 @@ describe('commerce endpoints', () => {
'GET /api/catalog/v1/all', 'GET /api/catalog/v1/all',
'GET /purchase/v1/cleanuppending', 'GET /purchase/v1/cleanuppending',
'GET /purchase/v1/hasspentmoney', 'GET /purchase/v1/hasspentmoney',
'GET /purchaseRestriction/isplayerrestricted',
'GET /purchasecampaign/allcurrent/v2', 'GET /purchasecampaign/allcurrent/v2',
'GET /reminder/currentTokenBundles/v2', 'GET /reminder/currentTokenBundles/v2',
'POST /purchase/v1/cleanuppending', 'POST /purchase/v1/cleanuppending',