diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag index 34e4ee14e72..60076acf83e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/user-api.jag @@ -33,8 +33,13 @@ var util = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var responseProcessor = require("utils").response; var result; +if (uriMatcher.match("/{context}/api/user/clearBilling")) { -if (uriMatcher.match("/{context}/api/user/authenticate")) { + carbonUser = session.get(constants.USER_SESSION_KEY); + session.put('BILLING_INFO_' + carbonUser.domain, null); + log.info("billing info cleared for " + carbonUser.domain); + +} else if (uriMatcher.match("/{context}/api/user/authenticate")) { var username = request.getParameter("username"); var password = request.getParameter("password"); //Check if a username and password is provided diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/user-menu.js index edd143481b0..9a3459a9a5d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/user-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/public/js/user-menu.js @@ -16,6 +16,33 @@ * under the License. */ $(document).ready(function () { + + $("#expire-upgrade-now-link").click(function() { + $.get("api/user/clearBilling", function(data, status){ + }); + window.location.href = $("#expire-upgrade-now-link").data("url"); + }); + + $("#expire-req-ext-link").click(function() { + $.get("api/user/clearBilling", function(data, status){ + }); + window.location.href = $("#expire-req-ext-link").data("url"); + }); + + $(".expire-upgrade-now-link").parent().click(function(e) { + e.preventDefault(); + $.get("api/user/clearBilling", function(data, status){ + }); + window.location.href = $(this).attr("href"); + }); + + $(".expire-req-ext-link").parent().click(function(e) { + e.preventDefault(); + $.get("api/user/clearBilling", function(data, status){ + }); + window.location.href = $(this).attr("href"); + }); + $('#cloud-menu-popover i.fw-tiles').popover({ html: true, trigger: 'click', diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs index 5b8f29183a4..c50ea375eb6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs @@ -171,10 +171,10 @@