diff --git a/.stats.yml b/.stats.yml index 34095f9c..953d452f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 141 +configured_endpoints: 146 diff --git a/api.md b/api.md index 50de341b..2df55f9c 100644 --- a/api.md +++ b/api.md @@ -307,6 +307,7 @@ Types: Methods: - client.ledgerEntries.retrieve(id, { ...params }) -> LedgerEntry +- client.ledgerEntries.update(id, { ...params }) -> LedgerEntry - client.ledgerEntries.list({ ...params }) -> LedgerEntriesPage # LedgerEventHandlers @@ -512,3 +513,16 @@ Methods: - client.bulkResults.retrieve(id) -> BulkResult - client.bulkResults.list({ ...params }) -> BulkResultsPage + +# LedgerAccountSettlements + +Types: + +- LedgerAccountSettlement + +Methods: + +- client.ledgerAccountSettlements.create({ ...params }) -> LedgerAccountSettlement +- client.ledgerAccountSettlements.retrieve(id) -> LedgerAccountSettlement +- client.ledgerAccountSettlements.update(id, { ...params }) -> LedgerAccountSettlement +- client.ledgerAccountSettlements.list({ ...params }) -> LedgerAccountSettlementsPage diff --git a/src/index.ts b/src/index.ts index f0178ec5..67f29484 100644 --- a/src/index.ts +++ b/src/index.ts @@ -179,6 +179,7 @@ export class ModernTreasury extends Core.APIClient { virtualAccounts: API.VirtualAccounts = new API.VirtualAccounts(this); bulkRequests: API.BulkRequests = new API.BulkRequests(this); bulkResults: API.BulkResults = new API.BulkResults(this); + ledgerAccountSettlements: API.LedgerAccountSettlements = new API.LedgerAccountSettlements(this); /** * A test endpoint often used to confirm credentials and headers are being passed @@ -391,6 +392,7 @@ export namespace ModernTreasury { export import LedgerEntry = API.LedgerEntry; export import LedgerEntriesPage = API.LedgerEntriesPage; export import LedgerEntryRetrieveParams = API.LedgerEntryRetrieveParams; + export import LedgerEntryUpdateParams = API.LedgerEntryUpdateParams; export import LedgerEntryListParams = API.LedgerEntryListParams; export import LedgerEventHandlers = API.LedgerEventHandlers; @@ -478,6 +480,13 @@ export namespace ModernTreasury { export import BulkResultsPage = API.BulkResultsPage; export import BulkResultListParams = API.BulkResultListParams; + export import LedgerAccountSettlements = API.LedgerAccountSettlements; + export import LedgerAccountSettlement = API.LedgerAccountSettlement; + export import LedgerAccountSettlementsPage = API.LedgerAccountSettlementsPage; + export import LedgerAccountSettlementCreateParams = API.LedgerAccountSettlementCreateParams; + export import LedgerAccountSettlementUpdateParams = API.LedgerAccountSettlementUpdateParams; + export import LedgerAccountSettlementListParams = API.LedgerAccountSettlementListParams; + export import AccountsType = API.AccountsType; export import AsyncResponse = API.AsyncResponse; export import Currency = API.Currency; diff --git a/src/resources/account-details.ts b/src/resources/account-details.ts index 1764585f..302c7bac 100644 --- a/src/resources/account-details.ts +++ b/src/resources/account-details.ts @@ -102,7 +102,7 @@ export interface AccountDetail { * One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank * account number is in a generic format. */ - account_number_type: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address'; + account_number_type: 'clabe' | 'hk_number' | 'iban' | 'other' | 'pan' | 'wallet_address'; created_at: string; @@ -134,7 +134,7 @@ export interface AccountDetailCreateParams { * One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank * account number is in a generic format. */ - account_number_type?: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address'; + account_number_type?: 'clabe' | 'hk_number' | 'iban' | 'other' | 'pan' | 'wallet_address'; } export interface AccountDetailListParams extends PageParams {} diff --git a/src/resources/bulk-requests.ts b/src/resources/bulk-requests.ts index 5d8168c6..5df3972a 100644 --- a/src/resources/bulk-requests.ts +++ b/src/resources/bulk-requests.ts @@ -602,7 +602,7 @@ export namespace BulkRequestCreateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -712,10 +712,12 @@ export namespace BulkRequestCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -733,9 +735,11 @@ export namespace BulkRequestCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -745,6 +749,7 @@ export namespace BulkRequestCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -1336,7 +1341,7 @@ export namespace BulkRequestCreateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -1446,10 +1451,12 @@ export namespace BulkRequestCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -1467,9 +1474,11 @@ export namespace BulkRequestCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1479,6 +1488,7 @@ export namespace BulkRequestCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } diff --git a/src/resources/counterparties.ts b/src/resources/counterparties.ts index 44e4b66f..de749da1 100644 --- a/src/resources/counterparties.ts +++ b/src/resources/counterparties.ts @@ -430,7 +430,7 @@ export namespace CounterpartyCreateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -540,10 +540,12 @@ export namespace CounterpartyCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -561,9 +563,11 @@ export namespace CounterpartyCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -573,6 +577,7 @@ export namespace CounterpartyCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -686,6 +691,10 @@ export interface CounterpartyCollectAccountParams { | 'jp_zengin_code' | 'se_bankgiro_clearing_code' | 'nz_national_clearing_code' + | 'hk_interbank_clearing_code' + | 'hu_interbank_clearing_code' + | 'dk_interbank_clearing_code' + | 'id_sknbi_code' >; /** diff --git a/src/resources/expected-payments.ts b/src/resources/expected-payments.ts index 1dd7fa43..3c2ea967 100644 --- a/src/resources/expected-payments.ts +++ b/src/resources/expected-payments.ts @@ -235,9 +235,11 @@ export type ExpectedPaymentType = | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -247,6 +249,7 @@ export type ExpectedPaymentType = | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin' | null; @@ -520,9 +523,11 @@ export interface ExpectedPaymentListParams extends PageParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -532,6 +537,7 @@ export interface ExpectedPaymentListParams extends PageParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } diff --git a/src/resources/external-accounts.ts b/src/resources/external-accounts.ts index d525c403..9207dec5 100644 --- a/src/resources/external-accounts.ts +++ b/src/resources/external-accounts.ts @@ -350,7 +350,7 @@ export namespace ExternalAccountCreateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -460,10 +460,12 @@ export namespace ExternalAccountCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -481,9 +483,11 @@ export namespace ExternalAccountCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -493,6 +497,7 @@ export namespace ExternalAccountCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -603,9 +608,11 @@ export interface ExternalAccountVerifyParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -615,6 +622,7 @@ export interface ExternalAccountVerifyParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; diff --git a/src/resources/incoming-payment-details.ts b/src/resources/incoming-payment-details.ts index 0edc99ce..92e557c8 100644 --- a/src/resources/incoming-payment-details.ts +++ b/src/resources/incoming-payment-details.ts @@ -155,7 +155,7 @@ export interface IncomingPaymentDetail { /** * The type of the originating account number for the incoming payment detail. */ - originating_account_number_type: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address' | null; + originating_account_number_type: 'clabe' | 'hk_number' | 'iban' | 'other' | 'pan' | 'wallet_address' | null; /** * The routing number of the originating account for the incoming payment detail. @@ -176,10 +176,12 @@ export interface IncomingPaymentDetail { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift' | null; diff --git a/src/resources/index.ts b/src/resources/index.ts index a0b990d7..44283c01 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -123,6 +123,14 @@ export { LedgerAccountPayoutsPage, LedgerAccountPayouts, } from './ledger-account-payouts'; +export { + LedgerAccountSettlement, + LedgerAccountSettlementCreateParams, + LedgerAccountSettlementUpdateParams, + LedgerAccountSettlementListParams, + LedgerAccountSettlementsPage, + LedgerAccountSettlements, +} from './ledger-account-settlements'; export { LedgerAccountStatementCreateResponse, LedgerAccountStatementRetrieveResponse, @@ -132,6 +140,7 @@ export { export { LedgerEntry, LedgerEntryRetrieveParams, + LedgerEntryUpdateParams, LedgerEntryListParams, LedgerEntriesPage, LedgerEntries, diff --git a/src/resources/internal-accounts/internal-accounts.ts b/src/resources/internal-accounts/internal-accounts.ts index b4bba779..716fdeb3 100644 --- a/src/resources/internal-accounts/internal-accounts.ts +++ b/src/resources/internal-accounts/internal-accounts.ts @@ -354,9 +354,11 @@ export interface InternalAccountListParams extends PageParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -366,6 +368,7 @@ export interface InternalAccountListParams extends PageParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } diff --git a/src/resources/invoices/invoices.ts b/src/resources/invoices/invoices.ts index ad81ef17..ab37b054 100644 --- a/src/resources/invoices/invoices.ts +++ b/src/resources/invoices/invoices.ts @@ -139,6 +139,12 @@ export interface Invoice { */ expected_payments: Array; + /** + * When payment_method is automatic, the fallback payment method to use when an + * automatic payment fails. One of `manual` or `ui`. + */ + fallback_payment_method: string | null; + /** * The URL of the hosted web UI where the invoice can be viewed. */ @@ -155,6 +161,12 @@ export interface Invoice { */ live_mode: boolean; + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + metadata: Record; + /** * Emails in addition to the counterparty email to send invoice status * notifications to. At least one email is required if notifications are enabled @@ -402,6 +414,12 @@ export interface InvoiceCreateParams { */ description?: string; + /** + * When payment_method is automatic, the fallback payment method to use when an + * automatic payment fails. One of `manual` or `ui`. + */ + fallback_payment_method?: string | null; + /** * The invoice issuer's business address. */ @@ -456,9 +474,11 @@ export interface InvoiceCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -468,6 +488,7 @@ export interface InvoiceCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; @@ -641,6 +662,12 @@ export interface InvoiceUpdateParams { */ due_date?: string; + /** + * When payment_method is automatic, the fallback payment method to use when an + * automatic payment fails. One of `manual` or `ui`. + */ + fallback_payment_method?: string | null; + /** * The invoice issuer's business address. */ @@ -700,9 +727,11 @@ export interface InvoiceUpdateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -712,6 +741,7 @@ export interface InvoiceUpdateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; diff --git a/src/resources/ledger-account-settlements.ts b/src/resources/ledger-account-settlements.ts new file mode 100644 index 00000000..ab13e0a2 --- /dev/null +++ b/src/resources/ledger-account-settlements.ts @@ -0,0 +1,261 @@ +// File generated from our OpenAPI spec by Stainless. + +import * as Core from 'modern-treasury/core'; +import { APIResource } from 'modern-treasury/resource'; +import { isRequestOptions } from 'modern-treasury/core'; +import * as LedgerAccountSettlementsAPI from 'modern-treasury/resources/ledger-account-settlements'; +import { Page, type PageParams } from 'modern-treasury/pagination'; + +export class LedgerAccountSettlements extends APIResource { + /** + * Create a ledger account settlement. + */ + create( + params: LedgerAccountSettlementCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + // @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat + const { 'Idempotency-Key': idempotencyKey, ...body } = params; + if (idempotencyKey) { + console.warn( + "The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead", + ); + } + return this._client.post('/api/ledger_account_settlements', { + body, + ...options, + headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers }, + }); + } + + /** + * Get details on a single ledger account settlement. + */ + retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/api/ledger_account_settlements/${id}`, options); + } + + /** + * Update the details of a ledger account settlement. + */ + update( + id: string, + body?: LedgerAccountSettlementUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + update(id: string, options?: Core.RequestOptions): Core.APIPromise; + update( + id: string, + body: LedgerAccountSettlementUpdateParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(body)) { + return this.update(id, {}, body); + } + return this._client.patch(`/api/ledger_account_settlements/${id}`, { body, ...options }); + } + + /** + * Get a list of ledger account settlements. + */ + list( + query?: LedgerAccountSettlementListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + query: LedgerAccountSettlementListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/api/ledger_account_settlements', LedgerAccountSettlementsPage, { + query, + ...options, + }); + } +} + +export class LedgerAccountSettlementsPage extends Page {} + +export interface LedgerAccountSettlement { + id: string; + + /** + * The amount of the ledger account settlement. + */ + amount: number | null; + + /** + * The id of the contra ledger account that sends to or receives funds from the + * settled ledger account. + */ + contra_ledger_account_id: string; + + created_at: string; + + /** + * The currency of the ledger account settlement. + */ + currency: string; + + /** + * The currency exponent of the ledger account settlement. + */ + currency_exponent: number | null; + + /** + * The description of the ledger account settlement. + */ + description: string | null; + + /** + * The exclusive upper bound of the effective_at timestamp of the ledger entries to + * be included in the ledger account settlement. The default value is the + * created_at timestamp of the ledger account settlement. + */ + effective_at_upper_bound: string; + + /** + * The id of the ledger that this ledger account settlement belongs to. + */ + ledger_id: string; + + /** + * The id of the ledger transaction that this settlement is associated with. + */ + ledger_transaction_id: string | null; + + /** + * This field will be true if this object exists in the live environment or false + * if it exists in the test environment. + */ + live_mode: boolean; + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + metadata: Record; + + object: string; + + /** + * The id of the settled ledger account whose ledger entries are queried against, + * and its balance is reduced as a result. + */ + settled_ledger_account_id: string; + + /** + * The direction of the ledger entry with the settlement_ledger_account. + */ + settlement_entry_direction: string | null; + + /** + * The status of the ledger account settlement. One of `processing`, `pending`, + * `posted`, `archiving` or `archived`. + */ + status: 'archived' | 'archiving' | 'pending' | 'posted' | 'processing' | 'reversed' | 'reversing'; + + updated_at: string; +} + +export interface LedgerAccountSettlementCreateParams { + /** + * The id of the contra ledger account that sends to or receives funds from the + * settled ledger account. + */ + contra_ledger_account_id: string; + + /** + * The id of the settled ledger account whose ledger entries are queried against, + * and its balance is reduced as a result. + */ + settled_ledger_account_id: string; + + /** + * If true, the settlement amount and settlement_entry_direction will bring the + * settlement ledger account's balance closer to zero, even if the balance is + * negative. + */ + allow_either_direction?: boolean | null; + + /** + * The description of the ledger account settlement. + */ + description?: string | null; + + /** + * The exclusive upper bound of the effective_at timestamp of the ledger entries to + * be included in the ledger account settlement. The default value is the + * created_at timestamp of the ledger account settlement. + */ + effective_at_upper_bound?: string | null; + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + metadata?: Record; + + /** + * It is set to `false` by default. It should be set to `true` when migrating + * existing settlements. + */ + skip_settlement_ledger_transaction?: boolean | null; + + /** + * The status of the ledger account settlement. It is set to `pending` by default. + * To post a ledger account settlement at creation, use `posted`. + */ + status?: 'pending' | 'posted' | null; +} + +export interface LedgerAccountSettlementUpdateParams { + /** + * The description of the ledger account settlement. + */ + description?: string | null; + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + metadata?: Record; + + /** + * To post a pending ledger account settlement, use `posted`. To archive a pending + * ledger transaction, use `archived`. + */ + status?: 'posted' | 'archived'; +} + +export interface LedgerAccountSettlementListParams extends PageParams { + /** + * If you have specific IDs to retrieve in bulk, you can pass them as query + * parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`. + */ + id?: Array; + + /** + * For example, if you want to query for records with metadata key `Type` and value + * `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query + * parameters. + */ + metadata?: Record; + + settled_ledger_account_id?: string; + + settlement_entry_direction?: string; +} + +export namespace LedgerAccountSettlements { + export import LedgerAccountSettlement = LedgerAccountSettlementsAPI.LedgerAccountSettlement; + export import LedgerAccountSettlementsPage = LedgerAccountSettlementsAPI.LedgerAccountSettlementsPage; + export import LedgerAccountSettlementCreateParams = LedgerAccountSettlementsAPI.LedgerAccountSettlementCreateParams; + export import LedgerAccountSettlementUpdateParams = LedgerAccountSettlementsAPI.LedgerAccountSettlementUpdateParams; + export import LedgerAccountSettlementListParams = LedgerAccountSettlementsAPI.LedgerAccountSettlementListParams; +} diff --git a/src/resources/ledger-entries.ts b/src/resources/ledger-entries.ts index 1ede9e81..bdf0d50b 100644 --- a/src/resources/ledger-entries.ts +++ b/src/resources/ledger-entries.ts @@ -28,6 +28,26 @@ export class LedgerEntries extends APIResource { return this._client.get(`/api/ledger_entries/${id}`, { query, ...options }); } + /** + * Update the details of a ledger entry. + */ + update( + id: string, + body?: LedgerEntryUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + update(id: string, options?: Core.RequestOptions): Core.APIPromise; + update( + id: string, + body: LedgerEntryUpdateParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(body)) { + return this.update(id, {}, body); + } + return this._client.patch(`/api/ledger_entries/${id}`, { body, ...options }); + } + /** * Get a list of all ledger entries. */ @@ -239,6 +259,14 @@ export interface LedgerEntryRetrieveParams { show_balances?: boolean; } +export interface LedgerEntryUpdateParams { + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + metadata?: Record; +} + export interface LedgerEntryListParams extends PageParams { /** * If you have specific IDs to retrieve in bulk, you can pass them as query @@ -289,6 +317,8 @@ export interface LedgerEntryListParams extends PageParams { ledger_account_payout_id?: string; + ledger_account_settlement_id?: string; + /** * Get all ledger entries that are included in the ledger account statement. */ @@ -354,5 +384,6 @@ export namespace LedgerEntries { export import LedgerEntry = LedgerEntriesAPI.LedgerEntry; export import LedgerEntriesPage = LedgerEntriesAPI.LedgerEntriesPage; export import LedgerEntryRetrieveParams = LedgerEntriesAPI.LedgerEntryRetrieveParams; + export import LedgerEntryUpdateParams = LedgerEntriesAPI.LedgerEntryUpdateParams; export import LedgerEntryListParams = LedgerEntriesAPI.LedgerEntryListParams; } diff --git a/src/resources/ledger-transactions/ledger-transactions.ts b/src/resources/ledger-transactions/ledger-transactions.ts index fe87cc05..64314aee 100644 --- a/src/resources/ledger-transactions/ledger-transactions.ts +++ b/src/resources/ledger-transactions/ledger-transactions.ts @@ -446,6 +446,8 @@ export interface LedgerTransactionListParams extends PageParams { ledger_account_payout_id?: string; + ledger_account_settlement_id?: string; + ledger_id?: string; ledgerable_id?: string; diff --git a/src/resources/payment-orders/payment-orders.ts b/src/resources/payment-orders/payment-orders.ts index 266c1baf..982a8e4a 100644 --- a/src/resources/payment-orders/payment-orders.ts +++ b/src/resources/payment-orders/payment-orders.ts @@ -513,9 +513,11 @@ export type PaymentOrderType = | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -525,6 +527,7 @@ export type PaymentOrderType = | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; @@ -1021,7 +1024,7 @@ export namespace PaymentOrderCreateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -1131,10 +1134,12 @@ export namespace PaymentOrderCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -1152,9 +1157,11 @@ export namespace PaymentOrderCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1164,6 +1171,7 @@ export namespace PaymentOrderCreateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -1504,7 +1512,7 @@ export namespace PaymentOrderUpdateParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -1614,10 +1622,12 @@ export namespace PaymentOrderUpdateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -1635,9 +1645,11 @@ export namespace PaymentOrderUpdateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1647,6 +1659,7 @@ export namespace PaymentOrderUpdateParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -1656,6 +1669,16 @@ export namespace PaymentOrderUpdateParams { export interface PaymentOrderListParams extends PageParams { counterparty_id?: string; + /** + * An inclusive upper bound for searching created_at + */ + created_at_end?: string; + + /** + * An inclusive lower bound for searching created_at + */ + created_at_start?: string; + direction?: Shared.TransactionDirection; /** @@ -1721,9 +1744,11 @@ export interface PaymentOrderListParams extends PageParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -1733,6 +1758,7 @@ export interface PaymentOrderListParams extends PageParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } @@ -2196,7 +2222,7 @@ export namespace PaymentOrderCreateAsyncParams { export interface AccountDetail { account_number: string; - account_number_type?: 'iban' | 'clabe' | 'wallet_address' | 'pan' | 'other'; + account_number_type?: 'iban' | 'hk_number' | 'clabe' | 'wallet_address' | 'pan' | 'other'; } export interface ContactDetail { @@ -2306,10 +2332,12 @@ export namespace PaymentOrderCreateAsyncParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -2327,9 +2355,11 @@ export namespace PaymentOrderCreateAsyncParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -2339,6 +2369,7 @@ export namespace PaymentOrderCreateAsyncParams { | 'sepa' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; } diff --git a/src/resources/routing-details.ts b/src/resources/routing-details.ts index d962109c..9ad41443 100644 --- a/src/resources/routing-details.ts +++ b/src/resources/routing-details.ts @@ -130,9 +130,11 @@ export interface RoutingDetail { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -142,6 +144,7 @@ export interface RoutingDetail { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin' | null; @@ -167,10 +170,12 @@ export interface RoutingDetail { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -241,10 +246,12 @@ export interface RoutingDetailCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -266,9 +273,11 @@ export interface RoutingDetailCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -278,6 +287,7 @@ export interface RoutingDetailCreateParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin' | null; diff --git a/src/resources/transactions/transactions.ts b/src/resources/transactions/transactions.ts index c7614a69..c37809d3 100644 --- a/src/resources/transactions/transactions.ts +++ b/src/resources/transactions/transactions.ts @@ -170,9 +170,11 @@ export interface Transaction { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -182,6 +184,7 @@ export interface Transaction { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin'; diff --git a/src/resources/validations.ts b/src/resources/validations.ts index dceab22a..436facd9 100644 --- a/src/resources/validations.ts +++ b/src/resources/validations.ts @@ -74,9 +74,11 @@ export interface RoutingNumberLookupRequest { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -86,6 +88,7 @@ export interface RoutingNumberLookupRequest { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin' >; @@ -145,10 +148,12 @@ export interface ValidationValidateRoutingNumberParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; } diff --git a/src/resources/virtual-accounts.ts b/src/resources/virtual-accounts.ts index 10adc715..5e930a32 100644 --- a/src/resources/virtual-accounts.ts +++ b/src/resources/virtual-accounts.ts @@ -214,7 +214,7 @@ export namespace VirtualAccountCreateParams { * One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank * account number is in a generic format. */ - account_number_type?: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address'; + account_number_type?: 'clabe' | 'hk_number' | 'iban' | 'other' | 'pan' | 'wallet_address'; } export interface RoutingDetail { @@ -239,10 +239,12 @@ export namespace VirtualAccountCreateParams { | 'gb_sort_code' | 'hk_interbank_clearing_code' | 'hu_interbank_clearing_code' + | 'id_sknbi_code' | 'in_ifsc' | 'jp_zengin_code' | 'my_branch_code' | 'nz_national_clearing_code' + | 'pl_national_clearing_code' | 'se_bankgiro_clearing_code' | 'swift'; @@ -264,9 +266,11 @@ export namespace VirtualAccountCreateParams { | 'hu_ics' | 'interac' | 'masav' + | 'mx_ccen' | 'neft' | 'nics' | 'nz_becs' + | 'pl_elixir' | 'provxchange' | 'ro_sent' | 'rtp' @@ -276,6 +280,7 @@ export namespace VirtualAccountCreateParams { | 'sg_giro' | 'sic' | 'signet' + | 'sknbi' | 'wire' | 'zengin' | null; diff --git a/tests/api-resources/invoices/invoices.test.ts b/tests/api-resources/invoices/invoices.test.ts index d2e6ec86..824ba87e 100644 --- a/tests/api-resources/invoices/invoices.test.ts +++ b/tests/api-resources/invoices/invoices.test.ts @@ -80,6 +80,7 @@ describe('resource invoices', () => { }, currency: 'AED', description: 'string', + fallback_payment_method: 'string', invoicer_address: { line1: 'string', line2: 'string', @@ -194,6 +195,7 @@ describe('resource invoices', () => { currency: 'AED', description: 'string', due_date: '2019-12-27T18:11:19.117Z', + fallback_payment_method: 'string', invoicer_address: { line1: 'string', line2: 'string', diff --git a/tests/api-resources/ledger-account-settlements.test.ts b/tests/api-resources/ledger-account-settlements.test.ts new file mode 100644 index 00000000..242d9c81 --- /dev/null +++ b/tests/api-resources/ledger-account-settlements.test.ts @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +import ModernTreasury from 'modern-treasury'; +import { Response } from 'node-fetch'; + +const modernTreasury = new ModernTreasury({ + apiKey: 'My API Key', + organizationId: 'my-organization-ID', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource ledgerAccountSettlements', () => { + test('create: only required params', async () => { + const responsePromise = modernTreasury.ledgerAccountSettlements.create({ + contra_ledger_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + settled_ledger_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await modernTreasury.ledgerAccountSettlements.create({ + contra_ledger_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + settled_ledger_account_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + allow_either_direction: true, + description: 'string', + effective_at_upper_bound: '2019-12-27T18:11:19.117Z', + metadata: { key: 'value', foo: 'bar', modern: 'treasury' }, + skip_settlement_ledger_transaction: true, + status: 'pending', + }); + }); + + test('retrieve', async () => { + const responsePromise = modernTreasury.ledgerAccountSettlements.retrieve('string'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieve: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerAccountSettlements.retrieve('string', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + + test('update', async () => { + const responsePromise = modernTreasury.ledgerAccountSettlements.update('string'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerAccountSettlements.update('string', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + + test('update: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerAccountSettlements.update( + 'string', + { + description: 'string', + metadata: { key: 'value', foo: 'bar', modern: 'treasury' }, + status: 'posted', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + + test('list', async () => { + const responsePromise = modernTreasury.ledgerAccountSettlements.list(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerAccountSettlements.list({ path: '/_stainless_unknown_path' }), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerAccountSettlements.list( + { + id: ['string', 'string', 'string'], + after_cursor: 'string', + metadata: { foo: 'string' }, + per_page: 0, + settled_ledger_account_id: 'string', + settlement_entry_direction: 'string', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); +}); diff --git a/tests/api-resources/ledger-entries.test.ts b/tests/api-resources/ledger-entries.test.ts index 04a4b1af..cb712330 100644 --- a/tests/api-resources/ledger-entries.test.ts +++ b/tests/api-resources/ledger-entries.test.ts @@ -39,6 +39,35 @@ describe('resource ledgerEntries', () => { ).rejects.toThrow(ModernTreasury.NotFoundError); }); + test('update', async () => { + const responsePromise = modernTreasury.ledgerEntries.update('string'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerEntries.update('string', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + + test('update: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + modernTreasury.ledgerEntries.update( + 'string', + { metadata: { key: 'value', foo: 'bar', modern: 'treasury' } }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(ModernTreasury.NotFoundError); + }); + test('list', async () => { const responsePromise = modernTreasury.ledgerEntries.list(); const rawResponse = await responsePromise.asResponse(); @@ -72,6 +101,7 @@ describe('resource ledgerEntries', () => { ledger_account_id: 'string', ledger_account_lock_version: { foo: 0 }, ledger_account_payout_id: 'string', + ledger_account_settlement_id: 'string', ledger_account_statement_id: 'string', ledger_transaction_id: 'string', metadata: { foo: 'string' }, diff --git a/tests/api-resources/ledger-transactions/ledger-transactions.test.ts b/tests/api-resources/ledger-transactions/ledger-transactions.test.ts index ecc4bc4a..e62c7d26 100644 --- a/tests/api-resources/ledger-transactions/ledger-transactions.test.ts +++ b/tests/api-resources/ledger-transactions/ledger-transactions.test.ts @@ -193,6 +193,7 @@ describe('resource ledgerTransactions', () => { ledger_account_category_id: 'string', ledger_account_id: 'string', ledger_account_payout_id: 'string', + ledger_account_settlement_id: 'string', ledger_id: 'string', ledgerable_id: 'string', ledgerable_type: 'counterparty', diff --git a/tests/api-resources/payment-orders/payment-orders.test.ts b/tests/api-resources/payment-orders/payment-orders.test.ts index 034f66d9..5e14fef5 100644 --- a/tests/api-resources/payment-orders/payment-orders.test.ts +++ b/tests/api-resources/payment-orders/payment-orders.test.ts @@ -365,6 +365,8 @@ describe('resource paymentOrders', () => { { after_cursor: 'string', counterparty_id: 'string', + created_at_end: '2019-12-27', + created_at_start: '2019-12-27', direction: 'credit', effective_date_end: '2019-12-27', effective_date_start: '2019-12-27',