diff --git a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx index 35756d2..eb72ba9 100644 --- a/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx +++ b/src/pages/transaction/approval-transaction/blocks/DetailApprovalTransaction.tsx @@ -202,14 +202,20 @@ const DetailApprovalTransaction = () => {
Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase?.amount) ?? new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.transfer.amount)}
++ {(transactionDetails?.purchase?.amount ?? transactionDetails?.transfer?.amount) != null + ? new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails.purchase?.amount ?? transactionDetails.transfer?.amount + ) + : "-"} +
Fee
- {transactionDetails?.kind === 'P' - ? transactionDetails?.purchase.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' }) - : transactionDetails?.transfer.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })} + {(transactionDetails?.transfer?.fee_amount ?? transactionDetails?.purchase?.fee_amount ?? 0) + .toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.amount)}
++ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.amount ?? transactionDetails?.transfer?.amount ?? 0 + )} +
Cashback
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.cashback)}
++ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.cashback ?? transactionDetails?.transfer?.cashback ?? 0 + )} +
Cashback Point
-{transactionDetails?.purchase.cashback_point}
++ {transactionDetails?.purchase?.cashback_point ?? transactionDetails?.transfer?.cashback_point ?? 0} +
Fee Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.fee_amount)}
++ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.fee_amount ?? transactionDetails?.transfer?.fee_amount ?? 0 + )} +
Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase?.amount) ?? new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.transfer.amount)}
++ {(transactionDetails?.purchase?.amount ?? transactionDetails?.transfer?.amount) != null + ? new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails.purchase?.amount ?? transactionDetails.transfer?.amount + ) + : "-"} +
Fee
- {transactionDetails?.kind === 'P' - ? transactionDetails?.purchase.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' }) - : transactionDetails?.transfer.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })} + {(transactionDetails?.transfer?.fee_amount ?? transactionDetails?.purchase?.fee_amount ?? 0) + .toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.amount)}
++ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.amount ?? transactionDetails?.transfer?.amount ?? 0 + )} +
Cashback
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.cashback)}
++ {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.cashback ?? transactionDetails?.transfer?.cashback ?? 0 + )} +
Cashback Point
-{transactionDetails?.purchase.cashback_point}
++ {transactionDetails?.purchase?.cashback_point ?? transactionDetails?.transfer?.cashback_point ?? 0} +
Fee Amount
-{new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.fee_amount)}
-Product Name
-{transactionDetails?.purchase.product.name}
-Price Cash
- {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(transactionDetails?.purchase.product.price_cash)} -Price Point
-{transactionDetails?.purchase.product.price_point}
-Product Type
-{transactionDetails?.purchase.product.type}
-Provider Name
-{transactionDetails?.purchase.product.provider.description}
-Provider Type
- {(() => { - let providertype; - if (transactionDetails?.purchase.product.provider.type === 'h2h') { - providertype = 'HOST TO HOST'; - } else if (transactionDetails?.purchase.product.provider.type === 'agent') { - providertype = 'AGENT'; - } - return providertype; - })()} + {new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format( + transactionDetails?.purchase?.fee_amount ?? transactionDetails?.transfer?.fee_amount ?? 0 + )}
Product Name
++ {transactionDetails?.purchase?.product?.name ?? "-"} +
+Price Cash
++ {transactionDetails?.purchase?.product?.price_cash != null + ? new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(transactionDetails.purchase.product.price_cash) + : "-"} +
+Price Point
++ {transactionDetails?.purchase?.product?.price_point ?? "-"} +
+Product Type
++ {transactionDetails?.purchase?.product?.type ?? "-"} +
+Provider Name
++ {transactionDetails?.purchase?.product?.provider?.description ?? "-"} +
+Provider Type
++ {transactionDetails?.purchase?.product?.provider?.type === "h2h" + ? "HOST TO HOST" + : transactionDetails?.purchase?.product?.provider?.type === "agent" + ? "AGENT" + : "-"} +
+Fee
- {transactionDetails?.transfer.fee_amount.toLocaleString('en-US', { style: 'currency', currency: 'USD' })} + {(transactionDetails?.transfer?.fee_amount ?? transactionDetails?.purchase?.fee_amount ?? 0).toLocaleString('en-US', { style: 'currency', currency: 'USD' })}