fix: post api transaction hemat

This commit is contained in:
mfadiln2018 2022-09-26 16:04:54 +07:00
parent 7cd52a5998
commit 4cf1454c2c
2 changed files with 18 additions and 6 deletions

View File

@ -29,7 +29,7 @@ export const doTransaction = async (
return res.data; return res.data;
} else if (supplier.code == 'Hemat') { } else if (supplier.code == 'Hemat') {
const options = { const options = {
headers: { Authorization: `${authorization}` }, headers: { 'Authorization': `${authorization.data}` },
}; };
const data = { const data = {
idtransaction: idtrx, idtransaction: idtrx,
@ -37,7 +37,13 @@ export const doTransaction = async (
code: `${productCode}`, code: `${productCode}`,
type: `${typePaid}`, type: `${typePaid}`,
}; };
const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options);
console.log(authorization.data, 'alskdlas')
console.log(supplier.url)
console.log(data, 'allData')
const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options).catch((err) => {
throw err;
});
return res.data; return res.data;
} }

View File

@ -589,20 +589,26 @@ export class TransactionService {
}) })
.join(''); .join('');
console.log('sebelum authorize')
const hitLoginHemat = const hitLoginHemat =
supplier.code == 'Hemat' ? supplier.code == 'Hemat' ?
await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) : await doAuthorizeHemat('wndpt001', '3NHESIJ5', supplier) :
''; '';
console.log('setelah authorize')
console.log(hitLoginHemat.data, 'data')
let hitSupplier = await doTransaction( let hitSupplier = await doTransaction(
orderTransactionDto.productCode, orderTransactionDto.productCode,
orderTransactionDto.destination, orderTransactionDto.destination,
trxId, trxId,
supplier, supplier,
hitLoginHemat.data, hitLoginHemat,
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT', product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
); );
// let hitSupplier;
console.log('setelah hit')
if (supplier.code != 'IRS') { if (supplier.code != 'IRS') {
const parsingResponse = hitSupplier.split(' '); const parsingResponse = hitSupplier.split(' ');
@ -814,7 +820,7 @@ export class TransactionService {
orderTransactionDto.destination, orderTransactionDto.destination,
trxId, trxId,
supplier, supplier,
hitLoginHemat.data, hitLoginHemat,
product product
); );
@ -960,7 +966,7 @@ export class TransactionService {
orderTransactionDto.destination, orderTransactionDto.destination,
trxId, trxId,
supplier, supplier,
hitLoginHemat.data, hitLoginHemat,
'INQUIRY' 'INQUIRY'
); );
const parsingResponse = hitSupplier.split(' '); const parsingResponse = hitSupplier.split(' ');