Skip to content

Commit

Permalink
Show end of ACH account numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdenio committed Mar 21, 2024
1 parent 7db63d1 commit 070256a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
32 changes: 30 additions & 2 deletions src/components/transaction/TransactionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface Detail {
value: ReactElement | string;
onPress?: () => void;
pressIconName?: React.ComponentProps<typeof Ionicons>["name"];
fontFamily?: string;
}

export function descriptionDetail(
Expand All @@ -35,14 +36,40 @@ export function descriptionDetail(
};
}

export default function TransactionDetails({ details }: { details: Detail[] }) {
export default function TransactionDetails({
details,
title,
}: {
details: Detail[];
title?: string;
}) {
const { colors: themeColors } = useTheme();

return (
<View style={{ marginBottom: 30 }}>
{title && (
<Text
style={{
color: palette.muted,
fontSize: 12,
textTransform: "uppercase",
marginBottom: 5,
marginLeft: 10,
}}
>
{title}
</Text>
)}

{details.map(
(
{ label, value, onPress, pressIconName = "chevron-forward-outline" },
{
label,
value,
onPress,
pressIconName = "chevron-forward-outline",
fontFamily,
},
index,
) => (
<TouchableHighlight
Expand Down Expand Up @@ -77,6 +104,7 @@ export default function TransactionDetails({ details }: { details: Detail[] }) {
overflow: "hidden",
flex: 1,
textAlign: "right",
fontFamily,
}}
selectable
>
Expand Down
6 changes: 6 additions & 0 deletions src/components/transaction/types/AchTransferTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default function AchTransferTransaction({
/>

<TransactionDetails
title="ACH Transfer"
details={[
{ label: "Name", value: ach_transfer.recipient_name },
...(ach_transfer.recipient_email
Expand All @@ -60,6 +61,11 @@ export default function AchTransferTransaction({
},
]
: []),
{
label: "Account",
value: `••••${ach_transfer.account_number_last4}`,
fontFamily: "JetBrains Mono",
},
{ label: "Bank name", value: ach_transfer.bank_name },
]}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/components/transaction/types/CardChargeTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default function CardChargeTransaction({
<View style={{ flexDirection: "column", alignItems: "center" }}>
<TransactionTitle badge={badge}>
{renderMoney(Math.abs(transaction.amount_cents))}{" "}
<Muted>charge at</Muted>{"\n"}{merchant.smart_name}
<Muted>charge at</Muted>
{"\n"}
{merchant.smart_name}
</TransactionTitle>
</View>
<TransactionDetails
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export interface AchTransfer {
recipient_name: string;
recipient_email?: string;
bank_name: string;
account_number_last4: string;
description: string;
sender: User;
}
Expand Down

0 comments on commit 070256a

Please sign in to comment.