Skip to content

Commit

Permalink
merge reason into one file, add withdrawal reason
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Nov 29, 2024
1 parent 401a2b2 commit 2683d61
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 72 deletions.
25 changes: 0 additions & 25 deletions proto/cmp/services/cancellation/v1/cancel_proposal.proto

This file was deleted.

3 changes: 1 addition & 2 deletions proto/cmp/services/cancellation/v1/check.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions proto/cmp/services/cancellation/v1/initiate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
44 changes: 44 additions & 0 deletions proto/cmp/services/cancellation/v1/reason.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
11 changes: 2 additions & 9 deletions proto/cmp/services/cancellation/v1/reject.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 0 additions & 16 deletions proto/cmp/services/cancellation/v1/rejection_reason.proto

This file was deleted.

7 changes: 3 additions & 4 deletions proto/cmp/services/cancellation/v1/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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) {}
}
25 changes: 25 additions & 0 deletions proto/cmp/services/cancellation/v1/withdraw.proto
Original file line number Diff line number Diff line change
@@ -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;
}
18 changes: 9 additions & 9 deletions proto/cmp/services/notification/v2/notify.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand All @@ -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;
}

0 comments on commit 2683d61

Please sign in to comment.