- added digiflazz supplier

This commit is contained in:
Fadli 2023-02-22 20:48:34 +07:00
parent 5463d1b12b
commit cfb7d035f6
4 changed files with 28 additions and 12 deletions

15
package-lock.json generated
View File

@ -23,6 +23,7 @@
"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",
@ -3835,6 +3836,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",
@ -13583,6 +13593,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",

View File

@ -36,6 +36,7 @@
"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",

View File

@ -32,9 +32,7 @@ export const doTransaction = async (
} else if (supplier.code == 'Digiflazz') { } else if (supplier.code == 'Digiflazz') {
if (typePaid == 'INQUIRY') { if (typePaid == 'INQUIRY') {
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`; const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
const cryptoMd5 = require('crypto'); var cryptoMd5 = require('md5');
cryptoMd5.createHash('md5').update(md5HashDigiflazz).digest('hex');
const options = { const options = {
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
@ -45,7 +43,7 @@ export const doTransaction = async (
customer_no: `${destination}`, customer_no: `${destination}`,
buyer_sku_code: `${productCode}`, buyer_sku_code: `${productCode}`,
ref_id: `${idtrx}`, ref_id: `${idtrx}`,
sign: cryptoMd5, sign: cryptoMd5(md5HashDigiflazz, 'hex'),
testing: true, testing: true,
}; };
const res = await axios.post( const res = await axios.post(
@ -57,9 +55,7 @@ export const doTransaction = async (
return res.data; return res.data;
} else if (typePaid == 'PAYMENT') { } else if (typePaid == 'PAYMENT') {
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`; const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
const cryptoMd5 = require('crypto'); var cryptoMd5 = require('md5');
cryptoMd5.createHash('md5').update(md5HashDigiflazz).digest('hex');
const options = { const options = {
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
@ -70,7 +66,7 @@ export const doTransaction = async (
customer_no: `${destination}`, customer_no: `${destination}`,
buyer_sku_code: `${productCode}`, buyer_sku_code: `${productCode}`,
ref_id: `${billTrxId}`, ref_id: `${billTrxId}`,
sign: cryptoMd5, sign: cryptoMd5(md5HashDigiflazz, 'hex'),
testing: true, testing: true,
}; };
const res = await axios.post( const res = await axios.post(
@ -82,9 +78,7 @@ export const doTransaction = async (
return res.data; return res.data;
} else { } else {
const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`; const md5HashDigiflazz = `${supplier.irs_user}${supplier.irs_pass}${idtrx}`;
const cryptoMd5 = require('crypto'); var cryptoMd5 = require('md5');
cryptoMd5.createHash('md5').update(md5HashDigiflazz).digest('hex');
const options = { const options = {
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
@ -94,7 +88,7 @@ export const doTransaction = async (
customer_no: `${destination}`, customer_no: `${destination}`,
buyer_sku_code: `${productCode}`, buyer_sku_code: `${productCode}`,
ref_id: `${idtrx}`, ref_id: `${idtrx}`,
sign: cryptoMd5, sign: cryptoMd5(md5HashDigiflazz, 'hex'),
testing: true, testing: true,
}; };
const res = await axios.post( const res = await axios.post(
@ -103,6 +97,7 @@ export const doTransaction = async (
options, options,
); );
console.log('resdigiflazz', res);
return res.data; return res.data;
} }
} else if (supplier.code == 'Hemat') { } else if (supplier.code == 'Hemat') {

View File

@ -2265,6 +2265,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"