Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions resources/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export class Payments extends BaseResource {
...(params?.accountId && { "filter[accountId]": params.accountId }),
...(params?.customerId && { "filter[customerId]": params.customerId }),
...(params?.tags && { "filter[tags]": params.tags }),
...(params?.status && { "filter[status]": params.status}),
...(params?.type && { "filter[type]": params.type}),
...(params?.direction && { "filter[direction]": params.direction}),
...(params?.since && { "filter[since]": params.since}),
...(params?.until && { "filter[until]": params.until}),
"sort": params?.sort ? params.sort : "-createdAt",
"include": params?.include ? params.include : ""
}
Expand Down Expand Up @@ -68,13 +73,38 @@ export interface PaymentListParams {
customerId?: string

/**
* Optional. Filter Applications by Tags.
* default: empty
*/
* Optional. Filter Applications by Tags.
* default: empty
*/
tags?: object

/**
* Optional. Filter Payments by [ACH Status](https://developers.unit.co/payments/#ach-status).
*/
status?: string

/**
* Optional. Filter Payments by Payment type. such as (ACHPayment, BookPayment, WirePayment or BillPayment).
*/
type?: string

/**
* Optional. Filter Payments by direction. such as (Debit, Credit).
*/
direction?: string

/**
* Optional. Filters the Payments that occurred after the specified date. e.g. 2020-01-13T16:01:19.346Z
*/
since?: string

/**
* Optional. Filters the Payments that occurred before the specified date. e.g. 2020-01-02T20:06:23.486Z
*/
until?: string

/**
* Optional. .Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
* Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
* default: sort=-createdAt
*/
sort?: string
Expand Down
80 changes: 66 additions & 14 deletions types/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Relationship, Counterparty, WireCounterparty } from "./common"

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

export type Payment = AchPayment | BookPayment | WirePayment
export type Payment = AchPayment | BookPayment | WirePayment | BillPayment

interface BasePaymentAttributes {
/**
Expand Down Expand Up @@ -85,9 +85,14 @@ export interface AchPayment {
account: Relationship

/**
* The Customer the deposit account belongs to. The customer is either a business or a individual.
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
*/
customer: Relationship
customer?: Relationship

/**
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to multiple individual customers.
*/
customers?: Relationship[]

/**
* The Counterparty the payment to be made to.
Expand Down Expand Up @@ -122,24 +127,29 @@ interface BookPayment {
account: Relationship

/**
* The Customer the deposit account belongs to. The customer is either a business or a individual.
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
*/
customer?: Relationship

/**
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customers.
*/
customer: Relationship
customers?: Relationship[]

/**
* The Counterparty account the payment to be made to.
*/
counterpartyAccount: Relationship

/**
* The Customer the counterparty account belongs to.The customer is either a business or a individual.
* The Customer the counterparty account belongs to. The customer is either a business or an individual, might be empty if there is more than one associated customer.
*/
counterpartyCustomer: Relationship
counterpartyCustomer: Relationship

/**
* The Book Transaction generated by this payment.
*/
transaction: Relationship
transaction: Relationship
}
}

Expand Down Expand Up @@ -176,19 +186,61 @@ export interface WirePayment {
account: Relationship

/**
* The Customer the deposit account belongs to.
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, business or individual.
*/
customer: Relationship
customer?: Relationship

/**
* The Customer the deposit account belongs to.
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customers.
*/
customers: Relationship[]
customers?: Relationship[]

/**
* The Wire Transaction generated by this payment.
*/
transaction: Relationship
transaction: Relationship
}
}

export interface BillPayment {
/**
* Identifier of the bill payment resource.
*/
id: string

/**
* Type of the payment resource. The value is always billPayment.
*/
type: "billPayment"

/**
* JSON object representing the payment resource.
*/
attributes: Pick<BasePaymentAttributes, "createdAt" | "status" | "direction" | "description" | "amount" | "tags">

/**
* Describes relationships between the Wire payment and the originating deposit account and customer.
*/
relationships: {
/**
* The Deposit Account creating the payment.
*/
account: Relationship

/**
* The Customer the deposit account belongs to. This relationship is only available if the account belongs to a single customer, butisness or individual.
*/
customer?: Relationship

/**
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to a multiple individual customer
*/
customers?: Relationship[]

/**
* The BillPay Transaction generated by this payment.
*/
transaction: Relationship
}
}

Expand Down Expand Up @@ -218,7 +270,7 @@ export interface CreateWirePaymentRequest {
/**
* The party on the other side of the Wire payment.
*/
counterparty: WireCounterparty
counterparty: WireCounterparty

/**
* See Idempotency.
Expand Down