Skip to content

Commit 5326a7e

Browse files
authored
Allow wire payment request (#87)
1 parent 165c5a1 commit 5326a7e

File tree

2 files changed

+112
-3
lines changed

2 files changed

+112
-3
lines changed

types/common.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,28 @@ export interface Counterparty {
236236
name: string
237237
}
238238

239+
export interface WireCounterparty {
240+
/**
241+
* Valid 9-digit ABA routing transit number.
242+
*/
243+
routingNumber: string
244+
245+
/**
246+
* Bank account number.
247+
*/
248+
accountNumber: string
249+
250+
/**
251+
* Name of the person or company that owns the bank account.
252+
*/
253+
name: string
254+
255+
/**
256+
* Address of the person or company that owns the bank account.
257+
*/
258+
address: Address
259+
}
260+
239261
export interface Coordinates {
240262
/**
241263
* The longitude value.

types/payments.ts

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Relationship, Counterparty } from "./common"
1+
import { Relationship, Counterparty, WireCounterparty } from "./common"
22

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

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

77
interface BasePaymentAttributes {
88
/**
@@ -143,14 +143,101 @@ interface BookPayment {
143143
}
144144
}
145145

146+
export interface WirePayment {
147+
/**
148+
* Identifier of the Wire payment resource.
149+
*/
150+
id: string
151+
152+
/**
153+
* Type of the payment resource. For originations the value is wirePayment.
154+
*/
155+
type: "wirePayment"
156+
157+
/**
158+
* JSON object representing the payment resource.
159+
*/
160+
attributes: {
161+
162+
/**
163+
* The party on the other side of the Wire payment.
164+
*/
165+
counterparty: WireCounterparty
166+
167+
} & BasePaymentAttributes
168+
169+
/**
170+
* Describes relationships between the Wire payment and the originating deposit account and customer.
171+
*/
172+
relationships: {
173+
/**
174+
* The Deposit Account originating the transfer.
175+
*/
176+
account: Relationship
177+
178+
/**
179+
* The Customer the deposit account belongs to.
180+
*/
181+
customer: Relationship
182+
183+
/**
184+
* The Customer the deposit account belongs to.
185+
*/
186+
customers: Relationship[]
187+
188+
/**
189+
* The Wire Transaction generated by this payment.
190+
*/
191+
transaction: Relationship
192+
}
193+
}
194+
146195
export interface PatchPaymentRequest {
147196
type: "achPayment" | "bookPayment"
148197
attributes: {
149198
tags: object
150199
}
151200
}
152201

153-
export type CreatePaymentRequest = CreateBookPaymentRequest | CreateInlinePaymentRequest | CreateLinkedPaymentRequest | CreateVerifiedPaymentRequest
202+
export type CreatePaymentRequest = CreateWirePaymentRequest | CreateBookPaymentRequest | CreateInlinePaymentRequest | CreateLinkedPaymentRequest | CreateVerifiedPaymentRequest
203+
204+
export interface CreateWirePaymentRequest {
205+
type: "wirePayment"
206+
207+
attributes: {
208+
/**
209+
* The amount (in cents).
210+
*/
211+
amount: number
212+
213+
/**
214+
* Payment description (maximum of 50 characters), this will show up on statement of the counterparty.
215+
*/
216+
description: string
217+
218+
/**
219+
* The party on the other side of the Wire payment.
220+
*/
221+
counterparty: WireCounterparty
222+
223+
/**
224+
* See Idempotency.
225+
*/
226+
idempotencyKey?: string
227+
228+
/**
229+
* 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)).
230+
*/
231+
tags?: object
232+
}
233+
234+
relationships: {
235+
/**
236+
* The Deposit Account originating the payment.
237+
*/
238+
account: Relationship
239+
}
240+
}
154241

155242
export interface CreateBookPaymentRequest {
156243
type: "bookPayment"

0 commit comments

Comments
 (0)