Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "method-node",
"version": "1.1.13",
"version": "1.1.14",
"description": "Node.js library for the Method API",
"main": "dist/index.ts",
"module": "dist/index.mjs",
Expand Down
1 change: 1 addition & 0 deletions src/resources/Account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ export interface IAccountSubscription {
id: string;
name: TAccountSubscriptionTypes;
status: TAccountSubscriptionStatuses;
payload: any | null;
latest_request_id: string | null;
created_at: string;
updated_at: string;
Expand Down
6 changes: 3 additions & 3 deletions src/resources/Entity/Attributes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Resource, { IResourceListOpts } from '../../resource';
import Configuration, { IResponse } from '../../configuration';
import type { IEntityAttributes } from './types';
import type { IEntityAttributes, IEntityAttributesCreateOpts } from './types';

export default class EntityAttributes extends Resource {
constructor(config: Configuration) {
Expand Down Expand Up @@ -34,7 +34,7 @@ export default class EntityAttributes extends Resource {
* @returns Returns an Entity’s Attributes object.
*/

async create() {
return super._create<IResponse<IEntityAttributes>, {}>({});
async create(opts: IEntityAttributesCreateOpts) {
return super._create<IResponse<IEntityAttributes>, IEntityAttributesCreateOpts>(opts);
}
};
4 changes: 2 additions & 2 deletions src/resources/Entity/Subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default class EntitySubscriptions extends Resource {
* @returns Returns a map of Subscription name to either Subscription object or Error.
*/

async create(sub_name: TEntitySubscriptionNames, requestConfig?: IRequestConfig) {
return super._create<IResponse<IEntitySubscription>, IEntitySubscriptionCreateOpts>({ enroll: sub_name }, requestConfig);
async create(opts: IEntitySubscriptionCreateOpts, requestConfig?: IRequestConfig) {
return super._create<IResponse<IEntitySubscription>, IEntitySubscriptionCreateOpts>(opts, requestConfig);
}

/**
Expand Down
39 changes: 38 additions & 1 deletion src/resources/Entity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,49 @@ export interface IEntityCreditScores {
updated_at: string,
};

export type TCreditHealthAttributeRating = 'excellent' | 'good' | 'fair' | 'needs_work';
export const CreditHealthAttributeRatings = {
excellent: 'excellent',
good: 'good',
fair: 'fair',
needs_work: 'needs_work',
} as const;

export type TCreditHealthAttributeRating = keyof typeof CreditHealthAttributeRatings;

export interface ICreditHealthAttribute {
value: number;
rating: TCreditHealthAttributeRating;
metadata?: {} | null;
}

export interface IEntityAttributesType {
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;
}

export const EntityAttributeNames = {
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 TEntityAttributeNames = keyof typeof EntityAttributeNames;

export interface IEntityAttributesCreateOpts {
attributes: TEntityAttributeNames[];
}

export interface IEntityAttributes {
Expand Down Expand Up @@ -263,10 +291,17 @@ export const EntitySubscriptionStatuses = {

export type TEntitySubscriptionStatuses = keyof typeof EntitySubscriptionStatuses;

export interface IEntitySubscriptionPayload {
attributes?: {
requested_attributes: TEntityAttributeNames[];
} | null;
};

export interface IEntitySubscription {
id: string;
name: TEntitySubscriptionNames;
status: TEntitySubscriptionStatuses;
payload: IEntitySubscriptionPayload | null;
latest_request_id: string | null;
created_at: string;
updated_at: string;
Expand All @@ -275,10 +310,12 @@ export interface IEntitySubscription {
export interface IEntitySubscriptionResponse {
connect?: IEntitySubscription;
credit_score?: IEntitySubscription;
attribute?: IEntitySubscription;
};

export interface IEntitySubscriptionCreateOpts {
enroll: TEntitySubscriptionNames;
payload?: IEntitySubscriptionPayload;
};

export const EntityVerificationSessionStatuses = {
Expand Down
18 changes: 14 additions & 4 deletions test/resources/Account.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('Accounts - core methods tests', () => {
mask: '8721',
ownership: 'unknown',
type: 'credit_card',
name: 'Chase Sapphire Reserve'
name: 'Chase Credit Card'
},
latest_verification_session: accounts_create_liability_response.latest_verification_session,
balance: null,
Expand Down Expand Up @@ -638,6 +638,7 @@ describe('Accounts - core methods tests', () => {
id: create_txn_subscriptions_response.id,
name: 'transaction',
status: 'active',
payload: null,
latest_request_id: null,
created_at: create_txn_subscriptions_response.created_at,
updated_at: create_txn_subscriptions_response.updated_at
Expand All @@ -656,6 +657,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_subscriptions_response.id,
name: 'update',
status: 'active',
payload: null,
latest_request_id: null,
created_at: create_update_subscriptions_response.created_at,
updated_at: create_update_subscriptions_response.updated_at
Expand All @@ -674,6 +676,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_snapshot_subscriptions_response.id,
name: 'update.snapshot',
status: 'active',
payload: null,
latest_request_id: null,
created_at: create_update_snapshot_subscriptions_response.created_at,
updated_at: create_update_snapshot_subscriptions_response.updated_at
Expand Down Expand Up @@ -703,6 +706,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_subscriptions_response.id,
name: 'update',
status: 'active',
payload: null,
latest_request_id: null,
created_at: subscriptions_response.update?.created_at || '',
updated_at: subscriptions_response.update?.updated_at || ''
Expand All @@ -714,6 +718,7 @@ describe('Accounts - core methods tests', () => {
id: create_txn_subscriptions_response.id,
name: 'transaction',
status: 'active',
payload: null,
latest_request_id: null,
created_at: subscriptions_transactions_response.transaction?.created_at || '',
updated_at: subscriptions_transactions_response.transaction?.updated_at || ''
Expand All @@ -725,6 +730,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_snapshot_subscriptions_response.id,
name: 'update.snapshot',
status: 'active',
payload: null,
latest_request_id: null,
created_at: subscriptions_update_snapshot_response['update.snapshot']?.created_at || '',
updated_at: subscriptions_update_snapshot_response['update.snapshot']?.updated_at || ''
Expand All @@ -746,6 +752,7 @@ describe('Accounts - core methods tests', () => {
id: create_txn_subscriptions_response.id,
name: 'transaction',
status: 'active',
payload: null,
latest_request_id: null,
created_at: retrieve_subscriptions_response.created_at,
updated_at: retrieve_subscriptions_response.updated_at
Expand All @@ -764,6 +771,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_subscriptions_response.id,
name: 'update',
status: 'active',
payload: null,
latest_request_id: null,
created_at: retrieve_subscriptions_response.created_at,
updated_at: retrieve_subscriptions_response.updated_at
Expand All @@ -782,6 +790,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_snapshot_subscriptions_response.id,
name: 'update.snapshot',
status: 'active',
payload: null,
latest_request_id: null,
created_at: retrieve_subscriptions_response.created_at,
updated_at: retrieve_subscriptions_response.updated_at
Expand All @@ -800,6 +809,7 @@ describe('Accounts - core methods tests', () => {
id: create_update_snapshot_subscriptions_response.id,
name: 'update.snapshot',
status: 'inactive',
payload: null,
latest_request_id: null,
created_at: delete_subscriptions_response.created_at,
updated_at: delete_subscriptions_response.updated_at
Expand Down Expand Up @@ -939,7 +949,7 @@ describe('Accounts - core methods tests', () => {
credit_limit: 2800000,
usage_pattern: null
},
data_as_of: null,
data_as_of: retrieve_updates_response.data_as_of,
error: null,
created_at: retrieve_updates_response.created_at,
updated_at: retrieve_updates_response.updated_at
Expand Down Expand Up @@ -975,7 +985,7 @@ describe('Accounts - core methods tests', () => {
credit_limit: 2800000,
usage_pattern: null
},
data_as_of: null,
data_as_of: update_to_check?.data_as_of || null,
error: null,
created_at: update_to_check?.created_at || '',
updated_at: update_to_check?.updated_at || ''
Expand Down Expand Up @@ -1110,7 +1120,7 @@ describe('Accounts - core methods tests', () => {
status: 'available',
status_error: null,
latest_request_id: accounts_retrieve_product_list_response.card_brand?.latest_request_id || null,
is_subscribable: false,
is_subscribable: true,
created_at: accounts_retrieve_product_list_response.card_brand?.created_at || '',
updated_at: accounts_retrieve_product_list_response.card_brand?.updated_at || ''
},
Expand Down
Loading