-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/ba 2468 payment methods management #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lbjunq
merged 14 commits into
epic/BA-2017-stripe-payments
from
feature/BA-2468-payment-methods-management
Jun 25, 2025
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a376370
1st
mathieubouhelier a8932c8
lint
mathieubouhelier 241fc75
lint
mathieubouhelier 6fc01a0
BA-2468-payment-methods-management
c42ed38
Merge branch 'master' of github.com:silverlogic/baseapp-frontend into…
df2666f
Add current user customer support
279946f
Merge branch 'epic/BA-2017-stripe-payments' of github.com:silverlogic…
0ff310f
Fix type
2dc0649
Fix type names
60dd44b
Improve Box sx
1d95c14
Auto refresh on card creation
53cb877
Fix query key
6ec0e53
Update file location
0e1d5f5
Review fixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
BA-2468-payment-methods-management
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
.../modules/payments/web/PaymentMethodsManagementComponent/components/PaymentMethodsItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { FC } from 'react' | ||
|
||
import { MoreVert } from '@mui/icons-material' | ||
import { Box, Chip, Divider, IconButton, Typography } from '@mui/material' | ||
|
||
import { getCardIcon } from '../../CheckoutComponent/utils' | ||
import { PaymentMethodsItemProps } from '../types' | ||
|
||
const PaymentMethodsItem: FC<PaymentMethodsItemProps> = ({ | ||
paymentMethod, | ||
setIsMenuOpen, | ||
setSelectedPaymentMethodId, | ||
setAnchorEl, | ||
isLast, | ||
}) => { | ||
const isExpired = | ||
paymentMethod?.card?.expMonth && | ||
paymentMethod?.card?.expYear && | ||
new Date(paymentMethod?.card?.expYear, paymentMethod?.card?.expMonth) < new Date() | ||
return ( | ||
<> | ||
<Box | ||
key={paymentMethod.id} | ||
sx={{ display: 'flex', alignItems: 'center', width: '100%', gap: 2 }} | ||
> | ||
{getCardIcon(paymentMethod?.card?.brand)} | ||
<Box sx={{ display: 'flex', flexDirection: 'column', flexGrow: 1 }}> | ||
<Box sx={{ display: 'flex', gap: 2, mb: 1 }}> | ||
{paymentMethod?.isDefault && <Chip color="default" label="Default" variant="soft" />} | ||
{isExpired && <Chip color="error" label="Expired" variant="soft" />} | ||
</Box> | ||
<Typography variant="body2" fontWeight={500}> | ||
{paymentMethod?.card?.brand?.toUpperCase() ?? 'CARD'} •••• •••• ••••{' '} | ||
{paymentMethod?.card?.last4} | ||
</Typography> | ||
<Typography variant="caption" color="text.secondary"> | ||
{`${isExpired ? 'Expired' : 'Expires'}: ${paymentMethod?.card?.expMonth}/${paymentMethod?.card?.expYear}`} | ||
</Typography> | ||
</Box> | ||
<IconButton | ||
onClick={() => { | ||
setIsMenuOpen(true) | ||
setSelectedPaymentMethodId(paymentMethod.id) | ||
setAnchorEl(document.activeElement as HTMLElement) | ||
}} | ||
sx={{ flexGrow: 0 }} | ||
> | ||
<MoreVert /> | ||
</IconButton> | ||
</Box> | ||
{!isLast && <Divider />} | ||
</> | ||
) | ||
} | ||
|
||
export default PaymentMethodsItem |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.