-fix transaction api error 401 for hemat
This commit is contained in:
		| @@ -28,18 +28,21 @@ export const doTransaction = async ( | |||||||
|  |  | ||||||
|       return res.data; |       return res.data; | ||||||
|     } else if (supplier.code == 'Hemat') { |     } else if (supplier.code == 'Hemat') { | ||||||
|       const options = { |       if (authorization != "") { | ||||||
|         headers: { Authorization: `${authorization}` }, |         console.log("initoken", authorization) | ||||||
|       }; |         const options = { | ||||||
|       const data = { |           headers: {'Authorization': 'Bearer ' + authorization} | ||||||
|         idtransaction: idtrx, |         }; | ||||||
|         destination: `${destination}`, |         const data = { | ||||||
|         code: `${productCode}`, |           idtransaction: idtrx, | ||||||
|         type: `${typePaid}`, |           destination: `${destination}`, | ||||||
|       }; |           code: `${productCode}`, | ||||||
|       const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options); |           type: `${typePaid}`, | ||||||
|  |         }; | ||||||
|  |         const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options); | ||||||
|  |  | ||||||
|       return res.data; |         return res.data; | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const res = await axios.get( |     const res = await axios.get( | ||||||
| @@ -47,7 +50,9 @@ export const doTransaction = async ( | |||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     return res.data; |     return res.data; | ||||||
|  |     console.log('restranshemat', res) | ||||||
|   } catch (err) { |   } catch (err) { | ||||||
|  |     console.log('errtranshemat', err) | ||||||
|     throw err; |     throw err; | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ export const doAuthorizeHemat = async (user, pass, supplier) => { | |||||||
|  |  | ||||||
|         return res.data; |         return res.data; | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|  |         console.log('errauthhemat', err) | ||||||
|         throw err; |         throw err; | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -589,10 +589,7 @@ export class TransactionService { | |||||||
|         }) |         }) | ||||||
|         .join(''); |         .join(''); | ||||||
|  |  | ||||||
|     const hitLoginHemat = |     const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); | ||||||
|         supplier.code == 'Hemat' ? |  | ||||||
|             await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : |  | ||||||
|             ''; |  | ||||||
|  |  | ||||||
|     let hitSupplier = await doTransaction( |     let hitSupplier = await doTransaction( | ||||||
|         orderTransactionDto.productCode, |         orderTransactionDto.productCode, | ||||||
| @@ -604,6 +601,7 @@ export class TransactionService { | |||||||
|     ); |     ); | ||||||
|     // let hitSupplier; |     // let hitSupplier; | ||||||
|  |  | ||||||
|  |     console.log('iniresponsupplier', hitSupplier) | ||||||
|     if (supplier.code != 'IRS') { |     if (supplier.code != 'IRS') { | ||||||
|       const parsingResponse = hitSupplier.split(' '); |       const parsingResponse = hitSupplier.split(' '); | ||||||
|       const newHitSupplier = { |       const newHitSupplier = { | ||||||
| @@ -804,10 +802,7 @@ export class TransactionService { | |||||||
|         }) |         }) | ||||||
|         .join(''); |         .join(''); | ||||||
|  |  | ||||||
|     const hitLoginHemat = |     const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); | ||||||
|         supplier.code == 'Hemat' ? |  | ||||||
|             await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : |  | ||||||
|             ''; |  | ||||||
|  |  | ||||||
|     let hitSupplier = await doTransaction( |     let hitSupplier = await doTransaction( | ||||||
|         orderTransactionDto.productCode, |         orderTransactionDto.productCode, | ||||||
| @@ -950,10 +945,7 @@ export class TransactionService { | |||||||
|     let status; |     let status; | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       const hitLoginHemat = |       const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); | ||||||
|           supplier.code == 'Hemat' ? |  | ||||||
|               await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : |  | ||||||
|               ''; |  | ||||||
|  |  | ||||||
|       let hitSupplier = await doTransaction( |       let hitSupplier = await doTransaction( | ||||||
|           `CEK${orderTransactionDto.productCode.slice(3)}`, |           `CEK${orderTransactionDto.productCode.slice(3)}`, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user