protected async xenditPaymentService(req: Request): Promise {     try {       logsFormater('xenditPaymentService - start', 'info')       let xenditNode: InstanceType = new XenditNode()       let xenditErrorCode: string[] = ['INVALID_JSON_FORMAT', 'REQUEST_FORBIDDEN_ERROR', 'INVOICE_NOT_FOUND_ERROR']       let xenditRes: DTOWebhooksXendit = req.body       let paymentLogs: InstanceType = new PaymentLogs()       logsFormater(`xenditRes: ${JSON.stringify(xenditRes)}`, 'info')       if (['PAID', 'SETTLED', 'EXPIRED'].includes(xenditRes.status)) {         const getXenditInvoice: Record = xenditNode.getPaymentInvoice({ invoiceID: xenditRes.id }, 'paid')         if (xenditErrorCode.includes(getXenditInvoice.status) || !getXenditInvoice) throw apiResponse(status.BAD_REQUEST, 'Xendit callback response, is fake not from xendit')         const [getMerchantCode, getUserId, updateStatusQrcode]: [Merchants, Qrcodes, UpdateResult] = await Promise.all([           super.model().findOne({ name: xenditRes.description.toLowerCase(), deletedAt: IsNull() }, { select: ['code'] }),           ServiceWebhooks.qrcode.model().findOne({ where: { externalId: xenditRes.external_id }, relations: ['user'] }),           ServiceWebhooks.qrcode.model().update({ externalId: xenditRes.external_id }, { status: xenditRes.status, createdAt: new Date() })         ])         if (!getMerchantCode) throw apiResponse(status.BAD_REQUEST, 'Merchant code is not exist')         if (!getUserId) throw apiResponse(status.BAD_REQUEST, 'UserID is not exist')         if (!updateStatusQrcode) throw apiResponse(status.BAD_REQUEST, 'Update status qrcode failed')         const xenditResNew: Record = { ...xenditRes, code: getMerchantCode.code }         if (getMerchantCode) io().emit(`xenditServer:${getMerchantCode.code}`, xenditResNew)         paymentLogs.transactionId = xenditRes.id         paymentLogs.externalId = xenditRes.external_id         paymentLogs.status = xenditRes.status         paymentLogs.resPayload = xenditRes as any         paymentLogs.merchantCode = getMerchantCode.code         paymentLogs.resourceType = xenditRes.external_id.match(/(promotion|payment)/gi)[0]         paymentLogs.createdAt = new Date()         paymentLogs.userId = getUserId.user.id       }       if (!['PAID', 'SETTLED', 'EXPIRED'].includes(xenditRes.status)) {         paymentLogs.status = xenditRes.status || 'ERROR'         paymentLogs.resPayload = xenditRes || {}         paymentLogs.merchantCode = 'NONE'         paymentLogs.resourceType = 'NONE'         paymentLogs.createdAt = new Date()       }       const insertLogs: InsertResult = await ServiceWebhooks.xendit.model().insert(paymentLogs)       if (!insertLogs) throw apiResponse(status.BAD_REQUEST, 'Insert new logs payment failed')       logsFormater('xenditPaymentService - end', 'info')       return Promise.resolve(apiResponse(status.OK, 'Xendit callback success'))     } catch (e: any) {       logsFormater(`xenditPaymentService - error: ${JSON.stringify(e)}`, 'error')       return Promise.reject(apiResponse(e.stat_code || status.BAD_REQUEST, e.stat_message || e.message))     }   }