mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
only check for google play purchase support of this method is requested
This commit is contained in:
+5
-5
@@ -37,16 +37,16 @@ export const createPurchaseRouter = ({ database, websocket }: {
|
|||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
router.post('/can-do-purchase', json(), async (req, res, next) => {
|
router.post('/can-do-purchase', json(), async (req, res, next) => {
|
||||||
if (!areGooglePlayPaymentsPossible) {
|
|
||||||
res.json({ canDoPurchase: 'no because not supported by the server' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!isCanDoPurchaseRequest(req.body)) {
|
if (!isCanDoPurchaseRequest(req.body)) {
|
||||||
throw new BadRequest()
|
throw new BadRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.body.type === 'googleplay' && !areGooglePlayPaymentsPossible) {
|
||||||
|
res.json({ canDoPurchase: 'no because not supported by the server' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const result: boolean = await database.transaction(async (transaction) => {
|
const result: boolean = await database.transaction(async (transaction) => {
|
||||||
const familyEntry = await requireFamilyEntry({
|
const familyEntry = await requireFamilyEntry({
|
||||||
database,
|
database,
|
||||||
|
|||||||
Reference in New Issue
Block a user