- | {log.type || ''} |
+
+ {(() => {
+ let status;
+ if (log.status === 'C') {
+ status = 'COMPLETE';
+ } else if (log.status === 'F') {
+ status = 'FAILED';
+ } else if (log.status === 'O') {
+ status = 'ON PROCESS';
+ } else if (log.status === 'P') {
+ status = 'PENDING';
+ } else if (log.status === 'R') {
+ status = 'ROLLBACK';
+ } else if (log.status === 'S') {
+ status = 'REVERSAL';
+ }
+ return status;
+ })()}
+ |
{log.request_date
? new Date(log.request_date).toLocaleDateString('en-GB', {
day: '2-digit',
@@ -737,10 +755,10 @@ const DetailApprovalTransaction = () => {
{(() => {
try {
- if (log.request_body === null) {
+ if (log.response_body === null) {
return '';
}
- const parsed = JSON.parse(log.request_body);
+ const parsed = JSON.parse(log.response_body);
return JSON.stringify(parsed, null, 2) ?? '';
} catch (e) {
return log.response_body ?? ''; // fallback: tampilkan as-is jika gagal parse
@@ -840,7 +858,7 @@ const DetailApprovalTransaction = () => {
- | Type |
+ Status |
Request Date |
Response Date |
Response Body |
@@ -850,9 +868,27 @@ const DetailApprovalTransaction = () => {
{transactionDetails?.p24 && transactionDetails?.p24.length > 0 ? (
- transactionDetails.p24.map((log: { request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
+ transactionDetails.p24.map((log: { status: string,request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
- | {log.type ?? ''} |
+
+ {(() => {
+ let status;
+ if (log.status === 'C') {
+ status = 'COMPLETE';
+ } else if (log.status === 'F') {
+ status = 'FAILED';
+ } else if (log.status === 'O') {
+ status = 'ON PROCESS';
+ } else if (log.status === 'P') {
+ status = 'PENDING';
+ } else if (log.status === 'R') {
+ status = 'ROLLBACK';
+ } else if (log.status === 'S') {
+ status = 'REVERSAL';
+ }
+ return status;
+ })()}
+ |
{log.request_date
? new Date(log.request_date).toLocaleDateString('en-GB', {
day: '2-digit',
@@ -883,10 +919,10 @@ const DetailApprovalTransaction = () => {
if (log.response_code === null) {
return '';
}
- const parsed = JSON.parse(log.request_body);
+ const parsed = JSON.parse(log.response_body);
return JSON.stringify(parsed, null, 2);
} catch (e) {
- return log.request_body; // fallback: tampilkan as-is jika gagal parse
+ return log.response_body; // fallback: tampilkan as-is jika gagal parse
}
})()}
diff --git a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx
index 09f8ff1..9876b39 100644
--- a/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx
+++ b/src/pages/transaction/history-transaction/blocks/DetailTransaction.tsx
@@ -49,6 +49,7 @@ const DetailTransaction = () => {
id: selectedTransactionId
});
setTransactionDetails(response?.data);
+ console.log(response?.data);
// console.log(selectedTransactionId);
} catch (error) {
console.error('Error fetching transaction', error);
@@ -744,7 +745,7 @@ const DetailTransaction = () => {
- | Type |
+ Status |
Request Date |
Response Date |
Response Body |
@@ -756,7 +757,25 @@ const DetailTransaction = () => {
{transactionDetails?.log && transactionDetails?.log.length > 0 ? (
transactionDetails.log.map((log: { type: string, request_endpoint: string, status: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
- | {log.type || ''} |
+
+ {(() => {
+ let status;
+ if (log.status === 'C') {
+ status = 'COMPLETE';
+ } else if (log.status === 'F') {
+ status = 'FAILED';
+ } else if (log.status === 'O') {
+ status = 'ON PROCESS';
+ } else if (log.status === 'P') {
+ status = 'PENDING';
+ } else if (log.status === 'R') {
+ status = 'ROLLBACK';
+ } else if (log.status === 'S') {
+ status = 'REVERSAL';
+ }
+ return status;
+ })()}
+ |
{log.request_date
? new Date(log.request_date).toLocaleDateString('en-GB', {
day: '2-digit',
@@ -798,10 +817,10 @@ const DetailTransaction = () => {
{(() => {
try {
- if (log.request_body === null) {
+ if (log.response_body === null) {
return '';
}
- const parsed = JSON.parse(log.request_body);
+ const parsed = JSON.parse(log.response_body);
return JSON.stringify(parsed, null, 2) ?? '';
} catch (e) {
return log.response_body ?? ''; // fallback: tampilkan as-is jika gagal parse
@@ -900,7 +919,7 @@ const DetailTransaction = () => {
- | Type |
+ Status |
Request Date |
Response Date |
Response Body |
@@ -910,9 +929,27 @@ const DetailTransaction = () => {
{transactionDetails?.p24 && transactionDetails?.p24.length > 0 ? (
- transactionDetails.p24.map((log: { request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
+ transactionDetails.p24.map((log: { status: string,request_endpoint: string, type: string; request_date: string; response_date: string; request_body: string; response_body: string; response_code: number }, index: number) => (
- | {log.type ?? ''} |
+
+ {(() => {
+ let status;
+ if (log.status === 'C') {
+ status = 'COMPLETE';
+ } else if (log.status === 'F') {
+ status = 'FAILED';
+ } else if (log.status === 'O') {
+ status = 'ON PROCESS';
+ } else if (log.status === 'P') {
+ status = 'PENDING';
+ } else if (log.status === 'R') {
+ status = 'ROLLBACK';
+ } else if (log.status === 'S') {
+ status = 'REVERSAL';
+ }
+ return status;
+ })()}
+ |
{log.request_date
? new Date(log.request_date).toLocaleDateString('en-GB', {
day: '2-digit',
| | | |