Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
eb03711a
Commit
eb03711a
authored
Jul 13, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new Subscriptions API for extending/reactivating trial
parent
4e282783
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
ee/app/assets/javascripts/api/subscriptions_api.js
ee/app/assets/javascripts/api/subscriptions_api.js
+28
-0
No files found.
ee/app/assets/javascripts/api/subscriptions_api.js
View file @
eb03711a
...
...
@@ -2,6 +2,12 @@ import { buildApiUrl } from '~/api/api_utils';
import
axios
from
'
~/lib/utils/axios_utils
'
;
const
SUBSCRIPTIONS_PATH
=
'
/api/:version/subscriptions
'
;
const
EXTEND_REACTIVATE_TRIAL_PATH
=
'
/-/trials/extend_reactivate
'
;
const
TRIAL_EXTENSION_TYPE
=
Object
.
freeze
({
extended
:
1
,
reactivated
:
2
,
});
export
function
createSubscription
(
groupId
,
customer
,
subscription
)
{
const
url
=
buildApiUrl
(
SUBSCRIPTIONS_PATH
);
...
...
@@ -13,3 +19,25 @@ export function createSubscription(groupId, customer, subscription) {
return
axios
.
post
(
url
,
{
params
});
}
const
updateTrial
=
async
(
namespaceId
,
trialExtensionType
)
=>
{
if
(
!
Object
.
values
(
TRIAL_EXTENSION_TYPE
).
includes
(
trialExtensionType
))
{
throw
new
TypeError
(
'
The "trialExtensionType" argument is invalid.
'
);
}
const
url
=
buildApiUrl
(
EXTEND_REACTIVATE_TRIAL_PATH
);
const
params
=
{
namespace_id
:
namespaceId
,
trial_extension_type
:
trialExtensionType
,
};
return
axios
.
put
(
url
,
params
);
};
export
const
extendTrial
=
async
(
namespaceId
)
=>
{
return
updateTrial
(
namespaceId
,
TRIAL_EXTENSION_TYPE
.
extended
);
};
export
const
reactivateTrial
=
async
(
namespaceId
)
=>
{
return
updateTrial
(
namespaceId
,
TRIAL_EXTENSION_TYPE
.
reactivated
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment