Skip to content

Commit

Permalink
feat(api)!: updates (#421)
Browse files Browse the repository at this point in the history
Set of changes to take in account the latest version of Lithic API.
# Migration
We are removing types that haven't been used by the Lithic API. There isn't a migration step per-se, these types were present in the OpenAPI spec but not actively used by the API.
feat(api)!: remove unused event type 'statement.created'
feat(api): add 'reverse' method for book transfers
feat(api): add field 'trace numbers' to payment method attribute model
feat(api)!: remove unused business account type
feat(api)!: remove unused embed request params type
  • Loading branch information
stainless-app[bot] committed Jun 21, 2024
1 parent 6343e38 commit 681824f
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 113
configured_endpoints: 114
3 changes: 1 addition & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Types:

- <code><a href="./src/resources/accounts.ts">Account</a></code>
- <code><a href="./src/resources/accounts.ts">AccountSpendLimits</a></code>
- <code><a href="./src/resources/accounts.ts">BusinessAccount</a></code>

Methods:

Expand Down Expand Up @@ -115,7 +114,6 @@ Types:

- <code><a href="./src/resources/cards/cards.ts">Card</a></code>
- <code><a href="./src/resources/cards/cards.ts">CardSpendLimits</a></code>
- <code><a href="./src/resources/cards/cards.ts">EmbedRequestParams</a></code>
- <code><a href="./src/resources/cards/cards.ts">SpendLimitDuration</a></code>
- <code><a href="./src/resources/cards/cards.ts">CardEmbedResponse</a></code>
- <code><a href="./src/resources/cards/cards.ts">CardProvisionResponse</a></code>
Expand Down Expand Up @@ -453,3 +451,4 @@ Methods:
- <code title="post /book_transfers">client.bookTransfers.<a href="./src/resources/book-transfers.ts">create</a>({ ...params }) -> BookTransferResponse</code>
- <code title="get /book_transfers/{book_transfer_token}">client.bookTransfers.<a href="./src/resources/book-transfers.ts">retrieve</a>(bookTransferToken) -> BookTransferResponse</code>
- <code title="get /book_transfers">client.bookTransfers.<a href="./src/resources/book-transfers.ts">list</a>({ ...params }) -> BookTransferResponsesCursorPage</code>
- <code title="post /book_transfers/{book_transfer_token}/reverse">client.bookTransfers.<a href="./src/resources/book-transfers.ts">reverse</a>(bookTransferToken, { ...params }) -> BookTransferResponse</code>
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ export namespace Lithic {
export import Accounts = API.Accounts;
export import Account = API.Account;
export import AccountSpendLimits = API.AccountSpendLimits;
export import BusinessAccount = API.BusinessAccount;
export import AccountsCursorPage = API.AccountsCursorPage;
export import AccountUpdateParams = API.AccountUpdateParams;
export import AccountListParams = API.AccountListParams;
Expand Down Expand Up @@ -307,7 +306,6 @@ export namespace Lithic {
export import Cards = API.Cards;
export import Card = API.Card;
export import CardSpendLimits = API.CardSpendLimits;
export import EmbedRequestParams = API.EmbedRequestParams;
export import SpendLimitDuration = API.SpendLimitDuration;
export import CardEmbedResponse = API.CardEmbedResponse;
export import CardProvisionResponse = API.CardProvisionResponse;
Expand Down Expand Up @@ -453,6 +451,7 @@ export namespace Lithic {
export import BookTransferResponsesCursorPage = API.BookTransferResponsesCursorPage;
export import BookTransferCreateParams = API.BookTransferCreateParams;
export import BookTransferListParams = API.BookTransferListParams;
export import BookTransferReverseParams = API.BookTransferReverseParams;

export import Address = API.Address;
export import Carrier = API.Carrier;
Expand Down
34 changes: 0 additions & 34 deletions src/resources/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,39 +263,6 @@ export namespace AccountSpendLimits {
}
}

export interface BusinessAccount {
/**
* Account token
*/
token: string;

collections_configuration?: BusinessAccount.CollectionsConfiguration;

/**
* Credit limit extended to the Account
*/
credit_limit?: number;
}

export namespace BusinessAccount {
export interface CollectionsConfiguration {
/**
* Number of days within the billing period
*/
billing_period: number;

/**
* Number of days after the billing period ends that a payment is required
*/
payment_period: number;

/**
* The external bank account token to use for auto-collections
*/
external_bank_account_token?: string;
}
}

export interface AccountUpdateParams {
/**
* Amount (in cents) for the account's daily spend limit. By default the daily
Expand Down Expand Up @@ -369,7 +336,6 @@ export interface AccountListParams extends CursorPageParams {
export namespace Accounts {
export import Account = AccountsAPI.Account;
export import AccountSpendLimits = AccountsAPI.AccountSpendLimits;
export import BusinessAccount = AccountsAPI.BusinessAccount;
export import AccountsCursorPage = AccountsAPI.AccountsCursorPage;
export import AccountUpdateParams = AccountsAPI.AccountUpdateParams;
export import AccountListParams = AccountsAPI.AccountListParams;
Expand Down
19 changes: 19 additions & 0 deletions src/resources/book-transfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ export class BookTransfers extends APIResource {
}
return this._client.getAPIList('/book_transfers', BookTransferResponsesCursorPage, { query, ...options });
}

/**
* Reverse a book transfer
*/
reverse(
bookTransferToken: string,
body: BookTransferReverseParams,
options?: Core.RequestOptions,
): Core.APIPromise<BookTransferResponse> {
return this._client.post(`/book_transfers/${bookTransferToken}/reverse`, { body, ...options });
}
}

export class BookTransferResponsesCursorPage extends CursorPage<BookTransferResponse> {}
Expand Down Expand Up @@ -285,9 +296,17 @@ export interface BookTransferListParams extends CursorPageParams {
status?: 'DECLINED' | 'SETTLED';
}

export interface BookTransferReverseParams {
/**
* Optional descriptor for the reversal.
*/
memo?: string;
}

export namespace BookTransfers {
export import BookTransferResponse = BookTransfersAPI.BookTransferResponse;
export import BookTransferResponsesCursorPage = BookTransfersAPI.BookTransferResponsesCursorPage;
export import BookTransferCreateParams = BookTransfersAPI.BookTransferCreateParams;
export import BookTransferListParams = BookTransfersAPI.BookTransferListParams;
export import BookTransferReverseParams = BookTransfersAPI.BookTransferReverseParams;
}
35 changes: 0 additions & 35 deletions src/resources/cards/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,40 +484,6 @@ export namespace CardSpendLimits {
}
}

export interface EmbedRequestParams {
/**
* Globally unique identifier for the card to be displayed.
*/
token: string;

/**
* A publicly available URI, so the white-labeled card element can be styled with
* the client's branding.
*/
css?: string;

/**
* An RFC 3339 timestamp for when the request should expire. UTC time zone.
*
* If no timezone is specified, UTC will be used. If payload does not contain an
* expiration, the request will never expire.
*
* Using an `expiration` reduces the risk of a
* [replay attack](https://en.wikipedia.org/wiki/Replay_attack). Without supplying
* the `expiration`, in the event that a malicious user gets a copy of your request
* in transit, they will be able to obtain the response data indefinitely.
*/
expiration?: string;

/**
* Required if you want to post the element clicked to the parent iframe.
*
* If you supply this param, you can also capture click events in the parent iframe
* by adding an event listener.
*/
target_origin?: string;
}

/**
* Spend limit duration values:
*
Expand Down Expand Up @@ -982,7 +948,6 @@ export interface CardSearchByPanParams {
export namespace Cards {
export import Card = CardsAPI.Card;
export import CardSpendLimits = CardsAPI.CardSpendLimits;
export import EmbedRequestParams = CardsAPI.EmbedRequestParams;
export import SpendLimitDuration = CardsAPI.SpendLimitDuration;
export import CardEmbedResponse = CardsAPI.CardEmbedResponse;
export import CardProvisionResponse = CardsAPI.CardProvisionResponse;
Expand Down
1 change: 0 additions & 1 deletion src/resources/cards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export { BalanceListResponse, BalanceListParams, BalanceListResponsesSinglePage,
export {
Card,
CardSpendLimits,
EmbedRequestParams,
SpendLimitDuration,
CardEmbedResponse,
CardProvisionResponse,
Expand Down
3 changes: 0 additions & 3 deletions src/resources/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export interface Event {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created';

Expand Down Expand Up @@ -195,7 +194,6 @@ export interface EventSubscription {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created'
> | null;
Expand Down Expand Up @@ -283,7 +281,6 @@ export interface EventListParams extends CursorPageParams {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created'
>;
Expand Down
3 changes: 0 additions & 3 deletions src/resources/events/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export interface SubscriptionCreateParams {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created'
>;
Expand Down Expand Up @@ -288,7 +287,6 @@ export interface SubscriptionUpdateParams {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created'
>;
Expand Down Expand Up @@ -366,7 +364,6 @@ export interface SubscriptionSendSimulatedExampleParams {
| 'payment_transaction.created'
| 'payment_transaction.updated'
| 'settlement_report.updated'
| 'statements.created'
| 'three_ds_authentication.created'
| 'transfer_transaction.created';
}
Expand Down
3 changes: 1 addition & 2 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export { APIStatus } from './top-level';
export {
Account,
AccountSpendLimits,
BusinessAccount,
AccountUpdateParams,
AccountListParams,
AccountsCursorPage,
Expand Down Expand Up @@ -52,13 +51,13 @@ export {
BookTransferResponse,
BookTransferCreateParams,
BookTransferListParams,
BookTransferReverseParams,
BookTransferResponsesCursorPage,
BookTransfers,
} from './book-transfers';
export {
Card,
CardSpendLimits,
EmbedRequestParams,
SpendLimitDuration,
CardEmbedResponse,
CardProvisionResponse,
Expand Down
2 changes: 2 additions & 0 deletions src/resources/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ export namespace Payment {
return_reason_code: string | null;

sec_code: 'CCD' | 'PPD' | 'WEB';

trace_numbers: Array<string | null>;
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/api-resources/book-transfers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,15 @@ describe('resource bookTransfers', () => {
),
).rejects.toThrow(Lithic.NotFoundError);
});

test('reverse', async () => {
const responsePromise = lithic.bookTransfers.reverse('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
});

0 comments on commit 681824f

Please sign in to comment.