Skip to content

Commit 7f8d98f

Browse files
axshaniilyamerman
andauthored
added BillPayment (#90)
Co-authored-by: Ilya Merman <[email protected]>
1 parent 9fe40d0 commit 7f8d98f

File tree

2 files changed

+100
-18
lines changed

2 files changed

+100
-18
lines changed

resources/payments.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export class Payments extends BaseResource {
3434
...(params?.accountId && { "filter[accountId]": params.accountId }),
3535
...(params?.customerId && { "filter[customerId]": params.customerId }),
3636
...(params?.tags && { "filter[tags]": params.tags }),
37+
...(params?.status && { "filter[status]": params.status}),
38+
...(params?.type && { "filter[type]": params.type}),
39+
...(params?.direction && { "filter[direction]": params.direction}),
40+
...(params?.since && { "filter[since]": params.since}),
41+
...(params?.until && { "filter[until]": params.until}),
3742
"sort": params?.sort ? params.sort : "-createdAt",
3843
"include": params?.include ? params.include : ""
3944
}
@@ -68,13 +73,38 @@ export interface PaymentListParams {
6873
customerId?: string
6974

7075
/**
71-
* Optional. Filter Applications by Tags.
72-
* default: empty
73-
*/
76+
* Optional. Filter Applications by Tags.
77+
* default: empty
78+
*/
7479
tags?: object
80+
81+
/**
82+
* Optional. Filter Payments by [ACH Status](https://developers.unit.co/payments/#ach-status).
83+
*/
84+
status?: string
85+
86+
/**
87+
* Optional. Filter Payments by Payment type. such as (ACHPayment, BookPayment, WirePayment or BillPayment).
88+
*/
89+
type?: string
90+
91+
/**
92+
* Optional. Filter Payments by direction. such as (Debit, Credit).
93+
*/
94+
direction?: string
95+
96+
/**
97+
* Optional. Filters the Payments that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z
98+
*/
99+
since?: string
100+
101+
/**
102+
* Optional. Filters the Payments that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z
103+
*/
104+
until?: string
75105

76106
/**
77-
* Optional. .Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
107+
* Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
78108
* default: sort=-createdAt
79109
*/
80110
sort?: string

types/payments.ts

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Relationship, Counterparty, WireCounterparty } from "./common"
22

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

5-
export type Payment = AchPayment | BookPayment | WirePayment
5+
export type Payment = AchPayment | BookPayment | WirePayment | BillPayment
66

77
interface BasePaymentAttributes {
88
/**
@@ -85,9 +85,14 @@ export interface AchPayment {
8585
account: Relationship
8686

8787
/**
88-
* The Customer the deposit account belongs to. The customer is either a business or a individual.
88+
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
8989
*/
90-
customer: Relationship
90+
customer?: Relationship
91+
92+
/**
93+
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to multiple individual customers.
94+
*/
95+
customers?: Relationship[]
9196

9297
/**
9398
* The Counterparty the payment to be made to.
@@ -122,24 +127,29 @@ interface BookPayment {
122127
account: Relationship
123128

124129
/**
125-
* The Customer the deposit account belongs to. The customer is either a business or a individual.
130+
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
131+
*/
132+
customer?: Relationship
133+
134+
/**
135+
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customers.
126136
*/
127-
customer: Relationship
137+
customers?: Relationship[]
128138

129139
/**
130140
* The Counterparty account the payment to be made to.
131141
*/
132142
counterpartyAccount: Relationship
133143

134144
/**
135-
* The Customer the counterparty account belongs to.The customer is either a business or a individual.
145+
* The Customer the counterparty account belongs to. The customer is either a business or an individual, might be empty if there is more than one associated customer.
136146
*/
137-
counterpartyCustomer: Relationship
147+
counterpartyCustomer: Relationship
138148

139149
/**
140150
* The Book Transaction generated by this payment.
141151
*/
142-
transaction: Relationship
152+
transaction: Relationship
143153
}
144154
}
145155

@@ -176,19 +186,61 @@ export interface WirePayment {
176186
account: Relationship
177187

178188
/**
179-
* The Customer the deposit account belongs to.
189+
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
180190
*/
181-
customer: Relationship
191+
customer?: Relationship
182192

183193
/**
184-
* The Customer the deposit account belongs to.
194+
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customers.
185195
*/
186-
customers: Relationship[]
196+
customers?: Relationship[]
187197

188198
/**
189199
* The Wire Transaction generated by this payment.
190200
*/
191-
transaction: Relationship
201+
transaction: Relationship
202+
}
203+
}
204+
205+
export interface BillPayment {
206+
/**
207+
* Identifier of the bill payment resource.
208+
*/
209+
id: string
210+
211+
/**
212+
* Type of the payment resource. The value is always billPayment.
213+
*/
214+
type: "billPayment"
215+
216+
/**
217+
* JSON object representing the payment resource.
218+
*/
219+
attributes: Pick<BasePaymentAttributes, "createdAt" | "status" | "direction" | "description" | "amount" | "tags">
220+
221+
/**
222+
* Describes relationships between the Wire payment and the originating deposit account and customer.
223+
*/
224+
relationships: {
225+
/**
226+
* The Deposit Account creating the payment.
227+
*/
228+
account: Relationship
229+
230+
/**
231+
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, butisness or individual.
232+
*/
233+
customer?: Relationship
234+
235+
/**
236+
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customer
237+
*/
238+
customers?: Relationship[]
239+
240+
/**
241+
* The BillPay Transaction generated by this payment.
242+
*/
243+
transaction: Relationship
192244
}
193245
}
194246

@@ -218,7 +270,7 @@ export interface CreateWirePaymentRequest {
218270
/**
219271
* The party on the other side of the Wire payment.
220272
*/
221-
counterparty: WireCounterparty
273+
counterparty: WireCounterparty
222274

223275
/**
224276
* See Idempotency.

0 commit comments

Comments
 (0)