Merge branch 'master' of https://gitlab.com/empatnusabangsa/ppob/ppob-backend into devops-production
This commit is contained in:
commit
42a1c219d9
37
package-lock.json
generated
37
package-lock.json
generated
|
@ -20,9 +20,11 @@
|
||||||
"@nestjs/typeorm": "^8.0.2",
|
"@nestjs/typeorm": "^8.0.2",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"bluebird": "^3.7.2",
|
"bluebird": "^3.7.2",
|
||||||
|
"blueimp-md5": "^2.19.0",
|
||||||
"class-transformer": "^0.4.0",
|
"class-transformer": "^0.4.0",
|
||||||
"class-validator": "^0.13.1",
|
"class-validator": "^0.13.1",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
|
"crypto-md5": "^1.0.0",
|
||||||
"csv-parser": "^3.0.0",
|
"csv-parser": "^3.0.0",
|
||||||
"decimal.js": "^10.3.1",
|
"decimal.js": "^10.3.1",
|
||||||
"exceljs": "^4.3.0",
|
"exceljs": "^4.3.0",
|
||||||
|
@ -30,6 +32,7 @@
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"joi": "^17.4.2",
|
"joi": "^17.4.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"md5-hash": "^1.0.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"nestjs-pino": "^2.3.1",
|
"nestjs-pino": "^2.3.1",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
|
@ -3103,6 +3106,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/blueimp-md5": {
|
||||||
|
"version": "2.19.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz",
|
||||||
|
"integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w=="
|
||||||
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||||
|
@ -3835,6 +3843,15 @@
|
||||||
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
|
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
|
||||||
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in."
|
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in."
|
||||||
},
|
},
|
||||||
|
"node_modules/crypto-md5": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto-md5/-/crypto-md5-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-65Mtei8+EkSIK+5Ie4gpWXoJ/5bgpqPXFknHHXAyhDqKsEAAzUslGd8mOeawbfcuQ8fADNKcF4xQA3fqlZJ8Ig==",
|
||||||
|
"engines": {
|
||||||
|
"iojs": ">=1.0.0",
|
||||||
|
"node": ">=0.5.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cssom": {
|
"node_modules/cssom": {
|
||||||
"version": "0.4.4",
|
"version": "0.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
|
||||||
|
@ -7348,6 +7365,11 @@
|
||||||
"tmpl": "1.0.5"
|
"tmpl": "1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/md5-hash": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/md5-hash/-/md5-hash-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-McGTs7cIc3JSw9SJH5JxFCJRoI1bi9tKh89LZxpHobmY2YGGhYTnDZ2rxcvNv0Bs1gBbSwSQfCwbuFleZOkkYA=="
|
||||||
|
},
|
||||||
"node_modules/media-typer": {
|
"node_modules/media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
@ -13012,6 +13034,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
||||||
},
|
},
|
||||||
|
"blueimp-md5": {
|
||||||
|
"version": "2.19.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz",
|
||||||
|
"integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w=="
|
||||||
|
},
|
||||||
"body-parser": {
|
"body-parser": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
||||||
|
@ -13583,6 +13610,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
|
||||||
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig=="
|
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig=="
|
||||||
},
|
},
|
||||||
|
"crypto-md5": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto-md5/-/crypto-md5-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-65Mtei8+EkSIK+5Ie4gpWXoJ/5bgpqPXFknHHXAyhDqKsEAAzUslGd8mOeawbfcuQ8fADNKcF4xQA3fqlZJ8Ig=="
|
||||||
|
},
|
||||||
"cssom": {
|
"cssom": {
|
||||||
"version": "0.4.4",
|
"version": "0.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
|
||||||
|
@ -16390,6 +16422,11 @@
|
||||||
"tmpl": "1.0.5"
|
"tmpl": "1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"md5-hash": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/md5-hash/-/md5-hash-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-McGTs7cIc3JSw9SJH5JxFCJRoI1bi9tKh89LZxpHobmY2YGGhYTnDZ2rxcvNv0Bs1gBbSwSQfCwbuFleZOkkYA=="
|
||||||
|
},
|
||||||
"media-typer": {
|
"media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
|
|
@ -33,9 +33,11 @@
|
||||||
"@nestjs/typeorm": "^8.0.2",
|
"@nestjs/typeorm": "^8.0.2",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"bluebird": "^3.7.2",
|
"bluebird": "^3.7.2",
|
||||||
|
"blueimp-md5": "^2.19.0",
|
||||||
"class-transformer": "^0.4.0",
|
"class-transformer": "^0.4.0",
|
||||||
"class-validator": "^0.13.1",
|
"class-validator": "^0.13.1",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
|
"crypto-md5": "^1.0.0",
|
||||||
"csv-parser": "^3.0.0",
|
"csv-parser": "^3.0.0",
|
||||||
"decimal.js": "^10.3.1",
|
"decimal.js": "^10.3.1",
|
||||||
"exceljs": "^4.3.0",
|
"exceljs": "^4.3.0",
|
||||||
|
@ -43,6 +45,7 @@
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"joi": "^17.4.2",
|
"joi": "^17.4.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"md5-hash": "^1.0.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"nestjs-pino": "^2.3.1",
|
"nestjs-pino": "^2.3.1",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
|
|
|
@ -13,6 +13,7 @@ export const doTransaction = async (
|
||||||
supplier,
|
supplier,
|
||||||
authorization,
|
authorization,
|
||||||
typePaid,
|
typePaid,
|
||||||
|
billTrxId,
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
if (supplier.code == 'IRS') {
|
if (supplier.code == 'IRS') {
|
||||||
|
@ -27,12 +28,86 @@ export const doTransaction = async (
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
} else if (supplier.code == 'Hemat') {
|
} else if (supplier.code == 'Digiflazz') {
|
||||||
if (authorization != "") {
|
if (typePaid == 'INQUIRY') {
|
||||||
console.log("initoken", authorization)
|
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
|
||||||
|
const md5Hash = require("blueimp-md5");
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
headers: {'Content-Type': 'application/json',
|
headers: { 'Content-Type': 'application/json' },
|
||||||
'Authorization': 'Bearer ' + authorization}
|
};
|
||||||
|
const data = {
|
||||||
|
commands: 'inq-pasca',
|
||||||
|
username: supplier.irs_user,
|
||||||
|
customer_no: `${destination}`,
|
||||||
|
buyer_sku_code: `${productCode}`,
|
||||||
|
ref_id: `${idtrx}`,
|
||||||
|
sign: md5Hash(md5HashDigiflazz),
|
||||||
|
testing: true,
|
||||||
|
};
|
||||||
|
const res = await axios.post(
|
||||||
|
`${supplier.url}/transaction`,
|
||||||
|
data,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.data.data;
|
||||||
|
} else if (typePaid == 'PAYMENT') {
|
||||||
|
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
|
||||||
|
const md5Hash = require("blueimp-md5");
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
};
|
||||||
|
const data = {
|
||||||
|
commands: 'pay-pasca',
|
||||||
|
username: supplier.irs_user,
|
||||||
|
customer_no: `${destination}`,
|
||||||
|
buyer_sku_code: `${productCode}`,
|
||||||
|
ref_id: `${billTrxId}`,
|
||||||
|
sign: md5Hash(md5HashDigiflazz),
|
||||||
|
testing: true,
|
||||||
|
};
|
||||||
|
const res = await axios.post(
|
||||||
|
`${supplier.url}/transaction`,
|
||||||
|
data,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.data.data;
|
||||||
|
} else {
|
||||||
|
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
|
||||||
|
const md5Hash = require("blueimp-md5");
|
||||||
|
console.log('testmd5', md5HashDigiflazz);
|
||||||
|
const options = {
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
};
|
||||||
|
const data = {
|
||||||
|
username: supplier.irs_user,
|
||||||
|
customer_no: `${destination}`,
|
||||||
|
buyer_sku_code: `${productCode}`,
|
||||||
|
ref_id: `${idtrx}`,
|
||||||
|
sign: md5Hash(md5HashDigiflazz),
|
||||||
|
testing: true,
|
||||||
|
};
|
||||||
|
const res = await axios.post(
|
||||||
|
`${supplier.url}/transaction`,
|
||||||
|
data,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('resdigiflazz', res);
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
} else if (supplier.code == 'Hemat') {
|
||||||
|
if (authorization != '') {
|
||||||
|
console.log('initoken', authorization);
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: `Bearer ${authorization}`,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const data = {
|
const data = {
|
||||||
idtransaction: idtrx,
|
idtransaction: idtrx,
|
||||||
|
@ -40,7 +115,11 @@ export const doTransaction = async (
|
||||||
code: `${productCode}`,
|
code: `${productCode}`,
|
||||||
type: `${typePaid}`,
|
type: `${typePaid}`,
|
||||||
};
|
};
|
||||||
const res = await axios.post(`${supplier.url}/v1/transaction/request`, data, options);
|
const res = await axios.post(
|
||||||
|
`${supplier.url}/v1/transaction/request`,
|
||||||
|
data,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
@ -52,9 +131,11 @@ export const doTransaction = async (
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
|
||||||
console.log('restranshemat', res)
|
console.log('restranshemat', res);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('errtranshemat', err);
|
console.log('errtransaction', err);
|
||||||
|
console.log('errtransaction2', err.response.data);
|
||||||
|
|
||||||
if (err.includes('Maaf Saldo anda tidak mencukupi')) {
|
if (err.includes('Maaf Saldo anda tidak mencukupi')) {
|
||||||
throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali';
|
throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -152,4 +152,24 @@ export class PpobCallbackController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Public()
|
||||||
|
@Post('/digiflazz')
|
||||||
|
async getDigiflazz(@Req() request: FastifyRequest) {
|
||||||
|
const response = request.body;
|
||||||
|
console.log('responsedigiflazz', response);
|
||||||
|
if (response['data']['message'] != 'Transaksi Sukses') {
|
||||||
|
//TODO: UPDATE GAGAL
|
||||||
|
await this.transactionService.checkCallbackOrderFailed(
|
||||||
|
response['data']['ref_id'],
|
||||||
|
response['data'],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
//TODO: UPDATE BERHASIL
|
||||||
|
await this.transactionService.checkCallbackOrderSuccess(
|
||||||
|
response['data']['ref_id'],
|
||||||
|
response['data'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,7 +614,9 @@ export class TransactionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
//HIT API SUPPLIER
|
//HIT API SUPPLIER
|
||||||
const trxId = Array(11)
|
let trxId;
|
||||||
|
|
||||||
|
trxId = Array(11)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map(() => {
|
.map(() => {
|
||||||
return Math.round(Math.random() * 16).toString(16);
|
return Math.round(Math.random() * 16).toString(16);
|
||||||
|
@ -635,6 +637,7 @@ export class TransactionService {
|
||||||
supplier,
|
supplier,
|
||||||
hitLoginHemat.data,
|
hitLoginHemat.data,
|
||||||
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
) : await doTransaction(
|
) : await doTransaction(
|
||||||
orderTransactionDto.productCode,
|
orderTransactionDto.productCode,
|
||||||
orderTransactionDto.destination,
|
orderTransactionDto.destination,
|
||||||
|
@ -642,6 +645,7 @@ export class TransactionService {
|
||||||
supplier,
|
supplier,
|
||||||
"",
|
"",
|
||||||
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
);
|
);
|
||||||
|
|
||||||
// let hitSupplier;
|
// let hitSupplier;
|
||||||
|
@ -677,6 +681,30 @@ export class TransactionService {
|
||||||
|
|
||||||
hitSupplier = newHitSupplier;
|
hitSupplier = newHitSupplier;
|
||||||
|
|
||||||
|
if (orderTransactionDto.bill_trx_id !== null) {
|
||||||
|
hitSupplier.harga = product_price.price;
|
||||||
|
}
|
||||||
|
} else if (supplier.code == 'Digiflazz') {
|
||||||
|
let newHitSupplier;
|
||||||
|
|
||||||
|
if (product.type == 'prepaid') {
|
||||||
|
newHitSupplier = {
|
||||||
|
success: hitSupplier.status.includes('Pending') || hitSupplier.status.includes('Sukses'),
|
||||||
|
sn: hitSupplier.sn,
|
||||||
|
harga: hitSupplier.price,
|
||||||
|
msg: hitSupplier.message,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
newHitSupplier= {
|
||||||
|
success: hitSupplier.status.includes('Pending') || hitSupplier.status.includes('Sukses'),
|
||||||
|
harga: hitSupplier.price,
|
||||||
|
msg: hitSupplier.message,
|
||||||
|
sn: hitSupplier.sn,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
hitSupplier = newHitSupplier;
|
||||||
|
|
||||||
if (orderTransactionDto.bill_trx_id !== null) {
|
if (orderTransactionDto.bill_trx_id !== null) {
|
||||||
hitSupplier.harga = product_price.price;
|
hitSupplier.harga = product_price.price;
|
||||||
}
|
}
|
||||||
|
@ -742,10 +770,9 @@ export class TransactionService {
|
||||||
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
||||||
transactionData.supplier_trx_id = trxId;
|
transactionData.supplier_trx_id = trxId;
|
||||||
transactionData.check_bill = orderTransactionDto.bill_trx_id;
|
transactionData.check_bill = orderTransactionDto.bill_trx_id;
|
||||||
transactionData.balance_remaining =
|
|
||||||
coaAccount.amount - product_price.mark_up_price - costInventory;
|
|
||||||
|
|
||||||
if (!hitSupplier.success) {
|
if (!hitSupplier.success) {
|
||||||
|
transactionData.balance_remaining = coaAccount.amount;
|
||||||
transactionData.status = statusTransaction.FAILED;
|
transactionData.status = statusTransaction.FAILED;
|
||||||
status = statusTransaction[transactionData.status];
|
status = statusTransaction[transactionData.status];
|
||||||
await this.transactionRepository.insert(transactionData);
|
await this.transactionRepository.insert(transactionData);
|
||||||
|
@ -757,8 +784,20 @@ export class TransactionService {
|
||||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
transactionData.balance_remaining =
|
||||||
|
coaAccount.amount - product_price.mark_up_price - costInventory;
|
||||||
|
if (
|
||||||
|
hitSupplier.sn == null ||
|
||||||
|
hitSupplier.sn == '' ||
|
||||||
|
hitSupplier.sn == undefined
|
||||||
|
) {
|
||||||
transactionData.status = statusTransaction.PENDING;
|
transactionData.status = statusTransaction.PENDING;
|
||||||
status = statusTransaction[transactionData.status];
|
status = statusTransaction[transactionData.status];
|
||||||
|
} else {
|
||||||
|
transactionData.seri_number = hitSupplier.sn;
|
||||||
|
transactionData.status = statusTransaction.SUCCESS;
|
||||||
|
status = statusTransaction[transactionData.status];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await manager.insert(Transactions, transactionData);
|
await manager.insert(Transactions, transactionData);
|
||||||
|
@ -882,6 +921,7 @@ export class TransactionService {
|
||||||
supplier,
|
supplier,
|
||||||
hitLoginHemat.data,
|
hitLoginHemat.data,
|
||||||
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
) : await doTransaction(
|
) : await doTransaction(
|
||||||
orderTransactionDto.productCode,
|
orderTransactionDto.productCode,
|
||||||
orderTransactionDto.destination,
|
orderTransactionDto.destination,
|
||||||
|
@ -889,6 +929,7 @@ export class TransactionService {
|
||||||
supplier,
|
supplier,
|
||||||
"",
|
"",
|
||||||
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
product.type == 'prepaid' ? 'PURCHASE' : 'PAYMENT',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
);
|
);
|
||||||
|
|
||||||
if (supplier.code != 'IRS') {
|
if (supplier.code != 'IRS') {
|
||||||
|
@ -1030,21 +1071,39 @@ export class TransactionService {
|
||||||
hitLoginHemat = await doAuthorizeHemat(supplier.irs_user, supplier.irs_pass, supplier);
|
hitLoginHemat = await doAuthorizeHemat(supplier.irs_user, supplier.irs_pass, supplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
let hitSupplier = supplier.code == 'Hemat' ? await doTransaction(
|
let hitSupplier;
|
||||||
|
|
||||||
|
if (supplier.code == 'Hemat') {
|
||||||
|
hitSupplier = await doTransaction(
|
||||||
orderTransactionDto.productCode,
|
orderTransactionDto.productCode,
|
||||||
orderTransactionDto.destination,
|
orderTransactionDto.destination,
|
||||||
trxId,
|
trxId,
|
||||||
supplier,
|
supplier,
|
||||||
hitLoginHemat.data,
|
hitLoginHemat.data,
|
||||||
'INQUIRY'
|
'INQUIRY',
|
||||||
) : await doTransaction(
|
orderTransactionDto.bill_trx_id
|
||||||
`CEK${orderTransactionDto.productCode.slice(3)}`,
|
)
|
||||||
|
} else if (supplier.code == 'Digiflazz') {
|
||||||
|
hitSupplier = await doTransaction(
|
||||||
|
orderTransactionDto.productCode,
|
||||||
|
orderTransactionDto.destination,
|
||||||
|
trxId,
|
||||||
|
supplier,
|
||||||
|
hitLoginHemat.data,
|
||||||
|
'INQUIRY',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
await doTransaction(
|
||||||
|
hitSupplier= `CEK${orderTransactionDto.productCode.slice(3)}`,
|
||||||
orderTransactionDto.destination,
|
orderTransactionDto.destination,
|
||||||
trxId,
|
trxId,
|
||||||
supplier,
|
supplier,
|
||||||
"",
|
"",
|
||||||
'INQUIRY'
|
'INQUIRY',
|
||||||
|
orderTransactionDto.bill_trx_id
|
||||||
);
|
);
|
||||||
|
}
|
||||||
// const parsingResponse = hitSupplier.split(' ');
|
// const parsingResponse = hitSupplier.split(' ');
|
||||||
|
|
||||||
if (supplier.code == 'Hemat') {
|
if (supplier.code == 'Hemat') {
|
||||||
|
@ -1052,6 +1111,11 @@ export class TransactionService {
|
||||||
success: hitSupplier.success == true,
|
success: hitSupplier.success == true,
|
||||||
msg: hitSupplier.msg,
|
msg: hitSupplier.msg,
|
||||||
};
|
};
|
||||||
|
} else if (supplier.code == 'Digiflazz') {
|
||||||
|
hitSupplier = {
|
||||||
|
success: hitSupplier.status.includes('Sukses'),
|
||||||
|
msg: hitSupplier.message,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
hitSupplier = {
|
hitSupplier = {
|
||||||
success: hitSupplier.includes('diproses') || hitSupplier.includes('dalam proses'),
|
success: hitSupplier.includes('diproses') || hitSupplier.includes('dalam proses'),
|
||||||
|
@ -1500,6 +1564,10 @@ export class TransactionService {
|
||||||
} else {
|
} else {
|
||||||
dataProductHistoryPrice.price = parseInt(callback['data']['additional']['harga']);
|
dataProductHistoryPrice.price = parseInt(callback['data']['additional']['harga']);
|
||||||
}
|
}
|
||||||
|
} else if (supplier.code == 'Digiflazz') {
|
||||||
|
if (callback['sn']) {
|
||||||
|
dataTransaction.seri_number = callback['sn'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (callback['sn']) {
|
if (callback['sn']) {
|
||||||
dataTransaction.seri_number = callback['sn'];
|
dataTransaction.seri_number = callback['sn'];
|
||||||
|
|
15
yarn.lock
15
yarn.lock
|
@ -1765,6 +1765,11 @@
|
||||||
"resolved" "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz"
|
"resolved" "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz"
|
||||||
"version" "3.4.7"
|
"version" "3.4.7"
|
||||||
|
|
||||||
|
"blueimp-md5@^2.19.0":
|
||||||
|
"integrity" "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w=="
|
||||||
|
"resolved" "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz"
|
||||||
|
"version" "2.19.0"
|
||||||
|
|
||||||
"body-parser@1.19.0":
|
"body-parser@1.19.0":
|
||||||
"integrity" "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw=="
|
"integrity" "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw=="
|
||||||
"resolved" "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz"
|
"resolved" "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz"
|
||||||
|
@ -2265,6 +2270,11 @@
|
||||||
"shebang-command" "^2.0.0"
|
"shebang-command" "^2.0.0"
|
||||||
"which" "^2.0.1"
|
"which" "^2.0.1"
|
||||||
|
|
||||||
|
"crypto-md5@^1.0.0":
|
||||||
|
"integrity" "sha512-65Mtei8+EkSIK+5Ie4gpWXoJ/5bgpqPXFknHHXAyhDqKsEAAzUslGd8mOeawbfcuQ8fADNKcF4xQA3fqlZJ8Ig=="
|
||||||
|
"resolved" "https://registry.npmjs.org/crypto-md5/-/crypto-md5-1.0.0.tgz"
|
||||||
|
"version" "1.0.0"
|
||||||
|
|
||||||
"crypto@^1.0.1":
|
"crypto@^1.0.1":
|
||||||
"integrity" "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig=="
|
"integrity" "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig=="
|
||||||
"resolved" "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz"
|
"resolved" "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz"
|
||||||
|
@ -4381,6 +4391,11 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"tmpl" "1.0.5"
|
"tmpl" "1.0.5"
|
||||||
|
|
||||||
|
"md5-hash@^1.0.1":
|
||||||
|
"integrity" "sha512-McGTs7cIc3JSw9SJH5JxFCJRoI1bi9tKh89LZxpHobmY2YGGhYTnDZ2rxcvNv0Bs1gBbSwSQfCwbuFleZOkkYA=="
|
||||||
|
"resolved" "https://registry.npmjs.org/md5-hash/-/md5-hash-1.0.1.tgz"
|
||||||
|
"version" "1.0.1"
|
||||||
|
|
||||||
"media-typer@0.3.0":
|
"media-typer@0.3.0":
|
||||||
"integrity" "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
"integrity" "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||||
"resolved" "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
|
"resolved" "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user