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

Commit 4e0a29c

Browse files
feat: stripe invoices (#807)
1 parent a4dd5f7 commit 4e0a29c

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

src/endpoints/gateways.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,41 @@ class GatewaysEndpoint extends BaseExtend {
3737
}
3838
)
3939
}
40+
41+
StripeCustomers(slug, stripe_account) {
42+
return this.request.send(
43+
`${this.endpoint}/${slug}/stripe_customers`,
44+
'POST',
45+
{
46+
data: {
47+
options: {
48+
stripe_account
49+
}
50+
}
51+
},
52+
undefined,
53+
this,
54+
false,
55+
)
56+
}
57+
58+
StripeInvoices(slug, stripe_account, customer_id) {
59+
return this.request.send(
60+
`${this.endpoint}/${slug}/stripe_invoices`,
61+
'POST',
62+
{
63+
data: {
64+
customer_id,
65+
options: {
66+
stripe_account,
67+
}
68+
}
69+
},
70+
undefined,
71+
this,
72+
false,
73+
)
74+
}
4075
}
4176

4277
export default GatewaysEndpoint

src/types/gateway.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ export interface OnboardingLinkResponse {
3737
onboarding_link: string
3838
}
3939

40+
export interface InvoicingResult {
41+
id: string
42+
created: string
43+
name: string
44+
email: string
45+
object: string
46+
}
47+
4048
/**
4149
* Gateway Endpoints
4250
*/
@@ -69,4 +77,27 @@ export interface GatewaysEndpoint
6977
returnUrl: string,
7078
test?: boolean
7179
): Promise<T>
80+
81+
/**
82+
* StripeCustomers
83+
* Description: This endpoint allows you to retrieve all customers of a connected Stripe Account
84+
* @param slug [string] The slug of supported gateway (currently only elastic_path_payments_stripe).
85+
* @param stripe_account [string] The id of the connected Stripe Account
86+
*/
87+
StripeCustomers<T = Resource<InvoicingResult>>(
88+
slug: 'elastic_path_payments_stripe',
89+
stripe_account: string
90+
): Promise<T>
91+
92+
/**
93+
* StripeInvoices
94+
* Description: This endpoint allows you to send a Stripe Invoice to a connected Customer
95+
* @param slug [string] The slug of supported gateway (currently only elastic_path_payments_stripe).
96+
* @param stripe_account [string] The id of the connected Stripe Account
97+
*/
98+
StripeInvoices<T = Resource<InvoicingResult>>(
99+
slug: 'elastic_path_payments_stripe',
100+
stripe_account: string,
101+
customer_id: string
102+
): Promise<T>
72103
}

0 commit comments

Comments
 (0)