@@ -125,35 +125,12 @@ module.exports = [
125125 } ,
126126 activeOrg : function (
127127 $stateParams ,
128- whitelists ,
129- moment
128+ whitelists
130129 ) {
131130 var lowerAccountName = $stateParams . userName . toLowerCase ( ) ;
132- var activeOrg = whitelists . find ( function ( whitelist ) {
131+ return whitelists . find ( function ( whitelist ) {
133132 return whitelist . attrs . lowerName === lowerAccountName ;
134133 } ) ;
135- // All of this should be moved to inside @runnable /api-client
136- activeOrg . attrs . trialEnd = moment ( ) . add ( 2 , 'days' ) . toISOString ( ) ;
137- activeOrg . attrs . activePeriodEnd = moment ( ) . subtract ( 1 , 'days' ) . toISOString ( ) ;
138- activeOrg . attrs . gracePeriodEnd = moment ( ) . add ( 5 , 'days' ) . toISOString ( ) ;
139- activeOrg . attrs . stripeCustomerId = 1234 ;
140- activeOrg . attrs . hasPaymentMethod = false ;
141- activeOrg . isInTrial = function ( ) {
142- return moment ( activeOrg . attrs . trialEnd ) > moment ( ) . utc ( ) ;
143- } ;
144- activeOrg . isInGrace = function ( ) {
145- return ! activeOrg . isInTrial ( ) && moment ( activeOrg . attrs . gracePeriodEnd ) > moment ( ) . utc ( ) ;
146- } ;
147- activeOrg . isInActivePeriod = function ( ) {
148- return moment ( activeOrg . attrs . activePeriodEnd ) > moment ( ) . utc ( ) ;
149- } ;
150- activeOrg . isGraceExpired = function ( ) {
151- return ! activeOrg . isInTrial ( ) && moment . utc ( activeOrg . attrs . gracePeriodEnd ) < moment ( ) . utc ( ) ;
152- } ;
153- activeOrg . trialDaysRemaining = function ( ) {
154- return moment ( activeOrg . attrs . trialEnd ) . diff ( moment . utc ( ) , 'days' ) ;
155- } ;
156- return activeOrg ;
157134 } ,
158135 activeAccount : function (
159136 $q ,
0 commit comments