| 1 | import type { |
| 2 | Account as StripeAccount, |
| 3 | CreateAccountError, |
| 4 | CreateAccountRequest, |
| 5 | } from "@distilled.cloud/stripe/stripe"; |
| 6 | import type * as Effect from "effect/Effect"; |
| 7 | import * as Binding from "../Binding.ts"; |
| 8 | import type { RuntimeContext } from "../RuntimeContext.ts"; |
| 9 | |
| 10 | /** |
| 11 | * Create a Stripe Connect Account over HTTP. Account-scoped — binds the |
| 12 | * API key onto the host, not a specific connected account. |
| 13 | * |
| 14 | * ### Creating an Account at runtime |
| 15 | * **Example:** Bind and create |
| 16 | * ```typescript |
| 17 | * const create = yield* Stripe.CreateAccount(); |
| 18 | * const account = yield* create({ |
| 19 | * type: "express", |
| 20 | * country: "US", |
| 21 | * email: "merchant@example.com", |
| 22 | * }); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | * @product Account |
| 27 | */ |
| 28 | export interface CreateAccount extends Binding.Service< |
| 29 | CreateAccount, |
| 30 | "Stripe.CreateAccount", |
| 31 | () => Effect.Effect< |
| 32 | ( |
| 33 | request: CreateAccountRequest, |
| 34 | ) => Effect.Effect<StripeAccount, CreateAccountError, RuntimeContext> |
| 35 | > |
| 36 | > {} |
| 37 | |
| 38 | export const CreateAccount = Binding.Service<CreateAccount>( |
| 39 | "Stripe.CreateAccount", |
| 40 | ); |