@djangocfg/api 1.0.4 → 1.0.6
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/index.cjs +15856 -34128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15274 -34396
- package/dist/index.d.ts +15274 -34396
- package/dist/index.mjs +15853 -33956
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/payments/ApiKeysContext.tsx +21 -58
- package/src/cfg/contexts/payments/BalancesContext.tsx +19 -72
- package/src/cfg/contexts/payments/CurrenciesContext.tsx +5 -18
- package/src/cfg/contexts/payments/OverviewContext.tsx +78 -124
- package/src/cfg/contexts/payments/PaymentsContext.tsx +37 -36
- package/src/cfg/contexts/payments/RootPaymentsContext.tsx +7 -76
- package/src/cfg/contexts/payments/index.ts +5 -24
- package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +38 -2380
- package/src/cfg/generated/_utils/fetchers/index.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__payments.ts +41 -2615
- package/src/cfg/generated/_utils/hooks/index.ts +0 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItem.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunk.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunkDetail.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunkRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemDetail.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ChatMessage.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/ChatSession.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/ChatSessionRequest.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/Document.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/DocumentRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedArchiveItemChunkRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedArchiveItemRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedChatSessionRequest.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/PatchedDocumentRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PaymentDetail.schema.ts +44 -0
- package/src/cfg/generated/_utils/schemas/PaymentList.schema.ts +7 -11
- package/src/cfg/generated/_utils/schemas/index.ts +1 -81
- package/src/cfg/generated/cfg__payments/client.ts +40 -1732
- package/src/cfg/generated/cfg__payments/models.ts +50 -1795
- package/src/cfg/generated/client.ts +0 -3
- package/src/cfg/generated/enums.ts +5 -347
- package/src/cfg/generated/index.ts +0 -5
- package/src/cfg/generated/schema.ts +5918 -18352
- package/src/cfg/services/payments/ApiKeysService.ts +34 -116
- package/src/cfg/services/payments/DashboardService.ts +37 -122
- package/src/cfg/services/payments/PaymentsService.ts +36 -69
- package/src/cfg/services/payments/SubscriptionsService.ts +35 -136
- package/src/cfg/services/webhooks/WebhooksService.ts +24 -66
- package/src/index.ts +1 -6
- package/src/cfg/generated/_utils/fetchers/cfg__payments__webhooks.ts +0 -109
- package/src/cfg/generated/_utils/hooks/cfg__payments__webhooks.ts +0 -100
- package/src/cfg/generated/_utils/schemas/APIKeyCreate.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyCreateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyDetail.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/APIKeyList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/APIKeyUpdate.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyUpdateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyValidationRequest.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/APIKeyValidationResponse.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/APIKeysOverview.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/AdminPaymentCreate.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/AdminPaymentCreateRequest.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/AdminPaymentDetail.schema.ts +0 -50
- package/src/cfg/generated/_utils/schemas/AdminPaymentList.schema.ts +0 -38
- package/src/cfg/generated/_utils/schemas/AdminPaymentStats.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/AdminPaymentUpdate.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/AdminPaymentUpdateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/AdminUser.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/BalanceOverview.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/ChartDataPoint.schema.ts +0 -20
- package/src/cfg/generated/_utils/schemas/ChartSeries.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/Currency.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/CurrencyAnalyticsItem.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/CurrencyList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/CurrencyRates.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/EndpointGroup.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/Network.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PaginatedAPIKeyListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminPaymentListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminPaymentStatsList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminUserList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedCurrencyListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedEndpointGroupList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedNetworkList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedProviderCurrencyList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedRecentPaymentList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedRecentTransactionList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedSubscriptionListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedTariffList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedTransactionList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedUserBalanceList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedWebhookEventListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedWebhookStatsList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PatchedAPIKeyUpdateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PatchedAdminPaymentUpdateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/PatchedPaymentRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PatchedSubscriptionRequest.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/Payment.schema.ts +0 -49
- package/src/cfg/generated/_utils/schemas/PaymentAnalyticsResponse.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/PaymentCreate.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/PaymentCreateRequest.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/PaymentOverview.schema.ts +0 -31
- package/src/cfg/generated/_utils/schemas/PaymentRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PaymentsChartResponse.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaymentsDashboardOverview.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/PaymentsMetrics.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/ProviderAnalyticsItem.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/ProviderCurrency.schema.ts +0 -36
- package/src/cfg/generated/_utils/schemas/RecentPayment.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/RecentTransaction.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/Subscription.schema.ts +0 -41
- package/src/cfg/generated/_utils/schemas/SubscriptionCreate.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SubscriptionCreateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SubscriptionList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/SubscriptionOverview.schema.ts +0 -37
- package/src/cfg/generated/_utils/schemas/SubscriptionRequest.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/SupportedCurrencies.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SupportedProviders.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/Tariff.schema.ts +0 -34
- package/src/cfg/generated/_utils/schemas/Transaction.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/UserBalance.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/WebhookEvent.schema.ts +0 -31
- package/src/cfg/generated/_utils/schemas/WebhookEventList.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/WebhookEventListRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/WebhookEventRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/WebhookHealth.schema.ts +0 -21
- package/src/cfg/generated/_utils/schemas/WebhookProviderStats.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/WebhookProviderStatsRequest.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/WebhookResponse.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookResponseRequest.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookStats.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookStatsRequest.schema.ts +0 -27
- package/src/cfg/generated/cfg__payments__webhooks/client.ts +0 -75
- package/src/cfg/generated/cfg__payments__webhooks/index.ts +0 -2
- package/src/cfg/generated/cfg__payments__webhooks/models.ts +0 -87
|
@@ -1,183 +1,101 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* API Keys Service
|
|
2
|
+
* API Keys Service (DEPRECATED)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* API Keys functionality has been removed in Payments v2.0
|
|
5
|
+
* This service is kept as a stub for backward compatibility
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import { BaseClient } from '../../BaseClient';
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
const DEPRECATED_ERROR = 'API Keys feature has been removed in Payments v2.0';
|
|
9
11
|
|
|
10
12
|
export class ApiKeysService extends BaseClient {
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* @deprecated API Keys removed in v2.0
|
|
13
15
|
*/
|
|
14
|
-
static async list(
|
|
15
|
-
is_active?: boolean;
|
|
16
|
-
ordering?: string;
|
|
17
|
-
page?: number;
|
|
18
|
-
page_size?: number;
|
|
19
|
-
search?: string;
|
|
20
|
-
user?: number;
|
|
21
|
-
}): Promise<{
|
|
16
|
+
static async list(): Promise<{
|
|
22
17
|
success: boolean;
|
|
23
|
-
keys?:
|
|
18
|
+
keys?: never;
|
|
24
19
|
error?: string;
|
|
25
20
|
}> {
|
|
26
|
-
|
|
27
|
-
const response = await this.api.cfg_payments.apiKeysList(params);
|
|
28
|
-
return { success: true, keys: response };
|
|
29
|
-
} catch (error) {
|
|
30
|
-
if (error instanceof APIError) {
|
|
31
|
-
return { success: false, error: error.errorMessage };
|
|
32
|
-
}
|
|
33
|
-
return { success: false, error: 'Network error' };
|
|
34
|
-
}
|
|
21
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
35
22
|
}
|
|
36
23
|
|
|
37
24
|
/**
|
|
38
|
-
*
|
|
25
|
+
* @deprecated API Keys removed in v2.0
|
|
39
26
|
*/
|
|
40
|
-
static async create(
|
|
41
|
-
data: CfgPaymentsTypes.APIKeyCreateRequest
|
|
42
|
-
): Promise<{
|
|
27
|
+
static async create(): Promise<{
|
|
43
28
|
success: boolean;
|
|
44
|
-
key?:
|
|
29
|
+
key?: never;
|
|
45
30
|
error?: string;
|
|
46
31
|
fieldErrors?: Record<string, string[]>;
|
|
47
32
|
}> {
|
|
48
|
-
|
|
49
|
-
const response = await this.api.cfg_payments.apiKeysCreate(data);
|
|
50
|
-
return { success: true, key: response };
|
|
51
|
-
} catch (error) {
|
|
52
|
-
if (error instanceof APIError) {
|
|
53
|
-
if (error.isValidationError && error.fieldErrors) {
|
|
54
|
-
return { success: false, fieldErrors: error.fieldErrors };
|
|
55
|
-
}
|
|
56
|
-
return { success: false, error: error.errorMessage };
|
|
57
|
-
}
|
|
58
|
-
return { success: false, error: 'Network error' };
|
|
59
|
-
}
|
|
33
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
60
34
|
}
|
|
61
35
|
|
|
62
36
|
/**
|
|
63
|
-
*
|
|
37
|
+
* @deprecated API Keys removed in v2.0
|
|
64
38
|
*/
|
|
65
|
-
static async get(
|
|
39
|
+
static async get(): Promise<{
|
|
66
40
|
success: boolean;
|
|
67
|
-
key?:
|
|
41
|
+
key?: never;
|
|
68
42
|
error?: string;
|
|
69
43
|
}> {
|
|
70
|
-
|
|
71
|
-
const response = await this.api.cfg_payments.apiKeysRetrieve(id);
|
|
72
|
-
return { success: true, key: response };
|
|
73
|
-
} catch (error) {
|
|
74
|
-
if (error instanceof APIError) {
|
|
75
|
-
return { success: false, error: error.errorMessage };
|
|
76
|
-
}
|
|
77
|
-
return { success: false, error: 'Network error' };
|
|
78
|
-
}
|
|
44
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
79
45
|
}
|
|
80
46
|
|
|
81
47
|
/**
|
|
82
|
-
*
|
|
48
|
+
* @deprecated API Keys removed in v2.0
|
|
83
49
|
*/
|
|
84
|
-
static async update(
|
|
85
|
-
id: string,
|
|
86
|
-
data: CfgPaymentsTypes.PatchedAPIKeyUpdateRequest
|
|
87
|
-
): Promise<{
|
|
50
|
+
static async update(): Promise<{
|
|
88
51
|
success: boolean;
|
|
89
|
-
key?:
|
|
52
|
+
key?: never;
|
|
90
53
|
error?: string;
|
|
91
54
|
fieldErrors?: Record<string, string[]>;
|
|
92
55
|
}> {
|
|
93
|
-
|
|
94
|
-
const response = await this.api.cfg_payments.apiKeysPartialUpdate(id, data);
|
|
95
|
-
return { success: true, key: response };
|
|
96
|
-
} catch (error) {
|
|
97
|
-
if (error instanceof APIError) {
|
|
98
|
-
if (error.isValidationError && error.fieldErrors) {
|
|
99
|
-
return { success: false, fieldErrors: error.fieldErrors };
|
|
100
|
-
}
|
|
101
|
-
return { success: false, error: error.errorMessage };
|
|
102
|
-
}
|
|
103
|
-
return { success: false, error: 'Network error' };
|
|
104
|
-
}
|
|
56
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
105
57
|
}
|
|
106
58
|
|
|
107
59
|
/**
|
|
108
|
-
*
|
|
60
|
+
* @deprecated API Keys removed in v2.0
|
|
109
61
|
*/
|
|
110
|
-
static async delete(
|
|
62
|
+
static async delete(): Promise<{
|
|
111
63
|
success: boolean;
|
|
112
64
|
error?: string;
|
|
113
65
|
}> {
|
|
114
|
-
|
|
115
|
-
await this.api.cfg_payments.apiKeysDestroy(id);
|
|
116
|
-
return { success: true };
|
|
117
|
-
} catch (error) {
|
|
118
|
-
if (error instanceof APIError) {
|
|
119
|
-
return { success: false, error: error.errorMessage };
|
|
120
|
-
}
|
|
121
|
-
return { success: false, error: 'Network error' };
|
|
122
|
-
}
|
|
66
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
123
67
|
}
|
|
124
68
|
|
|
125
69
|
/**
|
|
126
|
-
*
|
|
70
|
+
* @deprecated API Keys removed in v2.0
|
|
127
71
|
*/
|
|
128
|
-
static async validate(
|
|
129
|
-
data: CfgPaymentsTypes.APIKeyValidationRequest
|
|
130
|
-
): Promise<{
|
|
72
|
+
static async validate(): Promise<{
|
|
131
73
|
success: boolean;
|
|
132
|
-
validation?:
|
|
74
|
+
validation?: never;
|
|
133
75
|
error?: string;
|
|
134
76
|
}> {
|
|
135
|
-
|
|
136
|
-
const validation = await this.api.cfg_payments.apiKeysValidateCreate(data);
|
|
137
|
-
return { success: true, validation };
|
|
138
|
-
} catch (error) {
|
|
139
|
-
if (error instanceof APIError) {
|
|
140
|
-
return { success: false, error: error.errorMessage };
|
|
141
|
-
}
|
|
142
|
-
return { success: false, error: 'Network error' };
|
|
143
|
-
}
|
|
77
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
144
78
|
}
|
|
145
79
|
|
|
146
80
|
/**
|
|
147
|
-
*
|
|
81
|
+
* @deprecated API Keys removed in v2.0
|
|
148
82
|
*/
|
|
149
83
|
static async getAnalytics(): Promise<{
|
|
150
84
|
success: boolean;
|
|
151
|
-
analytics?:
|
|
85
|
+
analytics?: never;
|
|
152
86
|
error?: string;
|
|
153
87
|
}> {
|
|
154
|
-
|
|
155
|
-
const analytics = await this.api.cfg_payments.apiKeysAnalyticsRetrieve();
|
|
156
|
-
return { success: true, analytics };
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (error instanceof APIError) {
|
|
159
|
-
return { success: false, error: error.errorMessage };
|
|
160
|
-
}
|
|
161
|
-
return { success: false, error: 'Network error' };
|
|
162
|
-
}
|
|
88
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
163
89
|
}
|
|
164
90
|
|
|
165
91
|
/**
|
|
166
|
-
*
|
|
92
|
+
* @deprecated API Keys removed in v2.0
|
|
167
93
|
*/
|
|
168
94
|
static async getStats(): Promise<{
|
|
169
95
|
success: boolean;
|
|
170
|
-
stats?:
|
|
96
|
+
stats?: never;
|
|
171
97
|
error?: string;
|
|
172
98
|
}> {
|
|
173
|
-
|
|
174
|
-
const stats = await this.api.cfg_payments.apiKeysStatsRetrieve();
|
|
175
|
-
return { success: true, stats };
|
|
176
|
-
} catch (error) {
|
|
177
|
-
if (error instanceof APIError) {
|
|
178
|
-
return { success: false, error: error.errorMessage };
|
|
179
|
-
}
|
|
180
|
-
return { success: false, error: 'Network error' };
|
|
181
|
-
}
|
|
99
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
182
100
|
}
|
|
183
101
|
}
|
|
@@ -1,197 +1,112 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Payment Dashboard Service
|
|
2
|
+
* Payment Dashboard Service (DEPRECATED)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Dashboard functionality has been removed in Payments v2.0
|
|
5
|
+
* Use basic endpoints (balance, payments, transactions) instead
|
|
6
|
+
* This service is kept as a stub for backward compatibility
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
9
|
import { BaseClient } from '../../BaseClient';
|
|
8
|
-
|
|
10
|
+
|
|
11
|
+
const DEPRECATED_ERROR = 'Dashboard feature has been removed in Payments v2.0. Use balance/payments/transactions endpoints instead';
|
|
9
12
|
|
|
10
13
|
export class PaymentDashboardService extends BaseClient {
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* @deprecated Dashboard removed in v2.0
|
|
13
16
|
*/
|
|
14
17
|
static async getOverview(): Promise<{
|
|
15
18
|
success: boolean;
|
|
16
|
-
overview?:
|
|
19
|
+
overview?: never;
|
|
17
20
|
error?: string;
|
|
18
21
|
}> {
|
|
19
|
-
|
|
20
|
-
const overview = await this.api.cfg_payments.overviewDashboardOverviewRetrieve();
|
|
21
|
-
return { success: true, overview };
|
|
22
|
-
} catch (error) {
|
|
23
|
-
if (error instanceof APIError) {
|
|
24
|
-
return { success: false, error: error.errorMessage };
|
|
25
|
-
}
|
|
26
|
-
return { success: false, error: 'Network error' };
|
|
27
|
-
}
|
|
22
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
26
|
+
* @deprecated Dashboard removed in v2.0
|
|
32
27
|
*/
|
|
33
28
|
static async getMetrics(): Promise<{
|
|
34
29
|
success: boolean;
|
|
35
|
-
metrics?:
|
|
30
|
+
metrics?: never;
|
|
36
31
|
error?: string;
|
|
37
32
|
}> {
|
|
38
|
-
|
|
39
|
-
const metrics = await this.api.cfg_payments.overviewDashboardMetricsRetrieve();
|
|
40
|
-
return { success: true, metrics };
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (error instanceof APIError) {
|
|
43
|
-
return { success: false, error: error.errorMessage };
|
|
44
|
-
}
|
|
45
|
-
return { success: false, error: 'Network error' };
|
|
46
|
-
}
|
|
33
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
47
34
|
}
|
|
48
35
|
|
|
49
36
|
/**
|
|
50
|
-
*
|
|
37
|
+
* @deprecated Dashboard removed in v2.0
|
|
51
38
|
*/
|
|
52
39
|
static async getBalanceOverview(): Promise<{
|
|
53
40
|
success: boolean;
|
|
54
|
-
balance?:
|
|
41
|
+
balance?: never;
|
|
55
42
|
error?: string;
|
|
56
43
|
}> {
|
|
57
|
-
|
|
58
|
-
const balance = await this.api.cfg_payments.overviewDashboardBalanceOverviewRetrieve();
|
|
59
|
-
return { success: true, balance };
|
|
60
|
-
} catch (error) {
|
|
61
|
-
if (error instanceof APIError) {
|
|
62
|
-
return { success: false, error: error.errorMessage };
|
|
63
|
-
}
|
|
64
|
-
return { success: false, error: 'Network error' };
|
|
65
|
-
}
|
|
44
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
66
45
|
}
|
|
67
46
|
|
|
68
47
|
/**
|
|
69
|
-
*
|
|
48
|
+
* @deprecated Dashboard removed in v2.0
|
|
70
49
|
*/
|
|
71
50
|
static async getSubscriptionOverview(): Promise<{
|
|
72
51
|
success: boolean;
|
|
73
|
-
subscription?:
|
|
52
|
+
subscription?: never;
|
|
74
53
|
error?: string;
|
|
75
54
|
}> {
|
|
76
|
-
|
|
77
|
-
const subscription = await this.api.cfg_payments.overviewDashboardSubscriptionOverviewRetrieve();
|
|
78
|
-
return { success: true, subscription };
|
|
79
|
-
} catch (error) {
|
|
80
|
-
if (error instanceof APIError) {
|
|
81
|
-
return { success: false, error: error.errorMessage };
|
|
82
|
-
}
|
|
83
|
-
return { success: false, error: 'Network error' };
|
|
84
|
-
}
|
|
55
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
85
56
|
}
|
|
86
57
|
|
|
87
58
|
/**
|
|
88
|
-
*
|
|
59
|
+
* @deprecated Dashboard removed in v2.0
|
|
89
60
|
*/
|
|
90
61
|
static async getApiKeysOverview(): Promise<{
|
|
91
62
|
success: boolean;
|
|
92
|
-
apiKeys?:
|
|
63
|
+
apiKeys?: never;
|
|
93
64
|
error?: string;
|
|
94
65
|
}> {
|
|
95
|
-
|
|
96
|
-
const apiKeys = await this.api.cfg_payments.overviewDashboardApiKeysOverviewRetrieve();
|
|
97
|
-
return { success: true, apiKeys };
|
|
98
|
-
} catch (error) {
|
|
99
|
-
if (error instanceof APIError) {
|
|
100
|
-
return { success: false, error: error.errorMessage };
|
|
101
|
-
}
|
|
102
|
-
return { success: false, error: 'Network error' };
|
|
103
|
-
}
|
|
66
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
104
67
|
}
|
|
105
68
|
|
|
106
69
|
/**
|
|
107
|
-
*
|
|
70
|
+
* @deprecated Dashboard removed in v2.0
|
|
108
71
|
*/
|
|
109
|
-
static async getChartData(
|
|
72
|
+
static async getChartData(): Promise<{
|
|
110
73
|
success: boolean;
|
|
111
|
-
chartData?:
|
|
74
|
+
chartData?: never;
|
|
112
75
|
error?: string;
|
|
113
76
|
}> {
|
|
114
|
-
|
|
115
|
-
const chartData = await this.api.cfg_payments.overviewDashboardChartDataRetrieve({ period });
|
|
116
|
-
return { success: true, chartData };
|
|
117
|
-
} catch (error) {
|
|
118
|
-
if (error instanceof APIError) {
|
|
119
|
-
return { success: false, error: error.errorMessage };
|
|
120
|
-
}
|
|
121
|
-
return { success: false, error: 'Network error' };
|
|
122
|
-
}
|
|
77
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
123
78
|
}
|
|
124
79
|
|
|
125
80
|
/**
|
|
126
|
-
*
|
|
81
|
+
* @deprecated Dashboard removed in v2.0
|
|
127
82
|
*/
|
|
128
|
-
static async getPaymentAnalytics(
|
|
83
|
+
static async getPaymentAnalytics(): Promise<{
|
|
129
84
|
success: boolean;
|
|
130
|
-
analytics?:
|
|
85
|
+
analytics?: never;
|
|
131
86
|
error?: string;
|
|
132
87
|
}> {
|
|
133
|
-
|
|
134
|
-
const analytics = await this.api.cfg_payments.overviewDashboardPaymentAnalyticsRetrieve(limit);
|
|
135
|
-
return { success: true, analytics };
|
|
136
|
-
} catch (error) {
|
|
137
|
-
if (error instanceof APIError) {
|
|
138
|
-
return { success: false, error: error.errorMessage };
|
|
139
|
-
}
|
|
140
|
-
return { success: false, error: 'Network error' };
|
|
141
|
-
}
|
|
88
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
142
89
|
}
|
|
143
90
|
|
|
144
91
|
/**
|
|
145
|
-
*
|
|
92
|
+
* @deprecated Dashboard removed in v2.0
|
|
146
93
|
*/
|
|
147
|
-
static async getRecentPayments(
|
|
148
|
-
limit?: number;
|
|
149
|
-
page?: number;
|
|
150
|
-
page_size?: number;
|
|
151
|
-
}): Promise<{
|
|
94
|
+
static async getRecentPayments(): Promise<{
|
|
152
95
|
success: boolean;
|
|
153
|
-
payments?:
|
|
96
|
+
payments?: never;
|
|
154
97
|
error?: string;
|
|
155
98
|
}> {
|
|
156
|
-
|
|
157
|
-
const response = await this.api.cfg_payments.overviewDashboardRecentPaymentsList(
|
|
158
|
-
params?.limit,
|
|
159
|
-
params?.page,
|
|
160
|
-
params?.page_size
|
|
161
|
-
);
|
|
162
|
-
return { success: true, payments: response };
|
|
163
|
-
} catch (error) {
|
|
164
|
-
if (error instanceof APIError) {
|
|
165
|
-
return { success: false, error: error.errorMessage };
|
|
166
|
-
}
|
|
167
|
-
return { success: false, error: 'Network error' };
|
|
168
|
-
}
|
|
99
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
169
100
|
}
|
|
170
101
|
|
|
171
102
|
/**
|
|
172
|
-
*
|
|
103
|
+
* @deprecated Dashboard removed in v2.0
|
|
173
104
|
*/
|
|
174
|
-
static async getRecentTransactions(
|
|
175
|
-
limit?: number;
|
|
176
|
-
page?: number;
|
|
177
|
-
page_size?: number;
|
|
178
|
-
}): Promise<{
|
|
105
|
+
static async getRecentTransactions(): Promise<{
|
|
179
106
|
success: boolean;
|
|
180
|
-
transactions?:
|
|
107
|
+
transactions?: never;
|
|
181
108
|
error?: string;
|
|
182
109
|
}> {
|
|
183
|
-
|
|
184
|
-
const response = await this.api.cfg_payments.overviewDashboardRecentTransactionsList(
|
|
185
|
-
params?.limit,
|
|
186
|
-
params?.page,
|
|
187
|
-
params?.page_size
|
|
188
|
-
);
|
|
189
|
-
return { success: true, transactions: response };
|
|
190
|
-
} catch (error) {
|
|
191
|
-
if (error instanceof APIError) {
|
|
192
|
-
return { success: false, error: error.errorMessage };
|
|
193
|
-
}
|
|
194
|
-
return { success: false, error: 'Network error' };
|
|
195
|
-
}
|
|
110
|
+
return { success: false, error: DEPRECATED_ERROR };
|
|
196
111
|
}
|
|
197
112
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Payments Service
|
|
3
3
|
*
|
|
4
|
-
* Manages payment operations - create, check status,
|
|
4
|
+
* Manages payment operations - create, check status, confirm
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { BaseClient } from '../../BaseClient';
|
|
@@ -9,32 +9,20 @@ import { APIError, CfgPaymentsTypes } from '../../generated';
|
|
|
9
9
|
|
|
10
10
|
export class PaymentsService extends BaseClient {
|
|
11
11
|
/**
|
|
12
|
-
* List payments
|
|
12
|
+
* List payments
|
|
13
13
|
*/
|
|
14
14
|
static async list(params?: {
|
|
15
|
-
currency__code?: string;
|
|
16
|
-
ordering?: string;
|
|
17
15
|
page?: number;
|
|
18
16
|
page_size?: number;
|
|
19
|
-
provider?: string;
|
|
20
|
-
search?: string;
|
|
21
|
-
status?: string;
|
|
22
|
-
user?: number;
|
|
23
17
|
}): Promise<{
|
|
24
18
|
success: boolean;
|
|
25
19
|
payments?: CfgPaymentsTypes.PaginatedPaymentListList;
|
|
26
20
|
error?: string;
|
|
27
21
|
}> {
|
|
28
22
|
try {
|
|
29
|
-
const response = await this.api.cfg_payments.
|
|
30
|
-
params?.currency__code,
|
|
31
|
-
params?.ordering,
|
|
23
|
+
const response = await this.api.cfg_payments.paymentsList(
|
|
32
24
|
params?.page,
|
|
33
|
-
params?.page_size
|
|
34
|
-
params?.provider,
|
|
35
|
-
params?.search,
|
|
36
|
-
params?.status,
|
|
37
|
-
params?.user
|
|
25
|
+
params?.page_size
|
|
38
26
|
);
|
|
39
27
|
return { success: true, payments: response };
|
|
40
28
|
} catch (error) {
|
|
@@ -48,16 +36,14 @@ export class PaymentsService extends BaseClient {
|
|
|
48
36
|
/**
|
|
49
37
|
* Create payment
|
|
50
38
|
*/
|
|
51
|
-
static async create(
|
|
52
|
-
data: CfgPaymentsTypes.PaymentCreateRequest
|
|
53
|
-
): Promise<{
|
|
39
|
+
static async create(): Promise<{
|
|
54
40
|
success: boolean;
|
|
55
|
-
payment?:
|
|
41
|
+
payment?: any;
|
|
56
42
|
error?: string;
|
|
57
43
|
fieldErrors?: Record<string, string[]>;
|
|
58
44
|
}> {
|
|
59
45
|
try {
|
|
60
|
-
const response = await this.api.cfg_payments.
|
|
46
|
+
const response = await this.api.cfg_payments.paymentsCreateCreate();
|
|
61
47
|
return { success: true, payment: response };
|
|
62
48
|
} catch (error) {
|
|
63
49
|
if (error instanceof APIError) {
|
|
@@ -75,11 +61,11 @@ export class PaymentsService extends BaseClient {
|
|
|
75
61
|
*/
|
|
76
62
|
static async get(id: string): Promise<{
|
|
77
63
|
success: boolean;
|
|
78
|
-
payment?: CfgPaymentsTypes.
|
|
64
|
+
payment?: CfgPaymentsTypes.PaymentDetail;
|
|
79
65
|
error?: string;
|
|
80
66
|
}> {
|
|
81
67
|
try {
|
|
82
|
-
const payment = await this.api.cfg_payments.
|
|
68
|
+
const payment = await this.api.cfg_payments.paymentsRetrieve(id);
|
|
83
69
|
return { success: true, payment };
|
|
84
70
|
} catch (error) {
|
|
85
71
|
if (error instanceof APIError) {
|
|
@@ -94,11 +80,11 @@ export class PaymentsService extends BaseClient {
|
|
|
94
80
|
*/
|
|
95
81
|
static async getStatus(id: string): Promise<{
|
|
96
82
|
success: boolean;
|
|
97
|
-
payment?:
|
|
83
|
+
payment?: any;
|
|
98
84
|
error?: string;
|
|
99
85
|
}> {
|
|
100
86
|
try {
|
|
101
|
-
const payment = await this.api.cfg_payments.
|
|
87
|
+
const payment = await this.api.cfg_payments.paymentsStatusRetrieve(id);
|
|
102
88
|
return { success: true, payment };
|
|
103
89
|
} catch (error) {
|
|
104
90
|
if (error instanceof APIError) {
|
|
@@ -109,18 +95,15 @@ export class PaymentsService extends BaseClient {
|
|
|
109
95
|
}
|
|
110
96
|
|
|
111
97
|
/**
|
|
112
|
-
*
|
|
98
|
+
* Confirm payment (user clicked "I paid")
|
|
113
99
|
*/
|
|
114
|
-
static async
|
|
115
|
-
id: string,
|
|
116
|
-
data: CfgPaymentsTypes.PaymentRequest
|
|
117
|
-
): Promise<{
|
|
100
|
+
static async confirm(id: string): Promise<{
|
|
118
101
|
success: boolean;
|
|
119
|
-
payment?:
|
|
102
|
+
payment?: any;
|
|
120
103
|
error?: string;
|
|
121
104
|
}> {
|
|
122
105
|
try {
|
|
123
|
-
const payment = await this.api.cfg_payments.
|
|
106
|
+
const payment = await this.api.cfg_payments.paymentsConfirmCreate(id);
|
|
124
107
|
return { success: true, payment };
|
|
125
108
|
} catch (error) {
|
|
126
109
|
if (error instanceof APIError) {
|
|
@@ -131,62 +114,46 @@ export class PaymentsService extends BaseClient {
|
|
|
131
114
|
}
|
|
132
115
|
|
|
133
116
|
/**
|
|
134
|
-
*
|
|
117
|
+
* @deprecated Cancel payment removed in v2.0
|
|
135
118
|
*/
|
|
136
|
-
static async
|
|
137
|
-
id: string,
|
|
138
|
-
data: CfgPaymentsTypes.PaymentRequest
|
|
139
|
-
): Promise<{
|
|
119
|
+
static async cancel(): Promise<{
|
|
140
120
|
success: boolean;
|
|
141
|
-
payment?:
|
|
121
|
+
payment?: never;
|
|
142
122
|
error?: string;
|
|
143
123
|
}> {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
124
|
+
return { success: false, error: 'Cancel payment removed in v2.0' };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @deprecated Check status method replaced with getStatus in v2.0
|
|
129
|
+
*/
|
|
130
|
+
static async checkStatus(id: string): Promise<{
|
|
131
|
+
success: boolean;
|
|
132
|
+
payment?: any;
|
|
133
|
+
error?: string;
|
|
134
|
+
}> {
|
|
135
|
+
return this.getStatus(id);
|
|
153
136
|
}
|
|
154
137
|
|
|
155
138
|
/**
|
|
156
|
-
*
|
|
139
|
+
* @deprecated Analytics removed in v2.0
|
|
157
140
|
*/
|
|
158
141
|
static async getAnalytics(): Promise<{
|
|
159
142
|
success: boolean;
|
|
160
|
-
analytics?:
|
|
143
|
+
analytics?: never;
|
|
161
144
|
error?: string;
|
|
162
145
|
}> {
|
|
163
|
-
|
|
164
|
-
const analytics = await this.api.cfg_payments.paymentAnalyticsRetrieve();
|
|
165
|
-
return { success: true, analytics };
|
|
166
|
-
} catch (error) {
|
|
167
|
-
if (error instanceof APIError) {
|
|
168
|
-
return { success: false, error: error.errorMessage };
|
|
169
|
-
}
|
|
170
|
-
return { success: false, error: 'Network error' };
|
|
171
|
-
}
|
|
146
|
+
return { success: false, error: 'Analytics removed in v2.0' };
|
|
172
147
|
}
|
|
173
148
|
|
|
174
149
|
/**
|
|
175
|
-
*
|
|
150
|
+
* @deprecated Stats removed in v2.0
|
|
176
151
|
*/
|
|
177
152
|
static async getStats(): Promise<{
|
|
178
153
|
success: boolean;
|
|
179
|
-
stats?:
|
|
154
|
+
stats?: never;
|
|
180
155
|
error?: string;
|
|
181
156
|
}> {
|
|
182
|
-
|
|
183
|
-
const stats = await this.api.cfg_payments.paymentStatsRetrieve();
|
|
184
|
-
return { success: true, stats };
|
|
185
|
-
} catch (error) {
|
|
186
|
-
if (error instanceof APIError) {
|
|
187
|
-
return { success: false, error: error.errorMessage };
|
|
188
|
-
}
|
|
189
|
-
return { success: false, error: 'Network error' };
|
|
190
|
-
}
|
|
157
|
+
return { success: false, error: 'Stats removed in v2.0' };
|
|
191
158
|
}
|
|
192
159
|
}
|