@selfcommunity/api-services 0.6.7-payments.148 → 0.6.7-payments.150

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.
@@ -1585,11 +1585,15 @@ const Endpoints = {
1585
1585
  * Payments/Paywalls
1586
1586
  */
1587
1587
  GetContentProducts: {
1588
- url: (0, utils_1.urlReplacer)('/api/v2/payments/products/'),
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/product/$(id)/prices/'),
1596
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
1593
1597
  method: 'GET'
1594
1598
  },
1595
1599
  GetCheckoutSession: {
@@ -1607,6 +1611,10 @@ const Endpoints = {
1607
1611
  GetPaymentOrders: {
1608
1612
  url: (0, utils_1.urlReplacer)('/api/v2/payments/order/'),
1609
1613
  method: 'GET'
1614
+ },
1615
+ CreateCustomerPortalSession: {
1616
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/customer_portal_session/'),
1617
+ method: 'POST'
1610
1618
  }
1611
1619
  };
1612
1620
  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 } from '@selfcommunity/types';
3
+ import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
4
+ import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession } 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
@@ -34,13 +39,19 @@ export interface PaymentApiClientInterface {
34
39
  * @param data
35
40
  * @param config
36
41
  */
37
- checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
42
+ checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
38
43
  /**
39
- * This endpoint retrive order history of authenticated user
44
+ * This endpoint retrieve order history of authenticated user
40
45
  * @param params
41
46
  * @param config
42
47
  */
43
48
  getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
49
+ /**
50
+ * This endpoint retrieve customer portal
51
+ * @param data
52
+ * @param config
53
+ */
54
+ getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
44
55
  }
45
56
  /**
46
57
  * Contains all the endpoints needed to manage payments.
@@ -52,6 +63,12 @@ export declare class PaymentApiClient {
52
63
  * @param config
53
64
  */
54
65
  static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
66
+ /**
67
+ * This endpoint retrieves a specific payment product.
68
+ * @param id
69
+ * @param config
70
+ */
71
+ static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
55
72
  /**
56
73
  * This endpoint retrieves all the prices related to a product
57
74
  * @param id
@@ -76,13 +93,19 @@ export declare class PaymentApiClient {
76
93
  * @param data
77
94
  * @param config
78
95
  */
79
- static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
96
+ static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
80
97
  /**
81
98
  * This endpoint retrive order history of authenticated user
82
99
  * @param params
83
100
  * @param config
84
101
  */
85
102
  static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
103
+ /**
104
+ * This endpoint retrive customer portal
105
+ * @param data
106
+ * @param config
107
+ */
108
+ static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
86
109
  }
87
110
  /**
88
111
  *
@@ -121,9 +144,11 @@ export declare class PaymentApiClient {
121
144
  */
122
145
  export default class PaymentService {
123
146
  static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
147
+ static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
124
148
  static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
125
149
  static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
126
150
  static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
127
- static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
151
+ static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
128
152
  static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
153
+ static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
129
154
  }
@@ -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
@@ -61,6 +69,14 @@ class PaymentApiClient {
61
69
  static getPaymentsOrder(params, config) {
62
70
  return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetPaymentOrders.url({}), method: Endpoints_1.default.GetPaymentOrders.method }));
63
71
  }
72
+ /**
73
+ * This endpoint retrive customer portal
74
+ * @param data
75
+ * @param config
76
+ */
77
+ static getPaymentsCustomerPortal(data, config) {
78
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCustomerPortalSession.url({}), method: Endpoints_1.default.CreateCustomerPortalSession.method, data }));
79
+ }
64
80
  }
65
81
  exports.PaymentApiClient = PaymentApiClient;
66
82
  /**
@@ -104,6 +120,11 @@ class PaymentService {
104
120
  return PaymentApiClient.getPaymentProducts(params, config);
105
121
  });
106
122
  }
123
+ static getPaymentProduct(id, config) {
124
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
125
+ return PaymentApiClient.getPaymentProduct(id, config);
126
+ });
127
+ }
107
128
  static getPaymentProductPrices(id, params, config) {
108
129
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
109
130
  return PaymentApiClient.getPaymentProductPrices(id, params, config);
@@ -127,5 +148,8 @@ class PaymentService {
127
148
  static getPaymentsOrder(params, config) {
128
149
  return PaymentApiClient.getPaymentsOrder(params, config);
129
150
  }
151
+ static getPaymentsCustomerPortal(data, config) {
152
+ return PaymentApiClient.getPaymentsCustomerPortal(data, config);
153
+ }
130
154
  }
131
155
  exports.default = PaymentService;
@@ -30,6 +30,10 @@ export interface CheckoutCreateSessionParams {
30
30
  * Price id
31
31
  */
32
32
  payment_price_id: number;
33
+ /**
34
+ * Return url
35
+ */
36
+ return_url?: string;
33
37
  }
34
38
  export interface CheckoutSessionParams {
35
39
  /**
@@ -37,3 +41,9 @@ export interface CheckoutSessionParams {
37
41
  */
38
42
  session_id: string;
39
43
  }
44
+ export interface CustomerPortalCreateSessionParams {
45
+ /**
46
+ * Return url
47
+ */
48
+ return_url?: string;
49
+ }
@@ -1583,11 +1583,15 @@ const Endpoints = {
1583
1583
  * Payments/Paywalls
1584
1584
  */
1585
1585
  GetContentProducts: {
1586
- url: urlReplacer('/api/v2/payments/products/'),
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/product/$(id)/prices/'),
1594
+ url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
1591
1595
  method: 'GET'
1592
1596
  },
1593
1597
  GetCheckoutSession: {
@@ -1605,6 +1609,10 @@ const Endpoints = {
1605
1609
  GetPaymentOrders: {
1606
1610
  url: urlReplacer('/api/v2/payments/order/'),
1607
1611
  method: 'GET'
1612
+ },
1613
+ CreateCustomerPortalSession: {
1614
+ url: urlReplacer('/api/v2/payments/customer_portal_session/'),
1615
+ method: 'POST'
1608
1616
  }
1609
1617
  };
1610
1618
  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 } from '@selfcommunity/types';
3
+ import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams, CustomerPortalCreateSessionParams } from '../../types/payment';
4
+ import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession } 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
@@ -34,13 +39,19 @@ export interface PaymentApiClientInterface {
34
39
  * @param data
35
40
  * @param config
36
41
  */
37
- checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
42
+ checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
38
43
  /**
39
- * This endpoint retrive order history of authenticated user
44
+ * This endpoint retrieve order history of authenticated user
40
45
  * @param params
41
46
  * @param config
42
47
  */
43
48
  getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
49
+ /**
50
+ * This endpoint retrieve customer portal
51
+ * @param data
52
+ * @param config
53
+ */
54
+ getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
44
55
  }
45
56
  /**
46
57
  * Contains all the endpoints needed to manage payments.
@@ -52,6 +63,12 @@ export declare class PaymentApiClient {
52
63
  * @param config
53
64
  */
54
65
  static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
66
+ /**
67
+ * This endpoint retrieves a specific payment product.
68
+ * @param id
69
+ * @param config
70
+ */
71
+ static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
55
72
  /**
56
73
  * This endpoint retrieves all the prices related to a product
57
74
  * @param id
@@ -76,13 +93,19 @@ export declare class PaymentApiClient {
76
93
  * @param data
77
94
  * @param config
78
95
  */
79
- static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
96
+ static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
80
97
  /**
81
98
  * This endpoint retrive order history of authenticated user
82
99
  * @param params
83
100
  * @param config
84
101
  */
85
102
  static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
103
+ /**
104
+ * This endpoint retrive customer portal
105
+ * @param data
106
+ * @param config
107
+ */
108
+ static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
86
109
  }
87
110
  /**
88
111
  *
@@ -121,9 +144,11 @@ export declare class PaymentApiClient {
121
144
  */
122
145
  export default class PaymentService {
123
146
  static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
147
+ static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
124
148
  static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
125
149
  static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
126
150
  static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
127
- static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
151
+ static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
128
152
  static getPaymentsOrder(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
153
+ static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
129
154
  }
@@ -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
@@ -58,6 +66,14 @@ export class PaymentApiClient {
58
66
  static getPaymentsOrder(params, config) {
59
67
  return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPaymentOrders.url({}), method: Endpoints.GetPaymentOrders.method }));
60
68
  }
69
+ /**
70
+ * This endpoint retrive customer portal
71
+ * @param data
72
+ * @param config
73
+ */
74
+ static getPaymentsCustomerPortal(data, config) {
75
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreateCustomerPortalSession.url({}), method: Endpoints.CreateCustomerPortalSession.method, data }));
76
+ }
61
77
  }
62
78
  /**
63
79
  *
@@ -100,6 +116,11 @@ export default class PaymentService {
100
116
  return PaymentApiClient.getPaymentProducts(params, config);
101
117
  });
102
118
  }
119
+ static getPaymentProduct(id, config) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ return PaymentApiClient.getPaymentProduct(id, config);
122
+ });
123
+ }
103
124
  static getPaymentProductPrices(id, params, config) {
104
125
  return __awaiter(this, void 0, void 0, function* () {
105
126
  return PaymentApiClient.getPaymentProductPrices(id, params, config);
@@ -123,4 +144,7 @@ export default class PaymentService {
123
144
  static getPaymentsOrder(params, config) {
124
145
  return PaymentApiClient.getPaymentsOrder(params, config);
125
146
  }
147
+ static getPaymentsCustomerPortal(data, config) {
148
+ return PaymentApiClient.getPaymentsCustomerPortal(data, config);
149
+ }
126
150
  }
@@ -30,6 +30,10 @@ export interface CheckoutCreateSessionParams {
30
30
  * Price id
31
31
  */
32
32
  payment_price_id: number;
33
+ /**
34
+ * Return url
35
+ */
36
+ return_url?: string;
33
37
  }
34
38
  export interface CheckoutSessionParams {
35
39
  /**
@@ -37,3 +41,9 @@ export interface CheckoutSessionParams {
37
41
  */
38
42
  session_id: string;
39
43
  }
44
+ export interface CustomerPortalCreateSessionParams {
45
+ /**
46
+ * Return url
47
+ */
48
+ return_url?: string;
49
+ }