Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1396

Merged
merged 1 commit into from
Apr 18, 2022
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 lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ module.exports = {
ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'),
}),
Terminal: resourceNamespace('terminal', {
Configurations: require('./resources/Terminal/Configurations'),
ConnectionTokens: require('./resources/Terminal/ConnectionTokens'),
Locations: require('./resources/Terminal/Locations'),
Readers: require('./resources/Terminal/Readers'),
Expand Down
5 changes: 5 additions & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ module.exports = StripeResource.extend({
path: '/{customer}',
}),

createFundingInstructions: stripeMethod({
method: 'POST',
path: '/{customer}/funding_instructions',
}),

deleteDiscount: stripeMethod({
method: 'DELETE',
path: '/{customer}/discount',
Expand Down
36 changes: 36 additions & 0 deletions lib/resources/Terminal/Configurations.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: 'terminal/configurations',

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

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

update: stripeMethod({
method: 'POST',
path: '/{configuration}',
}),

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

del: stripeMethod({
method: 'DELETE',
path: '/{configuration}',
}),
});
47 changes: 47 additions & 0 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ describe('Customer', function() {
);
expect(paymentMethods).not.to.be.null;
});

it('createFundingInstructions method', async function() {
const fundingInstructions = await stripe.customers.createFundingInstructions(
'cus_123',
{
bank_transfer: {
requested_address_types: ['zengin'],
type: 'jp_bank_transfer',
},
currency: 'usd',
funding_type: 'bank_transfer',
}
);
expect(fundingInstructions).not.to.be.null;
});
});

describe('BalanceTransaction', function() {
Expand Down Expand Up @@ -2075,3 +2090,35 @@ describe('TestHelpers.TestClock', function() {
expect(testClock).not.to.be.null;
});
});

describe('Terminal.Configuration', function() {
it('list method', async function() {
const configurations = await stripe.terminal.configurations.list();
expect(configurations).not.to.be.null;
});

it('retrieve method', async function() {
const configuration = await stripe.terminal.configurations.retrieve(
'uc_123'
);
expect(configuration).not.to.be.null;
});

it('create method', async function() {
const configuration = await stripe.terminal.configurations.create();
expect(configuration).not.to.be.null;
});

it('update method', async function() {
const configuration = await stripe.terminal.configurations.update(
'uc_123',
{tipping: {usd: {fixed_amounts: [10]}}}
);
expect(configuration).not.to.be.null;
});

it('del method', async function() {
const deleted = await stripe.terminal.configurations.del('uc_123');
expect(deleted).not.to.be.null;
});
});
6 changes: 5 additions & 1 deletion types/2020-08-27/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ declare module 'stripe' {

card_present?: PaymentMethodDetails.CardPresent;

customer_balance?: PaymentMethodDetails.CustomerBalance;

eps?: PaymentMethodDetails.Eps;

fpx?: PaymentMethodDetails.Fpx;
Expand Down Expand Up @@ -1007,7 +1009,7 @@ declare module 'stripe' {
iin?: string | null;

/**
* Whether this [PaymentIntent](https://stripe.com/docs/api/payment_intents) is eligible for incremental authorizations. Request support using [request_incremental_authorization_support] /docs/api/payment_intents/create#create_payment_intent-payment_method_options-card_present-request_incremental_authorization_support.
* Whether this [PaymentIntent](https://stripe.com/docs/api/payment_intents) is eligible for incremental authorizations. Request support using [request_incremental_authorization_support](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_options-card_present-request_incremental_authorization_support).
*/
incremental_authorization_supported: boolean | null;

Expand Down Expand Up @@ -1102,6 +1104,8 @@ declare module 'stripe' {
}
}

interface CustomerBalance {}

interface Eps {
/**
* The customer's bank. Should be one of `arzte_und_apotheker_bank`, `austrian_anadi_bank_ag`, `bank_austria`, `bankhaus_carl_spangler`, `bankhaus_schelhammer_und_schattera_ag`, `bawag_psk_ag`, `bks_bank_ag`, `brull_kallmus_bank_ag`, `btv_vier_lander_bank`, `capital_bank_grawe_gruppe_ag`, `dolomitenbank`, `easybank_ag`, `erste_bank_und_sparkassen`, `hypo_alpeadriabank_international_ag`, `hypo_noe_lb_fur_niederosterreich_u_wien`, `hypo_oberosterreich_salzburg_steiermark`, `hypo_tirol_bank_ag`, `hypo_vorarlberg_bank_ag`, `hypo_bank_burgenland_aktiengesellschaft`, `marchfelder_bank`, `oberbank_ag`, `raiffeisen_bankengruppe_osterreich`, `schoellerbank_ag`, `sparda_bank_wien`, `volksbank_gruppe`, `volkskreditbank_ag`, or `vr_bank_braunau`.
Expand Down
116 changes: 116 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ declare module 'stripe' {
*/
balance?: number;

/**
* Balance information and default balance settings for this customer.
*/
cash_balance?: CustomerCreateParams.CashBalance;

coupon?: string;

/**
Expand Down Expand Up @@ -365,6 +370,34 @@ declare module 'stripe' {
}

namespace CustomerCreateParams {
interface CashBalance {
/**
* Settings controlling the behavior of the customer's cash balance,
* such as reconciliation of funds received.
*/
settings?: CashBalance.Settings;
}

namespace CashBalance {
interface Settings {
/**
* Method for using the customer balance to pay outstanding
* `customer_balance` PaymentIntents. If set to `automatic`, all available
* funds will automatically be used to pay any outstanding PaymentIntent.
* If set to `manual`, only customer balance funds from bank transfers
* with a reference code matching
* `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will
* automatically be used to pay the corresponding outstanding
* PaymentIntent.
*/
reconciliation_mode?: Settings.ReconciliationMode;
}

namespace Settings {
type ReconciliationMode = 'automatic' | 'manual';
}
}

interface InvoiceSettings {
/**
* Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
Expand Down Expand Up @@ -508,6 +541,11 @@ declare module 'stripe' {
*/
balance?: number;

/**
* Balance information and default balance settings for this customer.
*/
cash_balance?: CustomerUpdateParams.CashBalance;

coupon?: string;

/**
Expand Down Expand Up @@ -598,6 +636,34 @@ declare module 'stripe' {
}

namespace CustomerUpdateParams {
interface CashBalance {
/**
* Settings controlling the behavior of the customer's cash balance,
* such as reconciliation of funds received.
*/
settings?: CashBalance.Settings;
}

namespace CashBalance {
interface Settings {
/**
* Method for using the customer balance to pay outstanding
* `customer_balance` PaymentIntents. If set to `automatic`, all available
* funds will automatically be used to pay any outstanding PaymentIntent.
* If set to `manual`, only customer balance funds from bank transfers
* with a reference code matching
* `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will
* automatically be used to pay the corresponding outstanding
* PaymentIntent.
*/
reconciliation_mode?: Settings.ReconciliationMode;
}

namespace Settings {
type ReconciliationMode = 'automatic' | 'manual';
}
}

interface InvoiceSettings {
/**
* Default custom fields to be displayed on invoices for this customer. When updating, pass an empty string to remove previously-defined fields.
Expand Down Expand Up @@ -683,6 +749,44 @@ declare module 'stripe' {

interface CustomerDeleteParams {}

interface CustomerCreateFundingInstructionsParams {
/**
* Additional parameters for `bank_transfer` funding types
*/
bank_transfer: CustomerCreateFundingInstructionsParams.BankTransfer;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string;

/**
* The `funding_type` to get the instructions for.
*/
funding_type: 'bank_transfer';

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

namespace CustomerCreateFundingInstructionsParams {
interface BankTransfer {
/**
* List of address types that should be returned in the financial_addresses response. If not specified, all valid types will be returned.
*
* Permitted values include: `zengin`.
*/
requested_address_types?: Array<'zengin'>;

/**
* The type of the `bank_transfer`
*/
type: 'jp_bank_transfer';
}
}

interface CustomerDeleteDiscountParams {}

interface CustomerListPaymentMethodsParams extends PaginationParams {
Expand All @@ -708,6 +812,7 @@ declare module 'stripe' {
| 'boleto'
| 'card'
| 'card_present'
| 'customer_balance'
| 'eps'
| 'fpx'
| 'giropay'
Expand Down Expand Up @@ -804,6 +909,17 @@ declare module 'stripe' {
options?: RequestOptions
): Promise<Stripe.Response<Stripe.DeletedCustomer>>;

/**
* Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
* funding instructions will be created. If funding instructions have already been created for a given customer, the same
* funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
*/
createFundingInstructions(
id: string,
params: CustomerCreateFundingInstructionsParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.FundingInstructions>>;

/**
* Removes the currently applied discount on a customer.
*/
Expand Down
80 changes: 80 additions & 0 deletions types/2020-08-27/FundingInstructions.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// File generated from our OpenAPI spec

declare module 'stripe' {
namespace Stripe {
/**
* The FundingInstructions object.
*/
interface FundingInstructions {
/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: 'funding_instructions';

bank_transfer: FundingInstructions.BankTransfer;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string;

/**
* The `funding_type` of the returned instructions
*/
funding_type: 'bank_transfer';

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

namespace FundingInstructions {
interface BankTransfer {
/**
* The country of the bank account to fund
*/
country: string;

/**
* A list of financial addresses that can be used to fund a particular balance
*/
financial_addresses: Array<BankTransfer.FinancialAddress>;

/**
* The bank_transfer type
*/
type: BankTransfer.Type;
}

namespace BankTransfer {
interface FinancialAddress {
/**
* The payment networks supported by this FinancialAddress
*/
supported_networks?: Array<FinancialAddress.SupportedNetwork>;

/**
* The type of financial address
*/
type: FinancialAddress.Type;

/**
* Zengin Records contain Japan bank account details per the Zengin format.
*/
zengin?: FinancialAddress.Zengin;
}

namespace FinancialAddress {
type SupportedNetwork = 'sepa' | 'zengin';

type Type = 'iban' | 'zengin';

interface Zengin {}
}

type Type = 'eu_bank_transfer' | 'jp_bank_transfer';
}
}
}
}
Loading