Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
tags
.nyc_output
coverage
.idea
6 changes: 6 additions & 0 deletions lib/resources/Charges.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ module.exports = StripeResource.extend({
method: 'POST',
path: '/{charge}/capture',
}),

search: stripeMethod({
method: 'GET',
path: '/search',
methodType: 'search',
}),
});
6 changes: 6 additions & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ module.exports = StripeResource.extend({
methodType: 'list',
}),

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

createBalanceTransaction: stripeMethod({
method: 'POST',
path: '/{customer}/balance_transactions',
Expand Down
6 changes: 6 additions & 0 deletions lib/resources/Invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ module.exports = StripeResource.extend({
path: '/upcoming',
}),

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

sendInvoice: stripeMethod({
method: 'POST',
path: '/{invoice}/send',
Expand Down
6 changes: 6 additions & 0 deletions lib/resources/PaymentIntents.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ module.exports = StripeResource.extend({
path: '/{intent}/confirm',
}),

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

verifyMicrodeposits: stripeMethod({
method: 'POST',
path: '/{intent}/verify_microdeposits',
Expand Down
6 changes: 6 additions & 0 deletions lib/resources/Prices.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ module.exports = StripeResource.extend({
path: '',
methodType: 'list',
}),

search: stripeMethod({
method: 'GET',
path: '/search',
methodType: 'search',
}),
});
6 changes: 6 additions & 0 deletions lib/resources/Products.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ module.exports = StripeResource.extend({
method: 'DELETE',
path: '/{id}',
}),

search: stripeMethod({
method: 'GET',
path: '/search',
methodType: 'search',
}),
});
6 changes: 6 additions & 0 deletions lib/resources/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ module.exports = StripeResource.extend({
method: 'DELETE',
path: '/{subscriptionExposedId}/discount',
}),

search: stripeMethod({
method: 'GET',
path: '/search',
methodType: 'search',
}),
});
28 changes: 28 additions & 0 deletions test/resources/Integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,31 @@ describe('Customers Resource', () => {
});
});
});

describe('Charges Resource', () => {
describe('search', () => {
it('Retrieves first page', async () => {
const result = await stripe.charges.search({query: 'currency:"USD"'});
expect(result.total_count).to.equal(1);
expect(result.data.length).to.equal(1);
expect(result.data[0]).to.not.be.null;
});
it('Retrieves all as array', async () => {
const result = await stripe.charges
.search({query: 'currency:"USD"'})
.autoPagingToArray({limit: 1000});
expect(result.length).to.equal(1);
expect(result[0]).to.not.be.null;
});
it('Retrieves all foreach', async () => {
let cnt = 0;
await stripe.charges
.search({query: 'currency:"USD"'})
.autoPagingEach((item) => {
expect(item).to.not.be.null;
cnt += 1;
});
expect(cnt).to.equal(1);
});
});
});
30 changes: 30 additions & 0 deletions types/2020-08-27/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,28 @@ declare module 'stripe' {
}
}

interface ChargeSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for charges](https://stripe.com/docs/search#query-fields-for-charges).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

class ChargesResource {
/**
* To charge a credit card or other payment source, you create a Charge object. If your API key is in test mode, the supplied payment source (e.g., card) won't actually be charged, although everything else will occur as if in live mode. (Stripe assumes that the charge would have completed successfully).
Expand Down Expand Up @@ -2112,6 +2134,14 @@ declare module 'stripe' {
id: string,
options?: RequestOptions
): 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(
params: ChargeSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.Charge>;
}
}
}
30 changes: 30 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,28 @@ declare module 'stripe' {
| 'wechat_pay';
}

interface CustomerSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for customers](https://stripe.com/docs/search#query-fields-for-customers).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

class CustomersResource {
/**
* Creates a new customer object.
Expand Down Expand Up @@ -804,6 +826,14 @@ declare module 'stripe' {
options?: RequestOptions
): 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(
params: CustomerSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.Customer>;

/**
* Creates an immutable transaction that updates the customer's credit [balance](https://stripe.com/docs/billing/customer/balance).
*/
Expand Down
30 changes: 30 additions & 0 deletions types/2020-08-27/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,28 @@ declare module 'stripe' {
| 'none';
}

interface InvoiceSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for invoices](https://stripe.com/docs/search#query-fields-for-invoices).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

interface InvoiceSendInvoiceParams {
/**
* Specifies which fields in the response should be expanded.
Expand Down Expand Up @@ -2140,6 +2162,14 @@ declare module 'stripe' {
options?: RequestOptions
): 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(
params: InvoiceSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.Invoice>;

/**
* Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
*
Expand Down
30 changes: 30 additions & 0 deletions types/2020-08-27/PaymentIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5824,6 +5824,28 @@ declare module 'stripe' {
}
}

interface PaymentIntentSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for payment intents](https://stripe.com/docs/search#query-fields-for-payment-intents).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

interface PaymentIntentVerifyMicrodepositsParams {
/**
* Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account.
Expand Down Expand Up @@ -5971,6 +5993,14 @@ declare module 'stripe' {
options?: RequestOptions
): 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(
params: PaymentIntentSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.PaymentIntent>;

/**
* Verifies microdeposits on a PaymentIntent object.
*/
Expand Down
30 changes: 30 additions & 0 deletions types/2020-08-27/Prices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,28 @@ declare module 'stripe' {
type Type = 'one_time' | 'recurring';
}

interface PriceSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for prices](https://stripe.com/docs/search#query-fields-for-prices).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

class PricesResource {
/**
* Creates a new price for an existing product. The price can be recurring or one-time.
Expand Down Expand Up @@ -595,6 +617,14 @@ declare module 'stripe' {
options?: RequestOptions
): ApiListPromise<Stripe.Price>;
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(
params: PriceSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.Price>;
}
}
}
30 changes: 30 additions & 0 deletions types/2020-08-27/Products.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,28 @@ declare module 'stripe' {

interface ProductDeleteParams {}

interface ProductSearchParams {
/**
* The search query string. See [search query language](https://stripe.com/docs/search#search-query-language) and the list of supported [query fields for products](https://stripe.com/docs/search#query-fields-for-products).
*/
query: string;

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

/**
* A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
*/
limit?: number;

/**
* A cursor for pagination across multiple pages of results. Do not include this parameter on the first call. Use the next_page value returned in a response to request subsequent results.
*/
page?: string;
}

class ProductsResource {
/**
* Creates a new product object.
Expand Down Expand Up @@ -479,6 +501,14 @@ declare module 'stripe' {
id: string,
options?: RequestOptions
): 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(
params: ProductSearchParams,
options?: RequestOptions
): ApiSearchResultPromise<Stripe.Product>;
}
}
}
Loading