@selfcommunity/api-services 0.6.7-payments.166 → 0.6.7-payments.169
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/course/index.d.ts +11 -11
- package/lib/cjs/services/payment/index.d.ts +18 -5
- package/lib/cjs/services/payment/index.js +13 -0
- package/lib/cjs/types/course.d.ts +5 -1
- package/lib/cjs/types/payment.d.ts +22 -1
- package/lib/esm/constants/Endpoints.js +2 -1
- package/lib/esm/services/course/index.d.ts +11 -11
- package/lib/esm/services/payment/index.d.ts +18 -5
- package/lib/esm/services/payment/index.js +13 -0
- package/lib/esm/types/course.d.ts +5 -1
- 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,6 +1,6 @@
|
|
|
1
1
|
import { SCCourseCommentType, SCCourseLessonType, SCCourseSectionType, SCCourseType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
import { AxiosRequestConfig } from 'axios';
|
|
3
|
-
import { BaseGetParams, CourseCreateParams, CourseDashboardUsersParams, CourseInfoParams, CourseLessonCommentsParams, CourseSearchParams, CourseUserRoleParams, CourseUsersParams, SCPaginatedResponse } from '../../types';
|
|
3
|
+
import { BaseGetParams, BaseSearchParams, CourseCreateParams, CourseDashboardUsersParams, CourseInfoParams, CourseLessonCommentsParams, CourseSearchParams, CourseUserRoleParams, CourseUsersParams, SCPaginatedResponse } from '../../types';
|
|
4
4
|
import { CourseSectionParams, CourseUserParams } from '../../types/course';
|
|
5
5
|
export interface CourseApiClientInterface {
|
|
6
6
|
changeCourseUserRole(id: number | string, data: CourseUserRoleParams, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -10,8 +10,8 @@ export interface CourseApiClientInterface {
|
|
|
10
10
|
getSpecificCourseInfo(id: number | string, params?: CourseInfoParams, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
11
11
|
getCourseDashboardUsers(id: number | string, params?: CourseDashboardUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
12
12
|
createCourse(data: CourseCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
13
|
-
updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
14
|
-
patchCourse(id: number | string, data: Partial<SCCourseType
|
|
13
|
+
updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
14
|
+
patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
15
15
|
deleteCourse(id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
16
16
|
getCourseLessonComment(id: number | string, section_id: number | string, lesson_id: number | string, comment_id: number | string, config?: AxiosRequestConfig): Promise<SCCourseCommentType>;
|
|
17
17
|
getCourseComments(id: number | string, course_id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseCommentType>>;
|
|
@@ -39,7 +39,7 @@ export interface CourseApiClientInterface {
|
|
|
39
39
|
getCourseSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
40
40
|
getCourseInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
41
41
|
getCourseJoinedUsers(id: number | string, params?: CourseUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
42
|
-
joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
42
|
+
joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
43
43
|
leaveOrRemoveCourseRequest(id: number | string, params?: {
|
|
44
44
|
user: number;
|
|
45
45
|
}, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -108,14 +108,14 @@ export declare class CourseApiClient {
|
|
|
108
108
|
* @param data
|
|
109
109
|
* @param config
|
|
110
110
|
*/
|
|
111
|
-
static updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
111
|
+
static updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
112
112
|
/**
|
|
113
113
|
* This endpoint patches a course.
|
|
114
114
|
* @param id
|
|
115
115
|
* @param data
|
|
116
116
|
* @param config
|
|
117
117
|
*/
|
|
118
|
-
static patchCourse(id: number | string, data: Partial<SCCourseType
|
|
118
|
+
static patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
119
119
|
/**
|
|
120
120
|
* This endpoint deletes a course.
|
|
121
121
|
* @param id
|
|
@@ -330,7 +330,7 @@ export declare class CourseApiClient {
|
|
|
330
330
|
* @param id
|
|
331
331
|
* @param config
|
|
332
332
|
*/
|
|
333
|
-
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
333
|
+
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
334
334
|
/**
|
|
335
335
|
* This endpoint unsubscribes from a course.
|
|
336
336
|
* @param id
|
|
@@ -407,8 +407,8 @@ export default class CourseService {
|
|
|
407
407
|
static getSpecificCourseInfo(id: number | string, params?: CourseInfoParams, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
408
408
|
static getCourseDashboardUsers(id: number | string, params?: CourseDashboardUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
409
409
|
static createCourse(data: CourseCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
410
|
-
static updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
411
|
-
static patchCourse(id: number | string, data: Partial<SCCourseType
|
|
410
|
+
static updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
411
|
+
static patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
412
412
|
static deleteCourse(id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
413
413
|
static getCourseLessonComment(id: number | string, section_id: number | string, lesson_id: number | string, comment_id: number | string, config?: AxiosRequestConfig): Promise<SCCourseCommentType>;
|
|
414
414
|
static getCourseComments(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseCommentType>>;
|
|
@@ -432,11 +432,11 @@ export default class CourseService {
|
|
|
432
432
|
static markLessonComplete(id: number | string, section_id: number | string, lesson_id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
433
433
|
static markLessonIncomplete(id: number | string, section_id: number | string, lesson_id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
434
434
|
static changeCourseCover(id: number | string, data: FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
435
|
-
static getCourseWaitingApproval(id: number | string, params?:
|
|
435
|
+
static getCourseWaitingApproval(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
436
436
|
static getCourseSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
437
437
|
static getCourseInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
438
438
|
static getCourseJoinedUsers(id: number | string, params?: CourseUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
439
|
-
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
439
|
+
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
440
440
|
static leaveOrRemoveCourseRequest(id: number | string, params?: {
|
|
441
441
|
user: number;
|
|
442
442
|
}, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CourseCreateParams interface
|
|
3
3
|
*/
|
|
4
|
-
import { SCCoursePrivacyType, SCCourseJoinStatusType, SCCourseTypologyType } from '@selfcommunity/types';
|
|
4
|
+
import { SCCoursePrivacyType, SCCourseJoinStatusType, SCCourseTypologyType, SCCourseOrderingUsersType } from '@selfcommunity/types';
|
|
5
5
|
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
6
6
|
export interface CourseCreateParams {
|
|
7
7
|
/**
|
|
@@ -120,4 +120,8 @@ export interface CourseDashboardUsersParams extends BaseSearchParams {
|
|
|
120
120
|
* Filter by join_status; default: ["manager", "joined"]
|
|
121
121
|
*/
|
|
122
122
|
statuses?: SCCourseJoinStatusType[];
|
|
123
|
+
/**
|
|
124
|
+
* The order of the users. Default to -joined_at
|
|
125
|
+
*/
|
|
126
|
+
ordering?: SCCourseOrderingUsersType;
|
|
123
127
|
}
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { SCCourseCommentType, SCCourseLessonType, SCCourseSectionType, SCCourseType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
import { AxiosRequestConfig } from 'axios';
|
|
3
|
-
import { BaseGetParams, CourseCreateParams, CourseDashboardUsersParams, CourseInfoParams, CourseLessonCommentsParams, CourseSearchParams, CourseUserRoleParams, CourseUsersParams, SCPaginatedResponse } from '../../types';
|
|
3
|
+
import { BaseGetParams, BaseSearchParams, CourseCreateParams, CourseDashboardUsersParams, CourseInfoParams, CourseLessonCommentsParams, CourseSearchParams, CourseUserRoleParams, CourseUsersParams, SCPaginatedResponse } from '../../types';
|
|
4
4
|
import { CourseSectionParams, CourseUserParams } from '../../types/course';
|
|
5
5
|
export interface CourseApiClientInterface {
|
|
6
6
|
changeCourseUserRole(id: number | string, data: CourseUserRoleParams, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -10,8 +10,8 @@ export interface CourseApiClientInterface {
|
|
|
10
10
|
getSpecificCourseInfo(id: number | string, params?: CourseInfoParams, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
11
11
|
getCourseDashboardUsers(id: number | string, params?: CourseDashboardUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
12
12
|
createCourse(data: CourseCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
13
|
-
updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
14
|
-
patchCourse(id: number | string, data: Partial<SCCourseType
|
|
13
|
+
updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
14
|
+
patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
15
15
|
deleteCourse(id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
16
16
|
getCourseLessonComment(id: number | string, section_id: number | string, lesson_id: number | string, comment_id: number | string, config?: AxiosRequestConfig): Promise<SCCourseCommentType>;
|
|
17
17
|
getCourseComments(id: number | string, course_id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseCommentType>>;
|
|
@@ -39,7 +39,7 @@ export interface CourseApiClientInterface {
|
|
|
39
39
|
getCourseSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
40
40
|
getCourseInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
41
41
|
getCourseJoinedUsers(id: number | string, params?: CourseUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
42
|
-
joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
42
|
+
joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
43
43
|
leaveOrRemoveCourseRequest(id: number | string, params?: {
|
|
44
44
|
user: number;
|
|
45
45
|
}, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -108,14 +108,14 @@ export declare class CourseApiClient {
|
|
|
108
108
|
* @param data
|
|
109
109
|
* @param config
|
|
110
110
|
*/
|
|
111
|
-
static updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
111
|
+
static updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
112
112
|
/**
|
|
113
113
|
* This endpoint patches a course.
|
|
114
114
|
* @param id
|
|
115
115
|
* @param data
|
|
116
116
|
* @param config
|
|
117
117
|
*/
|
|
118
|
-
static patchCourse(id: number | string, data: Partial<SCCourseType
|
|
118
|
+
static patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
119
119
|
/**
|
|
120
120
|
* This endpoint deletes a course.
|
|
121
121
|
* @param id
|
|
@@ -330,7 +330,7 @@ export declare class CourseApiClient {
|
|
|
330
330
|
* @param id
|
|
331
331
|
* @param config
|
|
332
332
|
*/
|
|
333
|
-
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
333
|
+
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
334
334
|
/**
|
|
335
335
|
* This endpoint unsubscribes from a course.
|
|
336
336
|
* @param id
|
|
@@ -407,8 +407,8 @@ export default class CourseService {
|
|
|
407
407
|
static getSpecificCourseInfo(id: number | string, params?: CourseInfoParams, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
408
408
|
static getCourseDashboardUsers(id: number | string, params?: CourseDashboardUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
409
409
|
static createCourse(data: CourseCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
410
|
-
static updateCourse(id: number | string, data: SCCourseType, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
411
|
-
static patchCourse(id: number | string, data: Partial<SCCourseType
|
|
410
|
+
static updateCourse(id: number | string, data: SCCourseType | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
411
|
+
static patchCourse(id: number | string, data: Partial<SCCourseType> | FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
412
412
|
static deleteCourse(id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
413
413
|
static getCourseLessonComment(id: number | string, section_id: number | string, lesson_id: number | string, comment_id: number | string, config?: AxiosRequestConfig): Promise<SCCourseCommentType>;
|
|
414
414
|
static getCourseComments(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseCommentType>>;
|
|
@@ -432,11 +432,11 @@ export default class CourseService {
|
|
|
432
432
|
static markLessonComplete(id: number | string, section_id: number | string, lesson_id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
433
433
|
static markLessonIncomplete(id: number | string, section_id: number | string, lesson_id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
434
434
|
static changeCourseCover(id: number | string, data: FormData, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
435
|
-
static getCourseWaitingApproval(id: number | string, params?:
|
|
435
|
+
static getCourseWaitingApproval(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
436
436
|
static getCourseSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
437
437
|
static getCourseInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
438
438
|
static getCourseJoinedUsers(id: number | string, params?: CourseUsersParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
439
|
-
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<
|
|
439
|
+
static joinOrAcceptInviteToCourse(id: number | string, config?: AxiosRequestConfig): Promise<SCCourseType>;
|
|
440
440
|
static leaveOrRemoveCourseRequest(id: number | string, params?: {
|
|
441
441
|
user: number;
|
|
442
442
|
}, config?: AxiosRequestConfig): Promise<any>;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CourseCreateParams interface
|
|
3
3
|
*/
|
|
4
|
-
import { SCCoursePrivacyType, SCCourseJoinStatusType, SCCourseTypologyType } from '@selfcommunity/types';
|
|
4
|
+
import { SCCoursePrivacyType, SCCourseJoinStatusType, SCCourseTypologyType, SCCourseOrderingUsersType } from '@selfcommunity/types';
|
|
5
5
|
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
6
6
|
export interface CourseCreateParams {
|
|
7
7
|
/**
|
|
@@ -120,4 +120,8 @@ export interface CourseDashboardUsersParams extends BaseSearchParams {
|
|
|
120
120
|
* Filter by join_status; default: ["manager", "joined"]
|
|
121
121
|
*/
|
|
122
122
|
statuses?: SCCourseJoinStatusType[];
|
|
123
|
+
/**
|
|
124
|
+
* The order of the users. Default to -joined_at
|
|
125
|
+
*/
|
|
126
|
+
ordering?: SCCourseOrderingUsersType;
|
|
123
127
|
}
|
|
@@ -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
|
+
}
|