Skip to content

Commit 2117306

Browse files
committed
PM-959 - Remove any reference to the old payments api
1 parent cee1965 commit 2117306

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { PayoutAudit } from '../models/PayoutAudit'
1414
import ApiResponse from '../models/ApiResponse'
1515

1616
const baseUrl = `${EnvironmentConfig.TC_FINANCE_API}`
17-
const baseUrl_old = `${EnvironmentConfig.API.V5}/payments`
1817
const memberApiBaseUrl = `${EnvironmentConfig.API.V5}/members`
1918

2019
export async function getWalletDetails(): Promise<WalletDetails> {
@@ -38,7 +37,7 @@ export async function getUserPaymentProviders(): Promise<PaymentProvider[]> {
3837
}
3938

4039
export async function getUserTaxFormDetails(): Promise<TaxForm[]> {
41-
const response = await xhrGetAsync<ApiResponse<TaxForm[]>>(`${baseUrl_old}/user/tax-forms`)
40+
const response = await xhrGetAsync<ApiResponse<TaxForm[]>>(`${baseUrl}/user/tax-forms`)
4241
if (response.status === 'error') {
4342
throw new Error('Error fetching user tax form details')
4443
}
@@ -105,7 +104,7 @@ export async function getTaxForms(limit: number, offset: number, userIds: string
105104
userIds,
106105
})
107106

108-
const url = `${baseUrl_old}/admin/tax-forms`
107+
const url = `${baseUrl}/admin/tax-forms`
109108
const response = await xhrPostAsync<string, ApiResponse<{
110109
forms: TaxForm[],
111110
pagination: PaginationInfo
@@ -132,7 +131,7 @@ export async function getPaymentMethods(limit: number, offset: number, userIds:
132131
userIds,
133132
})
134133

135-
const url = `${baseUrl_old}/admin/payment-methods`
134+
const url = `${baseUrl}/admin/payment-methods`
136135
const response = await xhrPostAsync<string, ApiResponse<{
137136
paymentMethods: PaymentProvider[],
138137
pagination: PaginationInfo
@@ -183,7 +182,7 @@ export async function exportSearchResults(filters: Record<string, string[]>): Pr
183182
}
184183

185184
export async function downloadTaxForm(userId: string, taxFormId: string): Promise<Blob> {
186-
const url = `${baseUrl_old}/admin/tax-forms/${userId}/${taxFormId}/download`
185+
const url = `${baseUrl}/admin/tax-forms/${userId}/${taxFormId}/download`
187186
try {
188187
return await getAsyncWithBlobHandling<Blob>(url)
189188
} catch (err) {
@@ -192,7 +191,7 @@ export async function downloadTaxForm(userId: string, taxFormId: string): Promis
192191
}
193192

194193
export async function deleteTaxForm(userId: string, taxFormId: string): Promise<void> {
195-
const url = `${baseUrl_old}/admin/tax-forms/${userId}/${taxFormId}`
194+
const url = `${baseUrl}/admin/tax-forms/${userId}/${taxFormId}`
196195
try {
197196
return await xhrDeleteAsync(url)
198197
} catch (err) {
@@ -201,7 +200,7 @@ export async function deleteTaxForm(userId: string, taxFormId: string): Promise<
201200
}
202201

203202
export async function deletePaymentProvider(userId: string, providerId: number): Promise<void> {
204-
const url = `${baseUrl_old}/admin/payment-methods/${userId}/${providerId}`
203+
const url = `${baseUrl}/admin/payment-methods/${userId}/${providerId}`
205204
try {
206205
return await xhrDeleteAsync(url)
207206
} catch (err) {
@@ -262,7 +261,7 @@ export async function setPaymentProvider(
262261
type,
263262
})
264263

265-
const url = `${baseUrl_old}/user/payment-method`
264+
const url = `${baseUrl}/user/payment-method`
266265
const response = await xhrPostAsync<string, ApiResponse<TransactionResponse>>(url, body)
267266

268267
if (response.status === 'error') {
@@ -279,7 +278,7 @@ export async function confirmPaymentProvider(provider: string, code: string, tra
279278
transactionId,
280279
})
281280

282-
const url = `${baseUrl_old}/payment-provider/paypal/confirm`
281+
const url = `${baseUrl}/payment-provider/paypal/confirm`
283282
const response = await xhrPostAsync<string, ApiResponse<string>>(url, body)
284283

285284
if (response.status === 'error') {
@@ -290,7 +289,7 @@ export async function confirmPaymentProvider(provider: string, code: string, tra
290289
}
291290

292291
export async function getPaymentProviderRegistrationLink(type: string): Promise<TransactionResponse> {
293-
const url = `${baseUrl_old}/user/payment-method/${type}/registration-link`
292+
const url = `${baseUrl}/user/payment-method/${type}/registration-link`
294293
const response = await xhrGetAsync<ApiResponse<TransactionResponse>>(url)
295294

296295
if (response.status === 'error') {
@@ -301,7 +300,7 @@ export async function getPaymentProviderRegistrationLink(type: string): Promise<
301300
}
302301

303302
export async function removePaymentProvider(type: string): Promise<TransactionResponse> {
304-
const url = `${baseUrl_old}/user/payment-method/${type}`
303+
const url = `${baseUrl}/user/payment-method/${type}`
305304
const response = await xhrDeleteAsync<ApiResponse<TransactionResponse>>(url)
306305

307306
if (response.status === 'error') {
@@ -317,7 +316,7 @@ export async function setupTaxForm(userId: string, taxForm: string): Promise<Tra
317316
userId,
318317
})
319318

320-
const url = `${baseUrl_old}/user/tax-form`
319+
const url = `${baseUrl}/user/tax-form`
321320
const response = await xhrPostAsync<string, ApiResponse<TransactionResponse>>(url, body)
322321

323322
if (response.status === 'error') {
@@ -328,7 +327,7 @@ export async function setupTaxForm(userId: string, taxForm: string): Promise<Tra
328327
}
329328

330329
export async function removeTaxForm(taxFormId: string): Promise<TransactionResponse> {
331-
const url = `${baseUrl_old}/user/tax-forms/${taxFormId}`
330+
const url = `${baseUrl}/user/tax-forms/${taxFormId}`
332331
const response = await xhrDeleteAsync<ApiResponse<TransactionResponse>>(url)
333332

334333
if (response.status === 'error') {
@@ -339,7 +338,7 @@ export async function removeTaxForm(taxFormId: string): Promise<TransactionRespo
339338
}
340339

341340
export async function getRecipientViewURL(): Promise<TransactionResponse> {
342-
const url = `${baseUrl_old}/user/tax-form/view`
341+
const url = `${baseUrl}/user/tax-form/view`
343342
const response = await xhrGetAsync<ApiResponse<TransactionResponse>>(url)
344343

345344
if (response.status === 'error') {

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { PaginationInfo } from '../models/PaginationInfo'
1414
import ApiResponse from '../models/ApiResponse'
1515

1616
const baseUrl = `${EnvironmentConfig.TC_FINANCE_API}`
17-
const baseUrl_old = `${EnvironmentConfig.API.V5}/payments`
1817

1918
export async function getWalletDetails(): Promise<WalletDetails> {
2019
const response = await xhrGetAsync<ApiResponse<WalletDetails>>(`${baseUrl}/wallet`)
@@ -27,7 +26,7 @@ export async function getWalletDetails(): Promise<WalletDetails> {
2726
}
2827

2928
export async function getUserPaymentProviders(): Promise<PaymentProvider[]> {
30-
const response = await xhrGetAsync<ApiResponse<PaymentProvider[]>>(`${baseUrl_old}/user/payment-methods`)
29+
const response = await xhrGetAsync<ApiResponse<PaymentProvider[]>>(`${baseUrl}/user/payment-methods`)
3130

3231
if (response.status === 'error') {
3332
throw new Error('Error fetching user payment providers')
@@ -37,7 +36,7 @@ export async function getUserPaymentProviders(): Promise<PaymentProvider[]> {
3736
}
3837

3938
export async function getUserTaxFormDetails(): Promise<TaxForm[]> {
40-
const response = await xhrGetAsync<ApiResponse<TaxForm[]>>(`${baseUrl_old}/user/tax-forms`)
39+
const response = await xhrGetAsync<ApiResponse<TaxForm[]>>(`${baseUrl}/user/tax-forms`)
4140
if (response.status === 'error') {
4241
throw new Error('Error fetching user tax form details')
4342
}
@@ -91,7 +90,7 @@ export async function setPaymentProvider(
9190
type,
9291
})
9392

94-
const url = `${baseUrl_old}/user/payment-method`
93+
const url = `${baseUrl}/user/payment-method`
9594
const response = await xhrPostAsync<string, ApiResponse<TransactionResponse>>(url, body)
9695

9796
if (response.status === 'error') {
@@ -108,7 +107,7 @@ export async function confirmPaymentProvider(provider: string, code: string, tra
108107
transactionId,
109108
})
110109

111-
const url = `${baseUrl_old}/payment-provider/paypal/confirm`
110+
const url = `${baseUrl}/payment-provider/paypal/confirm`
112111
const response = await xhrPostAsync<string, ApiResponse<string>>(url, body)
113112

114113
if (response.status === 'error') {
@@ -119,7 +118,7 @@ export async function confirmPaymentProvider(provider: string, code: string, tra
119118
}
120119

121120
export async function getPaymentProviderRegistrationLink(type: string): Promise<TransactionResponse> {
122-
const url = `${baseUrl_old}/user/payment-method/${type}/registration-link`
121+
const url = `${baseUrl}/user/payment-method/${type}/registration-link`
123122
const response = await xhrGetAsync<ApiResponse<TransactionResponse>>(url)
124123

125124
if (response.status === 'error') {
@@ -130,7 +129,7 @@ export async function getPaymentProviderRegistrationLink(type: string): Promise<
130129
}
131130

132131
export async function removePaymentProvider(type: string): Promise<TransactionResponse> {
133-
const url = `${baseUrl_old}/user/payment-method/${type}`
132+
const url = `${baseUrl}/user/payment-method/${type}`
134133
const response = await xhrDeleteAsync<ApiResponse<TransactionResponse>>(url)
135134

136135
if (response.status === 'error') {
@@ -146,7 +145,7 @@ export async function setupTaxForm(userId: string, taxForm: string): Promise<Tra
146145
userId,
147146
})
148147

149-
const url = `${baseUrl_old}/user/tax-form`
148+
const url = `${baseUrl}/user/tax-form`
150149
const response = await xhrPostAsync<string, ApiResponse<TransactionResponse>>(url, body)
151150

152151
if (response.status === 'error') {
@@ -157,7 +156,7 @@ export async function setupTaxForm(userId: string, taxForm: string): Promise<Tra
157156
}
158157

159158
export async function removeTaxForm(taxFormId: string): Promise<TransactionResponse> {
160-
const url = `${baseUrl_old}/user/tax-forms/${taxFormId}`
159+
const url = `${baseUrl}/user/tax-forms/${taxFormId}`
161160
const response = await xhrDeleteAsync<ApiResponse<TransactionResponse>>(url)
162161

163162
if (response.status === 'error') {
@@ -168,7 +167,7 @@ export async function removeTaxForm(taxFormId: string): Promise<TransactionRespo
168167
}
169168

170169
export async function getRecipientViewURL(): Promise<TransactionResponse> {
171-
const url = `${baseUrl_old}/user/tax-form/view`
170+
const url = `${baseUrl}/user/tax-form/view`
172171
const response = await xhrGetAsync<ApiResponse<TransactionResponse>>(url)
173172

174173
if (response.status === 'error') {
@@ -182,7 +181,7 @@ export async function processPayments(paymentIds: string[]): Promise<{ processed
182181
const body = JSON.stringify({
183182
paymentIds,
184183
})
185-
const url = `${baseUrl_old}/withdraw`
184+
const url = `${baseUrl}/withdraw`
186185
const response = await xhrPostAsync<string, ApiResponse<{ processed: boolean }>>(url, body)
187186

188187
if (response.status === 'error') {
@@ -199,7 +198,7 @@ export async function verifyOtp(transactionId: string, code: string, blob: boole
199198
transactionId,
200199
})
201200

202-
const url = `${baseUrl_old}/otp/verify`
201+
const url = `${baseUrl}/otp/verify`
203202
try {
204203
// eslint-disable-next-line max-len
205204
const response = await xhrPostAsyncWithBlobHandling<string, ApiResponse<OtpVerificationResponse> | Blob>(url, body, {
@@ -225,7 +224,7 @@ export async function resendOtp(transactionId: string): Promise<TransactionRespo
225224
transactionId,
226225
})
227226

228-
const url = `${baseUrl_old}/otp/resend`
227+
const url = `${baseUrl}/otp/resend`
229228
try {
230229
const response = await xhrPostAsync<string, ApiResponse<TransactionResponse>>(url, body)
231230

0 commit comments

Comments
 (0)