Support users rest api change
This commit is contained in:
parent
23bcd75d8c
commit
673d50c215
@ -24,6 +24,11 @@ AppStore.prototype.getAccessToken = function (user) {
|
||||
return res.body.accessToken;
|
||||
};
|
||||
|
||||
AppStore.prototype.getProfile = function () {
|
||||
var res = request.get(this._origin + '/api/v1/profile').query({ accessToken: this._credentials.accessToken }).end();
|
||||
return res.body.profile;
|
||||
};
|
||||
|
||||
AppStore.prototype.setCredentials = function (password, accessToken) {
|
||||
this._credentials = { password: password, accessToken: accessToken };
|
||||
};
|
||||
@ -95,7 +100,7 @@ AppStore.prototype.restore = function (boxId, backupId) {
|
||||
common.verifyResponse(res, 'Could not restore cloudron');
|
||||
};
|
||||
|
||||
AppStore.prototype.setupBilling = function (callback) {
|
||||
AppStore.prototype.setupBilling = function (user, callback) {
|
||||
var stripeApi = stripe(common.stripeSecret());
|
||||
|
||||
var that = this;
|
||||
@ -117,7 +122,7 @@ AppStore.prototype.setupBilling = function (callback) {
|
||||
billingToken: token.id
|
||||
};
|
||||
|
||||
var res = request.put(that._origin + '/api/v1/users').send(data).query({ accessToken: that._credentials.accessToken }).end();
|
||||
var res = request.put(that._origin + '/api/v1/users/' + user.id).send(data).query({ accessToken: that._credentials.accessToken }).end();
|
||||
common.verifyResponse(res, 'Could not setup billing');
|
||||
|
||||
callback(null);
|
||||
|
@ -38,8 +38,13 @@ describe('Appstore new user flow', function () {
|
||||
appStore.setCredentials(owner.password, accessToken);
|
||||
});
|
||||
|
||||
it('can get profile', function () {
|
||||
var profile = appStore.getProfile();
|
||||
owner.id = profile.id;
|
||||
});
|
||||
|
||||
it('can setup billing details', function (done) {
|
||||
appStore.setupBilling(done);
|
||||
appStore.setupBilling(owner, done);
|
||||
});
|
||||
|
||||
it('can create a cloudron', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user