Init payments message types

This commit is contained in:
Jamie Kyle
2022-11-30 13:47:54 -08:00
committed by GitHub
parent 0c4b52a125
commit 6198b02640
26 changed files with 741 additions and 185 deletions

34
ts/types/Payment.ts Normal file
View File

@@ -0,0 +1,34 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export enum PaymentEventKind {
Notification = 1,
ActivationRequest = 2,
Activation = 3,
// Request = 4, -- disabled
// Cancellation = 5, -- disabled
}
export type PaymentNotificationEvent = {
kind: PaymentEventKind.Notification;
note: string | null;
};
export type PaymentActivationRequestEvent = {
kind: PaymentEventKind.ActivationRequest;
};
export type PaymentActivatedEvent = {
kind: PaymentEventKind.Activation;
};
export type AnyPaymentEvent =
| PaymentNotificationEvent
| PaymentActivationRequestEvent
| PaymentActivatedEvent;
export function isPaymentNotificationEvent(
event: AnyPaymentEvent
): event is PaymentNotificationEvent {
return event.kind === PaymentEventKind.Notification;
}