From ac5c6bfdb142782e3a6df6bb5fe09b5066f6757b Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Tue, 25 Aug 2026 17:25:37 -0400 Subject: [PATCH 1/7] fix up --- src/resources/Account/types.ts | 58 ++++++++-- src/resources/Entity/Attributes.ts | 3 +- src/resources/Entity/Connect.ts | 3 +- src/resources/Entity/types.ts | 177 +++++++++++++++++++++++------ src/resources/Payment/types.ts | 1 + test/resources/Account.tests.ts | 12 +- test/resources/Entity.tests.ts | 7 +- test/resources/Event.tests.ts | 2 +- test/resources/Payment.tests.ts | 6 + 9 files changed, 221 insertions(+), 48 deletions(-) diff --git a/src/resources/Account/types.ts b/src/resources/Account/types.ts index 7fbd922..2c59220 100644 --- a/src/resources/Account/types.ts +++ b/src/resources/Account/types.ts @@ -289,6 +289,7 @@ export interface IAccountLiability { type: TAccountLiabilityTypes | null; sub_type: TAccountLiabilitySubTypes | null; name: string | null; + network: string | null; }; export interface IAccountACH { @@ -312,9 +313,6 @@ export interface IAccountCardBrand { account_id: string; brands: IAccountCardBrandInfo[]; source: 'method' | 'network' | null; - issuer?: string | null; - last4?: string | null; - network?: string | null; status: 'completed' | 'in_progress' | 'failed'; shared: boolean; error: IResourceError | null; @@ -322,15 +320,61 @@ export interface IAccountCardBrand { updated_at: string; } +export interface IAccountCardBrandRewardCategory { + category: string | null; + category_presentable: string | null; + rate: number | null; + unit: string | null; + cap: string | null; +} + +export interface IAccountCardBrandRewards { + type: string | null; + program: string | null; + categories: IAccountCardBrandRewardCategory[]; +} + +export interface IAccountCardBrandQualifyingPeriod { + value: number; + unit: string; + relative_to: string; +} + +export interface IAccountCardBrandPromotion { + type: string | null; + title: string | null; + description: string | null; + value: number | null; + unit: string | null; + spend_requirement: number | null; + qualifying_period: IAccountCardBrandQualifyingPeriod | null; + expiration: string | null; +} + +export interface IAccountCardBrandDetails { + card_category: string | null; + purchase_apr_min: number | null; + purchase_apr_max: number | null; + cash_advance_apr_min: number | null; + cash_advance_apr_max: number | null; + annual_fee: number | null; + late_payment_fee: number | null; + rewards: IAccountCardBrandRewards; + promotions: IAccountCardBrandPromotion[]; + data_as_of: string | null; +} + export interface IAccountCardBrandInfo { id: string; - card_product_id: string; - description: string; + card_product_id?: string | null; + description?: string; name: string; - issuer: string; + issuer?: string | null; network: string; - type: 'specific' | 'generic' | 'in_review'; + network_tier?: string; + type?: 'specific' | 'generic' | 'in_review' | null; url: string; + details: IAccountCardBrandDetails | null; } export interface IAccountPayoff { diff --git a/src/resources/Entity/Attributes.ts b/src/resources/Entity/Attributes.ts index c814cdd..e154f72 100644 --- a/src/resources/Entity/Attributes.ts +++ b/src/resources/Entity/Attributes.ts @@ -34,10 +34,11 @@ export default class EntityAttributes extends Resource { * Creates a new Attributes request to retrieve the Entity’s attributes. * https://docs.methodfi.com/reference/entities/attributes/create * + * @param opts Attributes or bundles to request. Omit to request the full set. * @returns Returns an Entity’s Attributes object. */ - async create(opts: IEntityAttributesCreateOpts) { + async create(opts: IEntityAttributesCreateOpts = {}) { return super._create, IEntityAttributesCreateOpts>(opts); } }; diff --git a/src/resources/Entity/Connect.ts b/src/resources/Entity/Connect.ts index 99acfce..3f5af28 100644 --- a/src/resources/Entity/Connect.ts +++ b/src/resources/Entity/Connect.ts @@ -1,6 +1,6 @@ import Resource, { IResourceListOpts, IRequestConfig } from '../../resource'; import Configuration, { IResponse } from '../../configuration'; -import type { IEntityConnect } from './types'; +import type { IEntityConnect, TEntityConnectArtifactTypes } from './types'; export const AccountExpandableFields = { sensitive: 'sensitive', @@ -45,6 +45,7 @@ export type AccountSubscription = typeof AccountSubscriptionsEligibleForAutomati export interface IConnectCreateOpts { products?: AccountProduct[]; subscriptions?: AccountSubscription[]; + artifacts?: TEntityConnectArtifactTypes[]; } diff --git a/src/resources/Entity/types.ts b/src/resources/Entity/types.ts index f96b13f..9a8613c 100644 --- a/src/resources/Entity/types.ts +++ b/src/resources/Entity/types.ts @@ -115,6 +115,27 @@ export interface IEntityVerification { phone?: IEntityVerificationPhone; }; +export const EntityConnectArtifactTypes = { + raw_credit_report: 'raw_credit_report', + credit_report_pdf: 'credit_report_pdf', +} as const; + +export type TEntityConnectArtifactTypes = typeof EntityConnectArtifactTypes[keyof typeof EntityConnectArtifactTypes]; + +export const EntityConnectFileBureaus = { + equifax: 'equifax', + transunion: 'transunion', +} as const; + +export type TEntityConnectFileBureaus = typeof EntityConnectFileBureaus[keyof typeof EntityConnectFileBureaus]; + +export interface IEntityConnectFile { + id: string; + type: TEntityConnectArtifactTypes; + bureau: TEntityConnectFileBureaus; + mime_type: string; +}; + export interface IEntityConnect { id: string; entity_id: string; @@ -122,6 +143,7 @@ export interface IEntityConnect { accounts: string[] | null; requested_products: TAccountProducts[]; requested_subscriptions: TAccountSubscriptionTypes[]; + files: IEntityConnectFile[]; error: IResourceError | null; created_at: string; updated_at: string; @@ -160,35 +182,62 @@ export interface IEntityCreditScores { export interface IEntityAttribute { value: T | null; error: IResourceError | null; + metadata: Record | null; +} + +export interface ICreditHealthAttribute { + value: T | null; + rating: string; + metadata?: Record | null; } export interface IEntityAttributesType { revolving_credit_card_balance_total?: IEntityAttribute; credit_limit_total?: IEntityAttribute; credit_card_utilization?: IEntityAttribute; + available_credit_limit_total?: IEntityAttribute; + available_credit_total?: IEntityAttribute; weighted_average_apr_credit_card?: IEntityAttribute; usage_pattern?: IEntityAttribute; + utilization?: IEntityAttribute; + purchasing_power?: IEntityAttribute; + healthy_cards_count?: IEntityAttribute; + dormant_cards_count?: IEntityAttribute; + delinquent_cards_count?: IEntityAttribute; + net_active_cards_count?: IEntityAttribute; + utilization_velocity_4_week?: IEntityAttribute; + utilization_velocity_8_week?: IEntityAttribute; + utilization_velocity_12_week?: IEntityAttribute; next_payment_minimum_total_credit_cards?: IEntityAttribute; payment_to_minimum_ratio_avg_credit_cards?: IEntityAttribute; revolving_credit_card_balance_change_30d?: IEntityAttribute; revolving_credit_card_balance_change_60d?: IEntityAttribute; revolving_credit_card_balance_change_90d?: IEntityAttribute; - revolving_credit_card_utilization_trend_30d?: IEntityAttribute; - revolving_credit_card_utilization_trend_90d?: IEntityAttribute; + revolving_credit_card_utilization_trend_30d?: IEntityAttribute; + revolving_credit_card_utilization_trend_90d?: IEntityAttribute; revolving_credit_card_utilization_delta_30d?: IEntityAttribute; revolving_credit_card_utilization_delta_60d?: IEntityAttribute; revolving_credit_card_utilization_delta_90d?: IEntityAttribute; - delinquency_flag_credit_cards?: IEntityAttribute; + delinquency_flag_credit_cards?: IEntityAttribute; + any_delinquent_flag?: IEntityAttribute; + serious_delinquent_flag?: IEntityAttribute; + delinquency_recently_cured_flag?: IEntityAttribute; + delinquency_worst_dpd_bucket?: IEntityAttribute; + delinquency_accounts_count?: IEntityAttribute; + delinquent_balance_total?: IEntityAttribute; + delinquency_progression_flag?: IEntityAttribute; + delinquent_outcome?: IEntityAttribute; personal_loan_balance_total?: IEntityAttribute; personal_loan_amount_total?: IEntityAttribute; + available_loan_amount_personal_loans?: IEntityAttribute; personal_loan_monthly_installments_estimate?: IEntityAttribute; personal_loan_utilization?: IEntityAttribute; weighted_average_apr_personal_loan?: IEntityAttribute; personal_loan_balance_change_30d?: IEntityAttribute; personal_loan_balance_change_60d?: IEntityAttribute; personal_loan_balance_change_90d?: IEntityAttribute; - personal_loan_utilization_trend_30d?: IEntityAttribute; - personal_loan_utilization_trend_90d?: IEntityAttribute; + personal_loan_utilization_trend_30d?: IEntityAttribute; + personal_loan_utilization_trend_90d?: IEntityAttribute; personal_loan_utilization_delta_30d?: IEntityAttribute; personal_loan_utilization_delta_60d?: IEntityAttribute; personal_loan_utilization_delta_90d?: IEntityAttribute; @@ -198,15 +247,17 @@ export interface IEntityAttributesType { mortgage_balance_change_30d?: IEntityAttribute; mortgage_balance_change_60d?: IEntityAttribute; mortgage_balance_change_90d?: IEntityAttribute; - mortgage_utilization_trend_30d?: IEntityAttribute; - mortgage_utilization_trend_90d?: IEntityAttribute; + mortgage_utilization_trend_30d?: IEntityAttribute; + mortgage_utilization_trend_90d?: IEntityAttribute; mortgage_utilization_delta_30d?: IEntityAttribute; mortgage_utilization_delta_60d?: IEntityAttribute; mortgage_utilization_delta_90d?: IEntityAttribute; + heloc_balance_total?: IEntityAttribute; + heloc_utilization?: IEntityAttribute; overall_loan_amount_total?: IEntityAttribute; overall_utilization?: IEntityAttribute; - overall_utilization_trend_30d?: IEntityAttribute; - overall_utilization_trend_90d?: IEntityAttribute; + overall_utilization_trend_30d?: IEntityAttribute; + overall_utilization_trend_90d?: IEntityAttribute; overall_utilization_delta_30d?: IEntityAttribute; overall_utilization_delta_60d?: IEntityAttribute; overall_utilization_delta_90d?: IEntityAttribute; @@ -218,23 +269,54 @@ export interface IEntityAttributesType { other_balance_change_30d?: IEntityAttribute; other_balance_change_60d?: IEntityAttribute; other_balance_change_90d?: IEntityAttribute; - credit_health_credit_card_usage?: IEntityAttribute; - credit_health_derogatory_marks?: IEntityAttribute; - credit_health_hard_inquiries?: IEntityAttribute; - credit_health_soft_inquiries?: IEntityAttribute; - credit_health_total_accounts?: IEntityAttribute; - credit_health_credit_age?: IEntityAttribute; - credit_health_payment_history?: IEntityAttribute; - credit_health_open_accounts?: IEntityAttribute; - credit_health_entity_delinquent?: IEntityAttribute; + enrolled_in_direct_pay_previously?: IEntityAttribute; + last_direct_pay_date?: IEntityAttribute; + last_direct_pay_amount?: IEntityAttribute; + number_of_direct_pay_in_12_months?: IEntityAttribute; + credit_health_credit_card_usage?: ICreditHealthAttribute; + credit_health_derogatory_marks?: ICreditHealthAttribute; + credit_health_hard_inquiries?: ICreditHealthAttribute; + credit_health_soft_inquiries?: ICreditHealthAttribute; + credit_health_total_accounts?: ICreditHealthAttribute; + credit_health_credit_age?: ICreditHealthAttribute; + credit_health_payment_history?: ICreditHealthAttribute; + credit_health_open_accounts?: ICreditHealthAttribute; + credit_health_entity_delinquent?: ICreditHealthAttribute; } +// These v1 attributes can still appear on historical responses, but the v2 +// 2026-03-30 create validators do not accept them as requested_attributes. +export const LegacyEntityAttributeNames = { + credit_health_credit_card_usage: 'credit_health_credit_card_usage', + credit_health_derogatory_marks: 'credit_health_derogatory_marks', + credit_health_hard_inquiries: 'credit_health_hard_inquiries', + credit_health_soft_inquiries: 'credit_health_soft_inquiries', + credit_health_total_accounts: 'credit_health_total_accounts', + credit_health_credit_age: 'credit_health_credit_age', + credit_health_payment_history: 'credit_health_payment_history', + credit_health_open_accounts: 'credit_health_open_accounts', + credit_health_entity_delinquent: 'credit_health_entity_delinquent', +} as const; + +export type TLegacyEntityAttributeNames = typeof LegacyEntityAttributeNames[keyof typeof LegacyEntityAttributeNames]; + export const EntityAttributeNames = { revolving_credit_card_balance_total: 'revolving_credit_card_balance_total', credit_limit_total: 'credit_limit_total', credit_card_utilization: 'credit_card_utilization', + available_credit_limit_total: 'available_credit_limit_total', + available_credit_total: 'available_credit_total', weighted_average_apr_credit_card: 'weighted_average_apr_credit_card', usage_pattern: 'usage_pattern', + utilization: 'utilization', + purchasing_power: 'purchasing_power', + healthy_cards_count: 'healthy_cards_count', + dormant_cards_count: 'dormant_cards_count', + delinquent_cards_count: 'delinquent_cards_count', + net_active_cards_count: 'net_active_cards_count', + utilization_velocity_4_week: 'utilization_velocity_4_week', + utilization_velocity_8_week: 'utilization_velocity_8_week', + utilization_velocity_12_week: 'utilization_velocity_12_week', next_payment_minimum_total_credit_cards: 'next_payment_minimum_total_credit_cards', payment_to_minimum_ratio_avg_credit_cards: 'payment_to_minimum_ratio_avg_credit_cards', revolving_credit_card_balance_change_30d: 'revolving_credit_card_balance_change_30d', @@ -246,8 +328,17 @@ export const EntityAttributeNames = { revolving_credit_card_utilization_delta_60d: 'revolving_credit_card_utilization_delta_60d', revolving_credit_card_utilization_delta_90d: 'revolving_credit_card_utilization_delta_90d', delinquency_flag_credit_cards: 'delinquency_flag_credit_cards', + any_delinquent_flag: 'any_delinquent_flag', + serious_delinquent_flag: 'serious_delinquent_flag', + delinquency_recently_cured_flag: 'delinquency_recently_cured_flag', + delinquency_worst_dpd_bucket: 'delinquency_worst_dpd_bucket', + delinquency_accounts_count: 'delinquency_accounts_count', + delinquent_balance_total: 'delinquent_balance_total', + delinquency_progression_flag: 'delinquency_progression_flag', + delinquent_outcome: 'delinquent_outcome', personal_loan_balance_total: 'personal_loan_balance_total', personal_loan_amount_total: 'personal_loan_amount_total', + available_loan_amount_personal_loans: 'available_loan_amount_personal_loans', personal_loan_monthly_installments_estimate: 'personal_loan_monthly_installments_estimate', personal_loan_utilization: 'personal_loan_utilization', weighted_average_apr_personal_loan: 'weighted_average_apr_personal_loan', @@ -270,6 +361,8 @@ export const EntityAttributeNames = { mortgage_utilization_delta_30d: 'mortgage_utilization_delta_30d', mortgage_utilization_delta_60d: 'mortgage_utilization_delta_60d', mortgage_utilization_delta_90d: 'mortgage_utilization_delta_90d', + heloc_balance_total: 'heloc_balance_total', + heloc_utilization: 'heloc_utilization', overall_loan_amount_total: 'overall_loan_amount_total', overall_utilization: 'overall_utilization', overall_utilization_trend_30d: 'overall_utilization_trend_30d', @@ -285,21 +378,26 @@ export const EntityAttributeNames = { other_balance_change_30d: 'other_balance_change_30d', other_balance_change_60d: 'other_balance_change_60d', other_balance_change_90d: 'other_balance_change_90d', - credit_health_credit_card_usage: 'credit_health_credit_card_usage', - credit_health_derogatory_marks: 'credit_health_derogatory_marks', - credit_health_hard_inquiries: 'credit_health_hard_inquiries', - credit_health_soft_inquiries: 'credit_health_soft_inquiries', - credit_health_total_accounts: 'credit_health_total_accounts', - credit_health_credit_age: 'credit_health_credit_age', - credit_health_payment_history: 'credit_health_payment_history', - credit_health_open_accounts: 'credit_health_open_accounts', - credit_health_entity_delinquent: 'credit_health_entity_delinquent', + enrolled_in_direct_pay_previously: 'enrolled_in_direct_pay_previously', + last_direct_pay_date: 'last_direct_pay_date', + last_direct_pay_amount: 'last_direct_pay_amount', + number_of_direct_pay_in_12_months: 'number_of_direct_pay_in_12_months', + ...LegacyEntityAttributeNames, +} as const; + +export type TEntityAttributeNames = typeof EntityAttributeNames[keyof typeof EntityAttributeNames]; +export type TEntityRequestableAttributeNames = Exclude; + +export const EntityAttributeBundles = { + portfolio_intelligence: 'portfolio_intelligence', + wallet_intelligence: 'wallet_intelligence', } as const; -export type TEntityAttributeNames = keyof typeof EntityAttributeNames; +export type TEntityAttributeBundles = typeof EntityAttributeBundles[keyof typeof EntityAttributeBundles]; export interface IEntityAttributesCreateOpts { - attributes: TEntityAttributeNames[]; + requested_attributes?: TEntityRequestableAttributeNames[]; + bundles?: TEntityAttributeBundles[]; } export interface IEntityAttributes { @@ -398,11 +496,26 @@ export type TEntitySubscriptionStatuses = keyof typeof EntitySubscriptionStatuse export interface IEntitySubscriptionPayload { attributes?: { - requested_attributes: TEntityAttributeNames[]; - version?: string; + requested_attributes?: TEntityRequestableAttributeNames[]; + bundles?: TEntityAttributeBundles[]; + version?: 'v1' | 'v2'; } | null; }; +export type TEntityAttributeRequestScope = + | { + requested_attributes: TEntityRequestableAttributeNames[]; + bundles?: TEntityAttributeBundles[]; + } + | { + requested_attributes?: TEntityRequestableAttributeNames[]; + bundles: TEntityAttributeBundles[]; + }; + +export interface IEntitySubscriptionCreatePayload { + attributes?: TEntityAttributeRequestScope; +}; + export interface IEntitySubscription { id: string; name: TEntitySubscriptionNames; @@ -421,7 +534,7 @@ export interface IEntitySubscriptionResponse { export interface IEntitySubscriptionCreateOpts { enroll: TEntitySubscriptionNames; - payload?: IEntitySubscriptionPayload; + payload?: IEntitySubscriptionCreatePayload; }; export const EntityVerificationSessionStatuses = { diff --git a/src/resources/Payment/types.ts b/src/resources/Payment/types.ts index 010b13e..836d627 100644 --- a/src/resources/Payment/types.ts +++ b/src/resources/Payment/types.ts @@ -71,6 +71,7 @@ export interface IPayment { estimated_completion_date: string | null; source_settlement_date: string | null; destination_settlement_date: string | null; + destination_posted_date: string | null; source_status: TPaymentStatuses; destination_status: TPaymentStatuses; destination_payment_method?: TPaymentDestinationPaymentMethods | null; diff --git a/test/resources/Account.tests.ts b/test/resources/Account.tests.ts index d18dcec..e9d00d6 100644 --- a/test/resources/Account.tests.ts +++ b/test/resources/Account.tests.ts @@ -148,7 +148,8 @@ describe('Accounts - core methods tests', () => { ownership: 'unknown', type: 'credit_card', sub_type: 'flexible_spending', - name: accounts_create_liability_response.liability?.name || null + name: accounts_create_liability_response.liability?.name || null, + network: null, }, latest_verification_session: accounts_create_liability_response.latest_verification_session, balance: null, @@ -304,9 +305,6 @@ describe('Accounts - core methods tests', () => { status: 'in_progress', shared: false, source: null, - issuer: card_create_response.issuer, - last4: card_create_response.last4, - network: card_create_response.network, error: null, created_at: card_create_response.created_at, updated_at: card_create_response.updated_at @@ -343,8 +341,10 @@ describe('Accounts - core methods tests', () => { expect(brand.name).to.equal('Chase Sapphire Reserve'); expect(brand.issuer).to.equal('Chase'); expect(brand.network).to.equal('visa'); + expect(brand.network_tier).to.equal('infinite'); expect(brand.type).to.equal('specific'); expect(brand.url).to.equal('https://static.methodfi.com/card_brands/1b7ccaba6535cb837f802d968add4700.png'); + expect(brand).to.have.property('details'); }); it('should successfully list card brands for an account.', async () => { @@ -371,8 +371,10 @@ describe('Accounts - core methods tests', () => { expect(brand.name).to.equal('Chase Sapphire Reserve'); expect(brand.issuer).to.equal('Chase'); expect(brand.network).to.equal('visa'); + expect(brand.network_tier).to.equal('infinite'); expect(brand.type).to.equal('specific'); expect(brand.url).to.equal('https://static.methodfi.com/card_brands/1b7ccaba6535cb837f802d968add4700.png'); + expect(brand).to.have.property('details'); }); }); @@ -1100,7 +1102,7 @@ describe('Accounts - core methods tests', () => { status_error: null, latest_request_id: accounts_retrieve_product_list_response.attribute?.latest_request_id || null, latest_successful_request_id: accounts_retrieve_product_list_response.attribute?.latest_successful_request_id || null, - is_subscribable: false, + is_subscribable: true, created_at: accounts_retrieve_product_list_response.attribute?.created_at || '', updated_at: accounts_retrieve_product_list_response.attribute?.updated_at || '' }, diff --git a/test/resources/Entity.tests.ts b/test/resources/Entity.tests.ts index b405ad4..c3bd0b0 100644 --- a/test/resources/Entity.tests.ts +++ b/test/resources/Entity.tests.ts @@ -491,6 +491,7 @@ describe('Entities - core methods tests', () => { accounts: entities_account_ids, requested_products: [], requested_subscriptions: [], + files: [], error: null, created_at: entities_connect_create_response.created_at, updated_at: entities_connect_create_response.updated_at, @@ -513,6 +514,7 @@ describe('Entities - core methods tests', () => { accounts: entities_account_ids, requested_products: [], requested_subscriptions: [], + files: [], error: null, created_at: entities_connect_create_response.created_at, updated_at: entities_connect_create_response.updated_at, @@ -535,6 +537,7 @@ describe('Entities - core methods tests', () => { accounts: entities_account_ids, requested_products: [], requested_subscriptions: [], + files: [], error: null, created_at: entities_connect_create_response.created_at, updated_at: entities_connect_create_response.updated_at, @@ -562,6 +565,7 @@ describe('Entities - core methods tests', () => { accounts: null, requested_products: ['card_brand'], requested_subscriptions: ['update'], + files: [], error: null, created_at: entities_connect_create_response_async.created_at, updated_at: entities_connect_create_response_async.updated_at, @@ -589,6 +593,7 @@ describe('Entities - core methods tests', () => { accounts: entities_connect_results_response_async.accounts, requested_products: ['card_brand'], requested_subscriptions: ['update'], + files: [], error: null, created_at: entities_connect_results_response_async.created_at, updated_at: entities_connect_results_response_async.updated_at, @@ -744,7 +749,7 @@ describe('Entities - core methods tests', () => { entities_create_attribute_response = await client .entities(entities_create_response.id) .attributes.create({ - attributes: [EntityAttributeNames.credit_health_credit_card_usage] + requested_attributes: [EntityAttributeNames.credit_card_utilization] }); const expect_results: IEntityAttributes = { diff --git a/test/resources/Event.tests.ts b/test/resources/Event.tests.ts index 9d8013c..d8c4ae3 100644 --- a/test/resources/Event.tests.ts +++ b/test/resources/Event.tests.ts @@ -54,7 +54,7 @@ describe('Events - core methods tests', () => { }); attribute_response = await client.entities(entity_response.id).attributes.create({ - attributes: [EntityAttributeNames.credit_health_credit_card_usage], + requested_attributes: [EntityAttributeNames.credit_card_utilization], }); credit_score_response = await client.entities(entity_response.id).creditScores.create(); diff --git a/test/resources/Payment.tests.ts b/test/resources/Payment.tests.ts index a075dd1..ed65941 100644 --- a/test/resources/Payment.tests.ts +++ b/test/resources/Payment.tests.ts @@ -84,7 +84,9 @@ describe('Payments - core methods tests', () => { source_status: 'pending', destination_trace_id: null, destination_settlement_date: payments_create_response.destination_settlement_date, + destination_posted_date: null, destination_status: 'pending', + destination_payment_method: 'electronic', reversal_id: null, fee: null, idempotency_key: payments_create_response.idempotency_key, @@ -118,7 +120,9 @@ describe('Payments - core methods tests', () => { source_status: 'pending', destination_trace_id: null, destination_settlement_date: payments_create_response.destination_settlement_date, + destination_posted_date: null, destination_status: 'pending', + destination_payment_method: 'electronic', reversal_id: null, fee: null, idempotency_key: payments_retrieve_response.idempotency_key, @@ -162,7 +166,9 @@ describe('Payments - core methods tests', () => { source_status: 'canceled', destination_trace_id: null, destination_settlement_date: payments_create_response.destination_settlement_date, + destination_posted_date: null, destination_status: 'canceled', + destination_payment_method: 'electronic', reversal_id: null, fee: null, idempotency_key: payments_delete_response.idempotency_key, From 978d7a040ec1c77d2f3b306778d3b2b9d796ba61 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Tue, 25 Aug 2026 21:42:24 -0400 Subject: [PATCH 2/7] push remaimign changes --- src/resources/Account/Attributes.ts | 7 +- src/resources/Account/Subscriptions.ts | 10 +- src/resources/Account/types.ts | 229 +++++++++++++++++++++++-- src/resources/Entity/Connect.ts | 3 +- 4 files changed, 224 insertions(+), 25 deletions(-) diff --git a/src/resources/Account/Attributes.ts b/src/resources/Account/Attributes.ts index 1e69cab..e4b1f49 100644 --- a/src/resources/Account/Attributes.ts +++ b/src/resources/Account/Attributes.ts @@ -1,6 +1,6 @@ import Resource, { IResourceListOpts } from '../../resource'; import Configuration, { IResponse } from '../../configuration'; -import type { IAccountAttributes } from './types'; +import type { IAccountAttributes, IAccountAttributesCreateOpts } from './types'; export default class AccountAttributes extends Resource { constructor(config: Configuration) { @@ -34,10 +34,11 @@ export default class AccountAttributes extends Resource { * Creates a new Attributes request to retrieve the Account’s attributes. * https://docs.methodfi.com/reference/accounts/attributes/create * + * @param opts Attributes or bundles to request. Omit to request the full set. * @returns Returns an Account’s Attributes object. */ - async create() { - return super._create, {}>({}); + async create(opts: IAccountAttributesCreateOpts = {}) { + return super._create, IAccountAttributesCreateOpts>(opts); } }; diff --git a/src/resources/Account/Subscriptions.ts b/src/resources/Account/Subscriptions.ts index 84e14ed..e180f4c 100644 --- a/src/resources/Account/Subscriptions.ts +++ b/src/resources/Account/Subscriptions.ts @@ -41,14 +41,14 @@ export default class AccountSubscriptions extends Resource { * * Note: Subscription requests are processed individually, meaning the success or failure of one subscription does not affect others. The response object will detail any errors encountered. * - * @param data IAccountSubscriptionCreateOpts + * @param opts A Subscription name, or an IAccountSubscriptionCreateOpts object. * @returns Returns a map of Subscription name to Subscription object. */ - async create(sub_name: TAccountSubscriptionTypes) { - return super._create, IAccountSubscriptionCreateOpts>( - { enroll: sub_name }, - ); + async create(opts: IAccountSubscriptionCreateOpts | TAccountSubscriptionTypes) { + const data: IAccountSubscriptionCreateOpts = typeof opts === 'string' ? { enroll: opts } : opts; + + return super._create, IAccountSubscriptionCreateOpts>(data); } /** diff --git a/src/resources/Account/types.ts b/src/resources/Account/types.ts index 2c59220..29eda23 100644 --- a/src/resources/Account/types.ts +++ b/src/resources/Account/types.ts @@ -320,39 +320,141 @@ export interface IAccountCardBrand { updated_at: string; } +export const CardBrandNetworkTiers = { + standard: 'standard', + unknown: 'unknown', + platinum: 'platinum', + signature: 'signature', + infinite: 'infinite', + business: 'business', + signature_business: 'signature business', + world: 'world', + world_elite: 'world elite', + world_elite_business: 'world elite business', +} as const; + +export type TCardBrandNetworkTiers = typeof CardBrandNetworkTiers[keyof typeof CardBrandNetworkTiers]; + +export const CardBrandTypes = { + generic: 'generic', + specific: 'specific', + merged: 'merged', + in_review: 'in_review', +} as const; + +export type TCardBrandTypes = typeof CardBrandTypes[keyof typeof CardBrandTypes]; + +export const CardBrandCardCategories = { + travel: 'travel', + cash_back: 'cash_back', + store: 'store', + credit_builder: 'credit_builder', + basic: 'basic', + dining: 'dining', +} as const; + +export type TCardBrandCardCategories = typeof CardBrandCardCategories[keyof typeof CardBrandCardCategories]; + +export const CardBrandRewardsTypes = { + cash_back: 'cash_back', + points: 'points', + miles: 'miles', + discount: 'discount', + none: 'none', +} as const; + +export type TCardBrandRewardsTypes = typeof CardBrandRewardsTypes[keyof typeof CardBrandRewardsTypes]; + +export const CardBrandRewardCategoryGroups = { + travel: 'travel', + dining: 'dining', + groceries: 'groceries', + gas: 'gas', + streaming: 'streaming', + store: 'store', + base_rate: 'base_rate', + other: 'other', +} as const; + +export type TCardBrandRewardCategoryGroups = typeof CardBrandRewardCategoryGroups[keyof typeof CardBrandRewardCategoryGroups]; + +export const CardBrandEarnRateUnits = { + percent: 'percent', + points_per_dollar: 'points_per_dollar', + miles_per_dollar: 'miles_per_dollar', +} as const; + +export type TCardBrandEarnRateUnits = typeof CardBrandEarnRateUnits[keyof typeof CardBrandEarnRateUnits]; + +export const CardBrandPromotionTypes = { + sign_up_bonus: 'sign_up_bonus', + intro_apr: 'intro_apr', + partner_promo: 'partner_promo', + statement_credit: 'statement_credit', + referral_bonus: 'referral_bonus', + deferred_interest: 'deferred_interest', + co_brand_promo: 'co_brand_promo', + bonus_rewards: 'bonus_rewards', + other: 'other', +} as const; + +export type TCardBrandPromotionTypes = typeof CardBrandPromotionTypes[keyof typeof CardBrandPromotionTypes]; + +export const CardBrandPromotionValueUnits = { + points: 'points', + miles: 'miles', + percent: 'percent', + cents: 'cents', +} as const; + +export type TCardBrandPromotionValueUnits = typeof CardBrandPromotionValueUnits[keyof typeof CardBrandPromotionValueUnits]; + +export const CardBrandQualifyingPeriodUnits = { + months: 'months', + days: 'days', +} as const; + +export type TCardBrandQualifyingPeriodUnits = typeof CardBrandQualifyingPeriodUnits[keyof typeof CardBrandQualifyingPeriodUnits]; + +export const CardBrandQualifyingPeriodReferences = { + account_opening: 'account_opening', +} as const; + +export type TCardBrandQualifyingPeriodReferences = typeof CardBrandQualifyingPeriodReferences[keyof typeof CardBrandQualifyingPeriodReferences]; + export interface IAccountCardBrandRewardCategory { - category: string | null; + category: TCardBrandRewardCategoryGroups | null; category_presentable: string | null; rate: number | null; - unit: string | null; + unit: TCardBrandEarnRateUnits | null; cap: string | null; } export interface IAccountCardBrandRewards { - type: string | null; + type: TCardBrandRewardsTypes | null; program: string | null; categories: IAccountCardBrandRewardCategory[]; } export interface IAccountCardBrandQualifyingPeriod { value: number; - unit: string; - relative_to: string; + unit: TCardBrandQualifyingPeriodUnits; + relative_to: TCardBrandQualifyingPeriodReferences; } export interface IAccountCardBrandPromotion { - type: string | null; + type: TCardBrandPromotionTypes | null; title: string | null; description: string | null; value: number | null; - unit: string | null; + unit: TCardBrandPromotionValueUnits | null; spend_requirement: number | null; qualifying_period: IAccountCardBrandQualifyingPeriod | null; expiration: string | null; } export interface IAccountCardBrandDetails { - card_category: string | null; + card_category: TCardBrandCardCategories | null; purchase_apr_min: number | null; purchase_apr_max: number | null; cash_advance_apr_min: number | null; @@ -371,8 +473,8 @@ export interface IAccountCardBrandInfo { name: string; issuer?: string | null; network: string; - network_tier?: string; - type?: 'specific' | 'generic' | 'in_review' | null; + network_tier?: TCardBrandNetworkTiers; + type?: TCardBrandTypes | null; url: string; details: IAccountCardBrandDetails | null; } @@ -443,7 +545,7 @@ export interface IAccountSubscription { id: string; name: TAccountSubscriptionTypes; status: TAccountSubscriptionStatuses; - payload: any | null; + payload: IAccountSubscriptionPayload | null; latest_request_id: string | null; created_at: string; updated_at: string; @@ -462,8 +564,13 @@ export interface IAccountSubscriptionsResponse { credit_score?: IAccountSubscription; }; +export interface IAccountSubscriptionPayload { + attributes?: TAccountAttributeRequestScope; +}; + export interface IAccountSubscriptionCreateOpts { enroll: TAccountSubscriptionTypes; + payload?: IAccountSubscriptionPayload; }; export interface IAccountUpdate { @@ -704,8 +811,20 @@ export interface IAccountWithdrawConsentOpts { reason: 'holder_withdrew_consent' | null; }; -export const AccountAttributeNames = { +export const AccountAttributeBundles = { + wallet_intelligence: 'wallet_intelligence', + statement: 'statement', +} as const; + +export type TAccountAttributeBundles = typeof AccountAttributeBundles[keyof typeof AccountAttributeBundles]; + +export const StaticAccountAttributeNames = { type: 'type', +} as const; + +export type TStaticAccountAttributeNames = typeof StaticAccountAttributeNames[keyof typeof StaticAccountAttributeNames]; + +export const AccountAttributeNames = { usage_pattern: 'usage_pattern', delinquency_flag: 'delinquency_flag', utilization: 'utilization', @@ -715,28 +834,106 @@ export const AccountAttributeNames = { utilization_delta_60d: 'utilization_delta_60d', utilization_delta_90d: 'utilization_delta_90d', monthly_installments_estimate: 'monthly_installments_estimate', + heloc_utilization: 'heloc_utilization', + available_credit_limit: 'available_credit_limit', + available_loan_amount: 'available_loan_amount', + any_delinquent_flag: 'any_delinquent_flag', + serious_delinquent_flag: 'serious_delinquent_flag', + delinquency_recently_cured_flag: 'delinquency_recently_cured_flag', + delinquency_worst_dpd_bucket: 'delinquency_worst_dpd_bucket', + delinquency_progression_flag: 'delinquency_progression_flag', + delinquent_outcome: 'delinquent_outcome', + next_payment_due_date: 'next_payment_due_date', + next_payment_minimum_amount: 'next_payment_minimum_amount', + estimated_apr: 'estimated_apr', + utilization_bucket: 'utilization_bucket', + purchasing_power: 'purchasing_power', + account_age: 'account_age', + utilization_velocity_4_week: 'utilization_velocity_4_week', + utilization_velocity_8_week: 'utilization_velocity_8_week', + utilization_velocity_12_week: 'utilization_velocity_12_week', + weeks_since_last_activity: 'weeks_since_last_activity', + recent_balance_spike_flag: 'recent_balance_spike_flag', + spend_concentration_4_week: 'spend_concentration_4_week', + spend_concentration_8_week: 'spend_concentration_8_week', + spend_concentration_12_week: 'spend_concentration_12_week', + current_wallet_rank: 'current_wallet_rank', + brand_category: 'brand_category', + brand_tier: 'brand_tier', + enrolled_in_direct_pay_previously: 'enrolled_in_direct_pay_previously', + last_direct_pay_date: 'last_direct_pay_date', + last_direct_pay_amount: 'last_direct_pay_amount', + number_of_direct_pay_in_12_months: 'number_of_direct_pay_in_12_months', + ...StaticAccountAttributeNames, } as const; -export type TAccountAttributeNames = keyof typeof AccountAttributeNames; +export type TAccountAttributeNames = typeof AccountAttributeNames[keyof typeof AccountAttributeNames]; +export type TAccountRequestableAttributeNames = Exclude; export interface IAccountAttribute { value: T | null; error: IResourceError | null; + metadata: Record | null; } export interface IAccountAttributesType { type?: IAccountAttribute; usage_pattern?: IAccountAttribute; - delinquency_flag?: IAccountAttribute; + delinquency_flag?: IAccountAttribute; utilization?: IAccountAttribute; - utilization_trend_30d?: IAccountAttribute; - utilization_trend_90d?: IAccountAttribute; + utilization_trend_30d?: IAccountAttribute; + utilization_trend_90d?: IAccountAttribute; utilization_delta_30d?: IAccountAttribute; utilization_delta_60d?: IAccountAttribute; utilization_delta_90d?: IAccountAttribute; monthly_installments_estimate?: IAccountAttribute; + heloc_utilization?: IAccountAttribute; + available_credit_limit?: IAccountAttribute; + available_loan_amount?: IAccountAttribute; + any_delinquent_flag?: IAccountAttribute; + serious_delinquent_flag?: IAccountAttribute; + delinquency_recently_cured_flag?: IAccountAttribute; + delinquency_worst_dpd_bucket?: IAccountAttribute; + delinquency_progression_flag?: IAccountAttribute; + delinquent_outcome?: IAccountAttribute; + next_payment_due_date?: IAccountAttribute; + next_payment_minimum_amount?: IAccountAttribute; + estimated_apr?: IAccountAttribute; + utilization_bucket?: IAccountAttribute; + purchasing_power?: IAccountAttribute; + account_age?: IAccountAttribute; + utilization_velocity_4_week?: IAccountAttribute; + utilization_velocity_8_week?: IAccountAttribute; + utilization_velocity_12_week?: IAccountAttribute; + weeks_since_last_activity?: IAccountAttribute; + recent_balance_spike_flag?: IAccountAttribute; + spend_concentration_4_week?: IAccountAttribute; + spend_concentration_8_week?: IAccountAttribute; + spend_concentration_12_week?: IAccountAttribute; + current_wallet_rank?: IAccountAttribute; + brand_category?: IAccountAttribute; + brand_tier?: IAccountAttribute; + enrolled_in_direct_pay_previously?: IAccountAttribute; + last_direct_pay_date?: IAccountAttribute; + last_direct_pay_amount?: IAccountAttribute; + number_of_direct_pay_in_12_months?: IAccountAttribute; +} + +export interface IAccountAttributesCreateOpts { + requested_attributes?: TAccountRequestableAttributeNames[]; + bundles?: TAccountAttributeBundles[]; } +export type TAccountAttributeRequestScope = + | { + requested_attributes: TAccountRequestableAttributeNames[]; + bundles?: TAccountAttributeBundles[]; + } + | { + requested_attributes?: TAccountRequestableAttributeNames[]; + bundles: TAccountAttributeBundles[]; + }; + export interface IAccountAttributes { id: string; account_id: string; diff --git a/src/resources/Entity/Connect.ts b/src/resources/Entity/Connect.ts index 3f5af28..79b7555 100644 --- a/src/resources/Entity/Connect.ts +++ b/src/resources/Entity/Connect.ts @@ -1,6 +1,6 @@ import Resource, { IResourceListOpts, IRequestConfig } from '../../resource'; import Configuration, { IResponse } from '../../configuration'; -import type { IEntityConnect, TEntityConnectArtifactTypes } from './types'; +import type { IEntityConnect, TEntityConnectArtifactTypes, TEntityConnectFileBureaus } from './types'; export const AccountExpandableFields = { sensitive: 'sensitive', @@ -46,6 +46,7 @@ export interface IConnectCreateOpts { products?: AccountProduct[]; subscriptions?: AccountSubscription[]; artifacts?: TEntityConnectArtifactTypes[]; + bureau?: TEntityConnectFileBureaus; } From a85ddd5f771bb6543f411c6bcfd32dbb9a3e1ddf Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 09:03:26 -0400 Subject: [PATCH 3/7] final fixes --- src/resources/Account/Subscriptions.ts | 2 +- src/resources/Account/types.ts | 55 +++++++++++++++----------- src/resources/Entity/Connect.ts | 21 ++++++++-- src/resources/Entity/types.ts | 3 +- src/resources/Payment/types.ts | 5 ++- 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/src/resources/Account/Subscriptions.ts b/src/resources/Account/Subscriptions.ts index e180f4c..b4c8c38 100644 --- a/src/resources/Account/Subscriptions.ts +++ b/src/resources/Account/Subscriptions.ts @@ -46,7 +46,7 @@ export default class AccountSubscriptions extends Resource { */ async create(opts: IAccountSubscriptionCreateOpts | TAccountSubscriptionTypes) { - const data: IAccountSubscriptionCreateOpts = typeof opts === 'string' ? { enroll: opts } : opts; + const data = (typeof opts === 'string' ? { enroll: opts } : opts) as IAccountSubscriptionCreateOpts; return super._create, IAccountSubscriptionCreateOpts>(data); } diff --git a/src/resources/Account/types.ts b/src/resources/Account/types.ts index 29eda23..f34c88f 100644 --- a/src/resources/Account/types.ts +++ b/src/resources/Account/types.ts @@ -77,19 +77,24 @@ export interface IAccountProductListResponse { export const AccountSubscriptionTypes = { card_brand: 'card_brand', - payment_instrument: 'payment_instrument', 'payment_instrument.card': 'payment_instrument.card', 'payment_instrument.network_token': 'payment_instrument.network_token', transaction: 'transaction', update: 'update', update_snapshot: 'update.snapshot', attribute: 'attribute', - connect: 'connect', - credit_score: 'credit_score', } as const; export type TAccountSubscriptionTypes = typeof AccountSubscriptionTypes[keyof typeof AccountSubscriptionTypes]; +export const DeprecatedAccountSubscriptionTypes = { + payment_instrument: 'payment_instrument', +} as const; + +export type TDeprecatedAccountSubscriptionTypes = typeof DeprecatedAccountSubscriptionTypes[keyof typeof DeprecatedAccountSubscriptionTypes]; + +export type TAccountSubscriptionNames = TAccountSubscriptionTypes | TDeprecatedAccountSubscriptionTypes; + export const AccountOwnership = { primary: 'primary', authorized: 'authorized', @@ -423,38 +428,38 @@ export const CardBrandQualifyingPeriodReferences = { export type TCardBrandQualifyingPeriodReferences = typeof CardBrandQualifyingPeriodReferences[keyof typeof CardBrandQualifyingPeriodReferences]; export interface IAccountCardBrandRewardCategory { - category: TCardBrandRewardCategoryGroups | null; + category: string | null; category_presentable: string | null; rate: number | null; - unit: TCardBrandEarnRateUnits | null; + unit: string | null; cap: string | null; } export interface IAccountCardBrandRewards { - type: TCardBrandRewardsTypes | null; + type: string | null; program: string | null; categories: IAccountCardBrandRewardCategory[]; } export interface IAccountCardBrandQualifyingPeriod { value: number; - unit: TCardBrandQualifyingPeriodUnits; - relative_to: TCardBrandQualifyingPeriodReferences; + unit: string; + relative_to: string; } export interface IAccountCardBrandPromotion { - type: TCardBrandPromotionTypes | null; + type: string | null; title: string | null; description: string | null; value: number | null; - unit: TCardBrandPromotionValueUnits | null; + unit: string | null; spend_requirement: number | null; qualifying_period: IAccountCardBrandQualifyingPeriod | null; expiration: string | null; } export interface IAccountCardBrandDetails { - card_category: TCardBrandCardCategories | null; + card_category: string | null; purchase_apr_min: number | null; purchase_apr_max: number | null; cash_advance_apr_min: number | null; @@ -473,7 +478,7 @@ export interface IAccountCardBrandInfo { name: string; issuer?: string | null; network: string; - network_tier?: TCardBrandNetworkTiers; + network_tier?: string; type?: TCardBrandTypes | null; url: string; details: IAccountCardBrandDetails | null; @@ -543,7 +548,7 @@ export type TAccountSubscriptionStatuses = keyof typeof AccountSubscriptionStatu export interface IAccountSubscription { id: string; - name: TAccountSubscriptionTypes; + name: TAccountSubscriptionNames; status: TAccountSubscriptionStatuses; payload: IAccountSubscriptionPayload | null; latest_request_id: string | null; @@ -560,18 +565,20 @@ export interface IAccountSubscriptionsResponse { 'payment_instrument.card'?: IAccountSubscription; 'payment_instrument.network_token'?: IAccountSubscription; attribute?: IAccountSubscription; - connect?: IAccountSubscription; - credit_score?: IAccountSubscription; }; export interface IAccountSubscriptionPayload { attributes?: TAccountAttributeRequestScope; }; -export interface IAccountSubscriptionCreateOpts { - enroll: TAccountSubscriptionTypes; - payload?: IAccountSubscriptionPayload; -}; +export type IAccountSubscriptionCreateOpts = + | { + enroll: typeof AccountSubscriptionTypes.attribute; + payload?: IAccountSubscriptionPayload; + } + | { + enroll: Exclude; + }; export interface IAccountUpdate { id: string; @@ -872,8 +879,8 @@ export type TAccountRequestableAttributeNames = Exclude { value: T | null; - error: IResourceError | null; - metadata: Record | null; + error?: IResourceError | null; + metadata?: Record | null; } export interface IAccountAttributesType { @@ -1013,9 +1020,9 @@ export interface IAccount { liability?: IAccountLiability | null; products: TAccountProducts[]; restricted_products: TAccountProducts[]; - subscriptions?: TAccountSubscriptionTypes[]; - available_subscriptions?: TAccountSubscriptionTypes[]; - restricted_subscriptions?: TAccountSubscriptionTypes[]; + subscriptions?: TAccountSubscriptionNames[]; + available_subscriptions?: TAccountSubscriptionNames[]; + restricted_subscriptions?: TAccountSubscriptionNames[]; sensitive?: string | IAccountSensitive | null; balance?: string | IAccountBalance | null; card_brand?: string | IAccountCardBrand | null; diff --git a/src/resources/Entity/Connect.ts b/src/resources/Entity/Connect.ts index 79b7555..d240a86 100644 --- a/src/resources/Entity/Connect.ts +++ b/src/resources/Entity/Connect.ts @@ -24,6 +24,10 @@ export interface IExpandableOpts { export interface IConnectListOpts extends IResourceListOpts, IExpandableOpts {} +export interface IConnectRetrieveOpts extends IExpandableOpts { + include_raw_report?: boolean; +} + export const AccountProductsEligibleForAutomaticExecution = [ 'attribute', 'balance', @@ -42,13 +46,22 @@ export const AccountSubscriptionsEligibleForAutomaticExecution = [ export type AccountProduct = typeof AccountProductsEligibleForAutomaticExecution[number]; export type AccountSubscription = typeof AccountSubscriptionsEligibleForAutomaticExecution[number]; -export interface IConnectCreateOpts { +interface IConnectCreateOptsBase { products?: AccountProduct[]; subscriptions?: AccountSubscription[]; - artifacts?: TEntityConnectArtifactTypes[]; - bureau?: TEntityConnectFileBureaus; + include_raw_report?: boolean; } +export type IConnectCreateOpts = + | (IConnectCreateOptsBase & { + artifacts: TEntityConnectArtifactTypes[]; + bureau: TEntityConnectFileBureaus; + }) + | (IConnectCreateOptsBase & { + artifacts?: never; + bureau?: TEntityConnectFileBureaus; + }); + export default class EntityConnect extends Resource { constructor(config: Configuration) { @@ -63,7 +76,7 @@ export default class EntityConnect extends Resource { * @returns Returns a Connect object. */ - async retrieve(cxn_id: string, opts: IExpandableOpts = {}) { + async retrieve(cxn_id: string, opts: IConnectRetrieveOpts = {}) { return super._getWithSubPathAndParams>(cxn_id, opts); } diff --git a/src/resources/Entity/types.ts b/src/resources/Entity/types.ts index 9a8613c..7acdfab 100644 --- a/src/resources/Entity/types.ts +++ b/src/resources/Entity/types.ts @@ -144,6 +144,7 @@ export interface IEntityConnect { requested_products: TAccountProducts[]; requested_subscriptions: TAccountSubscriptionTypes[]; files: IEntityConnectFile[]; + credit_reports?: Record | null; error: IResourceError | null; created_at: string; updated_at: string; @@ -496,7 +497,7 @@ export type TEntitySubscriptionStatuses = keyof typeof EntitySubscriptionStatuse export interface IEntitySubscriptionPayload { attributes?: { - requested_attributes?: TEntityRequestableAttributeNames[]; + requested_attributes?: TEntityAttributeNames[]; bundles?: TEntityAttributeBundles[]; version?: 'v1' | 'v2'; } | null; diff --git a/src/resources/Payment/types.ts b/src/resources/Payment/types.ts index 836d627..450ab47 100644 --- a/src/resources/Payment/types.ts +++ b/src/resources/Payment/types.ts @@ -12,6 +12,8 @@ export const PaymentStatuses = { reversal_processing: 'reversal_processing', settled: 'settled', cashed: 'cashed', + error: 'error', + returned: 'returned', } as const; export type TPaymentStatuses = keyof typeof PaymentStatuses; @@ -38,7 +40,6 @@ export type TPaymentTypes = keyof typeof PaymentTypes; export const PaymentFeeTypes = { total: 'total', - markup: 'markup', } as const; export type TPaymentFeeTypes = keyof typeof PaymentFeeTypes; @@ -74,7 +75,7 @@ export interface IPayment { destination_posted_date: string | null; source_status: TPaymentStatuses; destination_status: TPaymentStatuses; - destination_payment_method?: TPaymentDestinationPaymentMethods | null; + destination_payment_method?: TPaymentDestinationPaymentMethods; fee: IPaymentFee | null; idempotency_key?: string | null; payment_instrument?: string | null; From 237b7c2642568ef6e173118db78ab975922d8f66 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 09:39:05 -0400 Subject: [PATCH 4/7] final sdk fixes --- index.ts | 2 +- src/resources/Account/Attributes.ts | 1 - src/resources/Account/Subscriptions.ts | 1 - src/resources/Account/types.ts | 129 +++++-------------------- src/resources/Entity/Attributes.ts | 1 - src/resources/Entity/types.ts | 6 +- src/resources/Payment/types.ts | 26 +++-- test/resources/Account.tests.ts | 19 ++++ test/resources/Payment.tests.ts | 47 +++++++++ 9 files changed, 111 insertions(+), 121 deletions(-) diff --git a/index.ts b/index.ts index 589c130..103e470 100644 --- a/index.ts +++ b/index.ts @@ -4,6 +4,6 @@ export { Environments } from './src/configuration'; export { AccountTypes } from './src/resources/Account'; export { ElementTypes } from './src/resources/Element'; export { EntityTypes, EntityStatuses } from './src/resources/Entity'; -export { PaymentFundStatuses, PaymentStatuses } from './src/resources/Payment'; +export { PaymentDirectionStatuses, PaymentFundStatuses, PaymentStatuses } from './src/resources/Payment'; export { ReportTypes, ReportStatuses } from './src/resources/Report'; export { WebhookTypes } from './src/resources/Webhook'; diff --git a/src/resources/Account/Attributes.ts b/src/resources/Account/Attributes.ts index e4b1f49..c73d9c0 100644 --- a/src/resources/Account/Attributes.ts +++ b/src/resources/Account/Attributes.ts @@ -34,7 +34,6 @@ export default class AccountAttributes extends Resource { * Creates a new Attributes request to retrieve the Account’s attributes. * https://docs.methodfi.com/reference/accounts/attributes/create * - * @param opts Attributes or bundles to request. Omit to request the full set. * @returns Returns an Account’s Attributes object. */ diff --git a/src/resources/Account/Subscriptions.ts b/src/resources/Account/Subscriptions.ts index b4c8c38..5db72f8 100644 --- a/src/resources/Account/Subscriptions.ts +++ b/src/resources/Account/Subscriptions.ts @@ -41,7 +41,6 @@ export default class AccountSubscriptions extends Resource { * * Note: Subscription requests are processed individually, meaning the success or failure of one subscription does not affect others. The response object will detail any errors encountered. * - * @param opts A Subscription name, or an IAccountSubscriptionCreateOpts object. * @returns Returns a map of Subscription name to Subscription object. */ diff --git a/src/resources/Account/types.ts b/src/resources/Account/types.ts index f34c88f..4e3a416 100644 --- a/src/resources/Account/types.ts +++ b/src/resources/Account/types.ts @@ -318,115 +318,13 @@ export interface IAccountCardBrand { account_id: string; brands: IAccountCardBrandInfo[]; source: 'method' | 'network' | null; - status: 'completed' | 'in_progress' | 'failed'; + status: 'completed' | 'pending' | 'in_progress' | 'failed'; shared: boolean; error: IResourceError | null; created_at: string; updated_at: string; } -export const CardBrandNetworkTiers = { - standard: 'standard', - unknown: 'unknown', - platinum: 'platinum', - signature: 'signature', - infinite: 'infinite', - business: 'business', - signature_business: 'signature business', - world: 'world', - world_elite: 'world elite', - world_elite_business: 'world elite business', -} as const; - -export type TCardBrandNetworkTiers = typeof CardBrandNetworkTiers[keyof typeof CardBrandNetworkTiers]; - -export const CardBrandTypes = { - generic: 'generic', - specific: 'specific', - merged: 'merged', - in_review: 'in_review', -} as const; - -export type TCardBrandTypes = typeof CardBrandTypes[keyof typeof CardBrandTypes]; - -export const CardBrandCardCategories = { - travel: 'travel', - cash_back: 'cash_back', - store: 'store', - credit_builder: 'credit_builder', - basic: 'basic', - dining: 'dining', -} as const; - -export type TCardBrandCardCategories = typeof CardBrandCardCategories[keyof typeof CardBrandCardCategories]; - -export const CardBrandRewardsTypes = { - cash_back: 'cash_back', - points: 'points', - miles: 'miles', - discount: 'discount', - none: 'none', -} as const; - -export type TCardBrandRewardsTypes = typeof CardBrandRewardsTypes[keyof typeof CardBrandRewardsTypes]; - -export const CardBrandRewardCategoryGroups = { - travel: 'travel', - dining: 'dining', - groceries: 'groceries', - gas: 'gas', - streaming: 'streaming', - store: 'store', - base_rate: 'base_rate', - other: 'other', -} as const; - -export type TCardBrandRewardCategoryGroups = typeof CardBrandRewardCategoryGroups[keyof typeof CardBrandRewardCategoryGroups]; - -export const CardBrandEarnRateUnits = { - percent: 'percent', - points_per_dollar: 'points_per_dollar', - miles_per_dollar: 'miles_per_dollar', -} as const; - -export type TCardBrandEarnRateUnits = typeof CardBrandEarnRateUnits[keyof typeof CardBrandEarnRateUnits]; - -export const CardBrandPromotionTypes = { - sign_up_bonus: 'sign_up_bonus', - intro_apr: 'intro_apr', - partner_promo: 'partner_promo', - statement_credit: 'statement_credit', - referral_bonus: 'referral_bonus', - deferred_interest: 'deferred_interest', - co_brand_promo: 'co_brand_promo', - bonus_rewards: 'bonus_rewards', - other: 'other', -} as const; - -export type TCardBrandPromotionTypes = typeof CardBrandPromotionTypes[keyof typeof CardBrandPromotionTypes]; - -export const CardBrandPromotionValueUnits = { - points: 'points', - miles: 'miles', - percent: 'percent', - cents: 'cents', -} as const; - -export type TCardBrandPromotionValueUnits = typeof CardBrandPromotionValueUnits[keyof typeof CardBrandPromotionValueUnits]; - -export const CardBrandQualifyingPeriodUnits = { - months: 'months', - days: 'days', -} as const; - -export type TCardBrandQualifyingPeriodUnits = typeof CardBrandQualifyingPeriodUnits[keyof typeof CardBrandQualifyingPeriodUnits]; - -export const CardBrandQualifyingPeriodReferences = { - account_opening: 'account_opening', -} as const; - -export type TCardBrandQualifyingPeriodReferences = typeof CardBrandQualifyingPeriodReferences[keyof typeof CardBrandQualifyingPeriodReferences]; - export interface IAccountCardBrandRewardCategory { category: string | null; category_presentable: string | null; @@ -479,7 +377,7 @@ export interface IAccountCardBrandInfo { issuer?: string | null; network: string; network_tier?: string; - type?: TCardBrandTypes | null; + type?: string | null; url: string; details: IAccountCardBrandDetails | null; } @@ -831,6 +729,17 @@ export const StaticAccountAttributeNames = { export type TStaticAccountAttributeNames = typeof StaticAccountAttributeNames[keyof typeof StaticAccountAttributeNames]; +export const LegacyAccountAttributeNames = { + debt_settlement: 'debt_settlement', + interest_estimate_min: 'interest_estimate_min', + interest_estimate_max: 'interest_estimate_max', + account_standing: 'account_standing', + delinquent_period: 'delinquent_period', + delinquent_amount: 'delinquent_amount', +} as const; + +export type TLegacyAccountAttributeNames = typeof LegacyAccountAttributeNames[keyof typeof LegacyAccountAttributeNames]; + export const AccountAttributeNames = { usage_pattern: 'usage_pattern', delinquency_flag: 'delinquency_flag', @@ -871,11 +780,15 @@ export const AccountAttributeNames = { last_direct_pay_date: 'last_direct_pay_date', last_direct_pay_amount: 'last_direct_pay_amount', number_of_direct_pay_in_12_months: 'number_of_direct_pay_in_12_months', + ...LegacyAccountAttributeNames, ...StaticAccountAttributeNames, } as const; export type TAccountAttributeNames = typeof AccountAttributeNames[keyof typeof AccountAttributeNames]; -export type TAccountRequestableAttributeNames = Exclude; +export type TAccountRequestableAttributeNames = Exclude< + TAccountAttributeNames, + TStaticAccountAttributeNames | TLegacyAccountAttributeNames +>; export interface IAccountAttribute { value: T | null; @@ -924,6 +837,12 @@ export interface IAccountAttributesType { last_direct_pay_date?: IAccountAttribute; last_direct_pay_amount?: IAccountAttribute; number_of_direct_pay_in_12_months?: IAccountAttribute; + debt_settlement?: IAccountAttribute; + interest_estimate_min?: IAccountAttribute; + interest_estimate_max?: IAccountAttribute; + account_standing?: IAccountAttribute; + delinquent_period?: IAccountAttribute; + delinquent_amount?: IAccountAttribute; } export interface IAccountAttributesCreateOpts { diff --git a/src/resources/Entity/Attributes.ts b/src/resources/Entity/Attributes.ts index e154f72..c612aa0 100644 --- a/src/resources/Entity/Attributes.ts +++ b/src/resources/Entity/Attributes.ts @@ -34,7 +34,6 @@ export default class EntityAttributes extends Resource { * Creates a new Attributes request to retrieve the Entity’s attributes. * https://docs.methodfi.com/reference/entities/attributes/create * - * @param opts Attributes or bundles to request. Omit to request the full set. * @returns Returns an Entity’s Attributes object. */ diff --git a/src/resources/Entity/types.ts b/src/resources/Entity/types.ts index 7acdfab..cd6179e 100644 --- a/src/resources/Entity/types.ts +++ b/src/resources/Entity/types.ts @@ -3,7 +3,7 @@ import type { TResourceStatus, IResourceListOpts, } from '../../resource'; -import { TAccountProducts, TAccountSubscriptionTypes } from '../Account'; +import type { IAccount, TAccountProducts, TAccountSubscriptionTypes } from '../Account'; export const CreditReportBureaus = { experian: 'experian', @@ -140,7 +140,7 @@ export interface IEntityConnect { id: string; entity_id: string; status: TResourceStatus; - accounts: string[] | null; + accounts: (string | IAccount)[] | null; requested_products: TAccountProducts[]; requested_subscriptions: TAccountSubscriptionTypes[]; files: IEntityConnectFile[]; @@ -285,8 +285,6 @@ export interface IEntityAttributesType { credit_health_entity_delinquent?: ICreditHealthAttribute; } -// These v1 attributes can still appear on historical responses, but the v2 -// 2026-03-30 create validators do not accept them as requested_attributes. export const LegacyEntityAttributeNames = { credit_health_credit_card_usage: 'credit_health_credit_card_usage', credit_health_derogatory_marks: 'credit_health_derogatory_marks', diff --git a/src/resources/Payment/types.ts b/src/resources/Payment/types.ts index 450ab47..d9c8f8a 100644 --- a/src/resources/Payment/types.ts +++ b/src/resources/Payment/types.ts @@ -12,14 +12,24 @@ export const PaymentStatuses = { reversal_processing: 'reversal_processing', settled: 'settled', cashed: 'cashed', +} as const; + +export type TPaymentStatuses = keyof typeof PaymentStatuses; + +export const PaymentDirectionStatuses = { + pending: 'pending', + canceled: 'canceled', + processing: 'processing', + sent: 'sent', + posted: 'posted', + cashed: 'cashed', error: 'error', returned: 'returned', } as const; -export type TPaymentStatuses = keyof typeof PaymentStatuses; +export type TPaymentDirectionStatuses = keyof typeof PaymentDirectionStatuses; export const PaymentFundStatuses = { - hold: 'hold', pending: 'pending', requested: 'requested', clearing: 'clearing', @@ -64,7 +74,7 @@ export interface IPayment { source: string; destination: string; amount: number; - description: string; + description: string | null; status: TPaymentStatuses; fund_status?: TPaymentFundStatuses; error: IResourceError | null; @@ -73,13 +83,13 @@ export interface IPayment { source_settlement_date: string | null; destination_settlement_date: string | null; destination_posted_date: string | null; - source_status: TPaymentStatuses; - destination_status: TPaymentStatuses; + source_status: TPaymentDirectionStatuses | null; + destination_status: TPaymentDirectionStatuses | null; destination_payment_method?: TPaymentDestinationPaymentMethods; fee: IPaymentFee | null; - idempotency_key?: string | null; - payment_instrument?: string | null; - reversal_account?: string | null; + idempotency_key: string | null; + payment_instrument: string | null; + reversal_account: string | null; type: TPaymentTypes; created_at: string; updated_at: string; diff --git a/test/resources/Account.tests.ts b/test/resources/Account.tests.ts index e9d00d6..2e68c98 100644 --- a/test/resources/Account.tests.ts +++ b/test/resources/Account.tests.ts @@ -4,6 +4,8 @@ import { client } from '../config'; import { awaitResults } from '../utils'; import type { IEntity, IEntityConnect } from '../../src/resources/Entity'; import { + AccountAttributeNames, + LegacyAccountAttributeNames, type IAccount, type IAccountBalance, type IAccountCardBrand, @@ -24,6 +26,23 @@ import { IResponse } from '../../src/configuration'; should(); +describe('Account public attribute names', () => { + it('should expose legacy response-only attribute names', () => { + Object.keys(LegacyAccountAttributeNames).sort().should.be.eql([ + 'account_standing', + 'debt_settlement', + 'delinquent_amount', + 'delinquent_period', + 'interest_estimate_max', + 'interest_estimate_min', + ].sort()); + + Object.values(LegacyAccountAttributeNames).forEach((name) => { + AccountAttributeNames.should.have.property(name, name); + }); + }); +}); + describe('Accounts - core methods tests', () => { let holder_1_response: IResponse; let holder_connect_response: IResponse; diff --git a/test/resources/Payment.tests.ts b/test/resources/Payment.tests.ts index ed65941..7c2f30d 100644 --- a/test/resources/Payment.tests.ts +++ b/test/resources/Payment.tests.ts @@ -3,11 +3,58 @@ import { describe } from 'mocha'; import { client } from '../config'; import type { IEntity } from '../../src/resources/Entity'; import type { IAccount } from '../../src/resources/Account'; +import { + PaymentDirectionStatuses, + PaymentFundStatuses, + PaymentStatuses, +} from '../../src/resources/Payment'; import type { IPayment } from '../../src/resources/Payment'; import { IResponse } from '../../src/configuration'; +import { PaymentDirectionStatuses as RootPaymentDirectionStatuses } from '../../index'; should(); +describe('Payment public response statuses', () => { + it('should expose only statuses serialized by Octo for each public field', () => { + RootPaymentDirectionStatuses.should.equal(PaymentDirectionStatuses); + + Object.keys(PaymentStatuses).sort().should.be.eql([ + 'canceled', + 'cashed', + 'failed', + 'pending', + 'posted', + 'processing', + 'reversal_processing', + 'reversal_required', + 'reversed', + 'sent', + 'settled', + ].sort()); + + Object.keys(PaymentDirectionStatuses).sort().should.be.eql([ + 'canceled', + 'cashed', + 'error', + 'pending', + 'posted', + 'processing', + 'returned', + 'sent', + ].sort()); + + Object.keys(PaymentFundStatuses).sort().should.be.eql([ + 'clearing', + 'failed', + 'pending', + 'posted', + 'requested', + 'sent', + 'unknown', + ].sort()); + }); +}); + describe('Payments - core methods tests', () => { let holder_1_response: IResponse; let source_1_response: IResponse; From 4eadc07226f3e50d85429ad2db597fea4e8b8982 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 09:44:44 -0400 Subject: [PATCH 5/7] fix --- src/resources/Payment/types.ts | 2 -- test/resources/Payment.tests.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/resources/Payment/types.ts b/src/resources/Payment/types.ts index d9c8f8a..2e3a9a2 100644 --- a/src/resources/Payment/types.ts +++ b/src/resources/Payment/types.ts @@ -11,7 +11,6 @@ export const PaymentStatuses = { reversal_required: 'reversal_required', reversal_processing: 'reversal_processing', settled: 'settled', - cashed: 'cashed', } as const; export type TPaymentStatuses = keyof typeof PaymentStatuses; @@ -23,7 +22,6 @@ export const PaymentDirectionStatuses = { sent: 'sent', posted: 'posted', cashed: 'cashed', - error: 'error', returned: 'returned', } as const; diff --git a/test/resources/Payment.tests.ts b/test/resources/Payment.tests.ts index 7c2f30d..7ab2e61 100644 --- a/test/resources/Payment.tests.ts +++ b/test/resources/Payment.tests.ts @@ -20,7 +20,6 @@ describe('Payment public response statuses', () => { Object.keys(PaymentStatuses).sort().should.be.eql([ 'canceled', - 'cashed', 'failed', 'pending', 'posted', @@ -35,7 +34,6 @@ describe('Payment public response statuses', () => { Object.keys(PaymentDirectionStatuses).sort().should.be.eql([ 'canceled', 'cashed', - 'error', 'pending', 'posted', 'processing', From 69dfedea0d4a40d9c230fa0bcee173f83fd66d14 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 10:19:22 -0400 Subject: [PATCH 6/7] bump ver --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8246e09..436ec55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "method-node", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "method-node", - "version": "3.0.0", + "version": "3.0.1", "license": "ISC", "dependencies": { "axios": "^1.7.4", diff --git a/package.json b/package.json index fe080e8..dd3e2de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "method-node", - "version": "3.0.0", + "version": "3.0.1", "description": "Node.js library for the Method API", "main": "dist/index.ts", "module": "dist/index.mjs", From c668b9ec30ed3f11ca16b91cbc3f8271d364abd7 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 10:54:35 -0400 Subject: [PATCH 7/7] bump to 3.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 436ec55..1d9c151 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "method-node", - "version": "3.0.1", + "version": "3.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "method-node", - "version": "3.0.1", + "version": "3.1.0", "license": "ISC", "dependencies": { "axios": "^1.7.4", diff --git a/package.json b/package.json index dd3e2de..fb469bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "method-node", - "version": "3.0.1", + "version": "3.1.0", "description": "Node.js library for the Method API", "main": "dist/index.ts", "module": "dist/index.mjs",