fix :
- trace error metro
This commit is contained in:
		| @@ -43,9 +43,9 @@ export class PpobCallbackController { | ||||
|   @Public() | ||||
|   @Get('/metro') | ||||
|   async getMetro(@Req() request: FastifyRequest) { | ||||
|     try { | ||||
|     // try { | ||||
|       const response = request.query; | ||||
|  | ||||
|       console.log('responsemetro', response['status']) | ||||
|       if (response['message'].toLowerCase().includes('cek')) { | ||||
|         if (response['status'] != 20) { | ||||
|           //TODO: UPDATE GAGAL | ||||
| @@ -79,32 +79,22 @@ export class PpobCallbackController { | ||||
|         console.log('statusapani2', response.toString()); | ||||
|  | ||||
|         if (response['status'].toString() != '20') { | ||||
|           console.log('responsemetro1', response['status']) | ||||
|           console.log('metrogagalmessage', response['message']) | ||||
|           //TODO: UPDATE GAGAL | ||||
|           const updateTransaction = | ||||
|               await this.transactionService.callbackOrderFailed( | ||||
|               await this.transactionService.checkCallbackOrderFailed( | ||||
|                   response['refid'], | ||||
|                   response, | ||||
|               ); | ||||
|  | ||||
|           return { | ||||
|             updateTransaction, | ||||
|             statusCode: HttpStatus.BAD_REQUEST, | ||||
|             message: 'failed to proccess', | ||||
|           }; | ||||
|  | ||||
|         } else { | ||||
|  | ||||
|           //TODO: UPDATE BERHASIL | ||||
|           const updateTransaction = | ||||
|               await this.transactionService.callbackOrderSuccess( | ||||
|               await this.transactionService.checkCallbackOrderSuccess( | ||||
|                   response['refid'], | ||||
|                   response, | ||||
|               ); | ||||
|  | ||||
|           return { | ||||
|             updateTransaction, | ||||
|             statusCode: HttpStatus.OK, | ||||
|             message: 'success', | ||||
|           }; | ||||
|         } | ||||
|       } | ||||
|  | ||||
| @@ -116,20 +106,20 @@ export class PpobCallbackController { | ||||
|         statusCode: HttpStatus.OK, | ||||
|         message: 'success', | ||||
|       }; | ||||
|     } catch (e) { | ||||
|       if (e instanceof EntityNotFoundError) { | ||||
|         throw new HttpException( | ||||
|           { | ||||
|             statusCode: HttpStatus.NOT_FOUND, | ||||
|             error: 'Error callback', | ||||
|             message: e | ||||
|           }, | ||||
|           HttpStatus.NOT_FOUND, | ||||
|         ); | ||||
|       } else { | ||||
|         throw e; | ||||
|       } | ||||
|     } | ||||
|     // } catch (e) { | ||||
|     //   if (e instanceof EntityNotFoundError) { | ||||
|     //     throw new HttpException( | ||||
|     //       { | ||||
|     //         statusCode: HttpStatus.NOT_FOUND, | ||||
|     //         error: 'Error callback', | ||||
|     //         message: e | ||||
|     //       }, | ||||
|     //       HttpStatus.NOT_FOUND, | ||||
|     //     ); | ||||
|     //   } else { | ||||
|     //     throw e; | ||||
|     //   } | ||||
|     // } | ||||
|   } | ||||
|  | ||||
|   @Public() | ||||
|   | ||||
| @@ -1502,6 +1502,7 @@ export class TransactionService { | ||||
|       if (callback['message'].includes('METRO')) { | ||||
|         const response = callback['message']; | ||||
|         const responseBaru = response.split('.'); | ||||
|         console.log('masukmsgmetrofail', responseBaru[2]) | ||||
|         dataTransaction.failed_reason = `Trx ${product.code} ke ${dataTransaction.destination} gagal. ${responseBaru[2]}`; | ||||
|         if (callback['price'] != dataTransaction.product_price.price) { | ||||
|           dataTransaction.product_price.price = parseInt(callback['price']); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user