Merge branch 'devops-staging' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend
This commit is contained in:
commit
a62d651fc7
|
@ -1,4 +1,5 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import {HttpException, HttpStatus, NotFoundException} from "@nestjs/common";
|
||||||
|
|
||||||
const irs_url = 'http://h2h.elangpixiu.com/api/h2h';
|
const irs_url = 'http://h2h.elangpixiu.com/api/h2h';
|
||||||
const irs_id = 'PT0005';
|
const irs_id = 'PT0005';
|
||||||
|
@ -126,15 +127,39 @@ export const doTransaction = async (
|
||||||
const res = await axios.get(
|
const res = await axios.get(
|
||||||
`${supplier.url}?memberID=${supplier.irs_id}&pin=${supplier.irs_pin}&password=${supplier.irs_pass}&product=${productCode}&dest=${destination}&counter=1&refID=${idtrx}`,
|
`${supplier.url}?memberID=${supplier.irs_id}&pin=${supplier.irs_pin}&password=${supplier.irs_pass}&product=${productCode}&dest=${destination}&counter=1&refID=${idtrx}`,
|
||||||
);
|
);
|
||||||
return res.data;
|
console.log('restransini', res);
|
||||||
console.log('restranshemat', res);
|
console.log('restransini1', res.status);
|
||||||
|
if (res.data.includes('Saldo anda tidak mencukupi')) {
|
||||||
|
throw new HttpException(
|
||||||
|
{
|
||||||
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali',
|
||||||
|
},
|
||||||
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali';
|
throw new HttpException(
|
||||||
|
{
|
||||||
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali',
|
||||||
|
},
|
||||||
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('errtransaction', err);
|
console.log('errtransaction', err);
|
||||||
console.log('errtransaction2', err.response.data);
|
console.log('errtransaction2', err.response.data);
|
||||||
throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali';
|
|
||||||
|
throw new HttpException(
|
||||||
|
{
|
||||||
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
error: 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali',
|
||||||
|
},
|
||||||
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user