From 2683d61f2425f0a2ed63b893425d63c51018949e Mon Sep 17 00:00:00 2001 From: Ekrem Seren Date: Fri, 29 Nov 2024 10:47:44 +0300 Subject: [PATCH] merge reason into one file, add withdrawal reason --- .../cancellation/v1/cancel_proposal.proto | 25 ----------- .../cmp/services/cancellation/v1/check.proto | 3 +- .../services/cancellation/v1/initiate.proto | 7 --- .../cmp/services/cancellation/v1/reason.proto | 44 +++++++++++++++++++ .../cmp/services/cancellation/v1/reject.proto | 11 +---- .../cancellation/v1/rejection_reason.proto | 16 ------- .../services/cancellation/v1/services.proto | 7 ++- .../services/cancellation/v1/withdraw.proto | 25 +++++++++++ .../cmp/services/notification/v2/notify.proto | 18 ++++---- 9 files changed, 84 insertions(+), 72 deletions(-) delete mode 100644 proto/cmp/services/cancellation/v1/cancel_proposal.proto delete mode 100644 proto/cmp/services/cancellation/v1/rejection_reason.proto create mode 100644 proto/cmp/services/cancellation/v1/withdraw.proto diff --git a/proto/cmp/services/cancellation/v1/cancel_proposal.proto b/proto/cmp/services/cancellation/v1/cancel_proposal.proto deleted file mode 100644 index 7048ab7..0000000 --- a/proto/cmp/services/cancellation/v1/cancel_proposal.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; - -package cmp.services.cancellation.v1; - -import "cmp/types/v1/common.proto"; - -// Request for cancelling an active cancellation proposal -message CancelCancellationRequest { - // Request header - cmp.types.v1.RequestHeader header = 1; - - // Cancellation token ID - uint64 token_id = 2; -} - -// Response for cancelling an active cancellation proposal -message CancelCancellationResponse { - // Response header - cmp.types.v1.ResponseHeader header = 1; - - // Transaction ID on-chain for cancelling the cancellation proposal. This - // transaction proves the cancellation of the cancellation proposal on-chain to - // avoid disputes. - string transaction_id = 2; -} diff --git a/proto/cmp/services/cancellation/v1/check.proto b/proto/cmp/services/cancellation/v1/check.proto index 9cfd457..5fdc351 100644 --- a/proto/cmp/services/cancellation/v1/check.proto +++ b/proto/cmp/services/cancellation/v1/check.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package cmp.services.cancellation.v1; import "cmp/services/cancellation/v1/reason.proto"; -import "cmp/services/cancellation/v1/rejection_reason.proto"; import "cmp/types/v1/common.proto"; import "cmp/types/v2/price.proto"; import "google/protobuf/timestamp.proto"; @@ -48,7 +47,7 @@ message CheckCancellationResponse { cmp.services.cancellation.v1.CancellationCheckStatus status = 5; // Rejection reason - cmp.services.cancellation.v1.CancellationRejectionReason rejection_reason = 6; + cmp.services.cancellation.v1.RejectionReason rejection_reason = 6; // Cancellation check timestamp google.protobuf.Timestamp timestamp = 7; diff --git a/proto/cmp/services/cancellation/v1/initiate.proto b/proto/cmp/services/cancellation/v1/initiate.proto index be07a28..752f376 100644 --- a/proto/cmp/services/cancellation/v1/initiate.proto +++ b/proto/cmp/services/cancellation/v1/initiate.proto @@ -18,13 +18,6 @@ message InitiateCancellationRequest { // The cancellation reason cmp.services.cancellation.v1.CancellationReason reason = 4; - - // Cancellation reason version. This is used by the contract to store on-chain, - // the protobuf pkg version of the enum above. So it's clear which enum is used. - // - // FIXME: Do we need this here? Maybe the bot can extract this info from the - // version of the package of the enum itself. - uint32 reason_version = 5; } message InitiateCancellationResponse { diff --git a/proto/cmp/services/cancellation/v1/reason.proto b/proto/cmp/services/cancellation/v1/reason.proto index 8f271d7..2556b3b 100644 --- a/proto/cmp/services/cancellation/v1/reason.proto +++ b/proto/cmp/services/cancellation/v1/reason.proto @@ -84,3 +84,47 @@ enum CancellationReason { CANCELLATION_REASON_PUBLIC_HEALTH_EMERGENCY = 55; CANCELLATION_REASON_GOVERNMENT_RESTRICTION = 56; } + +enum RejectionReason { + REJECTION_REASON_UNSPECIFIED = 0; + REJECTION_REASON_TECHNICAL_ERROR = 1; + REJECTION_REASON_INVALID_SERVICE_OR_BOOKING_REFERENCE = 2; + REJECTION_REASON_BOOKING_IS_ALREADY_CANCELLED = 3; + REJECTION_REASON_SERVICE_HAS_STARTED_OR_HAS_BEEN_DELIVERED = 4; + REJECTION_REASON_CANCELLATION_WINDOW_EXPIRED = 5; + REJECTION_REASON_SERVICE_CANNOT_BE_CANCELLED_ONLINE = 6; + REJECTION_REASON_RATE_OR_FARE_CANNOT_BE_CANCELLED = 7; + REJECTION_REASON_ENTIRE_PACKAGE_MUST_BE_CANCELLED = 8; // Service forms part of a package, the entire package must be cancelled + REJECTION_REASON_REFUND_CURRENCY_NOT_SUPPORTED = 9; +} + +enum WithdrawalReason { + // Default unspecified value - required for proto3 + WITHDRAWAL_REASON_UNSPECIFIED = 0; + + // Change of Circumstances + WITHDRAWAL_REASON_RESOLVED_WITH_SUPPLIER = 1; // Issue resolved through direct communication + WITHDRAWAL_REASON_ORIGINAL_ISSUE_RESOLVED = 2; // The original reason for cancellation no longer exists + WITHDRAWAL_REASON_ALTERNATIVE_SOLUTION_FOUND = 3; // Found another solution without cancelling + WITHDRAWAL_REASON_TRAVEL_PLANS_READJUSTED = 4; // Modified travel plans to accommodate booking + + // Financial Reasons + WITHDRAWAL_REASON_FUNDS_SECURED = 5; // Found money to continue with booking + WITHDRAWAL_REASON_BETTER_REFUND_OPTION_FOUND = 6; // Found a better way to handle the refund + WITHDRAWAL_REASON_PAYMENT_ISSUE_RESOLVED = 7; // Original payment problems resolved + + // Process Related + WITHDRAWAL_REASON_SUBMITTED_BY_MISTAKE = 8; // Accidental submission + WITHDRAWAL_REASON_INCORRECT_BOOKING_SELECTED = 9; // Wrong booking selected for cancellation + WITHDRAWAL_REASON_DUPLICATE_REQUEST = 10; // Already requested through another channel + + // Administrative + WITHDRAWAL_REASON_PENDING_SUPPLIER_RESPONSE = 11; // Waiting for supplier response on different matter + WITHDRAWAL_REASON_UNDER_REVIEW = 12; // Situation under review by customer service + WITHDRAWAL_REASON_AWAITING_DOCUMENTATION = 13; // Need to gather more documentation first + + // Reconsidered + WITHDRAWAL_REASON_FEE_TOO_HIGH = 14; // After seeing cancellation fee, decided to keep booking + WITHDRAWAL_REASON_BETTER_TO_RESELL = 15; // Decided to try reselling/transferring instead + WITHDRAWAL_REASON_CHANGED_MIND = 16; // Simply changed mind about cancelling +} diff --git a/proto/cmp/services/cancellation/v1/reject.proto b/proto/cmp/services/cancellation/v1/reject.proto index 7465019..8e7a3ba 100644 --- a/proto/cmp/services/cancellation/v1/reject.proto +++ b/proto/cmp/services/cancellation/v1/reject.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package cmp.services.cancellation.v1; -import "cmp/services/cancellation/v1/rejection_reason.proto"; +import "cmp/services/cancellation/v1/reason.proto"; import "cmp/types/v1/common.proto"; // Request for cancellation rejection @@ -14,14 +14,7 @@ message RejectCancellationRequest { uint64 token_id = 2; // Reason for rejection - cmp.services.cancellation.v1.CancellationRejectionReason reason = 3; - - // Rejection reason version. This is used by the contract to store on-chain, - // the protobuf pkg version of the enum above. So it's clear which enum is used. - // - // FIXME: Do we need this here? Maybe the bot can extract this info from the - // version of the package of the enum itself. - uint32 reason_version = 4; + cmp.services.cancellation.v1.RejectionReason reason = 3; } // Response for cancellation rejection diff --git a/proto/cmp/services/cancellation/v1/rejection_reason.proto b/proto/cmp/services/cancellation/v1/rejection_reason.proto deleted file mode 100644 index c0e85fc..0000000 --- a/proto/cmp/services/cancellation/v1/rejection_reason.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package cmp.services.cancellation.v1; - -enum CancellationRejectionReason { - CANCELLATION_REJECTION_REASON_UNSPECIFIED = 0; - CANCELLATION_REJECTION_REASON_TECHNICAL_ERROR = 1; - CANCELLATION_REJECTION_REASON_INVALID_SERVICE_OR_BOOKING_REFERENCE = 2; - CANCELLATION_REJECTION_REASON_BOOKING_IS_ALREADY_CANCELLED = 3; - CANCELLATION_REJECTION_REASON_SERVICE_HAS_STARTED_OR_HAS_BEEN_DELIVERED = 4; - CANCELLATION_REJECTION_REASON_CANCELLATION_WINDOW_EXPIRED = 5; - CANCELLATION_REJECTION_REASON_SERVICE_CANNOT_BE_CANCELLED_ONLINE = 6; - CANCELLATION_REJECTION_REASON_RATE_OR_FARE_CANNOT_BE_CANCELLED = 7; - CANCELLATION_REJECTION_REASON_ENTIRE_PACKAGE_MUST_BE_CANCELLED = 8; // Service forms part of a package, the entire package must be cancelled - CANCELLATION_REJECTION_REASON_REFUND_CURRENCY_NOT_SUPPORTED = 9; -} diff --git a/proto/cmp/services/cancellation/v1/services.proto b/proto/cmp/services/cancellation/v1/services.proto index a5f1325..f01d8ca 100644 --- a/proto/cmp/services/cancellation/v1/services.proto +++ b/proto/cmp/services/cancellation/v1/services.proto @@ -9,15 +9,14 @@ syntax = "proto3"; // disputes after a cancellation is executed. // // There is a detailed explanation on [Camino Docs](https://docs.camino.network/camino-messenger/cancellation) - package cmp.services.cancellation.v1; import "cmp/services/cancellation/v1/accept.proto"; import "cmp/services/cancellation/v1/accept_counter.proto"; -import "cmp/services/cancellation/v1/cancel_proposal.proto"; import "cmp/services/cancellation/v1/counter.proto"; import "cmp/services/cancellation/v1/initiate.proto"; import "cmp/services/cancellation/v1/reject.proto"; +import "cmp/services/cancellation/v1/withdraw.proto"; // Cancellation service // @@ -40,6 +39,6 @@ service CancellationService { // Accept countered cancellation rpc AcceptCounterCancellation(AcceptCounterCancellationRequest) returns (AcceptCounterCancellationResponse) {} - // Cancel cancellation proposal - rpc CancelCancellation(CancelCancellationRequest) returns (CancelCancellationResponse) {} + // Withdraw cancellation proposal + rpc WithdrawCancellation(WithdrawCancellationRequest) returns (WithdrawCancellationResponse) {} } diff --git a/proto/cmp/services/cancellation/v1/withdraw.proto b/proto/cmp/services/cancellation/v1/withdraw.proto new file mode 100644 index 0000000..716f10b --- /dev/null +++ b/proto/cmp/services/cancellation/v1/withdraw.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package cmp.services.cancellation.v1; + +import "cmp/types/v1/common.proto"; + +// Request for withdrawal of an active cancellation proposal +message WithdrawCancellationRequest { + // Request header + cmp.types.v1.RequestHeader header = 1; + + // Cancellation token ID + uint64 token_id = 2; +} + +// Response for withdrawal of an active cancellation proposal +message WithdrawCancellationResponse { + // Response header + cmp.types.v1.ResponseHeader header = 1; + + // Transaction ID on-chain for withdrawing the cancellation proposal. This + // transaction proves the withdrawal of the cancellation proposal on-chain to + // avoid disputes. + string transaction_id = 2; +} diff --git a/proto/cmp/services/notification/v2/notify.proto b/proto/cmp/services/notification/v2/notify.proto index c5834e0..f26afcc 100644 --- a/proto/cmp/services/notification/v2/notify.proto +++ b/proto/cmp/services/notification/v2/notify.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package cmp.services.notification.v2; import "cmp/services/cancellation/v1/reason.proto"; -import "cmp/services/cancellation/v1/rejection_reason.proto"; import "cmp/types/v1/uuid.proto"; import "google/protobuf/empty.proto"; @@ -17,9 +16,9 @@ service NotificationService { 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 CancellationAcceptedByTheOwnerNotification(CancellationAcceptedByTheOwner) returns (google.protobuf.Empty); rpc CancellationCounteredNotification(CancellationCountered) returns (google.protobuf.Empty); - rpc CancellationProposalCancelledNotification(CancellationProposalCancelled) returns (google.protobuf.Empty); + rpc CancellationWithdrawnNotification(CancellationWithdrawn) returns (google.protobuf.Empty); rpc CancellationRejectedNotification(CancellationRejected) returns (google.protobuf.Empty); } @@ -62,9 +61,9 @@ message CancellationAccepted { // Related on-chain event: // // ```solidity -// event CancellationProposalAcceptedByTheOwner(uint256 indexed tokenId, address indexed acceptedBy, uint256 refundAmount); +// event CancellationAcceptedByTheOwner(uint256 indexed tokenId, address indexed acceptedBy, uint256 refundAmount); // ``` -message CancellationProposalAcceptedByTheOwner { +message CancellationAcceptedByTheOwner { uint64 token_id = 1; string accepted_by = 2; uint64 refund_amount = 3; @@ -86,12 +85,13 @@ message CancellationCountered { // Related on-chain event: // // ```solidity -// event CancellationProposalCancelled(uint256 indexed tokenId, address indexed cancelledBy); +// event CancellationWithdrawn(uint256 indexed tokenId, address indexed cancelledBy, uint16 reason, uint16 reasonVersion); // ``` -message CancellationProposalCancelled { +message CancellationWithdrawn { uint64 token_id = 1; string cancelled_by = 2; - string tx_id = 3; + cmp.services.cancellation.v1.WithdrawalReason reason = 3; + string tx_id = 4; } // Related on-chain event: @@ -102,6 +102,6 @@ message CancellationProposalCancelled { message CancellationRejected { uint64 token_id = 1; string rejected_by = 2; - cmp.services.cancellation.v1.CancellationRejectionReason reason = 3; + cmp.services.cancellation.v1.RejectionReason reason = 3; string tx_id = 4; }