web/satellite: allow users who have balance to create projects

Change-Id: I5c93dea09812fcbfcc1b7a9ca2202de3087b7032
This commit is contained in:
VitaliiShpital 2020-04-08 15:53:53 +03:00 committed by Vitalii Shpital
parent bb4b7a919e
commit 6109fa685d
3 changed files with 4 additions and 3 deletions

View File

@ -206,7 +206,7 @@ export default class HeaderArea extends Vue {
const projects = await this.$store.dispatch(PROJECTS_ACTIONS.FETCH); const projects = await this.$store.dispatch(PROJECTS_ACTIONS.FETCH);
if (!projects.length) { if (!projects.length) {
await this.$store.dispatch(APP_STATE_ACTIONS.CHANGE_STATE, AppState.LOADED_EMPTY); await this.$store.dispatch(APP_STATE_ACTIONS.CHANGE_STATE, AppState.LOADED_EMPTY);
await this.$router.push(RouteConfig.ProjectDashboard.path); await this.$router.push(RouteConfig.Account.with(RouteConfig.Billing).path);
return; return;
} }

View File

@ -262,10 +262,10 @@ export function makePaymentsModule(api: PaymentsApi): StoreModule<PaymentsState>
}, },
getters: { getters: {
canUserCreateFirstProject: (state: PaymentsState): boolean => { canUserCreateFirstProject: (state: PaymentsState): boolean => {
return state.billingHistory.some((billingItem: BillingHistoryItem) => { return (state.billingHistory.some((billingItem: BillingHistoryItem) => {
return billingItem.amount >= 50 && billingItem.type === BillingHistoryItemType.Transaction return billingItem.amount >= 50 && billingItem.type === BillingHistoryItemType.Transaction
&& billingItem.status === BillingHistoryItemStatus.Completed; && billingItem.status === BillingHistoryItemStatus.Completed;
}) || state.creditCards.length > 0; }) && state.balance > 0) || state.creditCards.length > 0;
}, },
isInvoiceForPreviousRollup: (state: PaymentsState): boolean => { isInvoiceForPreviousRollup: (state: PaymentsState): boolean => {
const now = new Date(); const now = new Date();

View File

@ -76,6 +76,7 @@ describe('NewProjectArea', () => {
BillingHistoryItemStatus.Completed, 'test', new Date(), new Date(), BillingHistoryItemType.Transaction); BillingHistoryItemStatus.Completed, 'test', new Date(), new Date(), BillingHistoryItemType.Transaction);
store.commit(PAYMENTS_MUTATIONS.CLEAR); store.commit(PAYMENTS_MUTATIONS.CLEAR);
store.commit(PAYMENTS_MUTATIONS.SET_BILLING_HISTORY, [billingTransactionItem]); store.commit(PAYMENTS_MUTATIONS.SET_BILLING_HISTORY, [billingTransactionItem]);
store.commit(PAYMENTS_MUTATIONS.SET_BALANCE, 50);
const wrapper = mount(NewProjectArea, { const wrapper = mount(NewProjectArea, {
store, store,