diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 8444b19..aa05c01 100644 --- a/src/helper/irs-api.ts +++ b/src/helper/irs-api.ts @@ -28,18 +28,21 @@ export const doTransaction = async ( return res.data; } else if (supplier.code == 'Hemat') { - const options = { - headers: { Authorization: `${authorization}` }, - }; - const data = { - idtransaction: idtrx, - destination: `${destination}`, - code: `${productCode}`, - type: `${typePaid}`, - }; - const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options); + if (authorization != "") { + console.log("initoken", authorization) + const options = { + headers: {'Authorization': 'Bearer ' + authorization} + }; + const data = { + idtransaction: idtrx, + destination: `${destination}`, + code: `${productCode}`, + 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( @@ -47,7 +50,9 @@ export const doTransaction = async ( ); return res.data; + console.log('restranshemat', res) } catch (err) { + console.log('errtranshemat', err) throw err; } }; diff --git a/src/helper/sihemat-authorization.ts b/src/helper/sihemat-authorization.ts index cb9dee6..be672c9 100644 --- a/src/helper/sihemat-authorization.ts +++ b/src/helper/sihemat-authorization.ts @@ -10,6 +10,7 @@ export const doAuthorizeHemat = async (user, pass, supplier) => { return res.data; } catch (err) { + console.log('errauthhemat', err) throw err; } }; diff --git a/src/transaction/transaction.service.ts b/src/transaction/transaction.service.ts index 728c65c..b57df7f 100644 --- a/src/transaction/transaction.service.ts +++ b/src/transaction/transaction.service.ts @@ -589,10 +589,7 @@ export class TransactionService { }) .join(''); - const hitLoginHemat = - supplier.code == 'Hemat' ? - await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : - ''; + const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); let hitSupplier = await doTransaction( orderTransactionDto.productCode, @@ -604,6 +601,7 @@ export class TransactionService { ); // let hitSupplier; + console.log('iniresponsupplier', hitSupplier) if (supplier.code != 'IRS') { const parsingResponse = hitSupplier.split(' '); const newHitSupplier = { @@ -804,10 +802,7 @@ export class TransactionService { }) .join(''); - const hitLoginHemat = - supplier.code == 'Hemat' ? - await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : - ''; + const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); let hitSupplier = await doTransaction( orderTransactionDto.productCode, @@ -950,10 +945,7 @@ export class TransactionService { let status; try { - const hitLoginHemat = - supplier.code == 'Hemat' ? - await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : - ''; + const hitLoginHemat = await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier); let hitSupplier = await doTransaction( `CEK${orderTransactionDto.productCode.slice(3)}`,