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_user = 'D10BD0';
|
||||||
const irs_pass = '6251F3';
|
const irs_pass = '6251F3';
|
||||||
|
|
||||||
export const doTransaction = async (productCode, destination, idtrx) => {
|
export const doTransaction = async (
|
||||||
|
productCode,
|
||||||
|
destination,
|
||||||
|
idtrx,
|
||||||
|
supplier,
|
||||||
|
) => {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(
|
if(supplier.code != 'IRS'){
|
||||||
`${irs_url}?id=${irs_id}&pin=${irs_pin}&user=${irs_user}&pass=${irs_pass}&kodeproduk=${productCode}&tujuan=${destination}&counter=1&idtrx=${idtrx}`,
|
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;
|
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) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,6 +448,10 @@ export class TransactionService {
|
||||||
orderTransactionDto.productCode,
|
orderTransactionDto.productCode,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const supplier = await this.supplierService.findByCode(
|
||||||
|
product.supplier.code,
|
||||||
|
);
|
||||||
|
|
||||||
let product_price = await this.productHistoryPriceService.findOne(
|
let product_price = await this.productHistoryPriceService.findOne(
|
||||||
product.id,
|
product.id,
|
||||||
userData.partner?.id,
|
userData.partner?.id,
|
||||||
|
@ -489,12 +493,21 @@ export class TransactionService {
|
||||||
})
|
})
|
||||||
.join('');
|
.join('');
|
||||||
|
|
||||||
const hitSupplier = await doTransaction(
|
let hitSupplier = await doTransaction(
|
||||||
orderTransactionDto.productCode,
|
orderTransactionDto.productCode,
|
||||||
orderTransactionDto.destination,
|
orderTransactionDto.destination,
|
||||||
trxId,
|
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 = {
|
// const hitSupplier = {
|
||||||
// harga: 2000,
|
// harga: 2000,
|
||||||
// success: true,
|
// success: true,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user