From 4e0a29c330fbfddf6e335271c9154c5cc8770e50 Mon Sep 17 00:00:00 2001 From: Colin Fitz-Maurice Date: Tue, 16 May 2023 15:59:46 -0400 Subject: [PATCH] feat: stripe invoices (#807) --- src/endpoints/gateways.js | 35 +++++++++++++++++++++++++++++++++++ src/types/gateway.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/src/endpoints/gateways.js b/src/endpoints/gateways.js index 1dae4d28c..d4722460a 100644 --- a/src/endpoints/gateways.js +++ b/src/endpoints/gateways.js @@ -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 diff --git a/src/types/gateway.d.ts b/src/types/gateway.d.ts index a5edf7b18..5ae0a4641 100644 --- a/src/types/gateway.d.ts +++ b/src/types/gateway.d.ts @@ -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 */ @@ -69,4 +77,27 @@ export interface GatewaysEndpoint returnUrl: string, test?: boolean ): Promise + + /** + * 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>( + slug: 'elastic_path_payments_stripe', + stripe_account: string + ): Promise + + /** + * 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>( + slug: 'elastic_path_payments_stripe', + stripe_account: string, + customer_id: string + ): Promise }