Skip to content

Commit 9045838

Browse files
axshaniilyamerman
andauthored
added new events (#358)
* added new events * AuthorizationUpdated * fix typo --------- Co-authored-by: Ilya Merman <[email protected]>
1 parent 3ef2729 commit 9045838

File tree

1 file changed

+142
-3
lines changed

1 file changed

+142
-3
lines changed

types/events.ts

Lines changed: 142 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Direction, HealthcareAmounts, Merchant, Relationship, Tags, UnimplementedFields, UnimplementedRelationships } from "./common"
22
import { ReceivedPaymentStatus } from "./payments"
33

4-
export type UnitEvent = AccountEvents | ApplicationEvents | AuthorizationEvents | CardEvents | CustomerEvents | DocumentEvents | CheckDepositEvents | PaymentEvents | RecurringPaymentEvents | StatementsCreated | TransactionEvents | ChargeBackCreated | RewardEvents | DisputeEvents
4+
export type UnitEvent = AccountEvents | ApplicationEvents | AuthorizationEvents | CardEvents | CustomerEvents | DocumentEvents |
5+
CheckDepositEvents | PaymentEvents | RecurringPaymentEvents | StatementsCreated | TransactionEvents |
6+
ChargeBackCreated | RewardEvents | DisputeEvents | RepaymentEvents | StopPaymentEvents | CheckPaymentEvents
57

68
export interface BaseEvent {
79
id: string
@@ -101,7 +103,7 @@ type AuthorizationAttributes = BaseEventAttributes & {
101103
recurring: boolean
102104
}
103105

104-
export type AuthorizationEvents = AuthorizationCreated | AuthorizationCanceled | AuthorizationDeclined | AuthorizationAmountChanged | AuthorizationRequestApproved | AuthorizationRequestPending | AuthorizationRequestDeclined
106+
export type AuthorizationEvents = AuthorizationCreated | AuthorizationCanceled | AuthorizationDeclined | AuthorizationAmountChanged | AuthorizationRequestApproved | AuthorizationRequestPending | AuthorizationRequestDeclined | AuthorizationUpdated
105107

106108
export type AuthorizationCreated = BaseEvent & {
107109
type: "authorization.created"
@@ -134,6 +136,11 @@ export type AuthorizationAmountChanged = BaseEvent & {
134136
relationships: AuthorizationRelationships
135137
}
136138

139+
export type AuthorizationUpdated = BaseEvent & {
140+
type: "authorization.updated"
141+
relationships: AuthorizationRelationships
142+
}
143+
137144
type AuthorizationRequestRelationships = BaseEventRelationships & {
138145
authorizationRequest: Relationship
139146
card: Relationship
@@ -168,7 +175,6 @@ export type AuthorizationRequestPending = BaseEvent & {
168175
relationships: AuthorizationRequestRelationships
169176
}
170177

171-
172178
export type AuthorizationRequestDeclined = BaseEvent & {
173179
type: "authorizationRequest.declined"
174180
attributes: AuthorizationRequestAttributes & {
@@ -245,6 +251,9 @@ export type CustomerUpdated = BaseEvent & {
245251

246252
export type CustomerArchived = BaseEvent & {
247253
type: "customer.archived"
254+
attributes: {
255+
archiveReason: string
256+
} & BaseEventAttributes
248257
relationships: {
249258
customer: Relationship
250259
}
@@ -295,6 +304,7 @@ export type PaymentClearing = BaseEvent & {
295304
type: "payment.clearing"
296305
attributes: PaymentAttributes & {
297306
previousStatus: string
307+
available: number
298308
}
299309
relationships: PaymentRelationships
300310
}
@@ -303,6 +313,7 @@ export type PaymentSent = BaseEvent & {
303313
type: "payment.sent"
304314
attributes: PaymentAttributes & {
305315
previousStatus: string
316+
available: number
306317
}
307318
relationships: PaymentRelationships
308319
}
@@ -311,6 +322,7 @@ export type PaymentReturned = BaseEvent & {
311322
type: "payment.returned"
312323
attributes: PaymentAttributes & {
313324
previousStatus: string
325+
available: number
314326
}
315327
relationships: PaymentRelationships
316328
}
@@ -465,6 +477,105 @@ export type ReceivedPaymentReturned = BaseEvent & {
465477
} & BaseEventRelationships
466478
}
467479

480+
export type StopPaymentCreated = BaseEvent & {
481+
type: "stopPayment.created"
482+
relationships: {
483+
stopPayment: Relationship
484+
} & BaseEventRelationships
485+
}
486+
487+
export type StopPaymentStopped = BaseEvent & {
488+
type: "stopPayment.paymentStopped"
489+
attributes: {
490+
stoppedPaymentType: string
491+
} & BaseEventAttributes
492+
relationships: {
493+
stopPayment: Relationship
494+
stoppedPayment: Relationship
495+
} & BaseEventRelationships
496+
}
497+
498+
export type StopPaymentDisabled = BaseEvent & {
499+
type: "stopPayment.disabled"
500+
attributes: {
501+
status: string
502+
previousStatus: string
503+
} & BaseEventAttributes
504+
relationships: {
505+
stopPayment: Relationship
506+
} & BaseEventRelationships
507+
}
508+
509+
export type StopPaymentEvents = StopPaymentCreated | StopPaymentStopped | StopPaymentDisabled
510+
511+
export type CheckPaymentEvents = CheckPaymentCreated | CheckPaymentMarkedForReturn | CheckPaymentProcessed | CheckPaymentReturned | CheckPaymentAdditionalVerificationRequired | CheckPaymentAdditionalVerificationApproved
512+
513+
export type CheckPaymentCreated = BaseEvent & {
514+
type: "checkPayment.created"
515+
attributes: {
516+
status: string
517+
additionalVerificationStatus: boolean
518+
} & BaseEventAttributes
519+
relationships: {
520+
checkPayment: Relationship
521+
transaction: Relationship
522+
} & BaseEventRelationships
523+
}
524+
525+
export type CheckPaymentMarkedForReturn = BaseEvent & {
526+
type:"checkPayment.markedForReturn"
527+
attributes: {
528+
previousStatus: string
529+
} & BaseEventAttributes
530+
relationships: {
531+
checkPayment: Relationship
532+
} & BaseEventRelationships
533+
}
534+
535+
export type CheckPaymentProcessed = BaseEvent & {
536+
type: "checkPayment.processed"
537+
attributes: {
538+
previousStatus: string
539+
additionalVerificationStatus: boolean
540+
} & BaseEventAttributes
541+
relationships: {
542+
checkPayment: Relationship
543+
transaction: Relationship
544+
} & BaseEventRelationships
545+
}
546+
547+
export type CheckPaymentReturned = BaseEvent & {
548+
type: "checkPayment.returned"
549+
attributes: {
550+
previousStatus: string
551+
} & BaseEventAttributes
552+
relationships: {
553+
checkPayment: Relationship
554+
} & BaseEventRelationships
555+
}
556+
557+
export type CheckPaymentAdditionalVerificationRequired = BaseEvent & {
558+
type: "checkPayment.additionalVerificationRequired"
559+
attributes: {
560+
status: string
561+
amount: number
562+
} & BaseEventAttributes
563+
relationships: {
564+
checkPayment: Relationship
565+
} & BaseEventRelationships
566+
}
567+
568+
export type CheckPaymentAdditionalVerificationApproved = BaseEvent & {
569+
type: "checkPayment.additionalVerificationApproved"
570+
attributes: {
571+
status: string
572+
amount: number
573+
} & BaseEventAttributes
574+
relationships: {
575+
checkPayment: Relationship
576+
} & BaseEventRelationships
577+
}
578+
468579
export type ChargeBackCreated = BaseEvent & {
469580
type: "chargeback.created"
470581
attributes: {
@@ -602,3 +713,31 @@ export type DisputeStatusChanged = BaseEvent & {
602713
transaction: Relationship
603714
}
604715
}
716+
717+
export type RepaymentCreated = BaseEvent & {
718+
type: "repayment.created"
719+
attributes: {
720+
amount: number
721+
status: string
722+
}
723+
relationships: BaseEventRelationships & {
724+
repayment: Relationship
725+
payment: Relationship
726+
}
727+
}
728+
729+
export type RepaymentStatusChanged = BaseEvent & {
730+
type: "repayment.statusChanged"
731+
attributes: {
732+
amount: number
733+
newStatus: string
734+
previousStatus: string
735+
}
736+
relationships: BaseEventRelationships & {
737+
dispute: Relationship
738+
transaction: Relationship
739+
}
740+
}
741+
742+
export type RepaymentEvents = RepaymentCreated | RepaymentStatusChanged
743+

0 commit comments

Comments
 (0)