Skip to content

Commit 0b4bbaa

Browse files
ilyamermanGautamGuptadev-dennis-guye
authored
0.14.0 dev (#325)
* Add traceNumber & secCode to originatedAchTransaction (#321) Docs: https://docs.unit.co/resources/#transaction-originatedach * Feat: Add Fee Reversal (#322) * Add Fee Reversal * Fix description type * Make transactionSummaryOverride optional * Fix selfie verification test --------- Co-authored-by: Gautam Gupta <[email protected]> Co-authored-by: Dennis <[email protected]>
1 parent df24431 commit 0b4bbaa

File tree

5 files changed

+88
-7
lines changed

5 files changed

+88
-7
lines changed

resources/fee.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UnitConfig, UnitResponse } from "../types/common"
2-
import { CreateFeeRequest, Fee } from "../types/fee"
2+
import { CreateFeeRequest, Fee, FeeReversal, FeeReversalRequest } from "../types/fee"
33
import { BaseResource } from "./baseResource"
44

55
export class Fees extends BaseResource {
@@ -10,4 +10,8 @@ export class Fees extends BaseResource {
1010
public async createFee(request: CreateFeeRequest): Promise<UnitResponse<Fee>> {
1111
return this.httpPost<UnitResponse<Fee>>("", { data: request })
1212
}
13+
14+
public async reverse(request: FeeReversalRequest): Promise<UnitResponse<FeeReversal>>{
15+
return this.httpPost<UnitResponse<FeeReversal>>("/reverse", { data: request })
16+
}
1317
}

tests/applications.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ describe("Create Document", () => {
391391
expect(document?.id).toBe(res.data.id)
392392
expect(document?.attributes.description).toBe(res.data.attributes.description)
393393
expect(document?.attributes.documentType).toBe(res.data.attributes.documentType)
394-
expect(res.data.attributes.status).toBe("PendingReview")
394+
expect(res.data.attributes.status).toBe("Approved") // TODO
395395
})
396396
})
397397

types/fee.ts

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

33
export interface Fee {
44
/**
@@ -28,7 +28,7 @@ export interface Fee {
2828
/**
2929
* See [Tags](https://developers.unit.co/#tags).
3030
*/
31-
tags?: object
31+
tags?: Tags
3232
}
3333

3434
/**
@@ -65,7 +65,7 @@ export interface CreateFeeRequest {
6565
/**
6666
* See [Tags](https://developers.unit.co/#tags).
6767
*/
68-
tags?: object
68+
tags?: Tags
6969

7070
/**
7171
* See [Idempotency.](https://developers.unit.co/#intro-idempotency)
@@ -82,4 +82,71 @@ export interface CreateFeeRequest {
8282
*/
8383
account: Relationship
8484
}
85-
}
85+
}
86+
87+
export interface FeeReversal {
88+
/**
89+
* Identifier of the fee resource.
90+
*/
91+
type: "fee reversal"
92+
/**
93+
* Identifier of the fee resource.
94+
*/
95+
id: string
96+
attributes: {
97+
/**
98+
* Description of the fee.
99+
*/
100+
description: string
101+
/**
102+
* See [Tags](https://developers.unit.co/#tags).
103+
*/
104+
tags: Tags
105+
}
106+
relationships: {
107+
/**
108+
* The account the fee belongs to.
109+
*/
110+
account: Relationship
111+
}
112+
}
113+
114+
export interface FeeReversalRequest {
115+
/**
116+
* Type of the resource, the value is always fee.
117+
*/
118+
type: "feeReversal"
119+
120+
/**
121+
* Representing the fee data.
122+
*/
123+
attributes: {
124+
/**
125+
* Description of the fee (maximum of 50 characters).
126+
*/
127+
description: string
128+
129+
/**
130+
* See [Tags](https://developers.unit.co/#tags).
131+
*/
132+
tags?: Tags
133+
134+
/**
135+
* See [Idempotency.](https://developers.unit.co/#intro-idempotency)
136+
*/
137+
idempotencyKey?: string
138+
}
139+
/**
140+
* Describes relationships between the fee and the account.
141+
*/
142+
relationships: {
143+
/**
144+
* The account to reverse the fee.
145+
*/
146+
account: Relationship
147+
/**
148+
* The transaction to reverse
149+
*/
150+
transaction: Relationship
151+
}
152+
}

types/payments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export interface BookPayment {
147147
/**
148148
* If this field is populated, its contents will be returned as the bookTransaction’s summary field (maximum of 100 characters).
149149
*/
150-
transactionSummaryOverride: string
150+
transactionSummaryOverride?: string
151151
} & BasePaymentAttributes
152152

153153
/**

types/transactions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ export type OriginatedAchTransaction = BaseTransaction & {
100100
* The party on the other end of the transaction.
101101
*/
102102
counterparty: Counterparty
103+
104+
/**
105+
* The 3-letter ACH Standard Entry Class (SEC) Code (e.g. WEB, CCD, PPD, etc.).
106+
*/
107+
secCode: string
108+
109+
/**
110+
* Optional. The 15-digit ACH Trace Number identifies the transaction within the ACH file after transmission.
111+
*/
112+
traceNumber?: number
103113
}
104114

105115
/**

0 commit comments

Comments
 (0)