Skip to content

Commit d8b8f67

Browse files
axshaniilyamerman
andauthored
new transaction and few changes (#144)
Co-authored-by: Ilya Merman <[email protected]>
1 parent 6b6a84f commit d8b8f67

File tree

1 file changed

+165
-18
lines changed

1 file changed

+165
-18
lines changed

types/transactions.ts

Lines changed: 165 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Address, Coordinates, Counterparty, Relationship, Tags, UnimplementedFields} from "./common"
1+
import { Address, Coordinates, Counterparty, Relationship, Tags, UnimplementedFields } from "./common"
22

33
export type Transaction = OriginatedAchTransaction | ReceivedAchTransaction | ReturnedAchTransaction | ReturnedReceivedAchTransaction | DishonoredAchTransaction |
44
BookTransaction | PurchaseTransaction | AtmTransaction | FeeTransaction | CardReversalTransaction | CardTransaction | WireTransaction |
5-
ReleaseTransaction | AdjustmentTransaction | InterestTransaction | DisputeTransaction | CheckDepositTransaction | ReturnedCheckDepositTransaction
5+
ReleaseTransaction | AdjustmentTransaction | InterestTransaction | DisputeTransaction | CheckDepositTransaction | ReturnedCheckDepositTransaction |
6+
PaymentAdvanceTransaction | RepaidPaymentAdvanceTransaction
67

78
export type TransactionDirection = "Credit" | "Debit"
89

@@ -65,17 +66,18 @@ export interface BaseTransactionAttributes extends UnimplementedFields {
6566

6667
export interface BaseTransactionRelationships extends UnimplementedFields {
6768
/**
68-
* The Deposit Account of the customer.
69+
* The [Deposit Account](https://developers.unit.co/deposit-accounts/) of the customer.
6970
*/
7071
account: Relationship
7172

7273
/**
73-
* The customer the deposit account belongs to. The customer is either a business or a individual.
74+
* The [Customer](https://developers.unit.co/customers/) the deposit account belongs to.
75+
* This relationship is only available if the account belongs to a single customer, business or individual.
7476
*/
7577
customer?: Relationship
7678

7779
/**
78-
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to multiple individual customers.
80+
* 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.
7981
*/
8082
customers?: Relationship[]
8183
}
@@ -95,6 +97,11 @@ export type OriginatedAchTransaction = BaseTransaction & {
9597
*/
9698
description: string
9799

100+
/**
101+
* Optional, additional transaction description.
102+
*/
103+
addenda: string
104+
98105
/**
99106
* The party on the other end of the transaction.
100107
*/
@@ -303,7 +310,7 @@ export type BookTransaction = BaseTransaction & {
303310
/**
304311
* The payment belonging to this transaction
305312
*/
306-
payment: Relationship
313+
payment?: Relationship
307314
}
308315
}
309316

@@ -337,7 +344,7 @@ export type PurchaseTransaction = BaseTransaction & {
337344
type: number
338345

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

@@ -371,6 +378,23 @@ export type PurchaseTransaction = BaseTransaction & {
371378
* Indicates whether the card was present when the transaction was created.
372379
*/
373380
cardPresent: boolean
381+
382+
/**
383+
* Optional. The payment method used, one of: Manual, Swipe, Contactless, ChipAndPin, Stored, Other.
384+
*/
385+
paymentMethod?: string
386+
387+
/**
388+
* Optional. The type of digital wallet used, one of: Google, Apple, Other.
389+
*/
390+
digitalWallet?: string
391+
392+
/**
393+
* Optional. The verification method used, one of: Address, CVV2, AddressAndCVV2.
394+
*/
395+
cardVerificationData?: {
396+
verificationMethod?: string
397+
}
374398
}
375399

376400
/**
@@ -386,6 +410,11 @@ export type PurchaseTransaction = BaseTransaction & {
386410
* Optional. The [Authorization](https://developers.unit.co/#authorization) request made by the merchant, if present (see [Authorizations](https://developers.unit.co/#authorizations)).
387411
*/
388412
authorization?: Relationship
413+
414+
/**
415+
* The preceding authorization request, if present (see [Authorization Requests](https://developers.unit.co/cards-authorization-requests/)).
416+
*/
417+
authorizationRequest?: Relationship
389418
}
390419
}
391420

@@ -418,6 +447,12 @@ export type AtmTransaction = BaseTransaction & {
418447
* The surcharge fee (cents) for the transaction.
419448
*/
420449
surcharge: number
450+
451+
/**
452+
* Optional. The interchange share for this transaction.
453+
* Calculated at the end of each day, see the [transaction.updated](https://developers.unit.co/events/#transactionupdated) event.
454+
*/
455+
intercharge?: number
421456
}
422457

423458
/**
@@ -442,7 +477,7 @@ export type FeeTransaction = BaseTransaction & {
442477
*/
443478
relationships: {
444479
/**
445-
* Optional. The transaction which the reversal is related to.
480+
* Optional. The transaction which the fee is subject to.
446481
*/
447482
relatedTransaction?: Relationship
448483
}
@@ -489,6 +524,58 @@ export type CardTransaction = BaseTransaction & {
489524
* The last 4 digits of the debit card involved in the transaction.
490525
*/
491526
cardLast4Digits: string
527+
528+
merchant: {
529+
/**
530+
* The name of the merchant.
531+
*/
532+
name?: string
533+
534+
/**
535+
* The 4-digit ISO 18245 merchant category code (MCC).
536+
*/
537+
type?: number
538+
539+
/**
540+
* The merchant category, described by the MCC code (see [this reference](https://github.com/greggles/mcc-codes) for the list of category descriptions).
541+
*/
542+
category?: string
543+
544+
/**
545+
* Optional. The location (city, state, etc.) of the merchant.
546+
*/
547+
location?: string
548+
}
549+
550+
/**
551+
* Optional. Indicates whether the transaction is recurring.
552+
*/
553+
recurring?: boolean
554+
555+
/**
556+
* 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.
557+
*/
558+
interchange?: number
559+
560+
/**
561+
* Optional. The payment method used, one of: Manual, Swipe, Contactless, ChipAndPin, Stored, Other.
562+
*/
563+
paymentMethod?: string
564+
565+
566+
/**
567+
* Optional. The type of digital wallet used, one of: Google, Apple, Other.
568+
*/
569+
digitalWallet?: string
570+
571+
/**
572+
* Optional. The verification method used, one of: Address, CVV2, AddressAndCVV2.
573+
*/
574+
cardVerificationData?: {
575+
verificationMethod?: string
576+
}
577+
578+
492579
}
493580
}
494581

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

602+
/**
603+
* Originator To Beneficiary Information, multi-line string delimited by \n.
604+
*/
605+
originatorToBeneficiaryInformation: string
606+
515607
/**
516608
* Sender reference.
517609
*/
@@ -521,6 +613,16 @@ export type WireTransaction = BaseTransaction & {
521613
* Reference for the Beneficiary.
522614
*/
523615
referenceForBeneficiary: string
616+
617+
/**
618+
* Beneficiary Information, multi-line string delimited by \n.
619+
*/
620+
beneficiaryInformation: string
621+
622+
/**
623+
* Beneficiary Advice Information, multi-line string delimited by \n.
624+
*/
625+
beneficiaryAdviceInformation: string
524626
}
525627
}
526628

@@ -605,6 +707,13 @@ export type DisputeTransaction = BaseTransaction & {
605707
*/
606708
reason: "ProvisionalCredit" | "ProvisionalCreditReversalDenied" | "ProvisionalCreditReversalResolved" | "FinalCredit"
607709
}
710+
711+
relationships: {
712+
/**
713+
* The transaction that has been disputed.
714+
*/
715+
disputedTransaction?: Relationship
716+
}
608717
}
609718

610719
export type CheckDepositTransaction = BaseTransaction & {
@@ -614,16 +723,11 @@ export type CheckDepositTransaction = BaseTransaction & {
614723
type: "checkDepositTransaction"
615724

616725
/**
617-
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposi).
726+
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposit).
618727
*/
619728
relationships: {
620729
/**
621-
* The list of Customers the deposit account belongs to. This relationship is only available if the account belongs to multiple individual customers.
622-
*/
623-
customers?: Relationship[]
624-
625-
/**
626-
* The Check Deposit the transaction is related to.
730+
* The [Check Deposit](https://developers.unit.co/resources/#check-deposit) the transaction is related to.
627731
*/
628732
checkDeposit: Relationship
629733
}
@@ -646,12 +750,55 @@ export type ReturnedCheckDepositTransaction = BaseTransaction & {
646750
}
647751

648752
/**
649-
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposi).
753+
* Describes relationships between the transaction resource and other resources (account, customer, checkDeposit).
650754
*/
651755
relationships: {
652756
/**
653-
* The Check Deposit the transaction is related to.
757+
* The [Check Deposit](https://developers.unit.co/resources/#check-deposit) the transaction is related to.
654758
*/
655759
checkDeposit: Relationship
656760
}
657-
}
761+
}
762+
763+
export type PaymentAdvanceTransaction = BaseTransaction & {
764+
/**
765+
* Type of the transaction resource. The value is always paymentAdvanceTransaction.
766+
*/
767+
type: "paymentAdvanceTransaction"
768+
769+
attributes: {
770+
direction: "Debit"
771+
}
772+
773+
/**
774+
* Describes relationships between the transaction resource and other resources (account, customer, receivedPayment).
775+
*/
776+
relationships: {
777+
/**
778+
* The [ReceivedPayment](https://developers.unit.co/received-ach/) that was advanced and funded with this transaction.
779+
*/
780+
receivedPayment: Relationship
781+
}
782+
}
783+
784+
export type RepaidPaymentAdvanceTransaction = BaseTransaction & {
785+
/**
786+
* Type of the transaction resource. The value is always repaidPaymentAdvanceTransaction.
787+
*/
788+
type: "repaidPaymentAdvanceTransaction"
789+
790+
/**
791+
* Describes relationships between the transaction resource and other resources (account, customer, receivedPayment).
792+
*/
793+
relationships: {
794+
/**
795+
* The [ReceivedPayment](https://developers.unit.co/received-ach/) that was advanced and funded with this transaction.
796+
*/
797+
receivedPayment: Relationship
798+
799+
/**
800+
* The transaction that Debit the account for the advance that this repayment is related to.
801+
*/
802+
paymentAdvanceTransaction: Relationship
803+
}
804+
}

0 commit comments

Comments
 (0)