@spritz-finance/api-client 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -115,7 +115,7 @@ Spritz provides robust support for bank accounts, allowing you to easily manage
115
115
  You can retrieve a comprehensive list of all bank accounts that have been linked to a user's account using this functionality.
116
116
 
117
117
  ```typescript
118
- const bankAccounts = await client.bankAccounts.list()
118
+ const bankAccounts = await client.bankAccount.list()
119
119
  ```
120
120
 
121
121
  #### Example response
@@ -169,7 +169,7 @@ export interface USBankAccountInput {
169
169
  ```typescript
170
170
  import { BankAccountType, BankAccountSubType } from '@spritz-finance/api-client'
171
171
 
172
- const bankAccounts = await client.bankAccounts.create(BankAccountType.USBankAccount, {
172
+ const bankAccounts = await client.bankAccount.create(BankAccountType.USBankAccount, {
173
173
  accountNumber: '123456789',
174
174
  routingNumber: '987654321',
175
175
  email: 'bilbo@shiremail.net',
@@ -185,7 +185,7 @@ const bankAccounts = await client.bankAccounts.create(BankAccountType.USBankAcco
185
185
  You can conveniently change the display name of a bank account using the following endpoint. The first argument specifies the ID of the bank account, while the second argument represents the desired new name for the account.
186
186
 
187
187
  ```typescript
188
- const updateAccount = await client.bankAccounts.rename('62d17d3b377dab6c1342136e', 'My new account')
188
+ const updateAccount = await client.bankAccount.rename('62d17d3b377dab6c1342136e', 'My new account')
189
189
  ```
190
190
 
191
191
  ### Delete a bank account
@@ -193,7 +193,144 @@ const updateAccount = await client.bankAccounts.rename('62d17d3b377dab6c1342136e
193
193
  To remove a bank account from a user's account, you can use the following endpoint. You only need to specify the ID of the bank account that you want to delete as an argument.
194
194
 
195
195
  ```typescript
196
- await client.bankAccounts.delete('62d17d3b377dab6c1342136e')
196
+ await client.bankAccount.delete('62d17d3b377dab6c1342136e')
197
+ ```
198
+
199
+ ## Bills
200
+
201
+ Spritz provides robust support for bank accounts, allowing you to easily manage and interact with a user's bank account. To leverage these capabilities, you can utilize our specific methods and functionalities designed for bank accounts.
202
+
203
+ ### List user bills
204
+
205
+ You can retrieve a list of all the bills accounts that have been linked to a user's account using this functionality.
206
+
207
+ ```typescript
208
+ const bills = await client.bill.list()
209
+ ```
210
+
211
+ #### Example response
212
+
213
+ The bills endpoint returns a response comprising an array of all the bills belonging to the user that are available for making payments. This array provides all the necessary information to both display the account details in a user interface and process payments to the respective accounts.
214
+
215
+ ```typescript
216
+ const bills = [{
217
+ id: "62d17d3b377dab6c1342136e",
218
+ name: "Precious Credit Card",
219
+ type: "Bill",
220
+ billType: "CreditCard",
221
+ userId: "62d17d3b377dab6c1342136e",
222
+ mask: "4567",
223
+ originator: "User",
224
+ payable: true,
225
+ verifying: false,
226
+ billAccountDetails: {
227
+ balance: 240.23,
228
+ amountDue: 28.34,
229
+ openedAt: "2023-05-03T11:25:02.401Z",
230
+ lastPaymentAmount: null,
231
+ lastPaymentDate: null,
232
+ nextPaymentDueDate: "2023-06-03T11:25:02.401Z",
233
+ nextPaymentMinimumAmount: 28.34,
234
+ lastStatementBalance: 180.23,
235
+ remainingStatementBalance: null,
236
+ },
237
+ country: "US",
238
+ currency: "USD",
239
+ dataSync {
240
+ lastSync: "2023-05-03T11:25:02.401Z",
241
+ syncStatus: "Active",
242
+ },
243
+ institution: {
244
+ id: "62d27d4b277dab3c1342126e",
245
+ name: "Shire Bank Credit Card",
246
+ logo: "https://tinyurl.com/shire-bank-logo",
247
+ },
248
+ createdAt: "2023-05-03T11:25:02.401Z",
249
+ }]
250
+ ```
251
+
252
+ ### Add US bill account
253
+
254
+ At present, you can only add US bills to a user's account. Adding a bill involves finding the institution who holds the account, and providing the account number for the bill. To add a bill for the user, you can use the following.
255
+
256
+ ```typescript
257
+ import { BillType } from '@spritz-finance/api-client'
258
+
259
+ const institutions = await client.institution.popularUSBillInstitutions(BillType.CreditCard)
260
+ const billInstitution = institutions[0]
261
+ const accountNumber = '12345678913213'
262
+
263
+ const bill = await client.bill.create(billInstitution.id, accountNumber, BillType.CreditCard)
264
+ ```
265
+
266
+ ### Rename a bill
267
+
268
+ You can conveniently change the display name of a bill using the following endpoint. The first argument specifies the ID of the bill, while the second argument represents the desired new name for the account.
269
+
270
+ ```typescript
271
+ const updateAccount = await client.bill.rename('62d17d3b377dab6c1342136e', 'My first credit card')
272
+ ```
273
+
274
+ ### Delete a bill
275
+
276
+ To remove a bill from a user's account, you can use the following endpoint. You only need to specify the ID of the bill that you want to delete as an argument.
277
+
278
+ ```typescript
279
+ await client.bill.delete('62d17d3b377dab6c1342136e')
280
+ ```
281
+
282
+ ## Bill Institutions
283
+
284
+ When adding a new bill for a user, we need to provide a reference to the institution who holds the account for the user. As an example, if a user wanted to add their Chase Visa Credit Card to their Spritz account, the Institution of the account would be `Chase Credit Cards` and then the account number provided would be the 16-digit card number for their credit card.
285
+
286
+ Spritz exposes several endpoints to help users find the Institutions of their bill accounts.
287
+
288
+ ### Fetching popular bill institutions
289
+
290
+ ```typescript
291
+ const popularInstitutions = await client.institution.popularUSBillInstitutions()
292
+
293
+ // Optionally filter by a specific bill type
294
+ const popularInstitutions = await client.institution.popularUSBillInstitutions(BillType.Mortgage)
295
+ ```
296
+
297
+ ### Searching for bill institutions by name
298
+
299
+ ```typescript
300
+ const institutions = await client.institution.searchUSBillInstitutions('american express')
301
+
302
+ // Optionally filter by a specific bill type
303
+ const institutions = await client.institution.searchUSBillInstitutions(
304
+ 'american express',
305
+ BillType.CreditCard
306
+ )
307
+ ```
308
+
309
+ ## Bill Institutions
310
+
311
+ When adding a new bill for a user, we need to provide a reference to the institution who holds the account for the user. As an example, if a user wanted to add their Chase Visa Credit Card to their Spritz account, the Institution of the account would be `Chase Credit Cards` and then the account number provided would be the 16-digit card number for their credit card.
312
+
313
+ Spritz exposes several endpoints to help users find the Institutions of their bill accounts.
314
+
315
+ ### Fetching popular bill institutions
316
+
317
+ ```typescript
318
+ const popularInstitutions = await client.institution.popularUSBillInstitutions()
319
+
320
+ // Optionally filter by a specific bill type
321
+ const popularInstitutions = await client.institution.popularUSBillInstitutions(BillType.Mortgage)
322
+ ```
323
+
324
+ ### Searching for bill institutions by name
325
+
326
+ ```typescript
327
+ const institutions = await client.institution.searchUSBillInstitutions('american express')
328
+
329
+ // Optionally filter by a specific bill type
330
+ const institutions = await client.institution.searchUSBillInstitutions(
331
+ 'american express',
332
+ BillType.CreditCard
333
+ )
197
334
  ```
198
335
 
199
336
  ## Virtual Cards