Skip to content

Commit 835cbed

Browse files
committed
fix(wallet-admin): add cancel api
Signed-off-by: Rakib Ansary <rakibansary@topcoder.com>
1 parent 52ae1fd commit 835cbed

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,20 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
180180
releaseDate: currentEditState.releaseDate !== undefined ? currentEditState.releaseDate : undefined,
181181
}
182182

183-
let paymentStatus : 'ON_HOLD_ADMIN' | 'OWED' | undefined
184-
if (updateObj.paymentStatus !== undefined) paymentStatus = updateObj.paymentStatus.indexOf('Owed') > -1 ? 'OWED' : 'ON_HOLD_ADMIN'
183+
let paymentStatus : 'ON_HOLD_ADMIN' | 'OWED' | 'CANCELLED' | undefined
184+
if (updateObj.paymentStatus !== undefined) {
185+
if (updateObj.paymentStatus === 'Owed') {
186+
paymentStatus = 'OWED'
187+
} else if (updateObj.paymentStatus === 'On Hold') {
188+
paymentStatus = 'ON_HOLD_ADMIN'
189+
} else if (updateObj.paymentStatus === 'Cancel') {
190+
paymentStatus = 'CANCELLED'
191+
}
192+
}
185193

186194
const updates: {
187195
auditNote?: string
188-
paymentStatus?: 'ON_HOLD_ADMIN' | 'OWED'
196+
paymentStatus?: 'ON_HOLD_ADMIN' | 'OWED' | 'CANCELLED'
189197
releaseDate?: string
190198
paymentAmount?: number
191199
winningsId: string

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps
200200
options={[
201201
{ label: 'Owed', value: 'Owed' },
202202
{ label: 'On Hold', value: 'On Hold' },
203+
{ label: 'Cancel', value: 'Cancel' },
203204
]}
204205
value={paymentStatus}
205206
onChange={e => handleInputChange('paymentStatus', e.target.value)}

src/apps/wallet-admin/src/lib/services/wallet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function fetchAuditLogs(paymentId: string): Promise<WinningsAudit[]
5656

5757
export async function editPayment(updates: {
5858
winningsId: string,
59-
paymentStatus?: 'ON_HOLD_ADMIN' | 'OWED',
59+
paymentStatus?: 'ON_HOLD_ADMIN' | 'OWED' | 'CANCELLED',
6060
paymentAmount?: number,
6161
releaseDate?: string,
6262
}): Promise<string> {

0 commit comments

Comments
 (0)