-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from fleetbase/dev-v0.0.11
enforce stripe onboard for users to monetize extensions
- Loading branch information
Showing
10 changed files
with
152 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
import { task } from 'ember-concurrency'; | ||
|
||
export default class ExtensionMonetizeFormComponent extends Component { | ||
@service fetch; | ||
@tracked subscriptionModelOptions = ['flat_rate', 'tiered', 'usage']; | ||
@tracked billingPeriodOptions = ['daily', 'weekly', 'monthly', 'quarterly', 'yearly']; | ||
@tracked hasStripeConnectAccount = false; | ||
|
||
constructor() { | ||
super(...arguments); | ||
this.lookupStripeConnectAccount.perform(); | ||
} | ||
|
||
@task *lookupStripeConnectAccount() { | ||
try { | ||
const { hasStripeConnectAccount } = yield this.fetch.get('payments/has-stripe-connect-account', {}, { namespace: '~registry/v1' }); | ||
this.hasStripeConnectAccount = hasStripeConnectAccount; | ||
} catch (error) { | ||
this.hasStripeConnectAccount = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class DevelopersExtensionsEditMonetizeController extends Controller { | ||
@tracked subscriptionModelOptions = ['flat_rate', 'tiered', 'usage']; | ||
@tracked billingPeriodOptions = ['daily', 'weekly', 'monthly', 'quarterly', 'yearly']; | ||
} | ||
export default class DevelopersExtensionsEditMonetizeController extends Controller {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,42 @@ | ||
<Layout::Section::Header @title="Payments"> | ||
<div class="flex flex-row space-x-1"> | ||
<span class="text-sm text-black dark:text-white font-bold">Total Amount:</span> | ||
<span class="text-sm text-black dark:text-white">{{format-currency @model.total_amount "USD"}}</span> | ||
</div> | ||
{{#if this.hasStripeConnectAccount}} | ||
<div class="flex flex-row space-x-1"> | ||
<span class="text-sm text-black dark:text-white font-bold">Total Amount:</span> | ||
<span class="text-sm text-black dark:text-white">{{format-currency @model.total_amount "USD"}}</span> | ||
</div> | ||
{{/if}} | ||
</Layout::Section::Header> | ||
|
||
<Layout::Section::Body class="overflow-y-scroll h-full"> | ||
{{#if this.hasStripeConnectAccount}} | ||
<Table | ||
@rows={{@model.data}} | ||
@columns={{this.columns}} | ||
@selectable={{false}} | ||
@canSelectAll={{false}} | ||
@onSetup={{fn (mut this.table)}} | ||
@pagination={{true}} | ||
@paginationMeta={{@model.meta}} | ||
@page={{this.page}} | ||
@onPageChange={{fn (mut this.page)}} | ||
/> | ||
{{#if this.lookupStripeConnectAccount.isRunning}} | ||
<div class="flex items-center justify-center flex-1 p-4"> | ||
<Spinner @loadingMessage="Loading monetization settings..." @loadingMessageClass="ml-2 text-black dark:text-white" @wrapperClass="flex flex-row items-center" /> | ||
</div> | ||
{{else}} | ||
<div class="container"> | ||
<div class="max-w-3xl mx-auto mt-4"> | ||
<div class="content"> | ||
<div class="flex flex-col items-center justify-center"> | ||
<h1 class="text-lg font-semibold mb-1">Your account is not setup to accept payments yet.</h1> | ||
<p class="text-sm mb-2">To accept payments for extensions, you must complete the onboard process via Stripe.</p> | ||
<Button @type="primary" @size="lg" @text="Start payments onboard" @onClick={{transition-to "developers.payments.onboard"}} /> | ||
{{#if this.hasStripeConnectAccount}} | ||
<Table | ||
@rows={{@model.data}} | ||
@columns={{this.columns}} | ||
@selectable={{false}} | ||
@canSelectAll={{false}} | ||
@onSetup={{fn (mut this.table)}} | ||
@pagination={{true}} | ||
@paginationMeta={{@model.meta}} | ||
@page={{this.page}} | ||
@onPageChange={{fn (mut this.page)}} | ||
/> | ||
{{else}} | ||
<div class="container"> | ||
<div class="max-w-3xl mx-auto mt-4"> | ||
<div class="content"> | ||
<div class="flex flex-col items-center justify-center"> | ||
<h1 class="text-lg font-semibold mb-1">Your account is not setup to accept payments yet.</h1> | ||
<p class="text-sm mb-2">To accept payments for extensions, you must complete the onboard process via Stripe.</p> | ||
<Button @type="primary" @size="lg" @text="Start payments onboard" @onClick={{transition-to "developers.payments.onboard"}} /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{/if}} | ||
{{/if}} | ||
</Layout::Section::Body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters