@traxionpay/cbsmiddleware 0.0.15 → 0.0.17
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/banking/services/MBWIN.service.d.ts +7 -1
- package/dist/banking/services/MBWIN.service.d.ts.map +1 -1
- package/dist/banking/services/MBWIN.service.js +30 -6
- package/dist/banking/services/MBWIN.service.js.map +1 -1
- package/dist/logger/logger-option.d.ts.map +1 -1
- package/dist/logger/logger-option.js +4 -1
- package/dist/logger/logger-option.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/banking/services/MBWIN.service.ts +54 -8
- package/src/logger/logger-option.ts +5 -2
package/package.json
CHANGED
|
@@ -695,7 +695,23 @@ export class MBWINService implements BankService {
|
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
|
|
698
|
+
combineDateTime(date: string, time: string): string {
|
|
699
|
+
const isoString = `${date}T${time.padEnd(8, '0')}.000Z`; // ensure time is HH:mm:ss
|
|
700
|
+
const d = new Date(isoString);
|
|
701
|
+
|
|
702
|
+
// Format as: 2025-09-26T05:35:36.320+00:00
|
|
703
|
+
const isoWithOffset = d.toISOString().replace('Z', '+00:00');
|
|
704
|
+
|
|
705
|
+
return isoWithOffset;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
async getTransactionHistory(transactionHistoryDto: TransactionHistoryDto):
|
|
709
|
+
Promise<{
|
|
710
|
+
success: boolean;
|
|
711
|
+
message: any;
|
|
712
|
+
timestamp: any;
|
|
713
|
+
transactions: any;
|
|
714
|
+
}> {
|
|
699
715
|
|
|
700
716
|
const { token, account, dateFrom, dateTo, page, branch, accountType, fullName, birthDate, mobile, permissionKey } = transactionHistoryDto;
|
|
701
717
|
const mobileFormatted = mobile? formatTo09(mobile) : '';
|
|
@@ -819,21 +835,51 @@ export class MBWINService implements BankService {
|
|
|
819
835
|
|
|
820
836
|
const responseData = response.data;
|
|
821
837
|
|
|
822
|
-
|
|
823
|
-
|
|
838
|
+
this.logger.log({ responseData: response.data }, 'MBWIN transaction history Successful');
|
|
839
|
+
|
|
840
|
+
interface ReformattedTransaction {
|
|
841
|
+
dateTime: string;
|
|
842
|
+
amount: number;
|
|
843
|
+
type: string;
|
|
844
|
+
description: string;
|
|
845
|
+
transactionReference: string;
|
|
846
|
+
allDetails?: any
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
const reformattedTransactions: Record<string, ReformattedTransaction> = {};
|
|
850
|
+
|
|
851
|
+
if(!responseData?.data.success){
|
|
852
|
+
this.logger.error({ payload: payload, responseData }, 'MBWIN transaction history Error');
|
|
824
853
|
throw new HttpException({
|
|
825
854
|
statusCode: HttpStatus.BAD_REQUEST,
|
|
826
855
|
code: 4000, //TBD
|
|
827
|
-
message: responseData?.
|
|
828
|
-
data: { payload, response: responseData
|
|
856
|
+
message: responseData?.message || "Something went wrong!",
|
|
857
|
+
data: { payload, response: responseData }
|
|
829
858
|
}, HttpStatus.BAD_REQUEST);
|
|
830
859
|
}
|
|
831
860
|
|
|
832
|
-
|
|
833
|
-
|
|
861
|
+
if (responseData?.data && Array.isArray(responseData?.data?.trans)) {
|
|
862
|
+
responseData?.data?.trans.forEach((txn, index) => {
|
|
863
|
+
const key = `${index + 1}`;
|
|
864
|
+
// const dateTime = this.combineDateTime(txn.trnDate, txn.tranTime);
|
|
865
|
+
|
|
866
|
+
reformattedTransactions[key] = {
|
|
867
|
+
dateTime: txn.computerDate,
|
|
868
|
+
amount: txn.trnPriAmt,
|
|
869
|
+
type: txn.trnType,
|
|
870
|
+
description: txn.trnDesc,
|
|
871
|
+
transactionReference: '',
|
|
872
|
+
allDetails: {
|
|
873
|
+
...txn
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
});
|
|
877
|
+
}
|
|
834
878
|
return {
|
|
835
879
|
success: true,
|
|
836
|
-
|
|
880
|
+
message: response.data.data.message,
|
|
881
|
+
timestamp: response.data.timestamp,
|
|
882
|
+
transactions: reformattedTransactions,
|
|
837
883
|
}
|
|
838
884
|
}
|
|
839
885
|
catch (error) {
|
|
@@ -32,7 +32,7 @@ export const createFaultTolerantTransport = (): pino.TransportMultiOptions => {
|
|
|
32
32
|
singleLine: true,
|
|
33
33
|
mkdir: true,
|
|
34
34
|
prettyPrint: true,
|
|
35
|
-
translateTime: "yyyy-
|
|
35
|
+
translateTime: "SYS:yyyy-mm-dd'T'HH:MM:ss.l +0800",
|
|
36
36
|
// messageFormat:
|
|
37
37
|
// '{req.headers.x-correlation-id} [{context}] {responseTime} {msg}',
|
|
38
38
|
// ignore: 'pid,hostname,context,req,res,responseTime',
|
|
@@ -41,7 +41,10 @@ export const createFaultTolerantTransport = (): pino.TransportMultiOptions => {
|
|
|
41
41
|
zippedArchive: false,
|
|
42
42
|
maxFiles: '30d', // Keep logs for 30 days
|
|
43
43
|
colorize: true,
|
|
44
|
-
datePattern: 'YYYY-MM-DD',
|
|
44
|
+
datePattern: 'YYYY-MM-DD',
|
|
45
|
+
levelFirst: false,
|
|
46
|
+
messageFormat: "{req.headers.x-correlation-id} [{context}] {responseTime} {msg}",
|
|
47
|
+
ignore: "hostname,req,res",
|
|
45
48
|
};
|
|
46
49
|
const logFilename = generateLogFilename();
|
|
47
50
|
const logStream = ensureLogFileExists(logFilename);
|