diff --git a/src/components/EReceipt.tsx b/src/components/EReceipt.tsx index ebde8479b071..f0a7ac1aec97 100644 --- a/src/components/EReceipt.tsx +++ b/src/components/EReceipt.tsx @@ -32,17 +32,15 @@ function EReceipt({transaction, transactionID}: EReceiptProps) { const {translate} = useLocalize(); // Get receipt colorway, or default to Yellow. - const colorStyles = StyleUtils.getEReceiptColorStyles(StyleUtils.getEReceiptColorCode(transaction)); - const primaryColor = colorStyles?.backgroundColor; - const secondaryColor = colorStyles?.color; - - const transactionDetails = ReportUtils.getTransactionDetails(transaction, CONST.DATE.MONTH_DAY_YEAR_FORMAT); - const transactionAmount = transactionDetails?.amount; - const transactionCurrency = transactionDetails?.currency ?? ''; - const transactionMerchant = transactionDetails?.merchant; - const transactionDate = transactionDetails?.created; - const transactionCardID = transactionDetails?.cardID; + const {backgroundColor: primaryColor, color: secondaryColor} = StyleUtils.getEReceiptColorStyles(StyleUtils.getEReceiptColorCode(transaction)) ?? {}; + const { + amount: transactionAmount, + currency: transactionCurrency = '', + merchant: transactionMerchant, + created: transactionDate, + cardID: transactionCardID, + } = ReportUtils.getTransactionDetails(transaction, CONST.DATE.MONTH_DAY_YEAR_FORMAT) ?? {}; const formattedAmount = CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency); const currency = CurrencyUtils.getCurrencySymbol(transactionCurrency); const amount = currency ? formattedAmount.replace(currency, '') : formattedAmount;