WIP chargebee integration sketch

This commit is contained in:
Lukas F. Hartmann
2021-05-23 23:53:41 +02:00
parent 6ef1f8fba6
commit 0a1bd2a107
6 changed files with 140 additions and 60 deletions

View File

@@ -130,9 +130,27 @@ SpacedeckUsers = {
$event.stopPropagation();
}
create_user(name, email, password, password_confirmation, invite_code, function(session) {
create_user(name, email, password, password_confirmation, invite_code, function(res) {
this.creating_user = false;
this.login_submit(email, password, null, on_success);
if (res.chargebee_checkout) {
var chargebeeInstance = Chargebee.init({
site: "spacedeck-test",
enableRedirectMode: true,
enableFriendbuyTracking: false
});
chargebeeInstance.openCheckout({
hostedPage: function() {
return new Promise(function(resolve, reject) {
resolve(res.chargebee_checkout);
})
}
});
} else {
// user created, login
this.login_submit(email, password, null, on_success);
}
}.bind(this), function(req) {
this.creating_user = false;
try {