Merge branch 'development' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-staging
This commit is contained in:
		| @@ -8,24 +8,54 @@ const irs_user = 'D10BD0'; | ||||
| const irs_pass = '6251F3'; | ||||
|  | ||||
| export const doTransaction = async ( | ||||
|   productCode, | ||||
|   destination, | ||||
|   idtrx, | ||||
|   supplier, | ||||
|   authorization, | ||||
|   typePaid, | ||||
|   billTrxId, | ||||
|     productCode, | ||||
|     destination, | ||||
|     idtrx, | ||||
|     supplier, | ||||
|     authorization, | ||||
|     typePaid, | ||||
|     billTrxId, | ||||
| ) => { | ||||
|   try { | ||||
|     if (supplier.code == 'IRS') { | ||||
|       const res = await axios.get( | ||||
|         `${irs_url}?id=${irs_id}&pin=${irs_pin}&user=${irs_user}&pass=${irs_pass}&kodeproduk=${productCode}&tujuan=${destination}&counter=1&idtrx=${idtrx}`, | ||||
|       ); | ||||
|  | ||||
|       return res.data; | ||||
|       axios.get(`${irs_url}?id=${irs_id}&pin=${irs_pin}&user=${irs_user}&pass=${irs_pass}&kodeproduk=${productCode}&tujuan=${destination}&counter=1&idtrx=${idtrx}`) | ||||
|           .then(res => { | ||||
|             // Handle successful response | ||||
|             if (res.data.includes('saldo tidak cukup')) { | ||||
|               throw new HttpException( | ||||
|                   { | ||||
|                 statusCode: HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|                     error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali', | ||||
|                   }, | ||||
|                   HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|               ); | ||||
|             } else { | ||||
|               return res.data; | ||||
|             } | ||||
|           }) | ||||
|           .catch(e => { | ||||
|             // Handle error | ||||
|             if (e.error.includes('saldo tidak cukup')) { | ||||
|               throw new HttpException( | ||||
|                   { | ||||
|                     statusCode: HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|                     error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali', | ||||
|                   }, | ||||
|                   HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|               ); | ||||
|             } else { | ||||
|               throw new HttpException( | ||||
|                   { | ||||
|                     statusCode: HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|                     error: e.error, | ||||
|                   }, | ||||
|                   HttpStatus.INTERNAL_SERVER_ERROR, | ||||
|               ); | ||||
|             } | ||||
|           }); | ||||
|     } else if (supplier.code == 'NIRS') { | ||||
|       const res = await axios.get( | ||||
|         `${supplier.url}?id=${supplier.irs_id}&pin=${supplier.irs_pin}&user=${supplier.irs_user}&pass=${supplier.irs_pass}&kodeproduk=${productCode}&tujuan=${destination}&counter=1&idtrx=${idtrx}`, | ||||
|           `${supplier.url}?id=${supplier.irs_id}&pin=${supplier.irs_pin}&user=${supplier.irs_user}&pass=${supplier.irs_pass}&kodeproduk=${productCode}&tujuan=${destination}&counter=1&idtrx=${idtrx}`, | ||||
|       ); | ||||
|  | ||||
|       return res.data; | ||||
| @@ -114,9 +144,9 @@ export const doTransaction = async ( | ||||
|           type: `${typePaid}`, | ||||
|         }; | ||||
|         const res = await axios.post( | ||||
|           `${supplier.url}/v1/transaction/request`, | ||||
|           data, | ||||
|           options, | ||||
|             `${supplier.url}/v1/transaction/request`, | ||||
|             data, | ||||
|             options, | ||||
|         ); | ||||
|  | ||||
|         return res.data; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user