@selfcommunity/api-services 0.6.7-payments.165 → 0.6.7-payments.168
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 +2 -1
- package/lib/cjs/services/payment/index.d.ts +18 -5
- package/lib/cjs/services/payment/index.js +13 -0
- package/lib/cjs/types/payment.d.ts +22 -1
- package/lib/esm/constants/Endpoints.js +2 -1
- package/lib/esm/services/payment/index.d.ts +18 -5
- package/lib/esm/services/payment/index.js +13 -0
- package/lib/esm/types/payment.d.ts +22 -1
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -1638,6 +1638,7 @@ const Endpoints = {
|
|
|
1638
1638
|
CreateCustomerPortalSession: {
|
|
1639
1639
|
url: (0, utils_1.urlReplacer)('/api/v2/payments/customer_portal_session/'),
|
|
1640
1640
|
method: 'POST'
|
|
1641
|
-
}
|
|
1641
|
+
},
|
|
1642
|
+
CreatePaymentProduct: { url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/price/'), method: 'POST' }
|
|
1642
1643
|
};
|
|
1643
1644
|
exports.default = Endpoints;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
3
|
-
import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsParams, CustomerPortalCreateSessionParams, PaymentContentStatusParams, PaymentOrderParams } from '../../types/payment';
|
|
4
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPurchasableContent } from '@selfcommunity/types';
|
|
3
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsParams, CustomerPortalCreateSessionParams, PaymentContentStatusParams, PaymentOrderParams, CreatePaymentProductParams } from '../../types/payment';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPurchasableContent, SCPaywall } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
7
|
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id> and the current payment_order
|
|
@@ -14,7 +14,7 @@ export interface PaymentApiClientInterface {
|
|
|
14
14
|
* @param params
|
|
15
15
|
* @param config
|
|
16
16
|
*/
|
|
17
|
-
getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
17
|
+
getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
18
18
|
/**
|
|
19
19
|
* Get payment products
|
|
20
20
|
* @param params
|
|
@@ -64,6 +64,12 @@ export interface PaymentApiClientInterface {
|
|
|
64
64
|
* @param config
|
|
65
65
|
*/
|
|
66
66
|
getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
67
|
+
/**
|
|
68
|
+
* Create payment product
|
|
69
|
+
* @param data
|
|
70
|
+
* @param config
|
|
71
|
+
*/
|
|
72
|
+
createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
67
73
|
}
|
|
68
74
|
/**
|
|
69
75
|
* Contains all the endpoints needed to manage payments.
|
|
@@ -80,7 +86,7 @@ export declare class PaymentApiClient {
|
|
|
80
86
|
* @param params
|
|
81
87
|
* @param config
|
|
82
88
|
*/
|
|
83
|
-
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
89
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
84
90
|
/**
|
|
85
91
|
* This endpoint retrieves all the payment products
|
|
86
92
|
* @param params
|
|
@@ -106,6 +112,12 @@ export declare class PaymentApiClient {
|
|
|
106
112
|
* @param config
|
|
107
113
|
*/
|
|
108
114
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
115
|
+
/**
|
|
116
|
+
* Create payment product
|
|
117
|
+
* @param data
|
|
118
|
+
* @param config
|
|
119
|
+
*/
|
|
120
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
109
121
|
/**
|
|
110
122
|
* This endpoint retrieve checkout session
|
|
111
123
|
* @param params
|
|
@@ -168,7 +180,7 @@ export declare class PaymentApiClient {
|
|
|
168
180
|
*/
|
|
169
181
|
export default class PaymentService {
|
|
170
182
|
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<SCPurchasableContent>;
|
|
171
|
-
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
183
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
172
184
|
static getPaymentProducts(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
173
185
|
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
174
186
|
static getPaymentProductPrices(id: number | string, params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
@@ -177,4 +189,5 @@ export default class PaymentService {
|
|
|
177
189
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
178
190
|
static getPaymentsOrder(params?: PaymentOrderParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
179
191
|
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
192
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
180
193
|
}
|
|
@@ -62,6 +62,14 @@ class PaymentApiClient {
|
|
|
62
62
|
static checkoutCreateSession(data, config) {
|
|
63
63
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CheckoutCreateSession.url({}), method: Endpoints_1.default.CheckoutCreateSession.method, data }));
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Create payment product
|
|
67
|
+
* @param data
|
|
68
|
+
* @param config
|
|
69
|
+
*/
|
|
70
|
+
static createPaymentProduct(data, config) {
|
|
71
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreatePaymentProduct.url({}), method: Endpoints_1.default.CreatePaymentProduct.method, data }));
|
|
72
|
+
}
|
|
65
73
|
/**
|
|
66
74
|
* This endpoint retrieve checkout session
|
|
67
75
|
* @param params
|
|
@@ -180,5 +188,10 @@ class PaymentService {
|
|
|
180
188
|
static getPaymentsCustomerPortal(data, config) {
|
|
181
189
|
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
182
190
|
}
|
|
191
|
+
static createPaymentProduct(data, config) {
|
|
192
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
return PaymentApiClient.createPaymentProduct(data, config);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
183
196
|
}
|
|
184
197
|
exports.default = PaymentService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
2
|
-
import { SCCheckoutSessionUIMode, SCContentType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCheckoutSessionUIMode, SCContentType, SCPaymentPriceCurrencyType } from '@selfcommunity/types';
|
|
3
3
|
/**
|
|
4
4
|
* PaymentParams interface.
|
|
5
5
|
*/
|
|
@@ -77,3 +77,24 @@ export interface PaymentOrderParams extends BaseSearchParams {
|
|
|
77
77
|
*/
|
|
78
78
|
ordering?: string;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* CreatePaymentProduct interface.
|
|
82
|
+
*/
|
|
83
|
+
export interface CreatePaymentProductParams {
|
|
84
|
+
/**
|
|
85
|
+
* Product name
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Prduct price
|
|
90
|
+
*/
|
|
91
|
+
unit_amount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Description name
|
|
94
|
+
*/
|
|
95
|
+
description?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Price currency
|
|
98
|
+
*/
|
|
99
|
+
currency?: SCPaymentPriceCurrencyType;
|
|
100
|
+
}
|
|
@@ -1636,6 +1636,7 @@ const Endpoints = {
|
|
|
1636
1636
|
CreateCustomerPortalSession: {
|
|
1637
1637
|
url: urlReplacer('/api/v2/payments/customer_portal_session/'),
|
|
1638
1638
|
method: 'POST'
|
|
1639
|
-
}
|
|
1639
|
+
},
|
|
1640
|
+
CreatePaymentProduct: { url: urlReplacer('/api/v2/payments/payment_product/price/'), method: 'POST' }
|
|
1640
1641
|
};
|
|
1641
1642
|
export default Endpoints;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
3
|
-
import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsParams, CustomerPortalCreateSessionParams, PaymentContentStatusParams, PaymentOrderParams } from '../../types/payment';
|
|
4
|
-
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPurchasableContent } from '@selfcommunity/types';
|
|
3
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsParams, CustomerPortalCreateSessionParams, PaymentContentStatusParams, PaymentOrderParams, CreatePaymentProductParams } from '../../types/payment';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPurchasableContent, SCPaywall } from '@selfcommunity/types';
|
|
5
5
|
export interface PaymentApiClientInterface {
|
|
6
6
|
/**
|
|
7
7
|
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id> and the current payment_order
|
|
@@ -14,7 +14,7 @@ export interface PaymentApiClientInterface {
|
|
|
14
14
|
* @param params
|
|
15
15
|
* @param config
|
|
16
16
|
*/
|
|
17
|
-
getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
17
|
+
getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
18
18
|
/**
|
|
19
19
|
* Get payment products
|
|
20
20
|
* @param params
|
|
@@ -64,6 +64,12 @@ export interface PaymentApiClientInterface {
|
|
|
64
64
|
* @param config
|
|
65
65
|
*/
|
|
66
66
|
getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
67
|
+
/**
|
|
68
|
+
* Create payment product
|
|
69
|
+
* @param data
|
|
70
|
+
* @param config
|
|
71
|
+
*/
|
|
72
|
+
createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
67
73
|
}
|
|
68
74
|
/**
|
|
69
75
|
* Contains all the endpoints needed to manage payments.
|
|
@@ -80,7 +86,7 @@ export declare class PaymentApiClient {
|
|
|
80
86
|
* @param params
|
|
81
87
|
* @param config
|
|
82
88
|
*/
|
|
83
|
-
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
89
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
84
90
|
/**
|
|
85
91
|
* This endpoint retrieves all the payment products
|
|
86
92
|
* @param params
|
|
@@ -106,6 +112,12 @@ export declare class PaymentApiClient {
|
|
|
106
112
|
* @param config
|
|
107
113
|
*/
|
|
108
114
|
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
115
|
+
/**
|
|
116
|
+
* Create payment product
|
|
117
|
+
* @param data
|
|
118
|
+
* @param config
|
|
119
|
+
*/
|
|
120
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
109
121
|
/**
|
|
110
122
|
* This endpoint retrieve checkout session
|
|
111
123
|
* @param params
|
|
@@ -168,7 +180,7 @@ export declare class PaymentApiClient {
|
|
|
168
180
|
*/
|
|
169
181
|
export default class PaymentService {
|
|
170
182
|
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<SCPurchasableContent>;
|
|
171
|
-
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<
|
|
183
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
172
184
|
static getPaymentProducts(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
173
185
|
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
174
186
|
static getPaymentProductPrices(id: number | string, params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
@@ -177,4 +189,5 @@ export default class PaymentService {
|
|
|
177
189
|
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
178
190
|
static getPaymentsOrder(params?: PaymentOrderParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
179
191
|
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
192
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
180
193
|
}
|
|
@@ -59,6 +59,14 @@ export class PaymentApiClient {
|
|
|
59
59
|
static checkoutCreateSession(data, config) {
|
|
60
60
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CheckoutCreateSession.url({}), method: Endpoints.CheckoutCreateSession.method, data }));
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Create payment product
|
|
64
|
+
* @param data
|
|
65
|
+
* @param config
|
|
66
|
+
*/
|
|
67
|
+
static createPaymentProduct(data, config) {
|
|
68
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreatePaymentProduct.url({}), method: Endpoints.CreatePaymentProduct.method, data }));
|
|
69
|
+
}
|
|
62
70
|
/**
|
|
63
71
|
* This endpoint retrieve checkout session
|
|
64
72
|
* @param params
|
|
@@ -176,4 +184,9 @@ export default class PaymentService {
|
|
|
176
184
|
static getPaymentsCustomerPortal(data, config) {
|
|
177
185
|
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
178
186
|
}
|
|
187
|
+
static createPaymentProduct(data, config) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
return PaymentApiClient.createPaymentProduct(data, config);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
179
192
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
2
|
-
import { SCCheckoutSessionUIMode, SCContentType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCheckoutSessionUIMode, SCContentType, SCPaymentPriceCurrencyType } from '@selfcommunity/types';
|
|
3
3
|
/**
|
|
4
4
|
* PaymentParams interface.
|
|
5
5
|
*/
|
|
@@ -77,3 +77,24 @@ export interface PaymentOrderParams extends BaseSearchParams {
|
|
|
77
77
|
*/
|
|
78
78
|
ordering?: string;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* CreatePaymentProduct interface.
|
|
82
|
+
*/
|
|
83
|
+
export interface CreatePaymentProductParams {
|
|
84
|
+
/**
|
|
85
|
+
* Product name
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Prduct price
|
|
90
|
+
*/
|
|
91
|
+
unit_amount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Description name
|
|
94
|
+
*/
|
|
95
|
+
description?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Price currency
|
|
98
|
+
*/
|
|
99
|
+
currency?: SCPaymentPriceCurrencyType;
|
|
100
|
+
}
|