Skip to content

Commit

Permalink
Codegen for openapi v195
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe committed Sep 21, 2022
1 parent 6947bd5 commit 3b4e525
Show file tree
Hide file tree
Showing 23 changed files with 911 additions and 37 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v185
v195
5 changes: 5 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ module.exports = {
Configurations: require('./resources/BillingPortal/Configurations'),
Sessions: require('./resources/BillingPortal/Sessions'),
}),
Capital: resourceNamespace('capital', {
FinancingOffers: require('./resources/Capital/FinancingOffers'),
FinancingSummaries: require('./resources/Capital/FinancingSummaries'),
FinancingTransactions: require('./resources/Capital/FinancingTransactions'),
}),
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
Expand Down
26 changes: 26 additions & 0 deletions lib/resources/Capital/FinancingOffers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'capital/financing_offers',

retrieve: stripeMethod({
method: 'GET',
path: '/{financingOffer}',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),

markDelivered: stripeMethod({
method: 'POST',
path: '/{financingOffer}/mark_delivered',
}),
});
15 changes: 15 additions & 0 deletions lib/resources/Capital/FinancingSummaries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'capital/financing_summary',

retrieve: stripeMethod({
method: 'GET',
path: '',
}),
});
21 changes: 21 additions & 0 deletions lib/resources/Capital/FinancingTransactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'capital/financing_transactions',

retrieve: stripeMethod({
method: 'GET',
path: '/{financingTransaction}',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),
});
6 changes: 3 additions & 3 deletions types/2022-08-01/AccountSessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
declare module 'stripe' {
namespace Stripe {
/**
* An AccountSession allows a Connect platform to grant access to a connected account in Connect Elements.
* An AccountSession allows a Connect platform to grant access to a connected account in Connect Embedded UIs.
*
* We recommend that you create an AccountSession each time you need to display an embedded UI
* to your user. Do not save AccountSessions to your database as they expire relatively
* quickly, and cannot be used more than once.
*
* Related guide: [Connect Elements](https://stripe.com/docs/connect/get-started-connect-elements).
* Related guide: [Connect Embedded UIs](https://stripe.com/docs/connect/get-started-connect-elements).
*/
interface AccountSession {
/**
Expand All @@ -27,7 +27,7 @@ declare module 'stripe' {
*
* The client secret can be used to provide access to `account` from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.
*
* Refer to our docs to [setup Connect Elements](https://stripe.com/docs/connect/get-started-connect-elements) and learn about how `client_secret` should be handled.
* Refer to our docs to [setup Connect Embedded UIs](https://stripe.com/docs/connect/get-started-connect-elements) and learn about how `client_secret` should be handled.
*/
client_secret: string;

Expand Down
259 changes: 259 additions & 0 deletions types/2022-08-01/Capital/FinancingOffers.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
// File generated from our OpenAPI spec

declare module 'stripe' {
namespace Stripe {
namespace Capital {
/**
* This is an object representing an offer of financing from
* Stripe Capital to a Connect subaccount.
*/
interface FinancingOffer {
/**
* A unique identifier for the financing object.
*/
id: string;

/**
* The object type: financing_offer.
*/
object: 'capital.financing_offer';

/**
* This is an object representing the terms of an offer of financing from
* Stripe Capital to a Connected account. This resource represents
* the terms accepted by the Connected account, which may differ from those
* offered.
*/
accepted_terms?: FinancingOffer.AcceptedTerms;

/**
* The ID of the merchant associated with this financing object.
*/
account: string;

/**
* Time at which the offer was created. Given in seconds since unix epoch.
*/
created: number;

/**
* Time at which the offer expires. Given in seconds since unix epoch.
*/
expires_after: number;

/**
* The type of financing being offered.
*/
financing_type?: FinancingOffer.FinancingType;

/**
* Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
*/
livemode: boolean;

/**
* Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
*/
metadata?: Stripe.Metadata;

/**
* This is an object representing the terms of an offer of financing from
* Stripe Capital to a Connected account. This resource represents
* both the terms offered to the Connected account.
*/
offered_terms?: FinancingOffer.OfferedTerms;

/**
* Financing product identifier.
*/
product_type?: FinancingOffer.ProductType;

/**
* The current status of the offer.
*/
status: FinancingOffer.Status;

/**
* See [financing_type](https://stripe.com/docs/api/capital/connect_financing_object#financing_offer_object-financing_type).
*/
type?: FinancingOffer.Type;
}

namespace FinancingOffer {
interface AcceptedTerms {
/**
* Amount of financing offered, in minor units.
*/
advance_amount: number;

/**
* Currency that the financing offer is transacted in. For example, `usd`.
*/
currency: string;

/**
* Fixed fee amount, in minor units.
*/
fee_amount: number;

/**
* Populated when the `product_type` of the `financingoffer` is `refill`.
* Represents the discount amount on remaining premium for the existing loan at payout time.
*/
previous_financing_fee_discount_amount: number | null;

/**
* Per-transaction rate at which Stripe will withhold funds to repay the financing.
*/
withhold_rate: number;
}

type FinancingType = 'cash_advance' | 'flex_loan';

interface OfferedTerms {
/**
* Amount of financing offered, in minor units.
*/
advance_amount: number;

/**
* Describes the type of user the offer is being extended to.
*/
campaign_type: OfferedTerms.CampaignType;

/**
* Currency that the financing offer is transacted in. For example, `usd`.
*/
currency: string;

/**
* Fixed fee amount, in minor units.
*/
fee_amount: number;

/**
* Populated when the `product_type` of the `financingoffer` is `refill`.
* Represents the discount rate percentage on remaining premium on the existing loan. When the `financing_offer`
* is paid out, the `previous_financing_fee_discount_amount` will be computed as the multiple of this rate
* and the remaining premium.
*/
previous_financing_fee_discount_rate: number | null;

/**
* Per-transaction rate at which Stripe will withhold funds to repay the financing.
*/
withhold_rate: number;
}

namespace OfferedTerms {
type CampaignType =
| 'newly_eligible_user'
| 'previously_eligible_user'
| 'repeat_user';
}

type ProductType = 'refill' | 'standard';

type Status =
| 'accepted'
| 'canceled'
| 'completed'
| 'delivered'
| 'expired'
| 'fully_repaid'
| 'paid_out'
| 'rejected'
| 'undelivered';

type Type = 'cash_advance' | 'flex_loan';
}

interface FinancingOfferRetrieveParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface FinancingOfferListParams extends PaginationParams {
/**
* limit list to offers belonging to given connected account
*/
connected_account?: string;

created?: Stripe.RangeQueryParam | number;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;

/**
* limit list to offers with given status
*/
status?: FinancingOfferListParams.Status;
}

namespace FinancingOfferListParams {
type Status =
| 'accepted'
| 'canceled'
| 'completed'
| 'delivered'
| 'expired'
| 'fully_repaid'
| 'paid_out'
| 'rejected'
| 'undelivered';
}

interface FinancingOfferMarkDeliveredParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

class FinancingOffersResource {
/**
* Get the details of the financing offer
*/
retrieve(
id: string,
params?: FinancingOfferRetrieveParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingOffer>>;
retrieve(
id: string,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingOffer>>;

/**
* Retrieves the financing offers available for Connected accounts that belong to your platform.
*/
list(
params?: FinancingOfferListParams,
options?: RequestOptions
): ApiListPromise<Stripe.Capital.FinancingOffer>;
list(
options?: RequestOptions
): ApiListPromise<Stripe.Capital.FinancingOffer>;

/**
* Acknowledges that platform has received and delivered the financing_offer to
* the intended merchant recipient. This is required to make the application
* accessible.
*/
markDelivered(
id: string,
params?: FinancingOfferMarkDeliveredParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingOffer>>;
markDelivered(
id: string,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingOffer>>;
}
}
}
}
27 changes: 27 additions & 0 deletions types/2022-08-01/Capital/FinancingSummaries.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// File generated from our OpenAPI spec

declare module 'stripe' {
namespace Stripe {
namespace Capital {
interface FinancingSummaryRetrieveParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

class FinancingSummariesResource {
/**
* Retrieve the financing state for the account that was authenticated in the request.
*/
retrieve(
params?: FinancingSummaryRetrieveParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingSummary>>;
retrieve(
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Capital.FinancingSummary>>;
}
}
}
}
Loading

0 comments on commit 3b4e525

Please sign in to comment.