@djangocfg/ext-payments 1.0.13 → 1.0.17
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/hooks.cjs +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +1085 -1107
- package/dist/index.d.cts +480 -41
- package/dist/index.d.ts +480 -41
- package/dist/index.js +1037 -1093
- package/package.json +13 -16
- package/src/api/generated/ext_payments/CLAUDE.md +7 -3
- package/src/api/generated/ext_payments/_utils/fetchers/ext_payments__payments.ts +237 -5
- package/src/api/generated/ext_payments/_utils/hooks/ext_payments__payments.ts +71 -3
- 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/WithdrawalCreateRequest.schema.ts +21 -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 +5 -0
- package/src/api/generated/ext_payments/enums.ts +36 -0
- package/src/api/generated/ext_payments/ext_payments__payments/client.ts +58 -5
- package/src/api/generated/ext_payments/ext_payments__payments/models.ts +141 -0
- package/src/api/generated/ext_payments/schema.json +579 -3
- package/src/components/ActivityItem.tsx +118 -0
- package/src/components/ActivityList.tsx +93 -0
- package/src/components/AddFundsSheet.tsx +258 -0
- package/src/components/BalanceHero.tsx +102 -0
- package/src/components/PaymentSheet.tsx +290 -0
- package/src/components/ResponsiveSheet.tsx +151 -0
- package/src/components/WithdrawSheet.tsx +329 -0
- package/src/components/index.ts +18 -0
- package/src/contexts/WalletContext.tsx +355 -0
- package/src/contexts/index.ts +12 -45
- package/src/index.ts +6 -18
- 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/contexts/types.ts +0 -40
- package/src/hooks/index.ts +0 -20
- 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
|
@@ -85,12 +85,12 @@ export class ExtPaymentsPayments {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
88
|
+
* Create payment
|
|
89
|
+
*
|
|
90
|
+
* Create a new payment with specified amount and currency
|
|
91
91
|
*/
|
|
92
|
-
async paymentsCreateCreate(): Promise<Models.
|
|
93
|
-
const response = await this.client.request('POST', "/cfg/payments/payments/create/");
|
|
92
|
+
async paymentsCreateCreate(data: Models.PaymentCreateRequest): Promise<Models.PaymentDetail> {
|
|
93
|
+
const response = await this.client.request('POST', "/cfg/payments/payments/create/", { body: data });
|
|
94
94
|
return response;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -115,4 +115,57 @@ export class ExtPaymentsPayments {
|
|
|
115
115
|
return response;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
async withdrawalsList(page?: number, page_size?: number): Promise<Models.PaginatedWithdrawalListList>;
|
|
119
|
+
async withdrawalsList(params?: { page?: number; page_size?: number }): Promise<Models.PaginatedWithdrawalListList>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* ViewSet for withdrawal operations. Endpoints: - GET /withdrawals/ - List
|
|
123
|
+
* user's withdrawal requests - GET /withdrawals/{id}/ - Get withdrawal
|
|
124
|
+
* details - POST /withdrawals/create/ - Create withdrawal request - POST
|
|
125
|
+
* /withdrawals/{id}/cancel/ - Cancel pending withdrawal
|
|
126
|
+
*/
|
|
127
|
+
async withdrawalsList(...args: any[]): Promise<Models.PaginatedWithdrawalListList> {
|
|
128
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
129
|
+
|
|
130
|
+
let params;
|
|
131
|
+
if (isParamsObject) {
|
|
132
|
+
params = args[0];
|
|
133
|
+
} else {
|
|
134
|
+
params = { page: args[0], page_size: args[1] };
|
|
135
|
+
}
|
|
136
|
+
const response = await this.client.request('GET', "/cfg/payments/withdrawals/", { params });
|
|
137
|
+
return response;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* ViewSet for withdrawal operations. Endpoints: - GET /withdrawals/ - List
|
|
142
|
+
* user's withdrawal requests - GET /withdrawals/{id}/ - Get withdrawal
|
|
143
|
+
* details - POST /withdrawals/create/ - Create withdrawal request - POST
|
|
144
|
+
* /withdrawals/{id}/cancel/ - Cancel pending withdrawal
|
|
145
|
+
*/
|
|
146
|
+
async withdrawalsRetrieve(id: string): Promise<Models.WithdrawalDetail> {
|
|
147
|
+
const response = await this.client.request('GET', `/cfg/payments/withdrawals/${id}/`);
|
|
148
|
+
return response;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Cancel withdrawal request
|
|
153
|
+
*
|
|
154
|
+
* Cancel a pending withdrawal request
|
|
155
|
+
*/
|
|
156
|
+
async withdrawalsCancelCreate(id: string): Promise<Models.WithdrawalDetail> {
|
|
157
|
+
const response = await this.client.request('POST', `/cfg/payments/withdrawals/${id}/cancel/`);
|
|
158
|
+
return response;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Create withdrawal request
|
|
163
|
+
*
|
|
164
|
+
* Create a new withdrawal request (requires admin approval)
|
|
165
|
+
*/
|
|
166
|
+
async withdrawalsCreateCreate(data: Models.WithdrawalCreateRequest): Promise<Models.WithdrawalDetail> {
|
|
167
|
+
const response = await this.client.request('POST', "/cfg/payments/withdrawals/create/", { body: data });
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
|
|
118
171
|
}
|
|
@@ -134,3 +134,144 @@ export interface PaymentList {
|
|
|
134
134
|
completed_at?: string | null;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Serializer for creating payment.
|
|
139
|
+
*
|
|
140
|
+
* Request model (no read-only fields).
|
|
141
|
+
*/
|
|
142
|
+
export interface PaymentCreateRequest {
|
|
143
|
+
/** Payment amount in USD */
|
|
144
|
+
amount_usd: string;
|
|
145
|
+
/** Currency code (e.g., USDTTRC20) */
|
|
146
|
+
currency_code: string;
|
|
147
|
+
/** Optional payment description */
|
|
148
|
+
description?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* Response model (includes read-only fields).
|
|
154
|
+
*/
|
|
155
|
+
export interface PaginatedWithdrawalListList {
|
|
156
|
+
/** Total number of items across all pages */
|
|
157
|
+
count: number;
|
|
158
|
+
/** Current page number (1-based) */
|
|
159
|
+
page: number;
|
|
160
|
+
/** Total number of pages */
|
|
161
|
+
pages: number;
|
|
162
|
+
/** Number of items per page */
|
|
163
|
+
page_size: number;
|
|
164
|
+
/** Whether there is a next page */
|
|
165
|
+
has_next: boolean;
|
|
166
|
+
/** Whether there is a previous page */
|
|
167
|
+
has_previous: boolean;
|
|
168
|
+
/** Next page number (null if no next page) */
|
|
169
|
+
next_page?: number | null;
|
|
170
|
+
/** Previous page number (null if no previous page) */
|
|
171
|
+
previous_page?: number | null;
|
|
172
|
+
/** Array of items for current page */
|
|
173
|
+
results: Array<WithdrawalList>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Detailed withdrawal information.
|
|
178
|
+
*
|
|
179
|
+
* Response model (includes read-only fields).
|
|
180
|
+
*/
|
|
181
|
+
export interface WithdrawalDetail {
|
|
182
|
+
/** Unique identifier for this record */
|
|
183
|
+
id: string;
|
|
184
|
+
/** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
|
|
185
|
+
internal_withdrawal_id: string;
|
|
186
|
+
/** Withdrawal amount in USD (min $10) */
|
|
187
|
+
amount_usd: string;
|
|
188
|
+
currency_code: string;
|
|
189
|
+
currency_name: string;
|
|
190
|
+
currency_token: string;
|
|
191
|
+
currency_network: string;
|
|
192
|
+
/** Destination wallet address */
|
|
193
|
+
wallet_address: string;
|
|
194
|
+
/** Network transaction fee in USD */
|
|
195
|
+
network_fee_usd: string;
|
|
196
|
+
/** Service fee in USD */
|
|
197
|
+
service_fee_usd: string;
|
|
198
|
+
/** Total fee (network + service) in USD */
|
|
199
|
+
total_fee_usd: string;
|
|
200
|
+
/** Final amount to receive (amount - total_fee) */
|
|
201
|
+
final_amount_usd: string;
|
|
202
|
+
/** Amount in cryptocurrency (calculated at processing time) */
|
|
203
|
+
crypto_amount?: string | null;
|
|
204
|
+
/** Withdrawal status
|
|
205
|
+
|
|
206
|
+
* `pending` - Pending
|
|
207
|
+
* `approved` - Approved
|
|
208
|
+
* `processing` - Processing
|
|
209
|
+
* `completed` - Completed
|
|
210
|
+
* `rejected` - Rejected
|
|
211
|
+
* `cancelled` - Cancelled */
|
|
212
|
+
status: Enums.WithdrawalDetailStatus;
|
|
213
|
+
status_display: string;
|
|
214
|
+
/** Blockchain transaction hash (after sending) */
|
|
215
|
+
transaction_hash?: string | null;
|
|
216
|
+
/** Get blockchain explorer link. */
|
|
217
|
+
explorer_link?: string | null;
|
|
218
|
+
/** Admin notes (reason for rejection, etc.) */
|
|
219
|
+
admin_notes: string;
|
|
220
|
+
/** When this record was created */
|
|
221
|
+
created_at: string;
|
|
222
|
+
/** When approved by admin */
|
|
223
|
+
approved_at?: string | null;
|
|
224
|
+
/** When withdrawal was completed */
|
|
225
|
+
completed_at?: string | null;
|
|
226
|
+
/** When rejected by admin */
|
|
227
|
+
rejected_at?: string | null;
|
|
228
|
+
/** When cancelled by user */
|
|
229
|
+
cancelled_at?: string | null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Serializer for creating withdrawal request.
|
|
234
|
+
*
|
|
235
|
+
* Request model (no read-only fields).
|
|
236
|
+
*/
|
|
237
|
+
export interface WithdrawalCreateRequest {
|
|
238
|
+
/** Withdrawal amount in USD (min $10) */
|
|
239
|
+
amount_usd: string;
|
|
240
|
+
/** Currency code (e.g., USDTTRC20) */
|
|
241
|
+
currency_code: string;
|
|
242
|
+
/** Destination wallet address */
|
|
243
|
+
wallet_address: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Withdrawal list item (lighter than detail).
|
|
248
|
+
*
|
|
249
|
+
* Response model (includes read-only fields).
|
|
250
|
+
*/
|
|
251
|
+
export interface WithdrawalList {
|
|
252
|
+
/** Unique identifier for this record */
|
|
253
|
+
id: string;
|
|
254
|
+
/** Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID) */
|
|
255
|
+
internal_withdrawal_id: string;
|
|
256
|
+
/** Withdrawal amount in USD (min $10) */
|
|
257
|
+
amount_usd: string;
|
|
258
|
+
/** Final amount to receive (amount - total_fee) */
|
|
259
|
+
final_amount_usd: string;
|
|
260
|
+
currency_code: string;
|
|
261
|
+
currency_token: string;
|
|
262
|
+
/** Withdrawal status
|
|
263
|
+
|
|
264
|
+
* `pending` - Pending
|
|
265
|
+
* `approved` - Approved
|
|
266
|
+
* `processing` - Processing
|
|
267
|
+
* `completed` - Completed
|
|
268
|
+
* `rejected` - Rejected
|
|
269
|
+
* `cancelled` - Cancelled */
|
|
270
|
+
status: Enums.WithdrawalListStatus;
|
|
271
|
+
status_display: string;
|
|
272
|
+
/** When this record was created */
|
|
273
|
+
created_at: string;
|
|
274
|
+
/** When withdrawal was completed */
|
|
275
|
+
completed_at?: string | null;
|
|
276
|
+
}
|
|
277
|
+
|