This repository was archived by the owner on Apr 8, 2024. It is now read-only.
Commit 0dcb855 1 parent ed1a43f commit 0dcb855 Copy full SHA for 0dcb855
File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,21 @@ module.exports = class {
59
59
*/
60
60
async listSubscriptions ( state = 'active' ) {
61
61
return this . _returnResponseIf200 ( this . _got ( PATH_LIST_USERS , {
62
- form : {
63
- vendor_id : this . _vendorId ,
64
- vendor_auth_code : this . _authCode ,
65
- state
66
- }
62
+ /**
63
+ *
64
+ * @param {String } plan return only specific plan info
65
+ * @returns
66
+ */
67
+ async listPlans ( plan ) {
68
+ const form = {
69
+ vendor_id : this . _vendorId ,
70
+ vendor_auth_code : this . _authCode
71
+ }
72
+ if ( plan ) {
73
+ form . plan = plan
74
+ }
75
+ return this . _returnResponseIf200 ( this . _got ( PATH_LIST_PLANS , {
76
+ form
67
77
} ) )
68
78
}
69
79
Original file line number Diff line number Diff line change @@ -19,4 +19,14 @@ test('list all products', async () => {
19
19
test ( 'list all subscriptions' , async ( ) => {
20
20
const subs = await api . listSubscriptions ( )
21
21
expect ( subs ) . toHaveLength ( 0 )
22
+ } )
23
+
24
+ test ( 'list all plans' , async ( ) => {
25
+ const subs = await api . listPlans ( )
26
+ expect ( subs ) . toHaveLength ( 2 )
27
+ } )
28
+
29
+ test ( 'list one plan' , async ( ) => {
30
+ const subs = await api . listPlans ( 33590 )
31
+ expect ( subs ) . toHaveLength ( 1 )
22
32
} )
You can’t perform that action at this time.
0 commit comments