-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
payments onboard and extension purchasing flow completed
- Loading branch information
Showing
50 changed files
with
1,189 additions
and
43 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
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 |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
|
||
# addons | ||
/.node_modules.ember-try/ | ||
|
||
# server | ||
/server/ | ||
/server_vendor/ |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}> | ||
<div class="pt-4 pb-6 px-4"> | ||
<Spinner @loadingMessage={{@options.loadingMessage}} @loadingMessageClass="ml-2 text-black dark:text-white" @wrapperClass="flex flex-row items-center" /> | ||
</div> | ||
</Modal::Default> |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class ModalsConfirmExtensionPurchaseComponent extends Component {} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}> | ||
<div class="p-1"> | ||
<div id="checkout" {{did-insert @options.checkoutElementInserted}}></div> | ||
</div> | ||
</Modal::Default> |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class ModalsExtensionPurchaseFormComponent extends Component {} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class DevelopersPaymentsIndexController extends Controller { | ||
@tracked hasStripeConnectAccount = true; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import Controller from '@ember/controller'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { task } from 'ember-concurrency'; | ||
import { loadConnectAndInitialize } from '@stripe/connect-js'; | ||
import config from '../config/environment'; | ||
|
||
export default class DevelopersPaymentsOnboardController extends Controller { | ||
@service fetch; | ||
@service notifications; | ||
@tracked connectedAccountId; | ||
@tracked onboardInProgress = false; | ||
@tracked onboardCompleted = false; | ||
|
||
@task *startOnboard() { | ||
try { | ||
const { account } = yield this.fetch.post('payments/account', {}, { namespace: '~registry/v1' }); | ||
|
||
this.connectedAccountId = account; | ||
this.onboardInProgress = true; | ||
|
||
const instance = loadConnectAndInitialize({ | ||
publishableKey: config.stripe.publishableKey, | ||
fetchClientSecret: this.fetchClientSecret.bind(this), | ||
appearance: { | ||
overlays: 'dialog', | ||
variables: { | ||
colorPrimary: '#635BFF', | ||
}, | ||
}, | ||
}); | ||
|
||
const container = this.getTrackedElement('embeddedOnboardingContainer'); | ||
const embeddedOnboardingComponent = instance.create('account-onboarding'); | ||
embeddedOnboardingComponent.setOnExit(() => { | ||
this.onboardInProgress = false; | ||
this.onboardCompleted = true; | ||
}); | ||
container.appendChild(embeddedOnboardingComponent); | ||
} catch (error) { | ||
this.notifications.serverError(error); | ||
} | ||
} | ||
|
||
async fetchClientSecret() { | ||
try { | ||
const { clientSecret } = await this.fetch.post('payments/account-session', { account: this.connectedAccountId }, { namespace: '~registry/v1' }); | ||
|
||
return clientSecret; | ||
} catch (error) { | ||
this.notifications.serverError(error); | ||
} | ||
} | ||
|
||
@action createTrackedElement(name, el) { | ||
this[name] = el; | ||
} | ||
|
||
getTrackedElement(name) { | ||
if (this[name] instanceof HTMLElement) { | ||
return this[name]; | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.