@7365admin1/core 3.34.4-staging.20 → 3.34.4-staging.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/index.js +103 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2809,8 +2809,8 @@ type visitorPersonService = {
|
|
|
2809
2809
|
nric: string;
|
|
2810
2810
|
name: string;
|
|
2811
2811
|
contact: string;
|
|
2812
|
-
plateNumber
|
|
2813
|
-
email
|
|
2812
|
+
plateNumber?: string;
|
|
2813
|
+
email?: string;
|
|
2814
2814
|
type: visitorType;
|
|
2815
2815
|
site: string | ObjectId;
|
|
2816
2816
|
company?: string;
|
|
@@ -2821,7 +2821,7 @@ type visitorPersonRepo = {
|
|
|
2821
2821
|
name: string;
|
|
2822
2822
|
contacts: string[];
|
|
2823
2823
|
plateNumbers: string[];
|
|
2824
|
-
email
|
|
2824
|
+
email?: string;
|
|
2825
2825
|
type: visitorType;
|
|
2826
2826
|
site: string | ObjectId;
|
|
2827
2827
|
companyName: string[];
|
package/dist/index.js
CHANGED
|
@@ -34292,8 +34292,20 @@ function usePersonService() {
|
|
|
34292
34292
|
const email = value.email?.trim();
|
|
34293
34293
|
const type = value.type?.trim();
|
|
34294
34294
|
const company = value.company?.trim();
|
|
34295
|
+
const nricQuery = nric ? { nric: { $regex: `^${escapeRegex(nric)}$`, $options: "i" } } : null;
|
|
34296
|
+
const nameQuery = name ? { name: { $regex: `^${escapeRegex(name)}$`, $options: "i" } } : null;
|
|
34297
|
+
let nricCondition = null;
|
|
34298
|
+
if (nric) {
|
|
34299
|
+
if (nric.length < 9) {
|
|
34300
|
+
if (nameQuery) {
|
|
34301
|
+
nricCondition = { $and: [nricQuery, nameQuery] };
|
|
34302
|
+
}
|
|
34303
|
+
} else {
|
|
34304
|
+
nricCondition = nricQuery;
|
|
34305
|
+
}
|
|
34306
|
+
}
|
|
34295
34307
|
const orConditions = [
|
|
34296
|
-
...
|
|
34308
|
+
...nricCondition ? [nricCondition] : [],
|
|
34297
34309
|
...contact ? [{ contacts: { $regex: `^\\+?${cleanPhone(escapeRegex(contact))}$`, $options: "i" } }] : [],
|
|
34298
34310
|
...plateNumber ? [{ plateNumbers: { $regex: `^${escapeRegex(plateNumber)}$`, $options: "i" } }] : []
|
|
34299
34311
|
];
|
|
@@ -35687,7 +35699,6 @@ function useVisitorTransactionService() {
|
|
|
35687
35699
|
value.unitName = unit?.name;
|
|
35688
35700
|
}
|
|
35689
35701
|
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35690
|
-
console.log("type", type);
|
|
35691
35702
|
if (/^(guest|walk-in|contractor|delivery)$/.test(type)) {
|
|
35692
35703
|
await addUpdateFromVisitor({
|
|
35693
35704
|
nric,
|
|
@@ -35699,7 +35710,7 @@ function useVisitorTransactionService() {
|
|
|
35699
35710
|
site,
|
|
35700
35711
|
company,
|
|
35701
35712
|
updatedBy: createdBy
|
|
35702
|
-
});
|
|
35713
|
+
}, session);
|
|
35703
35714
|
}
|
|
35704
35715
|
if (Array.isArray(value.members) && value.members.length > 0) {
|
|
35705
35716
|
const chunkSize = 10;
|
|
@@ -35720,7 +35731,18 @@ function useVisitorTransactionService() {
|
|
|
35720
35731
|
await Promise.all(
|
|
35721
35732
|
chunk.map(async (member) => {
|
|
35722
35733
|
const clonedMember = structuredClone(member);
|
|
35723
|
-
const { visitorPass, passKeys } = clonedMember;
|
|
35734
|
+
const { visitorPass, passKeys, nric: nric2, name: name2, contact: contact2 } = clonedMember;
|
|
35735
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type2 ?? "invalid") && site2) {
|
|
35736
|
+
await addUpdateFromVisitor({
|
|
35737
|
+
nric: nric2,
|
|
35738
|
+
name: name2,
|
|
35739
|
+
contact: contact2,
|
|
35740
|
+
type: type2,
|
|
35741
|
+
site: site2,
|
|
35742
|
+
company: company2,
|
|
35743
|
+
updatedBy: createdBy
|
|
35744
|
+
}, session);
|
|
35745
|
+
}
|
|
35724
35746
|
const preparedVisitorPass = Array.isArray(visitorPass) ? visitorPass.map((item) => ({
|
|
35725
35747
|
...item,
|
|
35726
35748
|
receivedDate: /* @__PURE__ */ new Date(),
|
|
@@ -35907,16 +35929,30 @@ function useVisitorTransactionService() {
|
|
|
35907
35929
|
const parsed = new Date(value.checkIn);
|
|
35908
35930
|
value.checkIn = isNaN(parsed.getTime()) ? null : parsed;
|
|
35909
35931
|
}
|
|
35932
|
+
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35933
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type)) {
|
|
35934
|
+
await addUpdateFromVisitor({
|
|
35935
|
+
nric,
|
|
35936
|
+
name,
|
|
35937
|
+
contact,
|
|
35938
|
+
plateNumber,
|
|
35939
|
+
email,
|
|
35940
|
+
type,
|
|
35941
|
+
site,
|
|
35942
|
+
company,
|
|
35943
|
+
updatedBy: createdBy
|
|
35944
|
+
}, session);
|
|
35945
|
+
}
|
|
35910
35946
|
if (value.isMembersAdded != true && Array.isArray(value.members) && value.members.length > 0) {
|
|
35911
35947
|
const chunkSize = 10;
|
|
35912
35948
|
const {
|
|
35913
35949
|
block,
|
|
35914
35950
|
level,
|
|
35915
35951
|
unit,
|
|
35916
|
-
site,
|
|
35952
|
+
site: site2,
|
|
35917
35953
|
org,
|
|
35918
|
-
type,
|
|
35919
|
-
company,
|
|
35954
|
+
type: type2,
|
|
35955
|
+
company: company2,
|
|
35920
35956
|
remarks,
|
|
35921
35957
|
contractorType,
|
|
35922
35958
|
unitName
|
|
@@ -35926,7 +35962,18 @@ function useVisitorTransactionService() {
|
|
|
35926
35962
|
await Promise.all(
|
|
35927
35963
|
chunk.map(async (member) => {
|
|
35928
35964
|
const clonedMember = structuredClone(member);
|
|
35929
|
-
const { visitorPass, passKeys } = clonedMember;
|
|
35965
|
+
const { visitorPass, passKeys, nric: nric2, name: name2, contact: contact2 } = clonedMember;
|
|
35966
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type2 ?? "invalid") && site2) {
|
|
35967
|
+
await addUpdateFromVisitor({
|
|
35968
|
+
nric: nric2,
|
|
35969
|
+
name: name2,
|
|
35970
|
+
contact: contact2,
|
|
35971
|
+
type: type2,
|
|
35972
|
+
site: site2,
|
|
35973
|
+
company: company2,
|
|
35974
|
+
updatedBy: createdBy
|
|
35975
|
+
}, session);
|
|
35976
|
+
}
|
|
35930
35977
|
const preparedVisitorPass = Array.isArray(visitorPass) ? visitorPass.map((item) => ({
|
|
35931
35978
|
...item,
|
|
35932
35979
|
receivedDate: /* @__PURE__ */ new Date(),
|
|
@@ -35948,10 +35995,10 @@ function useVisitorTransactionService() {
|
|
|
35948
35995
|
level,
|
|
35949
35996
|
unit,
|
|
35950
35997
|
unitName,
|
|
35951
|
-
site,
|
|
35998
|
+
site: site2,
|
|
35952
35999
|
org,
|
|
35953
|
-
type,
|
|
35954
|
-
company,
|
|
36000
|
+
type: type2,
|
|
36001
|
+
company: company2,
|
|
35955
36002
|
remarks,
|
|
35956
36003
|
contractorType,
|
|
35957
36004
|
checkIn: value.checkIn,
|
|
@@ -64503,34 +64550,62 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
64503
64550
|
|
|
64504
64551
|
// src/utils/payment-signature.util.ts
|
|
64505
64552
|
var crypto3 = __toESM(require("crypto"));
|
|
64553
|
+
function hasOwn(obj, key) {
|
|
64554
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
64555
|
+
}
|
|
64556
|
+
function sha512(input) {
|
|
64557
|
+
return crypto3.createHash("sha512").update(input).digest("hex");
|
|
64558
|
+
}
|
|
64559
|
+
function assertSecret(secretKey) {
|
|
64560
|
+
if (!secretKey) {
|
|
64561
|
+
throw new Error("Payment signature: missing secret key.");
|
|
64562
|
+
}
|
|
64563
|
+
}
|
|
64506
64564
|
function paymentSignature(params, secretKey) {
|
|
64507
|
-
|
|
64565
|
+
assertSecret(secretKey);
|
|
64566
|
+
const fieldOrder = [
|
|
64567
|
+
"mid",
|
|
64568
|
+
"order_id",
|
|
64569
|
+
"payment_type",
|
|
64570
|
+
"amount",
|
|
64571
|
+
"ccy",
|
|
64572
|
+
"card_no",
|
|
64573
|
+
"exp_date",
|
|
64574
|
+
"cvv2"
|
|
64575
|
+
];
|
|
64508
64576
|
let concatenated = "";
|
|
64509
64577
|
fieldOrder.forEach((v) => {
|
|
64510
|
-
if (!params
|
|
64578
|
+
if (!hasOwn(params, v)) {
|
|
64511
64579
|
return;
|
|
64512
|
-
}
|
|
64513
|
-
|
|
64580
|
+
}
|
|
64581
|
+
const raw = String(params[v] ?? "");
|
|
64582
|
+
if (v === "cvv2") {
|
|
64583
|
+
concatenated += raw.slice(-1);
|
|
64514
64584
|
} else if (v === "card_no") {
|
|
64515
|
-
concatenated +=
|
|
64585
|
+
concatenated += raw.substring(0, 6) + raw.slice(-4);
|
|
64516
64586
|
} else {
|
|
64517
|
-
concatenated +=
|
|
64587
|
+
concatenated += raw;
|
|
64518
64588
|
}
|
|
64519
64589
|
});
|
|
64520
64590
|
concatenated += secretKey;
|
|
64521
|
-
|
|
64522
|
-
return signature;
|
|
64591
|
+
return sha512(concatenated);
|
|
64523
64592
|
}
|
|
64524
64593
|
function genericSignature(params, secretKey) {
|
|
64525
|
-
|
|
64594
|
+
assertSecret(secretKey);
|
|
64595
|
+
const paramsCopy = {
|
|
64596
|
+
...params
|
|
64597
|
+
};
|
|
64526
64598
|
delete paramsCopy["signature"];
|
|
64527
|
-
const
|
|
64528
|
-
|
|
64529
|
-
|
|
64530
|
-
|
|
64531
|
-
|
|
64532
|
-
|
|
64533
|
-
|
|
64599
|
+
const concatenated = Object.keys(paramsCopy).sort().map((key) => {
|
|
64600
|
+
const value = paramsCopy[key];
|
|
64601
|
+
if (value !== null && typeof value === "object") {
|
|
64602
|
+
throw new Error(
|
|
64603
|
+
`Payment signature: non-primitive value for field "${key}".`
|
|
64604
|
+
);
|
|
64605
|
+
}
|
|
64606
|
+
return String(value ?? "");
|
|
64607
|
+
}).join("") + secretKey;
|
|
64608
|
+
return sha512(concatenated);
|
|
64534
64609
|
}
|
|
64535
64610
|
|
|
64536
64611
|
// src/repositories/reddot-payment.repository.ts
|
|
@@ -64953,7 +65028,7 @@ var useRedDotPaymentSvc = () => {
|
|
|
64953
65028
|
};
|
|
64954
65029
|
if (!process.env.MERCHANT_ENQUIRY) {
|
|
64955
65030
|
throw new Error(
|
|
64956
|
-
"
|
|
65031
|
+
"MERCHANT_ENQUIRY environment variable is not defined."
|
|
64957
65032
|
);
|
|
64958
65033
|
}
|
|
64959
65034
|
const url = process.env.MERCHANT_ENQUIRY;
|