@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.
Files changed (76) hide show
  1. package/dist/config.cjs +5 -8
  2. package/dist/config.js +5 -8
  3. package/dist/index.cjs +1906 -1043
  4. package/dist/index.d.cts +644 -59
  5. package/dist/index.d.ts +644 -59
  6. package/dist/index.js +1886 -1040
  7. package/package.json +13 -16
  8. package/src/WalletPage.tsx +100 -0
  9. package/src/api/generated/ext_payments/CLAUDE.md +10 -4
  10. package/src/api/generated/ext_payments/_utils/fetchers/ext_payments__payments.ts +268 -5
  11. package/src/api/generated/ext_payments/_utils/hooks/ext_payments__payments.ts +102 -3
  12. package/src/api/generated/ext_payments/_utils/schemas/Balance.schema.ts +1 -1
  13. package/src/api/generated/ext_payments/_utils/schemas/PaginatedWithdrawalListList.schema.ts +24 -0
  14. package/src/api/generated/ext_payments/_utils/schemas/PaymentCreateRequest.schema.ts +21 -0
  15. package/src/api/generated/ext_payments/_utils/schemas/PaymentCreateResponse.schema.ts +22 -0
  16. package/src/api/generated/ext_payments/_utils/schemas/PaymentDetail.schema.ts +3 -3
  17. package/src/api/generated/ext_payments/_utils/schemas/PaymentList.schema.ts +2 -2
  18. package/src/api/generated/ext_payments/_utils/schemas/Transaction.schema.ts +1 -1
  19. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCancelResponse.schema.ts +22 -0
  20. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCreateRequest.schema.ts +21 -0
  21. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalCreateResponse.schema.ts +22 -0
  22. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalDetail.schema.ts +42 -0
  23. package/src/api/generated/ext_payments/_utils/schemas/WithdrawalList.schema.ts +29 -0
  24. package/src/api/generated/ext_payments/_utils/schemas/index.ts +8 -0
  25. package/src/api/generated/ext_payments/client.ts +1 -1
  26. package/src/api/generated/ext_payments/enums.ts +36 -0
  27. package/src/api/generated/ext_payments/ext_payments__payments/client.ts +104 -6
  28. package/src/api/generated/ext_payments/ext_payments__payments/models.ts +168 -8
  29. package/src/api/generated/ext_payments/index.ts +1 -1
  30. package/src/api/generated/ext_payments/schema.json +752 -42
  31. package/src/components/ActivityItem.tsx +118 -0
  32. package/src/components/ActivityList.tsx +93 -0
  33. package/src/components/AddFundsSheet.tsx +342 -0
  34. package/src/components/BalanceHero.tsx +102 -0
  35. package/src/components/CurrencyCombobox.tsx +49 -0
  36. package/src/components/PaymentSheet.tsx +352 -0
  37. package/src/components/WithdrawSheet.tsx +355 -0
  38. package/src/components/WithdrawalSheet.tsx +332 -0
  39. package/src/components/index.ts +11 -0
  40. package/src/config.ts +1 -0
  41. package/src/contexts/WalletContext.tsx +356 -0
  42. package/src/contexts/index.ts +13 -42
  43. package/src/contexts/types.ts +43 -37
  44. package/src/hooks/index.ts +3 -20
  45. package/src/hooks/useCurrencyOptions.ts +79 -0
  46. package/src/hooks/useEstimate.ts +113 -0
  47. package/src/hooks/useWithdrawalEstimate.ts +117 -0
  48. package/src/index.ts +9 -18
  49. package/src/types/index.ts +78 -0
  50. package/src/utils/errors.ts +36 -0
  51. package/src/utils/format.ts +65 -0
  52. package/src/utils/index.ts +3 -0
  53. package/src/contexts/BalancesContext.tsx +0 -63
  54. package/src/contexts/CurrenciesContext.tsx +0 -64
  55. package/src/contexts/OverviewContext.tsx +0 -173
  56. package/src/contexts/PaymentsContext.tsx +0 -122
  57. package/src/contexts/PaymentsExtensionProvider.tsx +0 -56
  58. package/src/contexts/README.md +0 -201
  59. package/src/contexts/RootPaymentsContext.tsx +0 -66
  60. package/src/layouts/PaymentsLayout/PaymentsLayout.tsx +0 -90
  61. package/src/layouts/PaymentsLayout/components/CreatePaymentDialog.tsx +0 -274
  62. package/src/layouts/PaymentsLayout/components/PaymentDetailsDialog.tsx +0 -287
  63. package/src/layouts/PaymentsLayout/components/index.ts +0 -2
  64. package/src/layouts/PaymentsLayout/events.ts +0 -47
  65. package/src/layouts/PaymentsLayout/index.ts +0 -16
  66. package/src/layouts/PaymentsLayout/types.ts +0 -6
  67. package/src/layouts/PaymentsLayout/views/overview/components/BalanceCard.tsx +0 -121
  68. package/src/layouts/PaymentsLayout/views/overview/components/RecentPayments.tsx +0 -139
  69. package/src/layouts/PaymentsLayout/views/overview/components/index.ts +0 -2
  70. package/src/layouts/PaymentsLayout/views/overview/index.tsx +0 -21
  71. package/src/layouts/PaymentsLayout/views/payments/components/PaymentsList.tsx +0 -279
  72. package/src/layouts/PaymentsLayout/views/payments/components/index.ts +0 -1
  73. package/src/layouts/PaymentsLayout/views/payments/index.tsx +0 -18
  74. package/src/layouts/PaymentsLayout/views/transactions/components/TransactionsList.tsx +0 -260
  75. package/src/layouts/PaymentsLayout/views/transactions/components/index.ts +0 -1
  76. package/src/layouts/PaymentsLayout/views/transactions/index.tsx +0 -18
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
- "title": "Django CFG API",
4
+ "title": "Cmdop API",
5
5
  "version": "1.0.0",
6
6
  "description": "Complete API documentation for Django CFG Demo Project",
7
7
  "x-django-metadata": {
@@ -45,7 +45,7 @@
45
45
  "/cfg/payments/currencies/": {
46
46
  "get": {
47
47
  "operationId": "cfg_payments_currencies_list",
48
- "description": "Returns list of available currencies with token+network info",
48
+ "description": "Returns list of available currencies with token+network info, popular first",
49
49
  "summary": "Get available currencies",
50
50
  "tags": [
51
51
  "payments"
@@ -73,6 +73,92 @@
73
73
  "x-async-capable": false
74
74
  }
75
75
  },
76
+ "/cfg/payments/currencies/{code}/estimate/": {
77
+ "get": {
78
+ "operationId": "cfg_payments_currencies_estimate_retrieve",
79
+ "description": "Get estimated crypto amount for a given USD amount, including min amount",
80
+ "summary": "Get currency estimate",
81
+ "parameters": [
82
+ {
83
+ "in": "query",
84
+ "name": "amount",
85
+ "schema": {
86
+ "type": "number",
87
+ "format": "double"
88
+ },
89
+ "description": "Amount in USD (default: 1)"
90
+ },
91
+ {
92
+ "in": "path",
93
+ "name": "code",
94
+ "schema": {
95
+ "type": "string"
96
+ },
97
+ "required": true
98
+ }
99
+ ],
100
+ "tags": [
101
+ "payments"
102
+ ],
103
+ "security": [
104
+ {
105
+ "jwtAuthWithLastLogin": []
106
+ }
107
+ ],
108
+ "responses": {
109
+ "200": {
110
+ "description": "Estimate response"
111
+ },
112
+ "400": {
113
+ "description": "Invalid currency"
114
+ }
115
+ },
116
+ "x-async-capable": false
117
+ }
118
+ },
119
+ "/cfg/payments/currencies/{code}/withdrawal-estimate/": {
120
+ "get": {
121
+ "operationId": "cfg_payments_currencies_withdrawal_estimate_retrieve",
122
+ "description": "Get estimated crypto amount for withdrawal with fee breakdown",
123
+ "summary": "Get withdrawal estimate",
124
+ "parameters": [
125
+ {
126
+ "in": "query",
127
+ "name": "amount",
128
+ "schema": {
129
+ "type": "number",
130
+ "format": "double"
131
+ },
132
+ "description": "Amount to withdraw in USD (default: 10)"
133
+ },
134
+ {
135
+ "in": "path",
136
+ "name": "code",
137
+ "schema": {
138
+ "type": "string"
139
+ },
140
+ "required": true
141
+ }
142
+ ],
143
+ "tags": [
144
+ "payments"
145
+ ],
146
+ "security": [
147
+ {
148
+ "jwtAuthWithLastLogin": []
149
+ }
150
+ ],
151
+ "responses": {
152
+ "200": {
153
+ "description": "Withdrawal estimate response"
154
+ },
155
+ "400": {
156
+ "description": "Invalid currency or amount"
157
+ }
158
+ },
159
+ "x-async-capable": false
160
+ }
161
+ },
76
162
  "/cfg/payments/payments/": {
77
163
  "get": {
78
164
  "operationId": "cfg_payments_payments_list",
@@ -234,25 +320,49 @@
234
320
  "/cfg/payments/payments/create/": {
235
321
  "post": {
236
322
  "operationId": "cfg_payments_payments_create_create",
237
- "description": "POST /api/v1/payments/create/\n\nCreate new payment.\n\nRequest body:\n{\n \"amount_usd\": \"100.00\",\n \"currency_code\": \"USDTTRC20\",\n \"description\": \"Optional description\"\n}",
323
+ "description": "Create a new payment with specified amount and currency",
324
+ "summary": "Create payment",
238
325
  "tags": [
239
326
  "payments"
240
327
  ],
328
+ "requestBody": {
329
+ "content": {
330
+ "application/json": {
331
+ "schema": {
332
+ "$ref": "#/components/schemas/PaymentCreateRequest"
333
+ }
334
+ },
335
+ "application/x-www-form-urlencoded": {
336
+ "schema": {
337
+ "$ref": "#/components/schemas/PaymentCreateRequest"
338
+ }
339
+ },
340
+ "multipart/form-data": {
341
+ "schema": {
342
+ "$ref": "#/components/schemas/PaymentCreateRequest"
343
+ }
344
+ }
345
+ },
346
+ "required": true
347
+ },
241
348
  "security": [
242
349
  {
243
350
  "jwtAuthWithLastLogin": []
244
351
  }
245
352
  ],
246
353
  "responses": {
247
- "200": {
354
+ "201": {
248
355
  "content": {
249
356
  "application/json": {
250
357
  "schema": {
251
- "$ref": "#/components/schemas/PaymentList"
358
+ "$ref": "#/components/schemas/PaymentCreateResponse"
252
359
  }
253
360
  }
254
361
  },
255
362
  "description": ""
363
+ },
364
+ "400": {
365
+ "description": "Validation error"
256
366
  }
257
367
  },
258
368
  "x-async-capable": false
@@ -314,6 +424,182 @@
314
424
  },
315
425
  "x-async-capable": false
316
426
  }
427
+ },
428
+ "/cfg/payments/withdrawals/": {
429
+ "get": {
430
+ "operationId": "cfg_payments_withdrawals_list",
431
+ "description": "ViewSet for withdrawal operations.\n\nEndpoints:\n- GET /withdrawals/ - List user's withdrawal requests\n- GET /withdrawals/{id}/ - Get withdrawal details\n- POST /withdrawals/create/ - Create withdrawal request\n- POST /withdrawals/{id}/cancel/ - Cancel pending withdrawal",
432
+ "parameters": [
433
+ {
434
+ "name": "page",
435
+ "required": false,
436
+ "in": "query",
437
+ "description": "A page number within the paginated result set.",
438
+ "schema": {
439
+ "type": "integer"
440
+ }
441
+ },
442
+ {
443
+ "name": "page_size",
444
+ "required": false,
445
+ "in": "query",
446
+ "description": "Number of results to return per page.",
447
+ "schema": {
448
+ "type": "integer"
449
+ }
450
+ }
451
+ ],
452
+ "tags": [
453
+ "payments"
454
+ ],
455
+ "security": [
456
+ {
457
+ "jwtAuthWithLastLogin": []
458
+ }
459
+ ],
460
+ "responses": {
461
+ "200": {
462
+ "content": {
463
+ "application/json": {
464
+ "schema": {
465
+ "$ref": "#/components/schemas/PaginatedWithdrawalListList"
466
+ }
467
+ }
468
+ },
469
+ "description": ""
470
+ }
471
+ },
472
+ "x-async-capable": false
473
+ }
474
+ },
475
+ "/cfg/payments/withdrawals/{id}/": {
476
+ "get": {
477
+ "operationId": "cfg_payments_withdrawals_retrieve",
478
+ "description": "ViewSet for withdrawal operations.\n\nEndpoints:\n- GET /withdrawals/ - List user's withdrawal requests\n- GET /withdrawals/{id}/ - Get withdrawal details\n- POST /withdrawals/create/ - Create withdrawal request\n- POST /withdrawals/{id}/cancel/ - Cancel pending withdrawal",
479
+ "parameters": [
480
+ {
481
+ "in": "path",
482
+ "name": "id",
483
+ "schema": {
484
+ "type": "string"
485
+ },
486
+ "required": true
487
+ }
488
+ ],
489
+ "tags": [
490
+ "payments"
491
+ ],
492
+ "security": [
493
+ {
494
+ "jwtAuthWithLastLogin": []
495
+ }
496
+ ],
497
+ "responses": {
498
+ "200": {
499
+ "content": {
500
+ "application/json": {
501
+ "schema": {
502
+ "$ref": "#/components/schemas/WithdrawalDetail"
503
+ }
504
+ }
505
+ },
506
+ "description": ""
507
+ }
508
+ },
509
+ "x-async-capable": false
510
+ }
511
+ },
512
+ "/cfg/payments/withdrawals/{id}/cancel/": {
513
+ "post": {
514
+ "operationId": "cfg_payments_withdrawals_cancel_create",
515
+ "description": "Cancel a pending withdrawal request",
516
+ "summary": "Cancel withdrawal request",
517
+ "parameters": [
518
+ {
519
+ "in": "path",
520
+ "name": "id",
521
+ "schema": {
522
+ "type": "string"
523
+ },
524
+ "required": true
525
+ }
526
+ ],
527
+ "tags": [
528
+ "payments"
529
+ ],
530
+ "security": [
531
+ {
532
+ "jwtAuthWithLastLogin": []
533
+ }
534
+ ],
535
+ "responses": {
536
+ "200": {
537
+ "content": {
538
+ "application/json": {
539
+ "schema": {
540
+ "$ref": "#/components/schemas/WithdrawalCancelResponse"
541
+ }
542
+ }
543
+ },
544
+ "description": ""
545
+ },
546
+ "400": {
547
+ "description": "Cannot cancel"
548
+ }
549
+ },
550
+ "x-async-capable": false
551
+ }
552
+ },
553
+ "/cfg/payments/withdrawals/create/": {
554
+ "post": {
555
+ "operationId": "cfg_payments_withdrawals_create_create",
556
+ "description": "Create a new withdrawal request (requires admin approval)",
557
+ "summary": "Create withdrawal request",
558
+ "tags": [
559
+ "payments"
560
+ ],
561
+ "requestBody": {
562
+ "content": {
563
+ "application/json": {
564
+ "schema": {
565
+ "$ref": "#/components/schemas/WithdrawalCreateRequest"
566
+ }
567
+ },
568
+ "application/x-www-form-urlencoded": {
569
+ "schema": {
570
+ "$ref": "#/components/schemas/WithdrawalCreateRequest"
571
+ }
572
+ },
573
+ "multipart/form-data": {
574
+ "schema": {
575
+ "$ref": "#/components/schemas/WithdrawalCreateRequest"
576
+ }
577
+ }
578
+ },
579
+ "required": true
580
+ },
581
+ "security": [
582
+ {
583
+ "jwtAuthWithLastLogin": []
584
+ }
585
+ ],
586
+ "responses": {
587
+ "201": {
588
+ "content": {
589
+ "application/json": {
590
+ "schema": {
591
+ "$ref": "#/components/schemas/WithdrawalCreateResponse"
592
+ }
593
+ }
594
+ },
595
+ "description": ""
596
+ },
597
+ "400": {
598
+ "description": "Validation error"
599
+ }
600
+ },
601
+ "x-async-capable": false
602
+ }
317
603
  }
318
604
  },
319
605
  "components": {
@@ -496,31 +782,143 @@
496
782
  }
497
783
  }
498
784
  },
499
- "PaymentDetail": {
785
+ "PaginatedWithdrawalListList": {
500
786
  "type": "object",
501
- "description": "Detailed payment information.",
787
+ "required": [
788
+ "count",
789
+ "page",
790
+ "pages",
791
+ "page_size",
792
+ "has_next",
793
+ "has_previous",
794
+ "results"
795
+ ],
502
796
  "properties": {
503
- "id": {
504
- "type": "string",
505
- "format": "uuid",
506
- "readOnly": true,
507
- "description": "Unique identifier for this record"
508
- },
509
- "internal_payment_id": {
510
- "type": "string",
511
- "readOnly": true,
512
- "description": "Internal payment identifier (PAY_YYYYMMDDHHMMSS_UUID)"
797
+ "count": {
798
+ "type": "integer",
799
+ "description": "Total number of items across all pages",
800
+ "example": 150
513
801
  },
514
- "amount_usd": {
515
- "type": "string",
516
- "format": "decimal",
517
- "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
518
- "readOnly": true,
519
- "description": "Payment amount in USD"
802
+ "page": {
803
+ "type": "integer",
804
+ "description": "Current page number (1-based)",
805
+ "example": 2
520
806
  },
521
- "currency_code": {
522
- "type": "string",
523
- "readOnly": true
807
+ "pages": {
808
+ "type": "integer",
809
+ "description": "Total number of pages",
810
+ "example": 15
811
+ },
812
+ "page_size": {
813
+ "type": "integer",
814
+ "description": "Number of items per page",
815
+ "example": 10
816
+ },
817
+ "has_next": {
818
+ "type": "boolean",
819
+ "description": "Whether there is a next page",
820
+ "example": true
821
+ },
822
+ "has_previous": {
823
+ "type": "boolean",
824
+ "description": "Whether there is a previous page",
825
+ "example": true
826
+ },
827
+ "next_page": {
828
+ "type": "integer",
829
+ "nullable": true,
830
+ "description": "Next page number (null if no next page)",
831
+ "example": 3
832
+ },
833
+ "previous_page": {
834
+ "type": "integer",
835
+ "nullable": true,
836
+ "description": "Previous page number (null if no previous page)",
837
+ "example": 1
838
+ },
839
+ "results": {
840
+ "type": "array",
841
+ "items": {
842
+ "$ref": "#/components/schemas/WithdrawalList"
843
+ },
844
+ "description": "Array of items for current page"
845
+ }
846
+ }
847
+ },
848
+ "PaymentCreateRequest": {
849
+ "type": "object",
850
+ "description": "Serializer for creating payment.",
851
+ "properties": {
852
+ "amount_usd": {
853
+ "type": "string",
854
+ "format": "decimal",
855
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
856
+ "description": "Payment amount in USD"
857
+ },
858
+ "currency_code": {
859
+ "type": "string",
860
+ "minLength": 1,
861
+ "description": "Currency code (e.g., USDTTRC20)",
862
+ "maxLength": 20
863
+ },
864
+ "description": {
865
+ "type": "string",
866
+ "description": "Optional payment description",
867
+ "maxLength": 500
868
+ }
869
+ },
870
+ "required": [
871
+ "amount_usd",
872
+ "currency_code"
873
+ ]
874
+ },
875
+ "PaymentCreateResponse": {
876
+ "type": "object",
877
+ "description": "Response for payment creation.",
878
+ "properties": {
879
+ "success": {
880
+ "type": "boolean"
881
+ },
882
+ "payment": {
883
+ "$ref": "#/components/schemas/PaymentDetail"
884
+ },
885
+ "qr_code_url": {
886
+ "type": "string",
887
+ "format": "uri",
888
+ "nullable": true
889
+ }
890
+ },
891
+ "required": [
892
+ "payment",
893
+ "qr_code_url",
894
+ "success"
895
+ ]
896
+ },
897
+ "PaymentDetail": {
898
+ "type": "object",
899
+ "description": "Detailed payment information.",
900
+ "properties": {
901
+ "id": {
902
+ "type": "string",
903
+ "format": "uuid",
904
+ "readOnly": true,
905
+ "description": "Unique identifier for this record"
906
+ },
907
+ "internal_payment_id": {
908
+ "type": "string",
909
+ "readOnly": true,
910
+ "description": "Internal payment identifier (PAY_YYYYMMDDHHMMSS_UUID)"
911
+ },
912
+ "amount_usd": {
913
+ "type": "string",
914
+ "format": "decimal",
915
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
916
+ "readOnly": true,
917
+ "description": "Payment amount in USD"
918
+ },
919
+ "currency_code": {
920
+ "type": "string",
921
+ "readOnly": true
524
922
  },
525
923
  "currency_name": {
526
924
  "type": "string",
@@ -539,24 +937,21 @@
539
937
  "format": "decimal",
540
938
  "pattern": "^-?\\d{0,12}(?:\\.\\d{0,8})?$",
541
939
  "readOnly": true,
542
- "nullable": true,
543
- "description": "Amount to pay in cryptocurrency"
940
+ "nullable": true
544
941
  },
545
942
  "actual_amount": {
546
943
  "type": "string",
547
944
  "format": "decimal",
548
945
  "pattern": "^-?\\d{0,12}(?:\\.\\d{0,8})?$",
549
946
  "readOnly": true,
550
- "nullable": true,
551
- "description": "Actual amount received in cryptocurrency"
947
+ "nullable": true
552
948
  },
553
949
  "actual_amount_usd": {
554
950
  "type": "string",
555
951
  "format": "decimal",
556
952
  "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
557
953
  "readOnly": true,
558
- "nullable": true,
559
- "description": "Actual amount received in USD"
954
+ "nullable": true
560
955
  },
561
956
  "status": {
562
957
  "enum": [
@@ -581,8 +976,7 @@
581
976
  "pay_address": {
582
977
  "type": "string",
583
978
  "readOnly": true,
584
- "nullable": true,
585
- "description": "Cryptocurrency payment address"
979
+ "nullable": true
586
980
  },
587
981
  "qr_code_url": {
588
982
  "type": "string",
@@ -594,14 +988,12 @@
594
988
  "type": "string",
595
989
  "format": "uri",
596
990
  "readOnly": true,
597
- "nullable": true,
598
- "description": "Payment page URL (if provided by provider)"
991
+ "nullable": true
599
992
  },
600
993
  "transaction_hash": {
601
994
  "type": "string",
602
995
  "readOnly": true,
603
- "nullable": true,
604
- "description": "Blockchain transaction hash"
996
+ "nullable": true
605
997
  },
606
998
  "explorer_link": {
607
999
  "type": "string",
@@ -618,15 +1010,13 @@
618
1010
  "type": "string",
619
1011
  "format": "date-time",
620
1012
  "readOnly": true,
621
- "nullable": true,
622
- "description": "When this payment expires (typically 30 minutes)"
1013
+ "nullable": true
623
1014
  },
624
1015
  "completed_at": {
625
1016
  "type": "string",
626
1017
  "format": "date-time",
627
1018
  "readOnly": true,
628
- "nullable": true,
629
- "description": "When this payment was completed"
1019
+ "nullable": true
630
1020
  },
631
1021
  "created_at": {
632
1022
  "type": "string",
@@ -832,6 +1222,326 @@
832
1222
  "transaction_type",
833
1223
  "type_display"
834
1224
  ]
1225
+ },
1226
+ "WithdrawalCancelResponse": {
1227
+ "type": "object",
1228
+ "description": "Response for withdrawal cancellation.",
1229
+ "properties": {
1230
+ "success": {
1231
+ "type": "boolean"
1232
+ },
1233
+ "withdrawal": {
1234
+ "$ref": "#/components/schemas/WithdrawalDetail"
1235
+ },
1236
+ "message": {
1237
+ "type": "string"
1238
+ }
1239
+ },
1240
+ "required": [
1241
+ "message",
1242
+ "success",
1243
+ "withdrawal"
1244
+ ]
1245
+ },
1246
+ "WithdrawalCreateRequest": {
1247
+ "type": "object",
1248
+ "description": "Serializer for creating withdrawal request.",
1249
+ "properties": {
1250
+ "amount_usd": {
1251
+ "type": "string",
1252
+ "format": "decimal",
1253
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1254
+ "description": "Withdrawal amount in USD (min $10)"
1255
+ },
1256
+ "currency_code": {
1257
+ "type": "string",
1258
+ "minLength": 1,
1259
+ "description": "Currency code (e.g., USDTTRC20)",
1260
+ "maxLength": 20
1261
+ },
1262
+ "wallet_address": {
1263
+ "type": "string",
1264
+ "minLength": 1,
1265
+ "description": "Destination wallet address",
1266
+ "maxLength": 255
1267
+ }
1268
+ },
1269
+ "required": [
1270
+ "amount_usd",
1271
+ "currency_code",
1272
+ "wallet_address"
1273
+ ]
1274
+ },
1275
+ "WithdrawalCreateResponse": {
1276
+ "type": "object",
1277
+ "description": "Response for withdrawal creation.",
1278
+ "properties": {
1279
+ "success": {
1280
+ "type": "boolean"
1281
+ },
1282
+ "withdrawal": {
1283
+ "$ref": "#/components/schemas/WithdrawalDetail"
1284
+ },
1285
+ "message": {
1286
+ "type": "string"
1287
+ }
1288
+ },
1289
+ "required": [
1290
+ "message",
1291
+ "success",
1292
+ "withdrawal"
1293
+ ]
1294
+ },
1295
+ "WithdrawalDetail": {
1296
+ "type": "object",
1297
+ "description": "Detailed withdrawal information.",
1298
+ "properties": {
1299
+ "id": {
1300
+ "type": "string",
1301
+ "format": "uuid",
1302
+ "readOnly": true,
1303
+ "description": "Unique identifier for this record"
1304
+ },
1305
+ "internal_withdrawal_id": {
1306
+ "type": "string",
1307
+ "readOnly": true,
1308
+ "description": "Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID)"
1309
+ },
1310
+ "amount_usd": {
1311
+ "type": "string",
1312
+ "format": "decimal",
1313
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1314
+ "readOnly": true,
1315
+ "description": "Withdrawal amount in USD (min $10)"
1316
+ },
1317
+ "currency_code": {
1318
+ "type": "string",
1319
+ "readOnly": true
1320
+ },
1321
+ "currency_name": {
1322
+ "type": "string",
1323
+ "readOnly": true
1324
+ },
1325
+ "currency_token": {
1326
+ "type": "string",
1327
+ "readOnly": true
1328
+ },
1329
+ "currency_network": {
1330
+ "type": "string",
1331
+ "readOnly": true
1332
+ },
1333
+ "wallet_address": {
1334
+ "type": "string",
1335
+ "readOnly": true,
1336
+ "description": "Destination wallet address"
1337
+ },
1338
+ "network_fee_usd": {
1339
+ "type": "string",
1340
+ "format": "decimal",
1341
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1342
+ "readOnly": true,
1343
+ "description": "Network transaction fee in USD"
1344
+ },
1345
+ "service_fee_usd": {
1346
+ "type": "string",
1347
+ "format": "decimal",
1348
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1349
+ "readOnly": true,
1350
+ "description": "Service fee in USD"
1351
+ },
1352
+ "total_fee_usd": {
1353
+ "type": "string",
1354
+ "format": "decimal",
1355
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1356
+ "readOnly": true,
1357
+ "description": "Total fee (network + service) in USD"
1358
+ },
1359
+ "final_amount_usd": {
1360
+ "type": "string",
1361
+ "format": "decimal",
1362
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1363
+ "readOnly": true,
1364
+ "description": "Final amount to receive (amount - total_fee)"
1365
+ },
1366
+ "crypto_amount": {
1367
+ "type": "string",
1368
+ "format": "decimal",
1369
+ "pattern": "^-?\\d{0,12}(?:\\.\\d{0,8})?$",
1370
+ "readOnly": true,
1371
+ "nullable": true
1372
+ },
1373
+ "status": {
1374
+ "enum": [
1375
+ "pending",
1376
+ "approved",
1377
+ "processing",
1378
+ "completed",
1379
+ "rejected",
1380
+ "cancelled"
1381
+ ],
1382
+ "type": "string",
1383
+ "x-spec-enum-id": "5a5625f418e926b6",
1384
+ "readOnly": true,
1385
+ "description": "Withdrawal status\n\n* `pending` - Pending\n* `approved` - Approved\n* `processing` - Processing\n* `completed` - Completed\n* `rejected` - Rejected\n* `cancelled` - Cancelled"
1386
+ },
1387
+ "status_display": {
1388
+ "type": "string",
1389
+ "readOnly": true
1390
+ },
1391
+ "transaction_hash": {
1392
+ "type": "string",
1393
+ "readOnly": true,
1394
+ "nullable": true
1395
+ },
1396
+ "explorer_link": {
1397
+ "type": "string",
1398
+ "nullable": true,
1399
+ "description": "Get blockchain explorer link.",
1400
+ "readOnly": true
1401
+ },
1402
+ "admin_notes": {
1403
+ "type": "string",
1404
+ "readOnly": true,
1405
+ "description": "Admin notes (reason for rejection, etc.)"
1406
+ },
1407
+ "created_at": {
1408
+ "type": "string",
1409
+ "format": "date-time",
1410
+ "readOnly": true,
1411
+ "description": "When this record was created"
1412
+ },
1413
+ "approved_at": {
1414
+ "type": "string",
1415
+ "format": "date-time",
1416
+ "readOnly": true,
1417
+ "nullable": true
1418
+ },
1419
+ "completed_at": {
1420
+ "type": "string",
1421
+ "format": "date-time",
1422
+ "readOnly": true,
1423
+ "nullable": true
1424
+ },
1425
+ "rejected_at": {
1426
+ "type": "string",
1427
+ "format": "date-time",
1428
+ "readOnly": true,
1429
+ "nullable": true
1430
+ },
1431
+ "cancelled_at": {
1432
+ "type": "string",
1433
+ "format": "date-time",
1434
+ "readOnly": true,
1435
+ "nullable": true
1436
+ }
1437
+ },
1438
+ "required": [
1439
+ "admin_notes",
1440
+ "amount_usd",
1441
+ "approved_at",
1442
+ "cancelled_at",
1443
+ "completed_at",
1444
+ "created_at",
1445
+ "crypto_amount",
1446
+ "currency_code",
1447
+ "currency_name",
1448
+ "currency_network",
1449
+ "currency_token",
1450
+ "explorer_link",
1451
+ "final_amount_usd",
1452
+ "id",
1453
+ "internal_withdrawal_id",
1454
+ "network_fee_usd",
1455
+ "rejected_at",
1456
+ "service_fee_usd",
1457
+ "status",
1458
+ "status_display",
1459
+ "total_fee_usd",
1460
+ "transaction_hash",
1461
+ "wallet_address"
1462
+ ]
1463
+ },
1464
+ "WithdrawalList": {
1465
+ "type": "object",
1466
+ "description": "Withdrawal list item (lighter than detail).",
1467
+ "properties": {
1468
+ "id": {
1469
+ "type": "string",
1470
+ "format": "uuid",
1471
+ "readOnly": true,
1472
+ "description": "Unique identifier for this record"
1473
+ },
1474
+ "internal_withdrawal_id": {
1475
+ "type": "string",
1476
+ "readOnly": true,
1477
+ "description": "Internal withdrawal identifier (WD_YYYYMMDDHHMMSS_UUID)"
1478
+ },
1479
+ "amount_usd": {
1480
+ "type": "string",
1481
+ "format": "decimal",
1482
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1483
+ "readOnly": true,
1484
+ "description": "Withdrawal amount in USD (min $10)"
1485
+ },
1486
+ "final_amount_usd": {
1487
+ "type": "string",
1488
+ "format": "decimal",
1489
+ "pattern": "^-?\\d{0,8}(?:\\.\\d{0,2})?$",
1490
+ "readOnly": true,
1491
+ "description": "Final amount to receive (amount - total_fee)"
1492
+ },
1493
+ "currency_code": {
1494
+ "type": "string",
1495
+ "readOnly": true
1496
+ },
1497
+ "currency_token": {
1498
+ "type": "string",
1499
+ "readOnly": true
1500
+ },
1501
+ "status": {
1502
+ "enum": [
1503
+ "pending",
1504
+ "approved",
1505
+ "processing",
1506
+ "completed",
1507
+ "rejected",
1508
+ "cancelled"
1509
+ ],
1510
+ "type": "string",
1511
+ "x-spec-enum-id": "5a5625f418e926b6",
1512
+ "readOnly": true,
1513
+ "description": "Withdrawal status\n\n* `pending` - Pending\n* `approved` - Approved\n* `processing` - Processing\n* `completed` - Completed\n* `rejected` - Rejected\n* `cancelled` - Cancelled"
1514
+ },
1515
+ "status_display": {
1516
+ "type": "string",
1517
+ "readOnly": true
1518
+ },
1519
+ "created_at": {
1520
+ "type": "string",
1521
+ "format": "date-time",
1522
+ "readOnly": true,
1523
+ "description": "When this record was created"
1524
+ },
1525
+ "completed_at": {
1526
+ "type": "string",
1527
+ "format": "date-time",
1528
+ "readOnly": true,
1529
+ "nullable": true,
1530
+ "description": "When withdrawal was completed"
1531
+ }
1532
+ },
1533
+ "required": [
1534
+ "amount_usd",
1535
+ "completed_at",
1536
+ "created_at",
1537
+ "currency_code",
1538
+ "currency_token",
1539
+ "final_amount_usd",
1540
+ "id",
1541
+ "internal_withdrawal_id",
1542
+ "status",
1543
+ "status_display"
1544
+ ]
835
1545
  }
836
1546
  },
837
1547
  "securitySchemes": {