Skip to content

Commit 2d1f880

Browse files
authored
Update CreateCheckPaymentRequest (#404)
* update counterparty type added missing fields * tiny test * description is mandatory
1 parent 4965b59 commit 2d1f880

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

tests/checkPayments.spec.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CheckPayment, Unit } from "../unit"
1+
import { CheckPayment, CreateCheckPaymentRequest, Unit } from "../unit"
22

33
import dotenv from "dotenv"
44
dotenv.config()
@@ -103,4 +103,42 @@ describe("Test Check Payments", () => {
103103

104104
expect(payment.type).toBe("checkPayment")
105105
})
106+
107+
test("Test CreateCheckPayment Resource", () => {
108+
const request: CreateCheckPaymentRequest = {
109+
"type": "checkPayment",
110+
"attributes": {
111+
"amount": 100,
112+
"sendDate": "2023-09-10",
113+
"counterparty": {
114+
"name": "John Doe",
115+
"address": {
116+
"street": "5230 Newell Rd",
117+
"city": "Palo Alto",
118+
"state": "CA",
119+
"postalCode": "94303",
120+
"country": "US"
121+
}
122+
},
123+
"description": "test-request"
124+
},
125+
"relationships": {
126+
"account": {
127+
"data": {
128+
"type": "depositAccount",
129+
"id": "1043"
130+
}
131+
},
132+
"customer": {
133+
"data": {
134+
"type": "individualCustomer",
135+
"id": "2"
136+
}
137+
}
138+
}
139+
}
140+
141+
expect(request.type).toBe("checkPayment")
142+
expect(request.attributes.amount).toBe(100)
143+
})
106144
})

types/checkPayment.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Tags, RelationshipsArray, Relationship, BaseListParams, Sort, Counterparty, BaseCreateRequestAttributes, CheckPaymentCounterparty } from "./common"
1+
import { Tags, RelationshipsArray, Relationship, BaseListParams, Sort, BaseCreateRequestAttributes, CheckPaymentCounterparty } from "./common"
22
import { BasePaymentRelationships } from "./payments"
33

44
export type StopPaymentStatus = "Active" | "Disabled"
@@ -288,15 +288,25 @@ export interface CreateCheckPaymentRequest extends BaseCreateRequestAttributes {
288288
sendDate?: string
289289

290290
/**
291-
* The payee's details . address1 may contain max 50 characters. address2 must be null. country must be "US".
291+
* The payee's details. street and street2 combined may contain up to 50 characters. country must be "US".
292292
*/
293-
counterparty: Counterparty
293+
counterparty: CheckPaymentCounterparty
294+
295+
/**
296+
* An internal description (maximum of 255 characters). This will not be printed on the check.
297+
*/
298+
description: string
294299
}
295300

296301
relationships: {
297302
/**
298303
* The [Deposit Account](https://docs.unit.co/deposit-accounts/) originating the payment.
299304
*/
300305
account: Relationship
306+
307+
/**
308+
* Link to the customer the the check will be signed by.
309+
*/
310+
customer: Relationship
301311
}
302312
}

types/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ export interface CheckPaymentCounterparty {
225225
*/
226226
counterpartyMoved?: boolean
227227
}
228+
228229
export interface Coordinates {
229230
/**
230231
* The longitude value.

0 commit comments

Comments
 (0)