UNPKG

stripe

Version:
707 lines 59.5 kB
"use strict"; // File generated from our OpenAPI spec Object.defineProperty(exports, "__esModule", { value: true }); exports.QuoteResource = void 0; const StripeResource_js_1 = require("../StripeResource.js"); class QuoteResource extends StripeResource_js_1.StripeResource { /** * Returns a list of your quotes. */ list(params, options) { return this._makeRequest('GET', '/v1/quotes', params, options, { methodType: 'list', responseSchema: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote). */ create(params, options) { return this._makeRequest('POST', '/v1/quotes', params, options, { requestSchema: { kind: 'object', fields: { line_items: { kind: 'array', element: { kind: 'object', fields: { price_data: { kind: 'object', fields: { unit_amount_decimal: { kind: 'decimal_string' } }, }, }, }, }, }, }, responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * Retrieves the quote with the given ID. */ retrieve(id, params, options) { return this._makeRequest('GET', `/v1/quotes/${id}`, params, options, { responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * A quote models prices and services for a customer. */ update(id, params, options) { return this._makeRequest('POST', `/v1/quotes/${id}`, params, options, { requestSchema: { kind: 'object', fields: { line_items: { kind: 'array', element: { kind: 'object', fields: { price_data: { kind: 'object', fields: { unit_amount_decimal: { kind: 'decimal_string' } }, }, }, }, }, }, }, responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * Accepts the specified quote. */ accept(id, params, options) { return this._makeRequest('POST', `/v1/quotes/${id}/accept`, params, options, { responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * Cancels the quote. */ cancel(id, params, options) { return this._makeRequest('POST', `/v1/quotes/${id}/cancel`, params, options, { responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * Finalizes the quote. */ finalizeQuote(id, params, options) { return this._makeRequest('POST', `/v1/quotes/${id}/finalize`, params, options, { responseSchema: { kind: 'object', fields: { computed: { kind: 'object', fields: { upfront: { kind: 'object', fields: { line_items: { kind: 'object', fields: { data: { kind: 'array', element: { kind: 'object', fields: { price: { kind: 'nullable', inner: { kind: 'object', fields: { currency_options: { kind: 'array', element: { kind: 'object', fields: { tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string', }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, tiers: { kind: 'array', element: { kind: 'object', fields: { flat_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, unit_amount_decimal: { kind: 'nullable', inner: { kind: 'decimal_string' }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }); } /** * Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf) */ pdf(id, params, options) { return this