feat(miniapp): improve mobile billing and utility controls

This commit is contained in:
2026-03-10 18:50:19 +04:00
parent 3168356431
commit b7658164a8
15 changed files with 878 additions and 52 deletions

View File

@@ -127,6 +127,24 @@ describe('createBotWebhookServer', () => {
}
})
},
miniAppUpdateUtilityBill: {
handler: async () =>
new Response(JSON.stringify({ ok: true, authorized: true, cycleState: {} }), {
status: 200,
headers: {
'content-type': 'application/json; charset=utf-8'
}
})
},
miniAppDeleteUtilityBill: {
handler: async () =>
new Response(JSON.stringify({ ok: true, authorized: true, cycleState: {} }), {
status: 200,
headers: {
'content-type': 'application/json; charset=utf-8'
}
})
},
miniAppApproveMember: {
handler: async () =>
new Response(JSON.stringify({ ok: true, authorized: true, member: {} }), {
@@ -409,6 +427,38 @@ describe('createBotWebhookServer', () => {
})
})
test('accepts mini app utility bill update request', async () => {
const response = await server.fetch(
new Request('http://localhost/api/miniapp/admin/utility-bills/update', {
method: 'POST',
body: JSON.stringify({ initData: 'payload', billId: 'utility-1' })
})
)
expect(response.status).toBe(200)
expect(await response.json()).toEqual({
ok: true,
authorized: true,
cycleState: {}
})
})
test('accepts mini app utility bill delete request', async () => {
const response = await server.fetch(
new Request('http://localhost/api/miniapp/admin/utility-bills/delete', {
method: 'POST',
body: JSON.stringify({ initData: 'payload', billId: 'utility-1' })
})
)
expect(response.status).toBe(200)
expect(await response.json()).toEqual({
ok: true,
authorized: true,
cycleState: {}
})
})
test('accepts mini app approve member request', async () => {
const response = await server.fetch(
new Request('http://localhost/api/miniapp/admin/approve-member', {