Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/apps/wallet-admin/src/home/tabs/payments/PaymentsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
if (updateObj.paymentStatus !== undefined) {
if (updateObj.paymentStatus === 'Owed') {
paymentStatus = 'OWED'
} else if (updateObj.paymentStatus === 'On Hold') {
} else if (updateObj.paymentStatus === 'On Hold (Admin)') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The change from 'On Hold' to 'On Hold (Admin)' in the condition might affect other parts of the code that rely on the previous status. Ensure that all relevant parts of the application are updated to handle this new status correctly.

paymentStatus = 'ON_HOLD_ADMIN'
} else if (updateObj.paymentStatus === 'Cancel') {
paymentStatus = 'CANCELLED'
Expand Down Expand Up @@ -267,24 +267,14 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
}, [fetchWinnings])

const onPaymentEditCallback = useCallback((payment: Winning) => {
let status = payment.status
if (status === 'On Hold (Admin)') {
status = 'On Hold'
} else if (['On Hold (Member)', 'On Hold (Tax Form)', 'On Hold (Payment Provider)'].indexOf(status) !== -1) {
status = 'Owed'
}

setConfirmFlow({
action: 'Save',
callback: async () => {
updatePayment(payment.id)
},
content: (
<PaymentEditForm
payment={{
...payment,
status,
}}
payment={payment}
canSave={setIsConfirmFormValid}
onValueUpdated={handleValueUpdated}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,16 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps

const options = useCallback(() => {
if (props.payment.status.toUpperCase() !== 'PAID') {
const isMemberHold = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The change from indexOf to includes is a good improvement for readability and clarity. However, ensure that props.payment.status is always a string to avoid potential runtime errors.

'On Hold (Member)',
'On Hold (Tax Form)',
'On Hold (Payment Provider)',
].includes(props.payment.status)

return [
...(isMemberHold ? [{ label: props.payment.status, value: props.payment.status }] : []),
{ label: 'Owed', value: 'Owed' },
{ label: 'On Hold', value: 'On Hold' },
{ label: 'On Hold (Admin)', value: 'On Hold (Admin)' },
{ label: 'Cancel', value: 'Cancel' },
]
}
Expand Down
Loading