Skip to content

Commit

Permalink
Codegen for openapi 1707cb8
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Mar 1, 2022
1 parent 826d7a2 commit b8931e7
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,7 @@ module.exports = {
Locations: require('./resources/Terminal/Locations'),
Readers: require('./resources/Terminal/Readers'),
}),
TestHelpers: resourceNamespace('testHelpers', {
TestClocks: require('./resources/TestHelpers/TestClocks'),
}),
};
36 changes: 36 additions & 0 deletions lib/resources/TestHelpers/TestClocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'test_helpers/test_clocks',

create: stripeMethod({
method: 'POST',
path: '',
}),

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

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

del: stripeMethod({
method: 'DELETE',
path: '/{testClock}',
}),

advance: stripeMethod({
method: 'POST',
path: '/{testClock}/advance',
}),
});
32 changes: 32 additions & 0 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2043,3 +2043,35 @@ describe('PaymentLink', function() {
expect(paymentLink).not.to.be.null;
});
});

describe('TestHelpers.TestClock', function() {
it('create method', async function() {
const testClock = await stripe.testHelpers.testClocks.create({
frozen_time: 123,
name: 'cogsworth',
});
expect(testClock).not.to.be.null;
});

it('retrieve method', async function() {
const testClock = await stripe.testHelpers.testClocks.retrieve('clock_xyz');
expect(testClock).not.to.be.null;
});

it('list method', async function() {
const testClocks = await stripe.testHelpers.testClocks.list();
expect(testClocks).not.to.be.null;
});

it('del method', async function() {
const deleted = await stripe.testHelpers.testClocks.del('clock_xyz');
expect(deleted).not.to.be.null;
});

it('advance method', async function() {
const testClock = await stripe.testHelpers.testClocks.advance('clock_xyz', {
frozen_time: 142,
});
expect(testClock).not.to.be.null;
});
});
10 changes: 10 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ declare module 'stripe' {
* The customer's tax IDs.
*/
tax_ids?: ApiList<Stripe.TaxId>;

/**
* ID of the test clock this customer belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;
}

namespace Customer {
Expand Down Expand Up @@ -352,6 +357,11 @@ declare module 'stripe' {
* The customer's tax IDs.
*/
tax_id_data?: Array<CustomerCreateParams.TaxIdDatum>;

/**
* ID of the test clock to attach to the customer.
*/
test_clock?: string;
}

namespace CustomerCreateParams {
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/InvoiceItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ declare module 'stripe' {
*/
tax_rates: Array<Stripe.TaxRate> | null;

/**
* ID of the test clock this invoice item belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;

/**
* Unit amount (in the `currency` specified) of the invoice item.
*/
Expand Down
15 changes: 15 additions & 0 deletions types/2020-08-27/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ declare module 'stripe' {
*/
tax: number | null;

/**
* ID of the test clock this invoice belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;

threshold_reason?: Invoice.ThresholdReason;

/**
Expand Down Expand Up @@ -894,6 +899,11 @@ declare module 'stripe' {
*/
payment_settings?: InvoiceCreateParams.PaymentSettings;

/**
* How to handle pending invoice items on invoice creation. One of `include`, `include_and_require`, or `exclude`. `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. `include_and_require` will include any pending invoice items, if no pending invoice items exist then the request will fail. `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to `include_and_require` if the parameter is omitted.
*/
pending_invoice_items_behavior?: InvoiceCreateParams.PendingInvoiceItemsBehavior;

/**
* Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`.
*/
Expand Down Expand Up @@ -1054,6 +1064,11 @@ declare module 'stripe' {
| 'wechat_pay';
}

type PendingInvoiceItemsBehavior =
| 'exclude'
| 'include'
| 'include_and_require';

interface TransferData {
/**
* The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred.
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/Products.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ declare module 'stripe' {
/**
* A URL of a publicly-accessible webpage for this product.
*/
url?: string;
url?: Stripe.Emptyable<string>;
}

namespace ProductUpdateParams {
Expand Down
10 changes: 10 additions & 0 deletions types/2020-08-27/Quotes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ declare module 'stripe' {
*/
subscription_schedule: string | Stripe.SubscriptionSchedule | null;

/**
* ID of the test clock this quote belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;

total_details: Quote.TotalDetails;

/**
Expand Down Expand Up @@ -590,6 +595,11 @@ declare module 'stripe' {
*/
subscription_data?: QuoteCreateParams.SubscriptionData;

/**
* ID of the test clock to attach to the quote.
*/
test_clock?: string;

/**
* The data with which to automatically create a Transfer for each of the invoices.
*/
Expand Down
39 changes: 39 additions & 0 deletions types/2020-08-27/Refunds.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ declare module 'stripe' {
*/
metadata: Stripe.Metadata | null;

next_action?: Refund.NextAction;

/**
* ID of the PaymentIntent that was refunded.
*/
Expand Down Expand Up @@ -93,6 +95,43 @@ declare module 'stripe' {
}

namespace Refund {
interface NextAction {
/**
* Contains the refund details.
*/
display_details: NextAction.DisplayDetails | null;

/**
* Type of the next action to perform.
*/
type: string;
}

namespace NextAction {
interface DisplayDetails {
email_sent: DisplayDetails.EmailSent;

/**
* The expiry timestamp.
*/
expires_at: number;
}

namespace DisplayDetails {
interface EmailSent {
/**
* The timestamp when the email was sent.
*/
email_sent_at: number;

/**
* The recipient's email address.
*/
email_sent_to: string;
}
}
}

type Reason =
| 'duplicate'
| 'expired_uncaptured_charge'
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/SubscriptionSchedules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ declare module 'stripe' {
* ID of the subscription managed by the subscription schedule.
*/
subscription: string | Stripe.Subscription | null;

/**
* ID of the test clock this subscription schedule belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;
}

namespace SubscriptionSchedule {
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/Subscriptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ declare module 'stripe' {
*/
status: Subscription.Status;

/**
* ID of the test clock this subscription belongs to.
*/
test_clock?: string | Stripe.TestHelpers.TestClock | null;

/**
* The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
*/
Expand Down
18 changes: 15 additions & 3 deletions types/2020-08-27/Terminal/Locations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,19 @@ declare module 'stripe' {
id: string,
params?: LocationRetrieveParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Terminal.Location>>;
): Promise<
Stripe.Response<
Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
>
>;
retrieve(
id: string,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Terminal.Location>>;
): Promise<
Stripe.Response<
Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
>
>;

/**
* Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Expand All @@ -187,7 +195,11 @@ declare module 'stripe' {
id: string,
params?: LocationUpdateParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Terminal.Location>>;
): Promise<
Stripe.Response<
Stripe.Terminal.Location | Stripe.Terminal.DeletedLocation
>
>;

/**
* Returns a list of Location objects.
Expand Down
Loading

0 comments on commit b8931e7

Please sign in to comment.