add: new partner
This commit is contained in:
parent
790c0902a6
commit
b87c444ae6
|
@ -6,13 +6,24 @@ const irs_pin = '04JFGC';
|
|||
const irs_user = 'D10BD0';
|
||||
const irs_pass = '6251F3';
|
||||
|
||||
export const doTransaction = async (productCode, destination, idtrx) => {
|
||||
export const doTransaction = async (
|
||||
productCode,
|
||||
destination,
|
||||
idtrx,
|
||||
supplier,
|
||||
) => {
|
||||
try {
|
||||
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;
|
||||
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;
|
||||
} else {
|
||||
const res = await axios.get(
|
||||
`${supplier.url}/trx?memberID=${irs_id}&pin=${irs_pin}&user=${irs_user}&password=${irs_pass}&product=${productCode}&dest=${destination}&counter=1&refID=${idtrx}`,
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
|
|
|
@ -448,6 +448,10 @@ export class TransactionService {
|
|||
orderTransactionDto.productCode,
|
||||
);
|
||||
|
||||
const supplier = await this.supplierService.findByCode(
|
||||
product.supplier.code,
|
||||
);
|
||||
|
||||
let product_price = await this.productHistoryPriceService.findOne(
|
||||
product.id,
|
||||
userData.partner?.id,
|
||||
|
@ -489,12 +493,21 @@ export class TransactionService {
|
|||
})
|
||||
.join('');
|
||||
|
||||
const hitSupplier = await doTransaction(
|
||||
let hitSupplier = await doTransaction(
|
||||
orderTransactionDto.productCode,
|
||||
orderTransactionDto.destination,
|
||||
trxId,
|
||||
supplier
|
||||
);
|
||||
|
||||
if (supplier.code != 'IRS') {
|
||||
const parsingResponse = hitSupplier.split(' ');
|
||||
hitSupplier = {
|
||||
success: hitSupplier.include('diproses');
|
||||
harga: parseInt(parsingResponse[parsingResponse.length - 2].replaceAll(".","")),
|
||||
msg: hitSupplier
|
||||
};
|
||||
}
|
||||
// const hitSupplier = {
|
||||
// harga: 2000,
|
||||
// success: true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user