common.webhook

io.token.proto.common.webhook /common/src/main/proto/webhook.proto


syntax = "proto3";
package io.token.proto.common.webhook;
option java_outer_classname = "WebhookProtos";
option csharp_namespace = "Tokenio.Proto.Common.WebhookProtos";

import "transaction.proto";
import "submission.proto";

enum EventType {
  INVALID = 0;
  TRANSFER_STATUS_CHANGED = 1;
  BULK_TRANSFER_STATUS_CHANGED = 2;
  STANDING_ORDER_STATUS_CHANGED = 3;
}

message Webhook {
  string id = 1;
  Config config = 2;
  int64 created_at_ms = 3;
  int64 updated_at_ms = 4;

  message Config {
    string url = 1;                    // Webhook URL
    repeated EventType type = 2 [packed = true];
  }
}

message Event {
  string id = 1; // UUID
  int64 created_at_ms = 2;
  oneof payload {
    TransferStatusChanged transfer_status_changed = 3;
    BulkTransferStatusChanged bulk_transfer_status_changed = 4;
    StandingOrderStatusChanged standing_order_status_changed = 5;
  }
}

message TransferStatusChanged {
  string transfer_id = 1;
  string transaction_id = 2;
  string ref_id = 3;
  transaction.TransactionStatus status = 4;
}

message BulkTransferStatusChanged {
  string bulk_transfer_id = 1;
  repeated Status statuses = 2;

  message Status {
    string transaction_id = 1;
    string ref_id = 2;
    transaction.TransactionStatus status = 3;
  }
}

message StandingOrderStatusChanged {
  string submission_id = 1;
  string standing_order_id = 2;
  submission.SubmissionStatus status = 3;
}