-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: cancellation message types and services
- Loading branch information
Showing
7 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
|
||
package cmp.services.cancellation.v1; | ||
|
||
import "cmp/types/v1/common.proto"; | ||
import "cmp/types/v2/price.proto"; | ||
|
||
// Request for cancellation acceptance | ||
message AcceptCancellationRequest { | ||
// Request header | ||
optional cmp.types.v1.RequestHeader header = 1; | ||
|
||
// Cancellation token ID | ||
optional uint64 token_id = 2; | ||
|
||
// Refund amount to validate the acceptance on-chain | ||
optional cmp.types.v2.Price refund_amount = 3; | ||
} | ||
|
||
// Response for cancellation acceptance | ||
message AcceptCancellationResponse { | ||
// Response header | ||
optional cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Accept cancellation transaction ID | ||
optional string transaction_id = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
|
||
package cmp.services.cancellation.v1; | ||
|
||
import "cmp/types/v1/common.proto"; | ||
import "cmp/types/v2/price.proto"; | ||
|
||
// Request for counter cancellation acceptance | ||
message AcceptCounterCancellationRequest { | ||
// Request header | ||
optional cmp.types.v1.RequestHeader header = 1; | ||
|
||
// Cancellation token ID | ||
optional uint64 token_id = 2; | ||
|
||
// Refund amount to validate the acceptance on-chain | ||
optional cmp.types.v2.Price refund_amount = 3; | ||
} | ||
|
||
// Response for counter cancellation acceptance | ||
message AcceptCounterCancellationResponse { | ||
// Response header | ||
optional cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Accept counter cancellation transaction ID | ||
optional string transaction_id = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
syntax = "proto3"; | ||
|
||
package cmp.services.cancellation.v1; | ||
|
||
import "cmp/types/v1/common.proto"; | ||
|
||
// Request for cancelling an active cancellation proposal | ||
message CancelCancellationRequest { | ||
// Request header | ||
optional cmp.types.v1.RequestHeader header = 1; | ||
|
||
// Cancellation token ID | ||
optional uint64 token_id = 2; | ||
} | ||
|
||
// Response for cancelling an active cancellation proposal | ||
message CancelCancellationResponse { | ||
// Response header | ||
optional cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Accept cancellation transaction ID | ||
optional string transaction_id = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
syntax = "proto3"; | ||
|
||
package cmp.services.cancellation.v1; | ||
|
||
import "cmp/types/v1/common.proto"; | ||
import "cmp/types/v2/price.proto"; | ||
|
||
// Request for countering a cancellation | ||
message CounterCancellationRequest { | ||
// Request header | ||
optional cmp.types.v1.RequestHeader header = 1; | ||
|
||
// Cancellation token ID | ||
optional uint64 token_id = 2; | ||
|
||
// Refund amount to counter the cancellation proposal with | ||
optional cmp.types.v2.Price refund_amount = 3; | ||
} | ||
|
||
// Response for countering a cancellation | ||
message CounterCancellationResponse { | ||
// Response header | ||
optional cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Counter cancellation transaction ID | ||
optional string transaction_id = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
import "cmp/types/v2/price.proto"; | ||
|
||
message InitiateCancellationRequest { | ||
// The request header | ||
cmp.types.v1.RequestHeader header = 1; | ||
|
||
// The token id of the booking to be cancelled | ||
uint64 token_id = 2; | ||
|
||
// The amount to be refunded | ||
cmp.types.v2.Price refund_amount = 3; | ||
} | ||
|
||
message InitiateCancellationResponse { | ||
// The response header | ||
cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Transaction id for the initiate cancellation request | ||
string transaction_id = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
syntax = "proto3"; | ||
|
||
package cmp.services.cancellation.v1; | ||
|
||
import "cmp/types/v1/common.proto"; | ||
|
||
// Request for cancellation rejection | ||
message RejectCancellationRequest { | ||
// Request Header | ||
cmp.types.v1.RequestHeader header = 1; | ||
|
||
// Token ID to reject the cancellation for (Booking Token) | ||
uint64 token_id = 2; | ||
|
||
// Reason for rejection | ||
cmp.services.cancellation.v1.CancellationRejectionReason reason = 3; | ||
} | ||
|
||
// Response for cancellation rejection | ||
message RejectCancellationResponse { | ||
// Response Header | ||
cmp.types.v1.ResponseHeader header = 1; | ||
|
||
// Transaction id for the rejected cancellation | ||
string transaction_id = 2; | ||
} | ||
|
||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
syntax = "proto3"; | ||
|
||
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"; | ||
|
||
service CancellationService { | ||
// Initiate cancellation | ||
rpc InitiateCancellation(InitiateCancellationRequest) returns (InitiateCancellationResponse) {} | ||
|
||
// Accept cancellation | ||
rpc AcceptCancellation(AcceptCancellationRequest) returns (AcceptCancellationResponse) {} | ||
|
||
// Reject cancellation | ||
rpc RejectCancellation(RejectCancellationRequest) returns (RejectCancellationResponse) {} | ||
|
||
// Counter cancellation | ||
rpc CounterCancellation(CounterCancellationRequest) returns (CounterCancellationResponse) {} | ||
|
||
// Accept countered cancellation | ||
rpc AcceptCounterCancellation(AcceptCounterCancellationRequest) returns (AcceptCounterCancellationResponse) {} | ||
|
||
// Cancel cancellation proposal | ||
rpc CancelCancellation(CancelCancellationRequest) returns (CancelCancellationResponse) {} | ||
} |