Skip to content

Commit

Permalink
add notifications for cancellation events
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Oct 28, 2024
1 parent 8af270b commit 7dc31df
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
1 change: 1 addition & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ lint:
ignore_only:
RPC_REQUEST_STANDARD_NAME:
- proto/cmp/services/notification/v1/notify.proto
- proto/cmp/services/notification/v2/notify.proto
rpc_allow_google_protobuf_empty_responses: true
breaking:
use:
Expand Down
5 changes: 5 additions & 0 deletions proto/cmp/services/notification/v1/notify.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ message TokenExpired {
cmp.types.v1.UUID mint_id = 2;
}

// Notification service for different events that the partner should be notified about
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/notification/v2/notify.proto.dot.xs.svg)
//
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/notification/v2/notify.proto.dot.svg)
service NotificationService {
rpc TokenBoughtNotification(TokenBought) returns (google.protobuf.Empty);
rpc TokenExpiredNotification(TokenExpired) returns (google.protobuf.Empty);
Expand Down
81 changes: 81 additions & 0 deletions proto/cmp/services/notification/v2/notify.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
syntax = "proto3";

package cmp.services.notification.v2;

import "cmp/services/cancellation/v1/reject.proto";
import "cmp/types/v1/uuid.proto";
import "google/protobuf/empty.proto";

// Notification service for different events that the partner should be notified about
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/notification/v2/notify.proto.dot.xs.svg)
//
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/notification/v2/notify.proto.dot.svg)
service NotificationService {
rpc TokenBoughtNotification(TokenBought) returns (google.protobuf.Empty);
rpc TokenExpiredNotification(TokenExpired) returns (google.protobuf.Empty);
rpc CancellationPendingNotification(CancellationPending) returns (google.protobuf.Empty);
rpc CancellationAcceptedNotification(CancellationAccepted) returns (google.protobuf.Empty);
rpc CancellationProposalAcceptedByTheOwnerNotification(CancellationProposalAcceptedByTheOwner) returns (google.protobuf.Empty);
rpc CancellationCounteredNotification(CancellationCountered) returns (google.protobuf.Empty);
rpc CancellationProposalCancelledNotification(CancellationProposalCancelled) returns (google.protobuf.Empty);
rpc CancellationRejectedNotification(CancellationRejected) returns (google.protobuf.Empty);
}

message TokenBought {
uint64 token_id = 1;
string tx_id = 2;
cmp.types.v1.UUID mint_id = 3;
}

message TokenExpired {
uint64 token_id = 1;
cmp.types.v1.UUID mint_id = 2;
}

// event CancellationPending(uint256 indexed tokenId, address indexed proposedBy, uint256 refundAmount);
message CancellationPending {
uint64 token_id = 1;
string proposed_by = 2;
uint64 refund_amount = 3;
string tx_id = 4;
}

// event CancellationAccepted(uint256 indexed tokenId, address indexed acceptedBy, uint256 refundAmount);
message CancellationAccepted {
uint64 token_id = 1;
string accepted_by = 2;
uint64 refund_amount = 3;
string tx_id = 4;
}

// event CancellationProposalAcceptedByTheOwner(uint256 indexed tokenId, address indexed acceptedBy, uint256 refundAmount);
message CancellationProposalAcceptedByTheOwner {
uint64 token_id = 1;
string accepted_by = 2;
uint64 refund_amount = 3;
string tx_id = 4;
}

// event CancellationCountered(uint256 indexed tokenId, address indexed counteredBy, uint256 newRefundAmount);
message CancellationCountered {
uint64 token_id = 1;
string countered_by = 2;
uint64 new_refund_amount = 3;
string tx_id = 4;
}

// event CancellationProposalCancelled(uint256 indexed tokenId, address indexed cancelledBy);
message CancellationProposalCancelled {
uint64 token_id = 1;
string cancelled_by = 2;
string tx_id = 3;
}

// event CancellationRejected(uint256 indexed tokenId, address indexed rejectedBy, CancellationRejectionReason reason);
message CancellationRejected {
uint64 token_id = 1;
string rejected_by = 2;
cmp.services.cancellation.v1.CancellationRejectionReason reason = 3;
string tx_id = 4;
}

0 comments on commit 7dc31df

Please sign in to comment.