@djangocfg/ext-payments 1.0.14 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.cjs +5 -8
- package/dist/config.js +5 -8
- package/dist/index.cjs +1906 -1043
- package/dist/index.d.cts +644 -59
- package/dist/index.d.ts +644 -59
- package/dist/index.js +1886 -1040
- package/package.json +13 -16
- package/src/WalletPage.tsx +100 -0
- package/src/api/generated/ext_payments/CLAUDE.md +10 -4
- package/src/api/generated/ext_payments/_utils/fetchers/ext_payments__payments.ts +268 -5
- package/src/api/generated/ext_payments/_utils/hooks/ext_payments__payments.ts +102 -3
- package/src/api/generated/ext_payments/_utils/schemas/Balance.schema.ts +1 -1
- package/src/api/generated/ext_payments/_utils/schemas/PaginatedWithdrawalListList.schema.ts +24 -0
- package/src/api/generated/ext_payments/_utils/schemas/PaymentCreateRequest.schema.ts +21 -0
- package/src/api/generated/ext_payments/_utils/schemas/PaymentCreateResponse.schema.ts +22 -0
- package/src/api/generated/ext_payments/_utils/schemas/PaymentDetail.schema.ts +3 -3
- package/src/api/generated/ext_payments/_utils/schemas/PaymentList.schema.ts +2 -2
- package/src/api/generated/ext_payments/_utils/schemas/Transaction.schema.ts +1 -1
- package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCancelResponse.schema.ts +22 -0
- package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCreateRequest.schema.ts +21 -0
- package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCreateResponse.schema.ts +22 -0
- package/src/api/generated/ext_payments/_utils/schemas/WithdrawalDetail.schema.ts +42 -0
- package/src/api/generated/ext_payments/_utils/schemas/WithdrawalList.schema.ts +29 -0
- package/src/api/generated/ext_payments/_utils/schemas/index.ts +8 -0
- package/src/api/generated/ext_payments/client.ts +1 -1
- package/src/api/generated/ext_payments/enums.ts +36 -0
- package/src/api/generated/ext_payments/ext_payments__payments/client.ts +104 -6
- package/src/api/generated/ext_payments/ext_payments__payments/models.ts +168 -8
- package/src/api/generated/ext_payments/index.ts +1 -1
- package/src/api/generated/ext_payments/schema.json +752 -42
- package/src/components/ActivityItem.tsx +118 -0
- package/src/components/ActivityList.tsx +93 -0
- package/src/components/AddFundsSheet.tsx +342 -0
- package/src/components/BalanceHero.tsx +102 -0
- package/src/components/CurrencyCombobox.tsx +49 -0
- package/src/components/PaymentSheet.tsx +352 -0
- package/src/components/WithdrawSheet.tsx +355 -0
- package/src/components/WithdrawalSheet.tsx +332 -0
- package/src/components/index.ts +11 -0
- package/src/config.ts +1 -0
- package/src/contexts/WalletContext.tsx +356 -0
- package/src/contexts/index.ts +13 -42
- package/src/contexts/types.ts +43 -37
- package/src/hooks/index.ts +3 -20
- package/src/hooks/useCurrencyOptions.ts +79 -0
- package/src/hooks/useEstimate.ts +113 -0
- package/src/hooks/useWithdrawalEstimate.ts +117 -0
- package/src/index.ts +9 -18
- package/src/types/index.ts +78 -0
- package/src/utils/errors.ts +36 -0
- package/src/utils/format.ts +65 -0
- package/src/utils/index.ts +3 -0
- package/src/contexts/BalancesContext.tsx +0 -63
- package/src/contexts/CurrenciesContext.tsx +0 -64
- package/src/contexts/OverviewContext.tsx +0 -173
- package/src/contexts/PaymentsContext.tsx +0 -122
- package/src/contexts/PaymentsExtensionProvider.tsx +0 -56
- package/src/contexts/README.md +0 -201
- package/src/contexts/RootPaymentsContext.tsx +0 -66
- package/src/layouts/PaymentsLayout/PaymentsLayout.tsx +0 -90
- package/src/layouts/PaymentsLayout/components/CreatePaymentDialog.tsx +0 -274
- package/src/layouts/PaymentsLayout/components/PaymentDetailsDialog.tsx +0 -287
- package/src/layouts/PaymentsLayout/components/index.ts +0 -2
- package/src/layouts/PaymentsLayout/events.ts +0 -47
- package/src/layouts/PaymentsLayout/index.ts +0 -16
- package/src/layouts/PaymentsLayout/types.ts +0 -6
- package/src/layouts/PaymentsLayout/views/overview/components/BalanceCard.tsx +0 -121
- package/src/layouts/PaymentsLayout/views/overview/components/RecentPayments.tsx +0 -139
- package/src/layouts/PaymentsLayout/views/overview/components/index.ts +0 -2
- package/src/layouts/PaymentsLayout/views/overview/index.tsx +0 -21
- package/src/layouts/PaymentsLayout/views/payments/components/PaymentsList.tsx +0 -279
- package/src/layouts/PaymentsLayout/views/payments/components/index.ts +0 -1
- package/src/layouts/PaymentsLayout/views/payments/index.tsx +0 -18
- package/src/layouts/PaymentsLayout/views/transactions/components/TransactionsList.tsx +0 -260
- package/src/layouts/PaymentsLayout/views/transactions/components/index.ts +0 -1
- package/src/layouts/PaymentsLayout/views/transactions/index.tsx +0 -18
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaymentCreateRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for creating payment.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for creating payment.
|
|
11
|
+
*/
|
|
12
|
+
export const PaymentCreateRequestSchema = z.object({
|
|
13
|
+
amount_usd: z.string(),
|
|
14
|
+
currency_code: z.string().min(1).max(20),
|
|
15
|
+
description: z.string().max(500).optional(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type PaymentCreateRequest = z.infer<typeof PaymentCreateRequestSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for PaymentCreateResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for payment creation.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { PaymentDetailSchema } from './PaymentDetail.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Response for payment creation.
|
|
12
|
+
*/
|
|
13
|
+
export const PaymentCreateResponseSchema = z.object({
|
|
14
|
+
success: z.boolean(),
|
|
15
|
+
payment: PaymentDetailSchema,
|
|
16
|
+
qr_code_url: z.union([z.url(), z.literal('')]).nullable(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type PaymentCreateResponse = z.infer<typeof PaymentCreateResponseSchema>
|
|
@@ -29,9 +29,9 @@ export const PaymentDetailSchema = z.object({
|
|
|
29
29
|
transaction_hash: z.string().nullable(),
|
|
30
30
|
explorer_link: z.string().nullable(),
|
|
31
31
|
confirmations_count: z.int(),
|
|
32
|
-
expires_at: z.
|
|
33
|
-
completed_at: z.
|
|
34
|
-
created_at: z.
|
|
32
|
+
expires_at: z.string().datetime({ offset: true }).nullable(),
|
|
33
|
+
completed_at: z.string().datetime({ offset: true }).nullable(),
|
|
34
|
+
created_at: z.string().datetime({ offset: true }),
|
|
35
35
|
is_completed: z.boolean(),
|
|
36
36
|
is_failed: z.boolean(),
|
|
37
37
|
is_expired: z.boolean(),
|
|
@@ -18,8 +18,8 @@ export const PaymentListSchema = z.object({
|
|
|
18
18
|
currency_token: z.string(),
|
|
19
19
|
status: z.nativeEnum(Enums.PaymentListStatus),
|
|
20
20
|
status_display: z.string(),
|
|
21
|
-
created_at: z.
|
|
22
|
-
completed_at: z.
|
|
21
|
+
created_at: z.string().datetime({ offset: true }),
|
|
22
|
+
completed_at: z.string().datetime({ offset: true }).nullable(),
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for WithdrawalCancelResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for withdrawal cancellation.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { WithdrawalDetailSchema } from './WithdrawalDetail.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Response for withdrawal cancellation.
|
|
12
|
+
*/
|
|
13
|
+
export const WithdrawalCancelResponseSchema = z.object({
|
|
14
|
+
success: z.boolean(),
|
|
15
|
+
withdrawal: WithdrawalDetailSchema,
|
|
16
|
+
message: z.string(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type WithdrawalCancelResponse = z.infer<typeof WithdrawalCancelResponseSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for WithdrawalCreateRequest
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Serializer for creating withdrawal request.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for creating withdrawal request.
|
|
11
|
+
*/
|
|
12
|
+
export const WithdrawalCreateRequestSchema = z.object({
|
|
13
|
+
amount_usd: z.string(),
|
|
14
|
+
currency_code: z.string().min(1).max(20),
|
|
15
|
+
wallet_address: z.string().min(1).max(255),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type WithdrawalCreateRequest = z.infer<typeof WithdrawalCreateRequestSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for WithdrawalCreateResponse
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Response for withdrawal creation.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { WithdrawalDetailSchema } from './WithdrawalDetail.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Response for withdrawal creation.
|
|
12
|
+
*/
|
|
13
|
+
export const WithdrawalCreateResponseSchema = z.object({
|
|
14
|
+
success: z.boolean(),
|
|
15
|
+
withdrawal: WithdrawalDetailSchema,
|
|
16
|
+
message: z.string(),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Infer TypeScript type from Zod schema
|
|
21
|
+
*/
|
|
22
|
+
export type WithdrawalCreateResponse = z.infer<typeof WithdrawalCreateResponseSchema>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for WithdrawalDetail
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Detailed withdrawal information.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import * as Enums from '../../enums'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Detailed withdrawal information.
|
|
12
|
+
*/
|
|
13
|
+
export const WithdrawalDetailSchema = z.object({
|
|
14
|
+
id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
15
|
+
internal_withdrawal_id: z.string(),
|
|
16
|
+
amount_usd: z.string(),
|
|
17
|
+
currency_code: z.string(),
|
|
18
|
+
currency_name: z.string(),
|
|
19
|
+
currency_token: z.string(),
|
|
20
|
+
currency_network: z.string(),
|
|
21
|
+
wallet_address: z.string(),
|
|
22
|
+
network_fee_usd: z.string(),
|
|
23
|
+
service_fee_usd: z.string(),
|
|
24
|
+
total_fee_usd: z.string(),
|
|
25
|
+
final_amount_usd: z.string(),
|
|
26
|
+
crypto_amount: z.string().nullable(),
|
|
27
|
+
status: z.nativeEnum(Enums.WithdrawalDetailStatus),
|
|
28
|
+
status_display: z.string(),
|
|
29
|
+
transaction_hash: z.string().nullable(),
|
|
30
|
+
explorer_link: z.string().nullable(),
|
|
31
|
+
admin_notes: z.string(),
|
|
32
|
+
created_at: z.string().datetime({ offset: true }),
|
|
33
|
+
approved_at: z.string().datetime({ offset: true }).nullable(),
|
|
34
|
+
completed_at: z.string().datetime({ offset: true }).nullable(),
|
|
35
|
+
rejected_at: z.string().datetime({ offset: true }).nullable(),
|
|
36
|
+
cancelled_at: z.string().datetime({ offset: true }).nullable(),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Infer TypeScript type from Zod schema
|
|
41
|
+
*/
|
|
42
|
+
export type WithdrawalDetail = z.infer<typeof WithdrawalDetailSchema>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for WithdrawalList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Withdrawal list item (lighter than detail).
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import * as Enums from '../../enums'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Withdrawal list item (lighter than detail).
|
|
12
|
+
*/
|
|
13
|
+
export const WithdrawalListSchema = z.object({
|
|
14
|
+
id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
15
|
+
internal_withdrawal_id: z.string(),
|
|
16
|
+
amount_usd: z.string(),
|
|
17
|
+
final_amount_usd: z.string(),
|
|
18
|
+
currency_code: z.string(),
|
|
19
|
+
currency_token: z.string(),
|
|
20
|
+
status: z.nativeEnum(Enums.WithdrawalListStatus),
|
|
21
|
+
status_display: z.string(),
|
|
22
|
+
created_at: z.string().datetime({ offset: true }),
|
|
23
|
+
completed_at: z.string().datetime({ offset: true }).nullable(),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Infer TypeScript type from Zod schema
|
|
28
|
+
*/
|
|
29
|
+
export type WithdrawalList = z.infer<typeof WithdrawalListSchema>
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
export * from './Balance.schema'
|
|
21
21
|
export * from './Currency.schema'
|
|
22
22
|
export * from './PaginatedPaymentListList.schema'
|
|
23
|
+
export * from './PaginatedWithdrawalListList.schema'
|
|
24
|
+
export * from './PaymentCreateRequest.schema'
|
|
25
|
+
export * from './PaymentCreateResponse.schema'
|
|
23
26
|
export * from './PaymentDetail.schema'
|
|
24
27
|
export * from './PaymentList.schema'
|
|
25
28
|
export * from './Transaction.schema'
|
|
29
|
+
export * from './WithdrawalCancelResponse.schema'
|
|
30
|
+
export * from './WithdrawalCreateRequest.schema'
|
|
31
|
+
export * from './WithdrawalCreateResponse.schema'
|
|
32
|
+
export * from './WithdrawalDetail.schema'
|
|
33
|
+
export * from './WithdrawalList.schema'
|
|
@@ -63,3 +63,39 @@ export enum TransactionTransactionType {
|
|
|
63
63
|
ADJUSTMENT = "adjustment",
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Withdrawal status
|
|
68
|
+
* * `pending` - Pending
|
|
69
|
+
* * `approved` - Approved
|
|
70
|
+
* * `processing` - Processing
|
|
71
|
+
* * `completed` - Completed
|
|
72
|
+
* * `rejected` - Rejected
|
|
73
|
+
* * `cancelled` - Cancelled
|
|
74
|
+
*/
|
|
75
|
+
export enum WithdrawalDetailStatus {
|
|
76
|
+
PENDING = "pending",
|
|
77
|
+
APPROVED = "approved",
|
|
78
|
+
PROCESSING = "processing",
|
|
79
|
+
COMPLETED = "completed",
|
|
80
|
+
REJECTED = "rejected",
|
|
81
|
+
CANCELLED = "cancelled",
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Withdrawal status
|
|
86
|
+
* * `pending` - Pending
|
|
87
|
+
* * `approved` - Approved
|
|
88
|
+
* * `processing` - Processing
|
|
89
|
+
* * `completed` - Completed
|
|
90
|
+
* * `rejected` - Rejected
|
|
91
|
+
* * `cancelled` - Cancelled
|
|
92
|
+
*/
|
|
93
|
+
export enum WithdrawalListStatus {
|
|
94
|
+
PENDING = "pending",
|
|
95
|
+
APPROVED = "approved",
|
|
96
|
+
PROCESSING = "processing",
|
|
97
|
+
COMPLETED = "completed",
|
|
98
|
+
REJECTED = "rejected",
|
|
99
|
+
CANCELLED = "cancelled",
|
|
100
|
+
}
|
|
101
|
+
|
|
@@ -24,13 +24,58 @@ export class ExtPaymentsPayments {
|
|
|
24
24
|
/**
|
|
25
25
|
* Get available currencies
|
|
26
26
|
*
|
|
27
|
-
* Returns list of available currencies with token+network info
|
|
27
|
+
* Returns list of available currencies with token+network info, popular
|
|
28
|
+
* first
|
|
28
29
|
*/
|
|
29
30
|
async currenciesList(): Promise<any> {
|
|
30
31
|
const response = await this.client.request('GET', "/cfg/payments/currencies/");
|
|
31
32
|
return response;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
async currenciesEstimateRetrieve(code: string, amount?: number): Promise<any>;
|
|
36
|
+
async currenciesEstimateRetrieve(code: string, params?: { amount?: number }): Promise<any>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get currency estimate
|
|
40
|
+
*
|
|
41
|
+
* Get estimated crypto amount for a given USD amount, including min amount
|
|
42
|
+
*/
|
|
43
|
+
async currenciesEstimateRetrieve(...args: any[]): Promise<any> {
|
|
44
|
+
const code = args[0];
|
|
45
|
+
const isParamsObject = args.length === 2 && typeof args[1] === 'object' && args[1] !== null && !Array.isArray(args[1]);
|
|
46
|
+
|
|
47
|
+
let params;
|
|
48
|
+
if (isParamsObject) {
|
|
49
|
+
params = args[1];
|
|
50
|
+
} else {
|
|
51
|
+
params = { amount: args[1] };
|
|
52
|
+
}
|
|
53
|
+
const response = await this.client.request('GET', `/cfg/payments/currencies/${code}/estimate/`, { params });
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async currenciesWithdrawalEstimateRetrieve(code: string, amount?: number): Promise<any>;
|
|
58
|
+
async currenciesWithdrawalEstimateRetrieve(code: string, params?: { amount?: number }): Promise<any>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get withdrawal estimate
|
|
62
|
+
*
|
|
63
|
+
* Get estimated crypto amount for withdrawal with fee breakdown
|
|
64
|
+
*/
|
|
65
|
+
async currenciesWithdrawalEstimateRetrieve(...args: any[]): Promise<any> {
|
|
66
|
+
const code = args[0];
|
|
67
|
+
const isParamsObject = args.length === 2 && typeof args[1] === 'object' && args[1] !== null && !Array.isArray(args[1]);
|
|
68
|
+
|
|
69
|
+
let params;
|
|
70
|
+
if (isParamsObject) {
|
|
71
|
+
params = args[1];
|
|
72
|
+
} else {
|
|
73
|
+
params = { amount: args[1] };
|
|
74
|
+
}
|
|
75
|
+
const response = await this.client.request('GET', `/cfg/payments/currencies/${code}/withdrawal-estimate/`, { params });
|
|
76
|
+
return response;
|
|
77
|
+
}
|
|
78
|
+
|
|
34
79
|
async paymentsList(page?: number, page_size?: number): Promise<Models.PaginatedPaymentListList>;
|
|
35
80
|
async paymentsList(params?: { page?: number; page_size?: number }): Promise<Models.PaginatedPaymentListList>;
|
|
36
81
|
|
|
@@ -85,12 +130,12 @@ export class ExtPaymentsPayments {
|
|
|
85
130
|
}
|
|
86
131
|
|
|
87
132
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
133
|
+
* Create payment
|
|
134
|
+
*
|
|
135
|
+
* Create a new payment with specified amount and currency
|
|
91
136
|
*/
|
|
92
|
-
async paymentsCreateCreate(): Promise<Models.
|
|
93
|
-
const response = await this.client.request('POST', "/cfg/payments/payments/create/");
|
|
137
|
+
async paymentsCreateCreate(data: Models.PaymentCreateRequest): Promise<Models.PaymentCreateResponse> {
|
|
138
|
+
const response = await this.client.request('POST', "/cfg/payments/payments/create/", { body: data });
|
|
94
139
|
return response;
|
|
95
140
|
}
|
|
96
141
|
|
|
@@ -115,4 +160,57 @@ export class ExtPaymentsPayments {
|
|
|
115
160
|
return response;
|
|
116
161
|
}
|
|
117
162
|
|
|
163
|
+
async withdrawalsList(page?: number, page_size?: number): Promise<Models.PaginatedWithdrawalListList>;
|
|
164
|
+
async withdrawalsList(params?: { page?: number; page_size?: number }): Promise<Models.PaginatedWithdrawalListList>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* ViewSet for withdrawal operations. Endpoints: - GET /withdrawals/ - List
|
|
168
|
+
* user's withdrawal requests - GET /withdrawals/{id}/ - Get withdrawal
|
|
169
|
+
* details - POST /withdrawals/create/ - Create withdrawal request - POST
|
|
170
|
+
* /withdrawals/{id}/cancel/ - Cancel pending withdrawal
|
|
171
|
+
*/
|
|
172
|
+
async withdrawalsList(...args: any[]): Promise<Models.PaginatedWithdrawalListList> {
|
|
173
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
174
|
+
|
|
175
|
+
let params;
|
|
176
|
+
if (isParamsObject) {
|
|
177
|
+
params = args[0];
|
|
178
|
+
} else {
|
|
179
|
+
params = { page: args[0], page_size: args[1] };
|
|
180
|
+
}
|
|
181
|
+
const response = await this.client.request('GET', "/cfg/payments/withdrawals/", { params });
|
|
182
|
+
return response;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* ViewSet for withdrawal operations. Endpoints: - GET /withdrawals/ - List
|
|
187
|
+
* user's withdrawal requests - GET /withdrawals/{id}/ - Get withdrawal
|
|
188
|
+
* details - POST /withdrawals/create/ - Create withdrawal request - POST
|
|
189
|
+
* /withdrawals/{id}/cancel/ - Cancel pending withdrawal
|
|
190
|
+
*/
|
|
191
|
+
async withdrawalsRetrieve(id: string): Promise<Models.WithdrawalDetail> {
|
|
192
|
+
const response = await this.client.request('GET', `/cfg/payments/withdrawals/${id}/`);
|
|
193
|
+
return response;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Cancel withdrawal request
|
|
198
|
+
*
|
|
199
|
+
* Cancel a pending withdrawal request
|
|
200
|
+
*/
|
|
201
|
+
async withdrawalsCancelCreate(id: string): Promise<Models.WithdrawalCancelResponse> {
|
|
202
|
+
const response = await this.client.request('POST', `/cfg/payments/withdrawals/${id}/cancel/`);
|
|
203
|
+
return response;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create withdrawal request
|
|
208
|
+
*
|
|
209
|
+
* Create a new withdrawal request (requires admin approval)
|
|
210
|
+
*/
|
|
211
|
+
async withdrawalsCreateCreate(data: Models.WithdrawalCreateRequest): Promise<Models.WithdrawalCreateResponse> {
|
|
212
|
+
const response = await this.client.request('POST', "/cfg/payments/withdrawals/create/", { body: data });
|
|
213
|
+
return response;
|
|
214
|
+
}
|
|
215
|
+
|
|
118
216
|
}
|
|
@@ -59,11 +59,8 @@ export interface PaymentDetail {
|
|
|
59
59
|
currency_name: string;
|
|
60
60
|
currency_token: string;
|
|
61
61
|
currency_network: string;
|
|
62
|
-
/** Amount to pay in cryptocurrency */
|
|
63
62
|
pay_amount?: string | null;
|
|
64
|
-
/** Actual amount received in cryptocurrency */
|
|
65
63
|
actual_amount?: string | null;
|
|
66
|
-
/** Actual amount received in USD */
|
|
67
64
|
actual_amount_usd?: string | null;
|
|
68
65
|
/** Current payment status
|
|
69
66
|
|
|
@@ -77,21 +74,16 @@ export interface PaymentDetail {
|
|
|
77
74
|
* `cancelled` - Cancelled */
|
|
78
75
|
status: Enums.PaymentDetailStatus;
|
|
79
76
|
status_display: string;
|
|
80
|
-
/** Cryptocurrency payment address */
|
|
81
77
|
pay_address?: string | null;
|
|
82
78
|
/** Get QR code URL. */
|
|
83
79
|
qr_code_url?: string | null;
|
|
84
|
-
/** Payment page URL (if provided by provider) */
|
|
85
80
|
payment_url?: string | null;
|
|
86
|
-
/** Blockchain transaction hash */
|
|
87
81
|
transaction_hash?: string | null;
|
|
88
82
|
/** Get blockchain explorer link. */
|
|
89
83
|
explorer_link?: string | null;
|
|
90
84
|
/** Number of blockchain confirmations */
|
|
91
85
|
confirmations_count: number;
|
|
92
|
-
/** When this payment expires (typically 30 minutes) */
|
|
93
86
|
expires_at?: string | null;
|
|
94
|
-
/** When this payment was completed */
|
|
95
87
|
completed_at?: string | null;
|
|
96
88
|
/** When this record was created */
|
|
97
89
|
created_at: string;
|
|
@@ -134,3 +126,171 @@ export interface PaymentList {
|
|
|
134
126
|
completed_at?: string | null;
|
|
135
127
|
}
|
|
136
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Serializer for creating payment.
|
|
131
|
+
*
|
|
132
|
+
* Request model (no read-only fields).
|
|
133
|
+
*/
|
|
134
|
+
export interface PaymentCreateRequest {
|
|
135
|
+
/** Payment amount in USD */
|
|
136
|
+
amount_usd: string;
|
|
137
|
+
/** Currency code (e.g., USDTTRC20) */
|
|
138
|
+
currency_code: string;
|
|
139
|
+
/** Optional payment description */
|
|
140
|
+
description?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Response for payment creation.
|
|
145
|
+
*
|
|
146
|
+
* Response model (includes read-only fields).
|
|
147
|
+
*/
|
|
148
|
+
export interface PaymentCreateResponse {
|
|
149
|
+
success: boolean;
|
|
150
|
+
payment: PaymentDetail;
|
|
151
|
+
qr_code_url: string | null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* Response model (includes read-only fields).
|
|
157
|
+
*/
|
|
158
|
+
export interface PaginatedWithdrawalListList {
|
|
159
|
+
/** Total number of items across all pages */
|
|
160
|
+
count: number;
|
|
161
|
+
/** Current page number (1-based) */
|
|
162
|
+
page: number;
|
|
163
|
+
/** Total number of pages */
|
|
164
|
+
pages: number;
|
|
165
|
+
/** Number of items per page */
|
|
166
|
+
page_size: number;
|
|
167
|
+
/** Whether there is a next page */
|
|
168
|
+
has_next: boolean;
|
|
169
|
+
/** Whether there is a previous page */
|
|
170
|
+
has_previous: boolean;
|
|
171
|
+
/** Next page number (null if no next page) */
|
|
172
|
+
next_page?: number | null;
|
|
173
|
+
/** Previous page number (null if no previous page) */
|
|
174
|
+
previous_page?: number | null;
|
|
175
|
+
/** Array of items for current page */
|
|
176
|
+
results: Array<WithdrawalList>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Detailed withdrawal information.
|
|
181
|
+
*
|
|
182
|
+
* Response model (includes read-only fields).
|
|
183
|
+
*/
|
|
184
|
+
export interface WithdrawalDetail {
|
|
185
|
+
/** Unique identifier for this record */
|
|
186
|
+
id: string;
|
|
187
|
+
/** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
|
|
188
|
+
internal_withdrawal_id: string;
|
|
189
|
+
/** Withdrawal amount in USD (min $10) */
|
|
190
|
+
amount_usd: string;
|
|
191
|
+
currency_code: string;
|
|
192
|
+
currency_name: string;
|
|
193
|
+
currency_token: string;
|
|
194
|
+
currency_network: string;
|
|
195
|
+
/** Destination wallet address */
|
|
196
|
+
wallet_address: string;
|
|
197
|
+
/** Network transaction fee in USD */
|
|
198
|
+
network_fee_usd: string;
|
|
199
|
+
/** Service fee in USD */
|
|
200
|
+
service_fee_usd: string;
|
|
201
|
+
/** Total fee (network + service) in USD */
|
|
202
|
+
total_fee_usd: string;
|
|
203
|
+
/** Final amount to receive (amount - total_fee) */
|
|
204
|
+
final_amount_usd: string;
|
|
205
|
+
crypto_amount?: string | null;
|
|
206
|
+
/** Withdrawal status
|
|
207
|
+
|
|
208
|
+
* `pending` - Pending
|
|
209
|
+
* `approved` - Approved
|
|
210
|
+
* `processing` - Processing
|
|
211
|
+
* `completed` - Completed
|
|
212
|
+
* `rejected` - Rejected
|
|
213
|
+
* `cancelled` - Cancelled */
|
|
214
|
+
status: Enums.WithdrawalDetailStatus;
|
|
215
|
+
status_display: string;
|
|
216
|
+
transaction_hash?: string | null;
|
|
217
|
+
/** Get blockchain explorer link. */
|
|
218
|
+
explorer_link?: string | null;
|
|
219
|
+
/** Admin notes (reason for rejection, etc.) */
|
|
220
|
+
admin_notes: string;
|
|
221
|
+
/** When this record was created */
|
|
222
|
+
created_at: string;
|
|
223
|
+
approved_at?: string | null;
|
|
224
|
+
completed_at?: string | null;
|
|
225
|
+
rejected_at?: string | null;
|
|
226
|
+
cancelled_at?: string | null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Response for withdrawal cancellation.
|
|
231
|
+
*
|
|
232
|
+
* Response model (includes read-only fields).
|
|
233
|
+
*/
|
|
234
|
+
export interface WithdrawalCancelResponse {
|
|
235
|
+
success: boolean;
|
|
236
|
+
withdrawal: WithdrawalDetail;
|
|
237
|
+
message: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Serializer for creating withdrawal request.
|
|
242
|
+
*
|
|
243
|
+
* Request model (no read-only fields).
|
|
244
|
+
*/
|
|
245
|
+
export interface WithdrawalCreateRequest {
|
|
246
|
+
/** Withdrawal amount in USD (min $10) */
|
|
247
|
+
amount_usd: string;
|
|
248
|
+
/** Currency code (e.g., USDTTRC20) */
|
|
249
|
+
currency_code: string;
|
|
250
|
+
/** Destination wallet address */
|
|
251
|
+
wallet_address: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Response for withdrawal creation.
|
|
256
|
+
*
|
|
257
|
+
* Response model (includes read-only fields).
|
|
258
|
+
*/
|
|
259
|
+
export interface WithdrawalCreateResponse {
|
|
260
|
+
success: boolean;
|
|
261
|
+
withdrawal: WithdrawalDetail;
|
|
262
|
+
message: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Withdrawal list item (lighter than detail).
|
|
267
|
+
*
|
|
268
|
+
* Response model (includes read-only fields).
|
|
269
|
+
*/
|
|
270
|
+
export interface WithdrawalList {
|
|
271
|
+
/** Unique identifier for this record */
|
|
272
|
+
id: string;
|
|
273
|
+
/** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
|
|
274
|
+
internal_withdrawal_id: string;
|
|
275
|
+
/** Withdrawal amount in USD (min $10) */
|
|
276
|
+
amount_usd: string;
|
|
277
|
+
/** Final amount to receive (amount - total_fee) */
|
|
278
|
+
final_amount_usd: string;
|
|
279
|
+
currency_code: string;
|
|
280
|
+
currency_token: string;
|
|
281
|
+
/** Withdrawal status
|
|
282
|
+
|
|
283
|
+
* `pending` - Pending
|
|
284
|
+
* `approved` - Approved
|
|
285
|
+
* `processing` - Processing
|
|
286
|
+
* `completed` - Completed
|
|
287
|
+
* `rejected` - Rejected
|
|
288
|
+
* `cancelled` - Cancelled */
|
|
289
|
+
status: Enums.WithdrawalListStatus;
|
|
290
|
+
status_display: string;
|
|
291
|
+
/** When this record was created */
|
|
292
|
+
created_at: string;
|
|
293
|
+
/** When withdrawal was completed */
|
|
294
|
+
completed_at?: string | null;
|
|
295
|
+
}
|
|
296
|
+
|