Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
feat: stripe invoices (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-fitzmaurice authored May 16, 2023
1 parent a4dd5f7 commit 4e0a29c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/endpoints/gateways.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,41 @@ class GatewaysEndpoint extends BaseExtend {
}
)
}

StripeCustomers(slug, stripe_account) {
return this.request.send(
`${this.endpoint}/${slug}/stripe_customers`,
'POST',
{
data: {
options: {
stripe_account
}
}
},
undefined,
this,
false,
)
}

StripeInvoices(slug, stripe_account, customer_id) {
return this.request.send(
`${this.endpoint}/${slug}/stripe_invoices`,
'POST',
{
data: {
customer_id,
options: {
stripe_account,
}
}
},
undefined,
this,
false,
)
}
}

export default GatewaysEndpoint
31 changes: 31 additions & 0 deletions src/types/gateway.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export interface OnboardingLinkResponse {
onboarding_link: string
}

export interface InvoicingResult {
id: string
created: string
name: string
email: string
object: string
}

/**
* Gateway Endpoints
*/
Expand Down Expand Up @@ -69,4 +77,27 @@ export interface GatewaysEndpoint
returnUrl: string,
test?: boolean
): Promise<T>

/**
* StripeCustomers
* Description: This endpoint allows you to retrieve all customers of a connected Stripe Account
* @param slug [string] The slug of supported gateway (currently only elastic_path_payments_stripe).
* @param stripe_account [string] The id of the connected Stripe Account
*/
StripeCustomers<T = Resource<InvoicingResult>>(
slug: 'elastic_path_payments_stripe',
stripe_account: string
): Promise<T>

/**
* StripeInvoices
* Description: This endpoint allows you to send a Stripe Invoice to a connected Customer
* @param slug [string] The slug of supported gateway (currently only elastic_path_payments_stripe).
* @param stripe_account [string] The id of the connected Stripe Account
*/
StripeInvoices<T = Resource<InvoicingResult>>(
slug: 'elastic_path_payments_stripe',
stripe_account: string,
customer_id: string
): Promise<T>
}

0 comments on commit 4e0a29c

Please sign in to comment.