Skip to content

Commit 10073b7

Browse files
committed
fix(wallet-admin): payment status update fixes
Signed-off-by: Rakib Ansary <rakibansary@topcoder.com>
1 parent 3f32694 commit 10073b7

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/apps/wallet-admin/src/home/tabs/payments/PaymentsTab.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { FilterBar, formatIOSDateString, PaymentView } from '../../../lib'
1313
import { ConfirmFlowData } from '../../../lib/models/ConfirmFlowData'
1414
import { PaginationInfo } from '../../../lib/models/PaginationInfo'
1515
import { TaxForm } from '../../../lib/models/TaxForm'
16+
import { PaymentProvider } from '../../../lib/models/PaymentProvider'
1617
import PaymentEditForm from '../../../lib/components/payment-edit/PaymentEdit'
1718
import PaymentsTable from '../../../lib/components/payments-table/PaymentTable'
1819

@@ -177,11 +178,11 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
177178
const missingPaymentProviders = await getPaymentMethods(100, 0, onHoldUserIds)
178179

179180
missingTaxForms.forms.forEach((form: TaxForm) => {
180-
userHasTaxFormSetup.set(form.userId, true)
181+
userHasTaxFormSetup.set(form.userId, form.status === 'ACTIVE')
181182
})
182183

183-
missingPaymentProviders.paymentMethods.forEach((method: { userId: string }) => {
184-
userHasPaymentProvider.set(method.userId, true)
184+
missingPaymentProviders.paymentMethods.forEach((method: PaymentProvider) => {
185+
userHasPaymentProvider.set(method.userId, method.status === 'CONNECTED')
185186
})
186187
} catch (err) {
187188
// Ignore errors
@@ -272,6 +273,13 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
272273
}, [fetchWinnings])
273274

274275
const onPaymentEditCallback = useCallback((payment: Winning) => {
276+
let status = payment.status
277+
if (status === 'On Hold (Admin)') {
278+
status = 'On Hold'
279+
} else if (['On Hold (Member)', 'On Hold (Tax Form)', 'On Hold (Payment Provider)'].indexOf(status) !== -1) {
280+
status = 'Owed'
281+
}
282+
275283
setConfirmFlow({
276284
action: 'Save',
277285
callback: async () => {
@@ -281,7 +289,7 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
281289
<PaymentEditForm
282290
payment={{
283291
...payment,
284-
status: ['On Hold (Member)', 'On Hold (Tax Form)', 'On Hold (Payment Provider)'].indexOf(payment.status) !== -1 ? 'Owed' : payment.status,
292+
status,
285293
}}
286294
canSave={setIsConfirmFormValid}
287295
onValueUpdated={handleValueUpdated}
@@ -318,9 +326,13 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
318326
value: 'OWED',
319327
},
320328
{
321-
label: 'On Hold',
329+
label: 'On Hold (Admin)',
322330
value: 'ON_HOLD_ADMIN',
323331
},
332+
{
333+
label: 'On Hold (Member)',
334+
value: 'ON_HOLD',
335+
},
324336
{
325337
label: 'Paid',
326338
value: 'PAID',

src/apps/wallet-admin/src/lib/components/payment-edit/PaymentEdit.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps
4040
releaseDate: props.payment.releaseDateObj,
4141
}), [props.payment])
4242

43+
console.log('Payment status', paymentStatus)
44+
4345
const validateNetAmount = (value: number): boolean => {
4446
if (Number.isNaN(value)) {
4547
setNetAmountErrorString('A valid number is required')

0 commit comments

Comments
 (0)