Skip to content

Commit 4343d82

Browse files
authored
Add status filter to check deposit and type tags field for check deposits and payments (#258)
1 parent 2b3fed4 commit 4343d82

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

resources/checkDeposit.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class CheckDeposits extends BaseResource {
1111
}
1212

1313
public async list(params?: CheckDepositListParams): Promise<UnitResponse<CheckDeposit[]>> {
14-
const parameters = {
14+
const parameters: any = {
1515
"page[limit]": (params?.limit ? params.limit : 100),
1616
"page[offset]": (params?.offset ? params.offset : 0),
1717
...(params?.accountId && { "filter[accountId]": params.accountId }),
@@ -21,6 +21,12 @@ export class CheckDeposits extends BaseResource {
2121
"include": params?.include ? params.include : "include"
2222
}
2323

24+
if (params?.status)
25+
params.status.forEach((s, idx) => {
26+
parameters[`filter[status][${idx}]`] = s
27+
})
28+
29+
2430
return this.httpGet<UnitResponse<CheckDeposit[]>>("", { params: parameters })
2531
}
2632

@@ -71,6 +77,11 @@ export interface CheckDepositListParams extends BaseListParams {
7177
*/
7278
tags?: object
7379

80+
/**
81+
* Optional. Filter results by [Check Deposit Status](https://developers.unit.co/check-deposits#check-deposit-status).
82+
*/
83+
status?: string[]
84+
7485
/**
7586
* Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order.
7687
*/

types/checkDeposit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Relationship,CheckCounterparty, RelationshipsArray } from "./common"
1+
import { Relationship,CheckCounterparty, RelationshipsArray, Tags } from "./common"
22

33
export type CheckDepositStatus = "AwaitingImages" | "AwaitingFrontImage" | "AwaitingBackImage" | "Pending" | "PendingReview" |
44
"Rejected" | "Clearing" | "Sent" | "Canceled" | "Returned"
@@ -116,7 +116,7 @@ export interface CreateCheckDepositRequest {
116116
/**
117117
* Optional. See Tags.
118118
*/
119-
tags?: object
119+
tags?: Tags
120120

121121
/**
122122
* Optional. See Idempotency.

types/payments.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Relationship, Counterparty, WireCounterparty, Direction, RelationshipsArray } from "./common"
1+
import { Relationship, Counterparty, WireCounterparty, Direction, RelationshipsArray, Tags } from "./common"
22

33
export type PaymentStatus = "Pending" | "PendingReview" | "Rejected" | "Clearing" | "Sent" | "Canceled" | "Returned"
44

@@ -39,7 +39,7 @@ interface BasePaymentAttributes {
3939
/**
4040
* See [Tags](https://developers.unit.co/#tags).
4141
*/
42-
tags?: object
42+
tags?: Tags
4343
}
4444

4545
interface BasePaymentRelationships {
@@ -321,7 +321,7 @@ export interface PatchPaymentRequest {
321321
/**
322322
* See [Tags](https://developers.unit.co/#tags).
323323
*/
324-
tags: object
324+
tags: Tags
325325
}
326326
}
327327

@@ -366,7 +366,7 @@ interface BaseAchPaymentCreateRequestAttributes {
366366
/**
367367
* See [Tags](https://developers.unit.co/#tags). Tags that will be copied to any transaction that this payment creates (see [Tag Inheritance](https://developers.unit.co/#tag-inheritance)).
368368
*/
369-
tags?: object
369+
tags?: Tags
370370

371371
}
372372

@@ -397,7 +397,7 @@ export interface CreateWirePaymentRequest {
397397
/**
398398
* See [Tags](https://developers.unit.co/#tags). Tags that will be copied to any transaction that this payment creates (see [Tag Inheritance](https://developers.unit.co/#tag-inheritance)).
399399
*/
400-
tags?: object
400+
tags?: Tags
401401
}
402402

403403
relationships: {
@@ -435,7 +435,7 @@ export interface CreateBookPaymentRequest {
435435
/**
436436
* See [Tags](https://developers.unit.co/#tags). Tags that will be copied to any transaction that this payment creates (see [Tag Inheritance](https://developers.unit.co/#tag-inheritance)).
437437
*/
438-
tags?: object
438+
tags?: Tags
439439
}
440440

441441
relationships: {

0 commit comments

Comments
 (0)