diff --git a/resources/billPays.ts b/resources/billPays.ts new file mode 100644 index 00000000..7d288520 --- /dev/null +++ b/resources/billPays.ts @@ -0,0 +1,14 @@ +import { Biller, GetBillerParams } from "../types/billPay" +import { UnitConfig, UnitResponse } from "../types/common" +import { BaseResource } from "./baseResource" + +export class BillPays extends BaseResource { + + constructor(token: string, basePath: string, config?: UnitConfig) { + super(token, basePath + "/payments/billpay/billers", config) + } + + public async get(params: GetBillerParams): Promise> { + return await this.httpGet>("", {params: params}) + } +} \ No newline at end of file diff --git a/resources/index.ts b/resources/index.ts index 95d701e8..63460490 100644 --- a/resources/index.ts +++ b/resources/index.ts @@ -16,4 +16,5 @@ export * from "./returns" export * from "./statements" export * from "./transactions" export * from "./webhooks" +export * from "./billPays" diff --git a/types/billPay.ts b/types/billPay.ts new file mode 100644 index 00000000..e9d8ad00 --- /dev/null +++ b/types/billPay.ts @@ -0,0 +1,38 @@ +export interface Biller { + /** + * Type of the biller resource. The value is always biller. + */ + type: "biller" + + /** + * Identifier of the biller resource. + */ + id: string + + /** + * JSON object representing the biller data. + */ + attributes: { + /** + * Name of the biller. + */ + name: string + + /** + * The category this biller is belong to. + */ + category: string + } +} + +export interface GetBillerParams { + /** + * Optional. Determine the results page number. + */ + page?: number + + /** + * Filter the name of the biller (full or partial). + */ + name: string +} diff --git a/types/index.ts b/types/index.ts index 92ef7bcb..1f8e1873 100644 --- a/types/index.ts +++ b/types/index.ts @@ -15,3 +15,4 @@ export * from "./payments" export * from "./returns" export * from "./transactions" export * from "./webhooks" +export * from "./billPay" diff --git a/unit.ts b/unit.ts index 9b6b8dd6..823eb4e5 100644 --- a/unit.ts +++ b/unit.ts @@ -18,6 +18,7 @@ import { Statments } from "./resources/statements" import { Returns } from "./resources/returns" import { ApplicationForms } from "./resources/applicationForm" import { AccountsEndOfDay } from "./resources/accountEndOfDay" +import { BillPays } from "./resources" export class Unit { public applications: Applications @@ -39,6 +40,7 @@ export class Unit { public events: Events public applicationForms: ApplicationForms public returns: Returns + public billPays: BillPays constructor(token: string, basePath: string, config?: UnitConfig) { // remove all trailing slashes from user-provided basePath @@ -62,6 +64,7 @@ export class Unit { this.statements = new Statments(token, basePath, config) this.applicationForms = new ApplicationForms(token, basePath, config) this.returns = new Returns(token, basePath, config) + this.billPays = new BillPays(token, basePath, config) this.helpers = helpers }