Skip to content

Commit 9a79609

Browse files
YegorZhtophercf
andauthored
Repayment Info and Version Bump (#498)
* feat: add type and resource for the repayment-information endpoint * version bump to 1.2.2 * fix: statement list test limit to prevent timeouts --------- Co-authored-by: chris fowlkes <[email protected]>
1 parent c988fcd commit 9a79609

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unit-finance/unit-node-sdk",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "",
55
"main": "dist/unit.js",
66
"types": "dist/unit.d.ts",

resources/account.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
AccountDepositProduct,
99
CloseAccountRequest,
1010
FreezeAccountRequest,
11-
AccountOwnersRequest
11+
AccountOwnersRequest,
12+
RepaymentInformation
1213
} from "../types/account"
1314
import {BaseResource} from "./baseResource"
1415

@@ -98,6 +99,10 @@ export class Accounts extends BaseResource {
9899
public async deactivateDaca(accountId: string): Promise<UnitResponse<Account>> {
99100
return this.httpGet<UnitResponse<Account>>(`/${accountId}/deactivate-daca`)
100101
}
102+
103+
public async getRepaymentInformation(accountId: string): Promise<UnitResponse<RepaymentInformation>> {
104+
return this.httpGet<UnitResponse<RepaymentInformation>>(`/${accountId}/repayment-information`)
105+
}
101106
}
102107

103108
export interface AccountListParams extends BaseListParams {

tests/statements.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { Unit } from "../unit"
1+
import { StatementsListParams, Unit } from "../unit"
22
import dotenv from "dotenv"
3-
import {createIndividualAccount} from "./testHelpers"
3+
import { createIndividualAccount } from "./testHelpers"
44
dotenv.config()
55
const unit = new Unit(process.env.UNIT_TOKEN || "test", process.env.UNIT_API_URL || "test")
66
const statementId: string[] = []
77

88
describe("Statements List", () => {
99
test("Get Statements List", async () => {
10-
const res = await unit.statements.list()
10+
const params: StatementsListParams = { limit: 50 }
11+
const res = await unit.statements.list(params)
1112
expect(res.data.length).toBeGreaterThan(0)
1213
res.data.forEach(element => {
1314
if(element.relationships.customer){

types/account.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,36 @@ export interface CreditAccount {
170170
} & UnimplementedFields
171171
}
172172

173+
export interface RepaymentInformation {
174+
type: "creditAccountRepaymentInformation"
175+
attributes: {
176+
/**
177+
* The amount (cents) of the total amount due, including the remainingAmountOverdue.
178+
*/
179+
remainingAmountDue: number
180+
/**
181+
* The amount (cents) of the amount overdue for the current payment period.
182+
*/
183+
remainingAmountOverdue: number
184+
/**
185+
* The number of repayments that have been initiated but not yet settled to a final state.
186+
*/
187+
initiatedRepayments: number
188+
/**
189+
* The start date in YYYY-MM-DD format for the current statement period.
190+
*/
191+
statementPeriodStart: string
192+
/**
193+
* The end date in YYYY-MM-DD format for the current statement period.
194+
*/
195+
statementPeriodEnd: string
196+
/**
197+
* The date in YYYY-MM-DD format for the expected repayment for the statement period start and end.
198+
*/
199+
nextRepaymentDueDate: string
200+
}
201+
}
202+
173203
export type CreateAccountRequest = CreateDepositAccountRequest | CreateBatchAccountRequest | CreateCreditAccountRequest
174204

175205
export interface CreateDepositAccountRequest {

0 commit comments

Comments
 (0)