@selfcommunity/api-services 0.6.7-payments.150 → 0.6.7-payments.152
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 +4 -0
- package/lib/cjs/services/payment/index.d.ts +14 -1
- package/lib/cjs/services/payment/index.js +14 -0
- package/lib/cjs/types/payment.d.ts +9 -1
- package/lib/esm/constants/Endpoints.js +4 -0
- package/lib/esm/services/payment/index.d.ts +14 -1
- package/lib/esm/services/payment/index.js +14 -0
- package/lib/esm/types/payment.d.ts +9 -1
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -1596,6 +1596,10 @@ const Endpoints = {
|
|
|
1596
1596
|
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
|
|
1597
1597
|
method: 'GET'
|
|
1598
1598
|
},
|
|
1599
|
+
GetCommunityProduct: {
|
|
1600
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/community/'),
|
|
1601
|
+
method: 'GET'
|
|
1602
|
+
},
|
|
1599
1603
|
GetCheckoutSession: {
|
|
1600
1604
|
url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/'),
|
|
1601
1605
|
method: 'GET'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
3
3
|
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
|
|
4
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession } from '@selfcommunity/types';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCCommunityPaymentProducts } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
7
|
* Get paywall products related to an object of type <content_type> and id <content_id>
|
|
@@ -22,6 +22,12 @@ export interface PaymentApiClientInterface {
|
|
|
22
22
|
* @param config
|
|
23
23
|
*/
|
|
24
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>;
|
|
25
31
|
/**
|
|
26
32
|
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
27
33
|
* @param data
|
|
@@ -76,6 +82,12 @@ export declare class PaymentApiClient {
|
|
|
76
82
|
* @param config
|
|
77
83
|
*/
|
|
78
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>;
|
|
79
91
|
/**
|
|
80
92
|
* This endpoint creates a checkout session.
|
|
81
93
|
* @param data
|
|
@@ -146,6 +158,7 @@ export default class PaymentService {
|
|
|
146
158
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
147
159
|
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
148
160
|
static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
161
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
149
162
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
150
163
|
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
151
164
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
@@ -36,6 +36,15 @@ class PaymentApiClient {
|
|
|
36
36
|
const p = (0, url_1.urlParams)(params);
|
|
37
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 }));
|
|
38
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
|
+
}
|
|
39
48
|
/**
|
|
40
49
|
* This endpoint creates a checkout session.
|
|
41
50
|
* @param data
|
|
@@ -130,6 +139,11 @@ class PaymentService {
|
|
|
130
139
|
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
131
140
|
});
|
|
132
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
|
+
}
|
|
133
147
|
static checkoutCreateSession(data, config) {
|
|
134
148
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
135
149
|
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
@@ -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
|
*/
|
|
@@ -34,6 +34,14 @@ export interface CheckoutCreateSessionParams {
|
|
|
34
34
|
* Return url
|
|
35
35
|
*/
|
|
36
36
|
return_url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Success url
|
|
39
|
+
*/
|
|
40
|
+
success_url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session UI mode
|
|
43
|
+
*/
|
|
44
|
+
ui_mode?: SCCheckoutSessionUIMode;
|
|
37
45
|
}
|
|
38
46
|
export interface CheckoutSessionParams {
|
|
39
47
|
/**
|
|
@@ -1594,6 +1594,10 @@ const Endpoints = {
|
|
|
1594
1594
|
url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
|
|
1595
1595
|
method: 'GET'
|
|
1596
1596
|
},
|
|
1597
|
+
GetCommunityProduct: {
|
|
1598
|
+
url: urlReplacer('/api/v2/payments/payment_product/community/'),
|
|
1599
|
+
method: 'GET'
|
|
1600
|
+
},
|
|
1597
1601
|
GetCheckoutSession: {
|
|
1598
1602
|
url: urlReplacer('/api/v2/payments/checkout_session/'),
|
|
1599
1603
|
method: 'GET'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
3
3
|
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
|
|
4
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession } from '@selfcommunity/types';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCCommunityPaymentProducts } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
7
|
* Get paywall products related to an object of type <content_type> and id <content_id>
|
|
@@ -22,6 +22,12 @@ export interface PaymentApiClientInterface {
|
|
|
22
22
|
* @param config
|
|
23
23
|
*/
|
|
24
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>;
|
|
25
31
|
/**
|
|
26
32
|
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
27
33
|
* @param data
|
|
@@ -76,6 +82,12 @@ export declare class PaymentApiClient {
|
|
|
76
82
|
* @param config
|
|
77
83
|
*/
|
|
78
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>;
|
|
79
91
|
/**
|
|
80
92
|
* This endpoint creates a checkout session.
|
|
81
93
|
* @param data
|
|
@@ -146,6 +158,7 @@ export default class PaymentService {
|
|
|
146
158
|
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
147
159
|
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
148
160
|
static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
161
|
+
static getCommunityPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCCommunityPaymentProducts>;
|
|
149
162
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
150
163
|
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
151
164
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
@@ -33,6 +33,15 @@ export class PaymentApiClient {
|
|
|
33
33
|
const p = urlParams(params);
|
|
34
34
|
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetProductPrices.url({ id })}?${p.toString()}`, method: Endpoints.GetProductPrices.method }));
|
|
35
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
|
+
}
|
|
36
45
|
/**
|
|
37
46
|
* This endpoint creates a checkout session.
|
|
38
47
|
* @param data
|
|
@@ -126,6 +135,11 @@ export default class PaymentService {
|
|
|
126
135
|
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
127
136
|
});
|
|
128
137
|
}
|
|
138
|
+
static getCommunityPaymentProducts(params, config) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
return PaymentApiClient.getCommunityPaymentProducts(params, config);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
129
143
|
static checkoutCreateSession(data, config) {
|
|
130
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
145
|
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
@@ -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
|
*/
|
|
@@ -34,6 +34,14 @@ export interface CheckoutCreateSessionParams {
|
|
|
34
34
|
* Return url
|
|
35
35
|
*/
|
|
36
36
|
return_url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Success url
|
|
39
|
+
*/
|
|
40
|
+
success_url?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Session UI mode
|
|
43
|
+
*/
|
|
44
|
+
ui_mode?: SCCheckoutSessionUIMode;
|
|
37
45
|
}
|
|
38
46
|
export interface CheckoutSessionParams {
|
|
39
47
|
/**
|