Skip to content
Merged
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
183 changes: 165 additions & 18 deletions types/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Address, Coordinates, Counterparty, Relationship, Tags, UnimplementedFields} from "./common"
import { Address, Coordinates, Counterparty, Relationship, Tags, UnimplementedFields } from "./common"

export type Transaction = OriginatedAchTransaction | ReceivedAchTransaction | ReturnedAchTransaction | ReturnedReceivedAchTransaction | DishonoredAchTransaction |
BookTransaction | PurchaseTransaction | AtmTransaction | FeeTransaction | CardReversalTransaction | CardTransaction | WireTransaction |
ReleaseTransaction | AdjustmentTransaction | InterestTransaction | DisputeTransaction | CheckDepositTransaction | ReturnedCheckDepositTransaction
ReleaseTransaction | AdjustmentTransaction | InterestTransaction | DisputeTransaction | CheckDepositTransaction | ReturnedCheckDepositTransaction |
PaymentAdvanceTransaction | RepaidPaymentAdvanceTransaction

export type TransactionDirection = "Credit" | "Debit"

Expand Down Expand Up @@ -65,17 +66,18 @@ export interface BaseTransactionAttributes extends UnimplementedFields {

export interface BaseTransactionRelationships extends UnimplementedFields {
/**
* The Deposit Account of the customer.
* The [Deposit Account](https://developers.unit.co/deposit-accounts/) of the customer.
*/
account: Relationship

/**
* The customer the deposit account belongs to. The customer is either a business or a individual.
* The [Customer](https://developers.unit.co/customers/) 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 multiple individual customers.
* The list of [Customers](https://developers.unit.co/customers/) the deposit account belongs to. This relationship is only available if the account belongs to multiple individual customers.
*/
customers?: Relationship[]
}
Expand All @@ -95,6 +97,11 @@ export type OriginatedAchTransaction = BaseTransaction & {
*/
description: string

/**
* Optional, additional transaction description.
*/
addenda: string

/**
* The party on the other end of the transaction.
*/
Expand Down Expand Up @@ -303,7 +310,7 @@ export type BookTransaction = BaseTransaction & {
/**
* The payment belonging to this transaction
*/
payment: Relationship
payment?: Relationship
}
}

Expand Down Expand Up @@ -337,7 +344,7 @@ export type PurchaseTransaction = BaseTransaction & {
type: number

/**
* The merchant category, described by the MCC code (see this reference for the list of category descriptions).
* The merchant category, described by the MCC code (see [this reference](https://github.com/greggles/mcc-codes) for the list of category descriptions).
*/
category: string

Expand Down Expand Up @@ -371,6 +378,23 @@ export type PurchaseTransaction = BaseTransaction & {
* Indicates whether the card was present when the transaction was created.
*/
cardPresent: boolean

/**
* Optional. The payment method used, one of: Manual, Swipe, Contactless, ChipAndPin, Stored, Other.
*/
paymentMethod?: string

/**
* Optional. The type of digital wallet used, one of: Google, Apple, Other.
*/
digitalWallet?: string

/**
* Optional. The verification method used, one of: Address, CVV2, AddressAndCVV2.
*/
cardVerificationData?: {
verificationMethod?: string
}
}

/**
Expand All @@ -386,6 +410,11 @@ export type PurchaseTransaction = BaseTransaction & {
* Optional. The [Authorization](https://developers.unit.co/#authorization) request made by the merchant, if present (see [Authorizations](https://developers.unit.co/#authorizations)).
*/
authorization?: Relationship

/**
* The preceding authorization request, if present (see [Authorization Requests](https://developers.unit.co/cards-authorization-requests/)).
*/
authorizationRequest?: Relationship
}
}

Expand Down Expand Up @@ -418,6 +447,12 @@ export type AtmTransaction = BaseTransaction & {
* The surcharge fee (cents) for the transaction.
*/
surcharge: number

/**
* Optional. The interchange share for this transaction.
* Calculated at the end of each day, see the [transaction.updated](https://developers.unit.co/events/#transactionupdated) event.
*/
intercharge?: number
}

/**
Expand All @@ -442,7 +477,7 @@ export type FeeTransaction = BaseTransaction & {
*/
relationships: {
/**
* Optional. The transaction which the reversal is related to.
* Optional. The transaction which the fee is subject to.
*/
relatedTransaction?: Relationship
}
Expand Down Expand Up @@ -489,6 +524,58 @@ export type CardTransaction = BaseTransaction & {
* The last 4 digits of the debit card involved in the transaction.
*/
cardLast4Digits: string

merchant: {
/**
* The name of the merchant.
*/
name?: string

/**
* The 4-digit ISO 18245 merchant category code (MCC).
*/
type?: number

/**
* The merchant category, described by the MCC code (see [this reference](https://github.com/greggles/mcc-codes) for the list of category descriptions).
*/
category?: string

/**
* Optional. The location (city, state, etc.) of the merchant.
*/
location?: string
}

/**
* Optional. Indicates whether the transaction is recurring.
*/
recurring?: boolean

/**
* Optional. The interchange share for this transaction. Calculated at the end of each day, see the [transaction.updated](https://developers.unit.co/events/#transactionupdated) event.
*/
interchange?: number

/**
* Optional. The payment method used, one of: Manual, Swipe, Contactless, ChipAndPin, Stored, Other.
*/
paymentMethod?: string


/**
* Optional. The type of digital wallet used, one of: Google, Apple, Other.
*/
digitalWallet?: string

/**
* Optional. The verification method used, one of: Address, CVV2, AddressAndCVV2.
*/
cardVerificationData?: {
verificationMethod?: string
}


}
}

Expand All @@ -512,6 +599,11 @@ export type WireTransaction = BaseTransaction & {
*/
description: string

/**
* Originator To Beneficiary Information, multi-line string delimited by \n.
*/
originatorToBeneficiaryInformation: string

/**
* Sender reference.
*/
Expand All @@ -521,6 +613,16 @@ export type WireTransaction = BaseTransaction & {
* Reference for the Beneficiary.
*/
referenceForBeneficiary: string

/**
* Beneficiary Information, multi-line string delimited by \n.
*/
beneficiaryInformation: string

/**
* Beneficiary Advice Information, multi-line string delimited by \n.
*/
beneficiaryAdviceInformation: string
}
}

Expand Down Expand Up @@ -605,6 +707,13 @@ export type DisputeTransaction = BaseTransaction & {
*/
reason: "ProvisionalCredit" | "ProvisionalCreditReversalDenied" | "ProvisionalCreditReversalResolved" | "FinalCredit"
}

relationships: {
/**
* The transaction that has been disputed.
*/
disputedTransaction?: Relationship
}
}

export type CheckDepositTransaction = BaseTransaction & {
Expand All @@ -614,16 +723,11 @@ export type CheckDepositTransaction = BaseTransaction & {
type: "checkDepositTransaction"

/**
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposi).
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposit).
*/
relationships: {
/**
* 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 Check Deposit the transaction is related to.
* The [Check Deposit](https://developers.unit.co/resources/#check-deposit) the transaction is related to.
*/
checkDeposit: Relationship
}
Expand All @@ -646,12 +750,55 @@ export type ReturnedCheckDepositTransaction = BaseTransaction & {
}

/**
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposi).
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposit).
*/
relationships: {
/**
* The Check Deposit the transaction is related to.
* The [Check Deposit](https://developers.unit.co/resources/#check-deposit) the transaction is related to.
*/
checkDeposit: Relationship
}
}
}

export type PaymentAdvanceTransaction = BaseTransaction & {
/**
* Type of the transaction resource. The value is always paymentAdvanceTransaction.
*/
type: "paymentAdvanceTransaction"

attributes: {
direction: "Debit"
}

/**
* Describes relationships between the transaction resource and other resources (account, customer, receivedPayment).
*/
relationships: {
/**
* The [ReceivedPayment](https://developers.unit.co/received-ach/) that was advanced and funded with this transaction.
*/
receivedPayment: Relationship
}
}

export type RepaidPaymentAdvanceTransaction = BaseTransaction & {
/**
* Type of the transaction resource. The value is always repaidPaymentAdvanceTransaction.
*/
type: "repaidPaymentAdvanceTransaction"

/**
* Describes relationships between the transaction resource and other resources (account, customer, receivedPayment).
*/
relationships: {
/**
* The [ReceivedPayment](https://developers.unit.co/received-ach/) that was advanced and funded with this transaction.
*/
receivedPayment: Relationship

/**
* The transaction that Debit the account for the advance that this repayment is related to.
*/
paymentAdvanceTransaction: Relationship
}
}