Skip to content

Conversation

@rezabrizi
Copy link
Contributor

Support automatic execution of valid products / subscriptions on POST Connect
Support recursive expansion of fields in all Connect endpoints

@rezabrizi rezabrizi requested review from ossiggy and sbilalh June 12, 2025 16:09
@rezabrizi rezabrizi self-assigned this Jun 12, 2025
@rezabrizi rezabrizi merged commit 69746cf into master Jun 12, 2025
4 checks passed
Comment on lines +5 to +38
export const AccountExpandableFields = {
sensitive: 'sensitive',
balance: 'balance',
card_brand: 'card_brand',
attribute: 'attribute',
payoff: 'payoff',
transaction: 'transaction',
update: 'update',
payment_instrument: 'payment_instrument',
latest_verification_session: 'latest_verification_session',
} as const;

type AccountExpandableField = typeof AccountExpandableFields[keyof typeof AccountExpandableFields];

export interface IExpandableOpts {
expand?: AccountExpandableField[];
}

export interface IConnectListOpts extends IResourceListOpts, IExpandableOpts {}

export const AccountProductsEligibleForAutomaticExecution = [
'account_attribute',
'balance',
'card_brand',
'update',
'payoff',
] as const;

export const AccountSubscriptionsEligibleForAutomaticExecution = [
'card_brand',
'update',
'update.snapshot',
'transaction',
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These already exist in the resources/Account/types.ts file. We should only maintain them in one location.

Comment on lines +323 to +340
expect(card_retrieve_response.id).to.equal(card_create_response.id);
expect(card_retrieve_response.account_id).to.equal(test_credit_card_account.id);
expect(card_retrieve_response.network).to.equal('visa');
expect(card_retrieve_response.status).to.equal('completed');
expect(card_retrieve_response.issuer).to.equal(card_create_response.issuer);
expect(card_retrieve_response.last4).to.equal('1580');
expect(card_retrieve_response.shared).to.equal(false);
expect(card_retrieve_response.source).to.equal('network');
expect(card_retrieve_response.error).to.be.null;
expect(card_retrieve_response.created_at).to.be.a('string');
expect(card_retrieve_response.updated_at).to.be.a('string');

const brand = card_retrieve_response.brands?.[0];
expect(brand).to.exist;
expect(brand.id).to.equal('brand_UBwVzXjpP4PJ6');
expect(brand.name).to.equal('Chase Sapphire Reserve');
expect(brand.url).to.equal('https://static.methodfi.com/card_brands/1b7ccaba6535cb837f802d968add4700.png');
expect(brand.art_id).to.be.a('string').and.match(/^art_/);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason you want to do it this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants