Skip to content

Commit

Permalink
API Updates (#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe committed Mar 29, 2022
1 parent 11fd41a commit c026aa1
Show file tree
Hide file tree
Showing 18 changed files with 439 additions and 18 deletions.
3 changes: 3 additions & 0 deletions lib/resources.js
Expand Up @@ -93,5 +93,8 @@ module.exports = {
}),
TestHelpers: resourceNamespace('testHelpers', {
TestClocks: require('./resources/TestHelpers/TestClocks'),
Terminal: resourceNamespace('terminal', {
Readers: require('./resources/TestHelpers/Terminal/Readers'),
}),
}),
};
20 changes: 20 additions & 0 deletions lib/resources/Terminal/Readers.js
Expand Up @@ -33,4 +33,24 @@ module.exports = StripeResource.extend({
method: 'DELETE',
path: '/{reader}',
}),

cancelAction: stripeMethod({
method: 'POST',
path: '/{reader}/cancel_action',
}),

processPaymentIntent: stripeMethod({
method: 'POST',
path: '/{reader}/process_payment_intent',
}),

processSetupIntent: stripeMethod({
method: 'POST',
path: '/{reader}/process_setup_intent',
}),

setReaderDisplay: stripeMethod({
method: 'POST',
path: '/{reader}/set_reader_display',
}),
});
15 changes: 15 additions & 0 deletions lib/resources/TestHelpers/Terminal/Readers.js
@@ -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: 'test_helpers/terminal/readers',

presentPaymentMethod: stripeMethod({
method: 'POST',
path: '/{reader}/present_payment_method',
}),
});
11 changes: 11 additions & 0 deletions test/resources/Integration.spec.js
Expand Up @@ -42,3 +42,14 @@ describe('Charges Resource', () => {
});
});
});

describe('Reader Resource', () => {
describe('presentPaymentMethod', () => {
it('Sends the correct request', async () => {
const reader = await stripe.testHelpers.terminal.readers.presentPaymentMethod(
'rdr_123'
);
expect(reader).to.not.be.null;
});
});
});
23 changes: 23 additions & 0 deletions test/resources/TestHelpers/Terminal/Readers.spec.js
@@ -0,0 +1,23 @@
'use strict';

const stripe = require('../../../../testUtils').getSpyableStripe();

const expect = require('chai').expect;

describe('Terminal', () => {
describe('Readers Resource', () => {
describe('update', () => {
it('Sends the correct request', () => {
stripe.testHelpers.terminal.readers.presentPaymentMethod('rdr_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url:
'/v1/test_helpers/terminal/readers/rdr_123/present_payment_method',
headers: {},
data: {},
settings: {},
});
});
});
});
});
7 changes: 5 additions & 2 deletions types/2020-08-27/Charges.d.ts
Expand Up @@ -108,7 +108,7 @@ declare module 'stripe' {
/**
* ID of the balance transaction that describes the reversal of the balance on your account due to payment failure.
*/
failure_balance_transaction?: string | Stripe.BalanceTransaction | null;
failure_balance_transaction: string | Stripe.BalanceTransaction | null;

/**
* Error code explaining reason for charge failure if available (see [the errors section](https://stripe.com/docs/api#errors) for a list of codes).
Expand Down Expand Up @@ -2136,7 +2136,10 @@ declare module 'stripe' {
): Promise<Stripe.Response<Stripe.Charge>>;

/**
* Search for charges you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for charges you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: ChargeSearchParams,
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/Checkout/Sessions.d.ts
Expand Up @@ -1310,7 +1310,7 @@ declare module 'stripe' {
metadata?: Stripe.MetadataParam;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name: string;

Expand Down
5 changes: 4 additions & 1 deletion types/2020-08-27/Customers.d.ts
Expand Up @@ -827,7 +827,10 @@ declare module 'stripe' {
): ApiListPromise<Stripe.PaymentMethod>;

/**
* Search for customers you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for customers you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: CustomerSearchParams,
Expand Down
7 changes: 5 additions & 2 deletions types/2020-08-27/Invoices.d.ts
Expand Up @@ -620,7 +620,7 @@ declare module 'stripe' {
/**
* If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent.
*/
us_bank_account?: PaymentMethodOptions.UsBankAccount | null;
us_bank_account: PaymentMethodOptions.UsBankAccount | null;
}

namespace PaymentMethodOptions {
Expand Down Expand Up @@ -2163,7 +2163,10 @@ declare module 'stripe' {
): Promise<Stripe.Response<Stripe.Invoice>>;

/**
* Search for invoices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for invoices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: InvoiceSearchParams,
Expand Down
7 changes: 5 additions & 2 deletions types/2020-08-27/PaymentIntents.d.ts
Expand Up @@ -577,7 +577,7 @@ declare module 'stripe' {
/**
* The type of the microdeposit sent to the customer. Used to distinguish between different verification methods.
*/
microdeposit_type?: VerifyWithMicrodeposits.MicrodepositType | null;
microdeposit_type: VerifyWithMicrodeposits.MicrodepositType | null;
}

namespace VerifyWithMicrodeposits {
Expand Down Expand Up @@ -5994,7 +5994,10 @@ declare module 'stripe' {
): Promise<Stripe.Response<Stripe.PaymentIntent>>;

/**
* Search for PaymentIntents you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for PaymentIntents you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: PaymentIntentSearchParams,
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/Plans.d.ts
Expand Up @@ -297,7 +297,7 @@ declare module 'stripe' {
metadata?: Stripe.MetadataParam;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name: string;

Expand Down
7 changes: 5 additions & 2 deletions types/2020-08-27/Prices.d.ts
Expand Up @@ -323,7 +323,7 @@ declare module 'stripe' {
metadata?: Stripe.MetadataParam;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name: string;

Expand Down Expand Up @@ -619,7 +619,10 @@ declare module 'stripe' {
list(options?: RequestOptions): ApiListPromise<Stripe.Price>;

/**
* Search for prices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for prices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: PriceSearchParams,
Expand Down
11 changes: 7 additions & 4 deletions types/2020-08-27/Products.d.ts
Expand Up @@ -64,7 +64,7 @@ declare module 'stripe' {
metadata: Stripe.Metadata;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name: string;

Expand Down Expand Up @@ -157,7 +157,7 @@ declare module 'stripe' {

interface ProductCreateParams {
/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name: string;

Expand Down Expand Up @@ -320,7 +320,7 @@ declare module 'stripe' {
metadata?: Stripe.Emptyable<Stripe.MetadataParam>;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions.
* The product's name, meant to be displayable to the customer.
*/
name?: string;

Expand Down Expand Up @@ -503,7 +503,10 @@ declare module 'stripe' {
): Promise<Stripe.Response<Stripe.DeletedProduct>>;

/**
* Search for products you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for products you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: ProductSearchParams,
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/SetupIntents.d.ts
Expand Up @@ -271,7 +271,7 @@ declare module 'stripe' {
/**
* The type of the microdeposit sent to the customer. Used to distinguish between different verification methods.
*/
microdeposit_type?: VerifyWithMicrodeposits.MicrodepositType | null;
microdeposit_type: VerifyWithMicrodeposits.MicrodepositType | null;
}

namespace VerifyWithMicrodeposits {
Expand Down
7 changes: 5 additions & 2 deletions types/2020-08-27/Subscriptions.d.ts
Expand Up @@ -272,7 +272,7 @@ declare module 'stripe' {
/**
* This sub-hash contains details about the ACH direct debit payment method options to pass to invoices created by the subscription.
*/
us_bank_account?: PaymentMethodOptions.UsBankAccount | null;
us_bank_account: PaymentMethodOptions.UsBankAccount | null;
}

namespace PaymentMethodOptions {
Expand Down Expand Up @@ -1705,7 +1705,10 @@ declare module 'stripe' {
): Promise<Stripe.Response<Stripe.DeletedDiscount>>;

/**
* Search for subscriptions you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language)
* Search for subscriptions you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
* Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
* conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
* to an hour behind during outages. Search functionality is not available to merchants in India.
*/
search(
params: SubscriptionSearchParams,
Expand Down

0 comments on commit c026aa1

Please sign in to comment.