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";
import "v2/payout.proto";
import "v2/openbanking/vrp.proto";
import "v2/common.proto";
import "bankinfo.proto";
import "event.proto";
import "v2/openbanking/payment.proto";

enum EventType {
  INVALID = 0;
  TRANSFER_STATUS_CHANGED = 1;
  BULK_TRANSFER_STATUS_CHANGED = 2;
  STANDING_ORDER_STATUS_CHANGED = 3;
  REFUND_STATUS_CHANGED = 4;
  VRP_STATUS_CHANGED = 5;
  VRP_CONSENT_STATUS_CHANGED = 6;
  BANK_AIS_OUTAGE_STATUS_CHANGED = 7;
  BANK_SIP_OUTAGE_STATUS_CHANGED = 8;
  PAYMENT_STATUS_CHANGED = 10;
  PAYOUT_STATUS_CHANGED = 11;
  SETTLEMENT_RULE_PAYOUT_EXECUTION_FAILED = 12;
}

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;
    RefundStatusChanged refund_status_changed = 6;
    io.token.proto.common.event.VrpStatusChanged vrp_status_changed = 7;
    io.token.proto.common.event.VrpConsentStatusChanged vrp_consent_status_changed = 8;
    io.token.proto.common.event.BankOutageStatusChanged bank_outage_status_changed = 9;
    PayoutStatusChanged payout_status_changed = 10;
    io.token.proto.common.event.SettlementRulePayoutExecutionFailed settlement_rule_payout_execution_failed = 13;
  }
  EventType event_type = 11; // This field will be populated only for V2 events.
  v2.openbanking.payment.Payment payment = 12; // This field will be populated only for payment event types.
}

message TransferStatusChanged {
  string transfer_id = 1;
  string transaction_id = 2;
  string ref_id = 3;
  transaction.TransactionStatus status = 4;
  string status_reason_information = 5; // Optional: provides detailed information on the status reason
  string token_request_id = 6;
  string bank_payment_status = 7; // original payment status from the bank
}

message PayoutStatusChanged {
  string payout_id = 1; //token payout id
  string bank_transaction_id = 2;
  string ref_id = 3;
  v2.payout.Status status = 4;  // do we need to add new statuses in TransactionStatus?
  string status_reason_information = 5; // Optional: provides detailed information on the status reason
  string bank_payment_status = 6; // original payment status from the bank
  string member_id = 7;
}

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

  message Status {
    string transaction_id = 1;
    string ref_id = 2;
    transaction.TransactionStatus status = 3;
    string bank_payment_status = 4; // original payment status from the bank
  }
}

message StandingOrderStatusChanged {
  string submission_id = 1;
  string standing_order_id = 2;
  submission.SubmissionStatus status = 3;
  string status_reason_information = 4; // Optional: provides detailed information on the status reason
  string token_request_id = 5;
  string bank_standing_order_status = 6; // original standing order status from the bank
}

message RefundStatusChanged {
  string refund_id = 1;
  string member_id = 2;
  v2.payout.Status status = 3;
  string bank_transaction_id = 4; // Transaction id from the bank side. Can be empty if it is not available from the bank side
  string bank_payment_status = 5; // The raw bank status. Can be empty if no payment status is available on bank side
  string ref_id = 6;
  v2.payout.RefundInitiation initiation = 7;
}