Skip to content

Commit a5f54f3

Browse files
Merge pull request #2189 from CodeNow/SAN-6074
SAN-6074 Remove billing options
2 parents d8e2740 + ced791f commit a5f54f3

9 files changed

Lines changed: 46 additions & 4 deletions

File tree

client/controllers/controllerApp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ function ControllerApp(
188188
};
189189

190190
if (currentOrg.isPaymentDue()) {
191+
if (!currentOrg.isBillingVisible()) {
192+
return $state.go('paused');
193+
}
191194
// Determine if it's a trial end or just a normal payment due
192195
if (currentOrg.poppa.attrs.hasPaymentMethod) {
193196
ModalService.showModal({

client/directives/accountsSelect/popoverAccountMenu/viewPopoverAccountMenu.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
)
2424
li.list-item.popover-list-item.small.disabled {{data.currentOrg.github.oauthName()}} Settings
2525
li.list-item.popover-list-item(
26+
ng-if = "data.currentOrg.isBillingVisible()"
2627
ng-click = "actions.openSettingsModal('billing')"
2728
)
2829
svg.iconnables

client/directives/modals/settingsModal/settingsModalView.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
.row.modal-tabs.tabs-all.grid-block.clearfix
2020
button.btn.btn-radio.grid-block.vertical(
2121
ng-attr-data-badge-count = "{{SEMC.currentOrg.poppa.isInTrial() && !SEMC.currentOrg.poppa.attrs.hasPaymentMethod ? SEMC.currentOrg.poppa.trialDaysRemaining() : ''}}"
22+
ng-if = "SEMC.currentOrg.isBillingVisible()"
2223
ng-class = "{\
2324
'active': SEMC.currentTab === 'billing',\
2425
'badge': SEMC.currentOrg.poppa.isInTrial() && !SEMC.currentOrg.poppa.attrs.hasPaymentMethod,\

client/services/createAndBuildNewContainerService.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ function createAndBuildNewContainer(
6161
user: fetchUser()
6262
})
6363
.then(function (response) {
64+
if (!currentOrg.isBillingVisible()) {
65+
return response;
66+
}
67+
6468
return fetchPlan()
6569
.then(function (plan) {
6670
oldPlanId = keypather.get(plan, 'next.id');
@@ -109,7 +113,11 @@ function createAndBuildNewContainer(
109113
var repoName = instance.getRepoName();
110114
invitePersonalRunnabot({githubUsername: githubUsername, repoName: repoName});
111115
}
112-
alertContainerCreated(oldPlanId);
116+
117+
if (currentOrg.isBillingVisible()) {
118+
alertContainerCreated(oldPlanId);
119+
}
120+
113121
return instance;
114122
})
115123
.catch(function (err) {

client/services/currentOrgService.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ function currentOrg(
3434
return org.poppa.attrs.isPermanentlyBanned || !org.poppa.attrs.isActive;
3535
};
3636

37+
org.isBillingVisible = function () {
38+
// Hide when onPrem or when FF is on
39+
return !(keypather.get(org, 'poppa.isOnPrem') || featureFlags.flags.hideBilling);
40+
};
41+
3742
return org;
3843
}

client/services/featureFlagService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function featureFlags(
3535
envVars2: false, // new env vars
3636
fullScreen: false, // toggles full screen
3737
fullScreenToggle: false, // toggles the button that toggles full screen
38+
hideBilling: false,
3839
hideExplorer: false,
3940
hostnameNotifications: false,
4041
hostnameTool: false,

test/unit/controllers/controllerApp.unit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ describe('controllerApp'.bold.underline.blue, function () {
4343
}
4444
},
4545
willAcceptPayment: sinon.stub().returns(true),
46-
isPaymentDue: sinon.stub().returns(true)
46+
isPaymentDue: sinon.stub().returns(true),
47+
isBillingVisible: sinon.stub().returns(true)
4748
};
4849
ctx = {};
4950
ctx.fetchInstancesByPodMock = new (require('../fixtures/mockFetch'))();

test/unit/controllers/controllerInstances.unit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('ControllerInstances'.bold.underline.blue, function () {
7070
org1: {
7171
models: [{
7272
attrs: angular.copy(apiMocks.instances.building)
73-
}]
73+
}],
7474
},
7575
org2: {
7676
models: []
@@ -103,7 +103,8 @@ describe('ControllerInstances'.bold.underline.blue, function () {
103103
hasCompletedDemo: true
104104
}
105105
}
106-
}
106+
},
107+
isBillingVisible: sinon.stub().returns(true)
107108
};
108109
mockBranch = {
109110
name: 'mockBranch',

test/unit/services/createAndBuildNewContainerService.unit.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ describe('createAndBuildNewContainer'.bold.underline.blue, function () {
2020
var errsStub;
2121
var alertContainerCreatedStub;
2222

23+
var mockCurrentOrg = {
24+
poppa: {
25+
trialDaysRemaining: sinon.stub(),
26+
isInTrial: sinon.stub(),
27+
isInGrace: sinon.stub(),
28+
isGraceExpired: sinon.stub(),
29+
attrs: {
30+
hasPaymentMethod: false
31+
}
32+
},
33+
github: {
34+
attrs: {
35+
id: 'githubId1234'
36+
}
37+
},
38+
willAcceptPayment: sinon.stub().returns(true),
39+
isPaymentDue: sinon.stub().returns(true),
40+
isBillingVisible: sinon.stub().returns(true)
41+
};
42+
2343
function createMasterPods() {
2444
ctx.masterPods = runnable.newInstances(
2545
[apiMocks.instances.building, apiMocks.instances.runningWithContainers[0]],
@@ -90,6 +110,7 @@ describe('createAndBuildNewContainer'.bold.underline.blue, function () {
90110
return mockFetchPlan;
91111
});
92112
$provide.value('errs', errsStub);
113+
$provide.value('currentOrg', mockCurrentOrg);
93114
});
94115
angular.mock.inject(function (
95116
_$rootScope_,

0 commit comments

Comments
 (0)