11import { Direction , HealthcareAmounts , Merchant , Relationship , Tags , UnimplementedFields , UnimplementedRelationships } from "./common"
2- import { ReceivedPaymentStatus } from "./payments"
2+ import { ReceivedPaymentStatus } from "./payments"
33
4- export type UnitEvent = AccountEvents | ApplicationEvents | AuthorizationEvents | CardEvents | CustomerEvents | DocumentApproved | CheckDepositEvents |
5- DocumentRejected | PaymentEvents | StatementsCreated | TransactionEvents | ChargeBackCreated | RewardEvents | DisputeEvents
4+ export type UnitEvent = AccountEvents | ApplicationEvents | AuthorizationEvents | CardEvents | CustomerEvents | DocumentEvents | CheckDepositEvents | PaymentEvents | RecurringPaymentEvents | StatementsCreated | TransactionEvents | ChargeBackCreated | RewardEvents | DisputeEvents
65
76export interface BaseEvent {
87 id : string
@@ -21,7 +20,12 @@ export interface BaseEventRelationships {
2120 customer : Relationship
2221}
2322
24- type AccountEvents = AccountClosed | AccountFrozen | AccountReopened | AccountUnfrozen
23+ export type AccountEvents = AccountCreated | AccountClosed | AccountFrozen | AccountReopened | AccountUnfrozen
24+
25+ export type AccountCreated = BaseEvent & {
26+ type : "account.created"
27+ relationships : BaseEventRelationships
28+ }
2529
2630export type AccountClosed = BaseEvent & {
2731 type : "account.closed"
@@ -49,7 +53,14 @@ export type AccountUnfrozen = BaseEvent & {
4953 relationships : BaseEventRelationships
5054}
5155
52- type ApplicationEvents = ApplicationDenied | ApplicationAwaitingDocuments | ApplicationPendingReview
56+ export type ApplicationEvents = ApplicationCanceled | ApplicationDenied | ApplicationAwaitingDocuments | ApplicationPendingReview
57+
58+ export type ApplicationCanceled = BaseEvent & {
59+ type : "application.canceled"
60+ relationships : {
61+ application : Relationship
62+ }
63+ }
5364
5465export type ApplicationDenied = BaseEvent & {
5566 type : "application.denied"
@@ -83,8 +94,7 @@ type AuthorizationAttributes = BaseEventAttributes & {
8394 recurring : boolean
8495}
8596
86- type AuthorizationEvents = AuthorizationCreated | AuthorizationCanceled | AuthorizationDeclined | AuthorizationAmountChanged | AuthorizationRequestApproved
87- | AuthorizationRequestPending | AuthorizationRequestDeclined
97+ export type AuthorizationEvents = AuthorizationCreated | AuthorizationCanceled | AuthorizationDeclined | AuthorizationAmountChanged | AuthorizationRequestApproved | AuthorizationRequestPending | AuthorizationRequestDeclined
8898
8999export type AuthorizationCreated = BaseEvent & {
90100 type : "authorization.created"
@@ -176,7 +186,14 @@ export type BulkPaymentsFinished = BaseEvent & {
176186 }
177187}
178188
179- type CardEvents = CardActivated | CardStatusChanged
189+ export type CardEvents = CardCreated | CardActivated | CardStatusChanged
190+
191+ export type CardCreated = BaseEvent & {
192+ type : "card.created"
193+ relationships : {
194+ card : Relationship
195+ } & BaseEventRelationships
196+ }
180197
181198export type CardActivated = BaseEvent & {
182199 type : "card.activated"
@@ -196,7 +213,7 @@ export type CardStatusChanged = BaseEvent & {
196213 } & BaseEventRelationships
197214}
198215
199- type CustomerEvents = CustomerCreated | CustomerUpdated | CustomerArchived
216+ export type CustomerEvents = CustomerCreated | CustomerUpdated | CustomerArchived
200217
201218export type CustomerCreated = BaseEvent & {
202219 type : "customer.created"
@@ -220,6 +237,8 @@ export type CustomerArchived = BaseEvent & {
220237 }
221238}
222239
240+ export type DocumentEvents = DocumentApproved | DocumentRejected
241+
223242export type DocumentApproved = BaseEvent & {
224243 type : "document.approved"
225244 relationships : {
@@ -249,9 +268,7 @@ type PaymentAttributes = BaseEventAttributes & {
249268 amount : number
250269}
251270
252- type PaymentEvents = PaymentCreated | PaymentClearing | PaymentCanceled | PaymentRejected | PaymentReturned | PaymentSent | PaymentPendingReview |
253- ReceivedPaymentCreated | ReceivedPaymentAdvanced | ReceivedPaymentReturned | ReceivedPaymentCompleted | BulkPaymentsFailed | BulkPaymentsFinished |
254- DeclinedIncomingPayment
271+ export type PaymentEvents = PaymentCreated | PaymentClearing | PaymentCanceled | PaymentRejected | PaymentReturned | PaymentSent | PaymentPendingReview | ReceivedPaymentCreated | ReceivedPaymentAdvanced | ReceivedPaymentReturned | ReceivedPaymentCompleted | BulkPaymentsFailed | BulkPaymentsFinished | DeclinedIncomingPayment
255272
256273export type PaymentCreated = BaseEvent & {
257274 type : "payment.created"
@@ -305,14 +322,53 @@ export type PaymentPendingReview = BaseEvent & {
305322 relationships : PaymentRelationships
306323}
307324
325+ type RecurringPaymentStatus = "Active" | "Completed" | "Disabled"
326+
327+ type RecurringPaymentAttributes = BaseEventAttributes & {
328+ amount : number
329+ }
330+
331+ type RecurringPaymentRelationships = BaseEventRelationships & {
332+ recurringPayment : Relationship
333+ }
334+
335+ export type RecurringPaymentEvents = RecurringPaymentCreated | RecurringPaymentStatusChanged | RecurringPaymentFailed
336+
337+ export type RecurringPaymentCreated = BaseEvent & {
338+ type : "recurringPayment.created"
339+ attributes : {
340+ status : RecurringPaymentStatus
341+ nextScheduledAction : string
342+ } & RecurringPaymentAttributes
343+ relationships : RecurringPaymentRelationships
344+ }
345+
346+ export type RecurringPaymentStatusChanged = BaseEvent & {
347+ type : "recurringPayment.statusChanged"
348+ attributes : {
349+ status : RecurringPaymentStatus
350+ previousStatus : RecurringPaymentStatus
351+ numberOfPayments : number
352+ } & RecurringPaymentAttributes
353+ relationships : RecurringPaymentRelationships
354+ }
355+
356+ export type RecurringPaymentFailed = BaseEvent & {
357+ type : "recurringPayment.failed"
358+ attributes : {
359+ error : string
360+ } & RecurringPaymentAttributes
361+ relationships : RecurringPaymentRelationships
362+ }
363+
308364export type StatementsCreated = BaseEvent & {
309365 type : "statements.created"
310366 attributes : {
311367 period : string
312368 }
313369}
314370
315- type TransactionEvents = TransactionCreated | TransactionUpdated
371+ export type TransactionEvents = TransactionCreated | TransactionUpdated
316372
317373export type TransactionCreated = BaseEvent & {
318374 type : "transaction.created"
@@ -402,7 +458,7 @@ export type ChargeBackCreated = BaseEvent & {
402458 } & BaseEventRelationships
403459}
404460
405- type RewardEvents = RewardSent | RewardRejected
461+ export type RewardEvents = RewardSent | RewardRejected
406462
407463export type RewardSent = BaseEvent & {
408464 type : "reward.sent"
@@ -428,7 +484,7 @@ type CheckDepositRelationships = {
428484 checkDeposit : Relationship
429485} & BaseEventRelationships
430486
431- type CheckDepositEvents = CheckDepositCreated | CheckDepositPendingReview | CheckDepositPending | CheckDepositRejected | CheckDepositClearing | CheckDepositSent | CheckDepositReturend
487+ export type CheckDepositEvents = CheckDepositCreated | CheckDepositPendingReview | CheckDepositPending | CheckDepositRejected | CheckDepositClearing | CheckDepositSent | CheckDepositReturend
432488
433489export type CheckDepositCreated = BaseEvent & {
434490 type : "checkDeposit.created"
@@ -498,7 +554,7 @@ export type DeclinedIncomingPayment = BaseEvent & {
498554 relationships : BaseEventRelationships
499555}
500556
501- type DisputeEvents = DisputeCreated | DisputeStatusChanged
557+ export type DisputeEvents = DisputeCreated | DisputeStatusChanged
502558
503559export type DisputeCreated = BaseEvent & {
504560 type : "dispute.created"
@@ -526,7 +582,3 @@ export type DisputeStatusChanged = BaseEvent & {
526582 transaction : Relationship
527583 }
528584}
529-
530-
531-
532-
0 commit comments