@selfcommunity/api-services 0.6.7-payments.149 → 0.6.7-payments.151
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/lib/cjs/constants/Endpoints.js +14 -2
- package/lib/cjs/services/payment/index.d.ts +42 -4
- package/lib/cjs/services/payment/index.js +38 -0
- package/lib/cjs/types/payment.d.ts +19 -1
- package/lib/esm/constants/Endpoints.js +14 -2
- package/lib/esm/services/payment/index.d.ts +42 -4
- package/lib/esm/services/payment/index.js +38 -0
- package/lib/esm/types/payment.d.ts +19 -1
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -1585,11 +1585,19 @@ const Endpoints = {
|
|
|
1585
1585
|
* Payments/Paywalls
|
|
1586
1586
|
*/
|
|
1587
1587
|
GetContentProducts: {
|
|
1588
|
-
url: (0, utils_1.urlReplacer)('/api/v2/payments/
|
|
1588
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/'),
|
|
1589
|
+
method: 'GET'
|
|
1590
|
+
},
|
|
1591
|
+
GetProduct: {
|
|
1592
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
|
|
1589
1593
|
method: 'GET'
|
|
1590
1594
|
},
|
|
1591
1595
|
GetProductPrices: {
|
|
1592
|
-
url: (0, utils_1.urlReplacer)('/api/v2/payments/
|
|
1596
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
|
|
1597
|
+
method: 'GET'
|
|
1598
|
+
},
|
|
1599
|
+
GetCommunityProduct: {
|
|
1600
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/community/'),
|
|
1593
1601
|
method: 'GET'
|
|
1594
1602
|
},
|
|
1595
1603
|
GetCheckoutSession: {
|
|
@@ -1607,6 +1615,10 @@ const Endpoints = {
|
|
|
1607
1615
|
GetPaymentOrders: {
|
|
1608
1616
|
url: (0, utils_1.urlReplacer)('/api/v2/payments/order/'),
|
|
1609
1617
|
method: 'GET'
|
|
1618
|
+
},
|
|
1619
|
+
CreateCustomerPortalSession: {
|
|
1620
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/customer_portal_session/'),
|
|
1621
|
+
method: 'POST'
|
|
1610
1622
|
}
|
|
1611
1623
|
};
|
|
1612
1624
|
exports.default = Endpoints;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SCPaymentProduct, SCPaymentPrice } from '@selfcommunity/types';
|
|
2
1
|
import { AxiosRequestConfig } from 'axios';
|
|
3
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
4
|
-
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams } from '../../types/payment';
|
|
5
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete } from '@selfcommunity/types';
|
|
3
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCCommunityPaymentProducts } from '@selfcommunity/types';
|
|
6
5
|
export interface PaymentApiClientInterface {
|
|
7
6
|
/**
|
|
8
7
|
* Get paywall products related to an object of type <content_type> and id <content_id>
|
|
@@ -10,6 +9,12 @@ export interface PaymentApiClientInterface {
|
|
|
10
9
|
* @param config
|
|
11
10
|
*/
|
|
12
11
|
getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get product
|
|
14
|
+
* @param id
|
|
15
|
+
* @param config
|
|
16
|
+
*/
|
|
17
|
+
getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
13
18
|
/**
|
|
14
19
|
* Get prices related to a product
|
|
15
20
|
* @param id
|
|
@@ -17,6 +22,12 @@ export interface PaymentApiClientInterface {
|
|
|
17
22
|
* @param config
|
|
18
23
|
*/
|
|
19
24
|
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
25
|
+
/**
|
|
26
|
+
* Get paywall for the community
|
|
27
|
+
* @param params
|
|
28
|
+
* @param config
|
|
29
|
+
*/
|
|
30
|
+
getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
20
31
|
/**
|
|
21
32
|
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
22
33
|
* @param data
|
|
@@ -36,11 +47,17 @@ export interface PaymentApiClientInterface {
|
|
|
36
47
|
*/
|
|
37
48
|
checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
38
49
|
/**
|
|
39
|
-
* This endpoint
|
|
50
|
+
* This endpoint retrieve order history of authenticated user
|
|
40
51
|
* @param params
|
|
41
52
|
* @param config
|
|
42
53
|
*/
|
|
43
54
|
getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint retrieve customer portal
|
|
57
|
+
* @param data
|
|
58
|
+
* @param config
|
|
59
|
+
*/
|
|
60
|
+
getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
44
61
|
}
|
|
45
62
|
/**
|
|
46
63
|
* Contains all the endpoints needed to manage payments.
|
|
@@ -52,6 +69,12 @@ export declare class PaymentApiClient {
|
|
|
52
69
|
* @param config
|
|
53
70
|
*/
|
|
54
71
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
72
|
+
/**
|
|
73
|
+
* This endpoint retrieves a specific payment product.
|
|
74
|
+
* @param id
|
|
75
|
+
* @param config
|
|
76
|
+
*/
|
|
77
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
55
78
|
/**
|
|
56
79
|
* This endpoint retrieves all the prices related to a product
|
|
57
80
|
* @param id
|
|
@@ -59,6 +82,12 @@ export declare class PaymentApiClient {
|
|
|
59
82
|
* @param config
|
|
60
83
|
*/
|
|
61
84
|
static getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
85
|
+
/**
|
|
86
|
+
* This endpoint retrieves all the products related the Community product
|
|
87
|
+
* @param params
|
|
88
|
+
* @param config
|
|
89
|
+
*/
|
|
90
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
62
91
|
/**
|
|
63
92
|
* This endpoint creates a checkout session.
|
|
64
93
|
* @param data
|
|
@@ -83,6 +112,12 @@ export declare class PaymentApiClient {
|
|
|
83
112
|
* @param config
|
|
84
113
|
*/
|
|
85
114
|
static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
115
|
+
/**
|
|
116
|
+
* This endpoint retrive customer portal
|
|
117
|
+
* @param data
|
|
118
|
+
* @param config
|
|
119
|
+
*/
|
|
120
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
86
121
|
}
|
|
87
122
|
/**
|
|
88
123
|
*
|
|
@@ -121,9 +156,12 @@ export declare class PaymentApiClient {
|
|
|
121
156
|
*/
|
|
122
157
|
export default class PaymentService {
|
|
123
158
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
159
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
124
160
|
static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
161
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
125
162
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
126
163
|
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
127
164
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
128
165
|
static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
166
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
129
167
|
}
|
|
@@ -18,6 +18,14 @@ class PaymentApiClient {
|
|
|
18
18
|
const p = (0, url_1.urlParams)(params);
|
|
19
19
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetContentProducts.url({})}?${p.toString()}`, method: Endpoints_1.default.GetContentProducts.method }));
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* This endpoint retrieves a specific payment product.
|
|
23
|
+
* @param id
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
static getPaymentProduct(id, config) {
|
|
27
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetProduct.url({ id }), method: Endpoints_1.default.GetProduct.method }));
|
|
28
|
+
}
|
|
21
29
|
/**
|
|
22
30
|
* This endpoint retrieves all the prices related to a product
|
|
23
31
|
* @param id
|
|
@@ -28,6 +36,15 @@ class PaymentApiClient {
|
|
|
28
36
|
const p = (0, url_1.urlParams)(params);
|
|
29
37
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetProductPrices.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetProductPrices.method }));
|
|
30
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* This endpoint retrieves all the products related the Community product
|
|
41
|
+
* @param params
|
|
42
|
+
* @param config
|
|
43
|
+
*/
|
|
44
|
+
static getCommunityPaymentProducts(params, config) {
|
|
45
|
+
const p = (0, url_1.urlParams)(params);
|
|
46
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCommunityProduct.url({})}?${p.toString()}`, method: Endpoints_1.default.GetCommunityProduct.method }));
|
|
47
|
+
}
|
|
31
48
|
/**
|
|
32
49
|
* This endpoint creates a checkout session.
|
|
33
50
|
* @param data
|
|
@@ -61,6 +78,14 @@ class PaymentApiClient {
|
|
|
61
78
|
static getPaymentsOrder(params, config) {
|
|
62
79
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetPaymentOrders.url({}), method: Endpoints_1.default.GetPaymentOrders.method }));
|
|
63
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* This endpoint retrive customer portal
|
|
83
|
+
* @param data
|
|
84
|
+
* @param config
|
|
85
|
+
*/
|
|
86
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
87
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCustomerPortalSession.url({}), method: Endpoints_1.default.CreateCustomerPortalSession.method, data }));
|
|
88
|
+
}
|
|
64
89
|
}
|
|
65
90
|
exports.PaymentApiClient = PaymentApiClient;
|
|
66
91
|
/**
|
|
@@ -104,11 +129,21 @@ class PaymentService {
|
|
|
104
129
|
return PaymentApiClient.getPaymentProducts(params, config);
|
|
105
130
|
});
|
|
106
131
|
}
|
|
132
|
+
static getPaymentProduct(id, config) {
|
|
133
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
return PaymentApiClient.getPaymentProduct(id, config);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
107
137
|
static getPaymentProductPrices(id, params, config) {
|
|
108
138
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
139
|
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
110
140
|
});
|
|
111
141
|
}
|
|
142
|
+
static getCommunityPaymentProducts(params, config) {
|
|
143
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
return PaymentApiClient.getCommunityPaymentProducts(params, config);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
112
147
|
static checkoutCreateSession(data, config) {
|
|
113
148
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
114
149
|
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
@@ -127,5 +162,8 @@ class PaymentService {
|
|
|
127
162
|
static getPaymentsOrder(params, config) {
|
|
128
163
|
return PaymentApiClient.getPaymentsOrder(params, config);
|
|
129
164
|
}
|
|
165
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
166
|
+
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
167
|
+
}
|
|
130
168
|
}
|
|
131
169
|
exports.default = PaymentService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseGetParams } from './baseParams';
|
|
2
|
-
import { SCContentType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCheckoutSessionUIMode, SCContentType } from '@selfcommunity/types';
|
|
3
3
|
/**
|
|
4
4
|
* PaymentParams interface.
|
|
5
5
|
*/
|
|
@@ -30,6 +30,18 @@ export interface CheckoutCreateSessionParams {
|
|
|
30
30
|
* Price id
|
|
31
31
|
*/
|
|
32
32
|
payment_price_id: number;
|
|
33
|
+
/**
|
|
34
|
+
* Return url
|
|
35
|
+
*/
|
|
36
|
+
return_url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Success url
|
|
39
|
+
*/
|
|
40
|
+
success_url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session UI mode
|
|
43
|
+
*/
|
|
44
|
+
ui_mode?: SCCheckoutSessionUIMode;
|
|
33
45
|
}
|
|
34
46
|
export interface CheckoutSessionParams {
|
|
35
47
|
/**
|
|
@@ -37,3 +49,9 @@ export interface CheckoutSessionParams {
|
|
|
37
49
|
*/
|
|
38
50
|
session_id: string;
|
|
39
51
|
}
|
|
52
|
+
export interface CustomerPortalCreateSessionParams {
|
|
53
|
+
/**
|
|
54
|
+
* Return url
|
|
55
|
+
*/
|
|
56
|
+
return_url?: string;
|
|
57
|
+
}
|
|
@@ -1583,11 +1583,19 @@ const Endpoints = {
|
|
|
1583
1583
|
* Payments/Paywalls
|
|
1584
1584
|
*/
|
|
1585
1585
|
GetContentProducts: {
|
|
1586
|
-
url: urlReplacer('/api/v2/payments/
|
|
1586
|
+
url: urlReplacer('/api/v2/payments/payment_product/'),
|
|
1587
|
+
method: 'GET'
|
|
1588
|
+
},
|
|
1589
|
+
GetProduct: {
|
|
1590
|
+
url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
|
|
1587
1591
|
method: 'GET'
|
|
1588
1592
|
},
|
|
1589
1593
|
GetProductPrices: {
|
|
1590
|
-
url: urlReplacer('/api/v2/payments/
|
|
1594
|
+
url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
|
|
1595
|
+
method: 'GET'
|
|
1596
|
+
},
|
|
1597
|
+
GetCommunityProduct: {
|
|
1598
|
+
url: urlReplacer('/api/v2/payments/payment_product/community/'),
|
|
1591
1599
|
method: 'GET'
|
|
1592
1600
|
},
|
|
1593
1601
|
GetCheckoutSession: {
|
|
@@ -1605,6 +1613,10 @@ const Endpoints = {
|
|
|
1605
1613
|
GetPaymentOrders: {
|
|
1606
1614
|
url: urlReplacer('/api/v2/payments/order/'),
|
|
1607
1615
|
method: 'GET'
|
|
1616
|
+
},
|
|
1617
|
+
CreateCustomerPortalSession: {
|
|
1618
|
+
url: urlReplacer('/api/v2/payments/customer_portal_session/'),
|
|
1619
|
+
method: 'POST'
|
|
1608
1620
|
}
|
|
1609
1621
|
};
|
|
1610
1622
|
export default Endpoints;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { SCPaymentProduct, SCPaymentPrice } from '@selfcommunity/types';
|
|
2
1
|
import { AxiosRequestConfig } from 'axios';
|
|
3
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
4
|
-
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams } from '../../types/payment';
|
|
5
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete } from '@selfcommunity/types';
|
|
3
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCCommunityPaymentProducts } from '@selfcommunity/types';
|
|
6
5
|
export interface PaymentApiClientInterface {
|
|
7
6
|
/**
|
|
8
7
|
* Get paywall products related to an object of type <content_type> and id <content_id>
|
|
@@ -10,6 +9,12 @@ export interface PaymentApiClientInterface {
|
|
|
10
9
|
* @param config
|
|
11
10
|
*/
|
|
12
11
|
getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get product
|
|
14
|
+
* @param id
|
|
15
|
+
* @param config
|
|
16
|
+
*/
|
|
17
|
+
getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
13
18
|
/**
|
|
14
19
|
* Get prices related to a product
|
|
15
20
|
* @param id
|
|
@@ -17,6 +22,12 @@ export interface PaymentApiClientInterface {
|
|
|
17
22
|
* @param config
|
|
18
23
|
*/
|
|
19
24
|
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
25
|
+
/**
|
|
26
|
+
* Get paywall for the community
|
|
27
|
+
* @param params
|
|
28
|
+
* @param config
|
|
29
|
+
*/
|
|
30
|
+
getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
20
31
|
/**
|
|
21
32
|
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
22
33
|
* @param data
|
|
@@ -36,11 +47,17 @@ export interface PaymentApiClientInterface {
|
|
|
36
47
|
*/
|
|
37
48
|
checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
38
49
|
/**
|
|
39
|
-
* This endpoint
|
|
50
|
+
* This endpoint retrieve order history of authenticated user
|
|
40
51
|
* @param params
|
|
41
52
|
* @param config
|
|
42
53
|
*/
|
|
43
54
|
getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint retrieve customer portal
|
|
57
|
+
* @param data
|
|
58
|
+
* @param config
|
|
59
|
+
*/
|
|
60
|
+
getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
44
61
|
}
|
|
45
62
|
/**
|
|
46
63
|
* Contains all the endpoints needed to manage payments.
|
|
@@ -52,6 +69,12 @@ export declare class PaymentApiClient {
|
|
|
52
69
|
* @param config
|
|
53
70
|
*/
|
|
54
71
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
72
|
+
/**
|
|
73
|
+
* This endpoint retrieves a specific payment product.
|
|
74
|
+
* @param id
|
|
75
|
+
* @param config
|
|
76
|
+
*/
|
|
77
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
55
78
|
/**
|
|
56
79
|
* This endpoint retrieves all the prices related to a product
|
|
57
80
|
* @param id
|
|
@@ -59,6 +82,12 @@ export declare class PaymentApiClient {
|
|
|
59
82
|
* @param config
|
|
60
83
|
*/
|
|
61
84
|
static getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
85
|
+
/**
|
|
86
|
+
* This endpoint retrieves all the products related the Community product
|
|
87
|
+
* @param params
|
|
88
|
+
* @param config
|
|
89
|
+
*/
|
|
90
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
62
91
|
/**
|
|
63
92
|
* This endpoint creates a checkout session.
|
|
64
93
|
* @param data
|
|
@@ -83,6 +112,12 @@ export declare class PaymentApiClient {
|
|
|
83
112
|
* @param config
|
|
84
113
|
*/
|
|
85
114
|
static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
115
|
+
/**
|
|
116
|
+
* This endpoint retrive customer portal
|
|
117
|
+
* @param data
|
|
118
|
+
* @param config
|
|
119
|
+
*/
|
|
120
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
86
121
|
}
|
|
87
122
|
/**
|
|
88
123
|
*
|
|
@@ -121,9 +156,12 @@ export declare class PaymentApiClient {
|
|
|
121
156
|
*/
|
|
122
157
|
export default class PaymentService {
|
|
123
158
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
159
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
124
160
|
static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
161
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
125
162
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
126
163
|
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
127
164
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
128
165
|
static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
166
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
129
167
|
}
|
|
@@ -15,6 +15,14 @@ export class PaymentApiClient {
|
|
|
15
15
|
const p = urlParams(params);
|
|
16
16
|
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetContentProducts.url({})}?${p.toString()}`, method: Endpoints.GetContentProducts.method }));
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* This endpoint retrieves a specific payment product.
|
|
20
|
+
* @param id
|
|
21
|
+
* @param config
|
|
22
|
+
*/
|
|
23
|
+
static getPaymentProduct(id, config) {
|
|
24
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetProduct.url({ id }), method: Endpoints.GetProduct.method }));
|
|
25
|
+
}
|
|
18
26
|
/**
|
|
19
27
|
* This endpoint retrieves all the prices related to a product
|
|
20
28
|
* @param id
|
|
@@ -25,6 +33,15 @@ export class PaymentApiClient {
|
|
|
25
33
|
const p = urlParams(params);
|
|
26
34
|
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetProductPrices.url({ id })}?${p.toString()}`, method: Endpoints.GetProductPrices.method }));
|
|
27
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This endpoint retrieves all the products related the Community product
|
|
38
|
+
* @param params
|
|
39
|
+
* @param config
|
|
40
|
+
*/
|
|
41
|
+
static getCommunityPaymentProducts(params, config) {
|
|
42
|
+
const p = urlParams(params);
|
|
43
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCommunityProduct.url({})}?${p.toString()}`, method: Endpoints.GetCommunityProduct.method }));
|
|
44
|
+
}
|
|
28
45
|
/**
|
|
29
46
|
* This endpoint creates a checkout session.
|
|
30
47
|
* @param data
|
|
@@ -58,6 +75,14 @@ export class PaymentApiClient {
|
|
|
58
75
|
static getPaymentsOrder(params, config) {
|
|
59
76
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPaymentOrders.url({}), method: Endpoints.GetPaymentOrders.method }));
|
|
60
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* This endpoint retrive customer portal
|
|
80
|
+
* @param data
|
|
81
|
+
* @param config
|
|
82
|
+
*/
|
|
83
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
84
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreateCustomerPortalSession.url({}), method: Endpoints.CreateCustomerPortalSession.method, data }));
|
|
85
|
+
}
|
|
61
86
|
}
|
|
62
87
|
/**
|
|
63
88
|
*
|
|
@@ -100,11 +125,21 @@ export default class PaymentService {
|
|
|
100
125
|
return PaymentApiClient.getPaymentProducts(params, config);
|
|
101
126
|
});
|
|
102
127
|
}
|
|
128
|
+
static getPaymentProduct(id, config) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return PaymentApiClient.getPaymentProduct(id, config);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
103
133
|
static getPaymentProductPrices(id, params, config) {
|
|
104
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
135
|
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
106
136
|
});
|
|
107
137
|
}
|
|
138
|
+
static getCommunityPaymentProducts(params, config) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
return PaymentApiClient.getCommunityPaymentProducts(params, config);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
108
143
|
static checkoutCreateSession(data, config) {
|
|
109
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
145
|
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
@@ -123,4 +158,7 @@ export default class PaymentService {
|
|
|
123
158
|
static getPaymentsOrder(params, config) {
|
|
124
159
|
return PaymentApiClient.getPaymentsOrder(params, config);
|
|
125
160
|
}
|
|
161
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
162
|
+
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
163
|
+
}
|
|
126
164
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseGetParams } from './baseParams';
|
|
2
|
-
import { SCContentType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCheckoutSessionUIMode, SCContentType } from '@selfcommunity/types';
|
|
3
3
|
/**
|
|
4
4
|
* PaymentParams interface.
|
|
5
5
|
*/
|
|
@@ -30,6 +30,18 @@ export interface CheckoutCreateSessionParams {
|
|
|
30
30
|
* Price id
|
|
31
31
|
*/
|
|
32
32
|
payment_price_id: number;
|
|
33
|
+
/**
|
|
34
|
+
* Return url
|
|
35
|
+
*/
|
|
36
|
+
return_url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Success url
|
|
39
|
+
*/
|
|
40
|
+
success_url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session UI mode
|
|
43
|
+
*/
|
|
44
|
+
ui_mode?: SCCheckoutSessionUIMode;
|
|
33
45
|
}
|
|
34
46
|
export interface CheckoutSessionParams {
|
|
35
47
|
/**
|
|
@@ -37,3 +49,9 @@ export interface CheckoutSessionParams {
|
|
|
37
49
|
*/
|
|
38
50
|
session_id: string;
|
|
39
51
|
}
|
|
52
|
+
export interface CustomerPortalCreateSessionParams {
|
|
53
|
+
/**
|
|
54
|
+
* Return url
|
|
55
|
+
*/
|
|
56
|
+
return_url?: string;
|
|
57
|
+
}
|