Skip to content

Commit

Permalink
feat(api): updates to required fields for ExpectedPayments (#477)
Browse files Browse the repository at this point in the history
- mark more fields as optional when creating or updating an ExpectedPayment
- add types for ReconciliationRules
  • Loading branch information
stainless-app[bot] committed Oct 16, 2024
1 parent 45c3b65 commit fa5cd1e
Show file tree
Hide file tree
Showing 11 changed files with 315 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 158
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury-49164a27d198e4831dc88d88b785c1c5ddbca297c5c3ee072823e7fbae6f1c16.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury-5753cf83c1cfd8a49c2fb5445fa9a6970330522400bebaf8a4a9f56aecbcff24.yml
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Types:

- <code><a href="./src/resources/expected-payments.ts">ExpectedPayment</a></code>
- <code><a href="./src/resources/expected-payments.ts">ExpectedPaymentType</a></code>
- <code><a href="./src/resources/expected-payments.ts">ReconciliationRule</a></code>

Methods:

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export namespace ModernTreasury {
export import ExpectedPayments = API.ExpectedPayments;
export import ExpectedPayment = API.ExpectedPayment;
export import ExpectedPaymentType = API.ExpectedPaymentType;
export import ReconciliationRule = API.ReconciliationRule;
export import ExpectedPaymentsPage = API.ExpectedPaymentsPage;
export import ExpectedPaymentCreateParams = API.ExpectedPaymentCreateParams;
export import ExpectedPaymentUpdateParams = API.ExpectedPaymentUpdateParams;
Expand Down
42 changes: 21 additions & 21 deletions src/resources/bulk-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,24 +787,13 @@ export namespace BulkRequestCreateParams {
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_lower_bound: number;
amount_lower_bound?: number | null;

/**
* The highest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_upper_bound: number;

/**
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction: Shared.TransactionDirection;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id: string;
amount_upper_bound?: number | null;

/**
* The ID of the counterparty you expect for this payment.
Expand All @@ -814,7 +803,7 @@ export namespace BulkRequestCreateParams {
/**
* Must conform to ISO 4217. Defaults to the currency of the internal account.
*/
currency?: Shared.Currency;
currency?: Shared.Currency | null;

/**
* The earliest date the payment may come in. Format: yyyy-mm-dd
Expand All @@ -831,6 +820,17 @@ export namespace BulkRequestCreateParams {
*/
description?: string | null;

/**
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction?: 'credit' | 'debit' | null;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id?: string | null;

/**
* Specifies a ledger transaction object that will be created with the expected
* payment. If the ledger transaction cannot be created, then the expected payment
Expand Down Expand Up @@ -868,7 +868,7 @@ export namespace BulkRequestCreateParams {
/**
* An array of reconciliation rule variables for this payment.
*/
reconciliation_rule_variables?: Array<Record<string, string>> | null;
reconciliation_rule_variables?: Array<ExpectedPaymentsAPI.ReconciliationRule> | null;

/**
* For `ach`, this field will be passed through on an addenda record. For `wire`
Expand Down Expand Up @@ -1794,13 +1794,13 @@ export namespace BulkRequestCreateParams {
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_lower_bound?: number;
amount_lower_bound?: number | null;

/**
* The highest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_upper_bound?: number;
amount_upper_bound?: number | null;

/**
* The ID of the counterparty you expect for this payment.
Expand All @@ -1810,7 +1810,7 @@ export namespace BulkRequestCreateParams {
/**
* Must conform to ISO 4217. Defaults to the currency of the internal account.
*/
currency?: Shared.Currency;
currency?: Shared.Currency | null;

/**
* The earliest date the payment may come in. Format: yyyy-mm-dd
Expand All @@ -1831,12 +1831,12 @@ export namespace BulkRequestCreateParams {
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction?: Shared.TransactionDirection;
direction?: 'credit' | 'debit' | null;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id?: string;
internal_account_id?: string | null;

/**
* Additional data represented as key-value pairs. Both the key and value must be
Expand All @@ -1857,7 +1857,7 @@ export namespace BulkRequestCreateParams {
/**
* An array of reconciliation rule variables for this payment.
*/
reconciliation_rule_variables?: Array<Record<string, string>> | null;
reconciliation_rule_variables?: Array<ExpectedPaymentsAPI.ReconciliationRule> | null;

/**
* For `ach`, this field will be passed through on an addenda record. For `wire`
Expand Down
132 changes: 114 additions & 18 deletions src/resources/expected-payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ export class ExpectedPayments extends APIResource {
* create expected payment
*/
create(
params: ExpectedPaymentCreateParams,
params?: ExpectedPaymentCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<ExpectedPayment>;
create(options?: Core.RequestOptions): Core.APIPromise<ExpectedPayment>;
create(
params: ExpectedPaymentCreateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<ExpectedPayment> {
if (isRequestOptions(params)) {
return this.create({}, params);
}
// @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) {
Expand Down Expand Up @@ -91,13 +99,13 @@ export interface ExpectedPayment {
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_lower_bound: number;
amount_lower_bound: number | null;

/**
* The highest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_upper_bound: number;
amount_upper_bound: number | null;

/**
* The ID of the counterparty you expect for this payment.
Expand All @@ -109,7 +117,7 @@ export interface ExpectedPayment {
/**
* Must conform to ISO 4217. Defaults to the currency of the internal account.
*/
currency: Shared.Currency;
currency: Shared.Currency | null;

/**
* The earliest date the payment may come in. Format: yyyy-mm-dd
Expand All @@ -130,12 +138,12 @@ export interface ExpectedPayment {
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction: Shared.TransactionDirection;
direction: 'credit' | 'debit' | null;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id: string;
internal_account_id: string | null;

/**
* The ID of the ledger transaction linked to the expected payment.
Expand Down Expand Up @@ -176,7 +184,7 @@ export interface ExpectedPayment {
/**
* An array of reconciliation rule variables for this payment.
*/
reconciliation_rule_variables: Array<Record<string, string>> | null;
reconciliation_rule_variables: Array<ReconciliationRule> | null;

/**
* For `ach`, this field will be passed through on an addenda record. For `wire`
Expand Down Expand Up @@ -254,7 +262,7 @@ export type ExpectedPaymentType =
| 'zengin'
| null;

export interface ExpectedPaymentCreateParams {
export interface ReconciliationRule {
/**
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
Expand All @@ -271,13 +279,89 @@ export interface ExpectedPaymentCreateParams {
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction: Shared.TransactionDirection;
direction: 'credit' | 'debit';

/**
* The ID of the Internal Account for the expected payment.
* The ID of the Internal Account for the expected payment
*/
internal_account_id: string;

/**
* The ID of the counterparty you expect for this payment
*/
counterparty_id?: string | null;

/**
* Must conform to ISO 4217. Defaults to the currency of the internal account
*/
currency?: Shared.Currency;

/**
* A hash of custom identifiers for this payment
*/
custom_identifiers?: Record<string, string> | null;

/**
* The earliest date the payment may come in. Format is yyyy-mm-dd
*/
date_lower_bound?: string | null;

/**
* The latest date the payment may come in. Format is yyyy-mm-dd
*/
date_upper_bound?: string | null;

/**
* One of ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen,
* sepa, signet wire
*/
type?:
| 'ach'
| 'au_becs'
| 'bacs'
| 'book'
| 'card'
| 'chats'
| 'check'
| 'cross_border'
| 'dk_nets'
| 'eft'
| 'hu_ics'
| 'interac'
| 'masav'
| 'mx_ccen'
| 'neft'
| 'nics'
| 'nz_becs'
| 'pl_elixir'
| 'provxchange'
| 'ro_sent'
| 'rtp'
| 'se_bankgirot'
| 'sen'
| 'sepa'
| 'sg_giro'
| 'sic'
| 'signet'
| 'sknbi'
| 'wire'
| 'zengin'
| null;
}

export interface ExpectedPaymentCreateParams {
/**
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_lower_bound?: number | null;

/**
* The highest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_upper_bound?: number | null;

/**
* The ID of the counterparty you expect for this payment.
*/
Expand All @@ -286,7 +370,7 @@ export interface ExpectedPaymentCreateParams {
/**
* Must conform to ISO 4217. Defaults to the currency of the internal account.
*/
currency?: Shared.Currency;
currency?: Shared.Currency | null;

/**
* The earliest date the payment may come in. Format: yyyy-mm-dd
Expand All @@ -303,6 +387,17 @@ export interface ExpectedPaymentCreateParams {
*/
description?: string | null;

/**
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction?: 'credit' | 'debit' | null;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id?: string | null;

/**
* Specifies a ledger transaction object that will be created with the expected
* payment. If the ledger transaction cannot be created, then the expected payment
Expand Down Expand Up @@ -340,7 +435,7 @@ export interface ExpectedPaymentCreateParams {
/**
* An array of reconciliation rule variables for this payment.
*/
reconciliation_rule_variables?: Array<Record<string, string>> | null;
reconciliation_rule_variables?: Array<ReconciliationRule> | null;

/**
* For `ach`, this field will be passed through on an addenda record. For `wire`
Expand Down Expand Up @@ -527,13 +622,13 @@ export interface ExpectedPaymentUpdateParams {
* The lowest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_lower_bound?: number;
amount_lower_bound?: number | null;

/**
* The highest amount this expected payment may be equal to. Value in specified
* currency's smallest unit. e.g. $10 would be represented as 1000.
*/
amount_upper_bound?: number;
amount_upper_bound?: number | null;

/**
* The ID of the counterparty you expect for this payment.
Expand All @@ -543,7 +638,7 @@ export interface ExpectedPaymentUpdateParams {
/**
* Must conform to ISO 4217. Defaults to the currency of the internal account.
*/
currency?: Shared.Currency;
currency?: Shared.Currency | null;

/**
* The earliest date the payment may come in. Format: yyyy-mm-dd
Expand All @@ -564,12 +659,12 @@ export interface ExpectedPaymentUpdateParams {
* One of credit or debit. When you are receiving money, use credit. When you are
* being charged, use debit.
*/
direction?: Shared.TransactionDirection;
direction?: 'credit' | 'debit' | null;

/**
* The ID of the Internal Account for the expected payment.
*/
internal_account_id?: string;
internal_account_id?: string | null;

/**
* Additional data represented as key-value pairs. Both the key and value must be
Expand All @@ -590,7 +685,7 @@ export interface ExpectedPaymentUpdateParams {
/**
* An array of reconciliation rule variables for this payment.
*/
reconciliation_rule_variables?: Array<Record<string, string>> | null;
reconciliation_rule_variables?: Array<ReconciliationRule> | null;

/**
* For `ach`, this field will be passed through on an addenda record. For `wire`
Expand Down Expand Up @@ -698,6 +793,7 @@ export interface ExpectedPaymentListParams extends PageParams {
export namespace ExpectedPayments {
export import ExpectedPayment = ExpectedPaymentsAPI.ExpectedPayment;
export import ExpectedPaymentType = ExpectedPaymentsAPI.ExpectedPaymentType;
export import ReconciliationRule = ExpectedPaymentsAPI.ReconciliationRule;
export import ExpectedPaymentsPage = ExpectedPaymentsAPI.ExpectedPaymentsPage;
export import ExpectedPaymentCreateParams = ExpectedPaymentsAPI.ExpectedPaymentCreateParams;
export import ExpectedPaymentUpdateParams = ExpectedPaymentsAPI.ExpectedPaymentUpdateParams;
Expand Down
Loading

0 comments on commit fa5cd1e

Please sign in to comment.