- Add GetUserPackageStatusQueryValidator for user package status validation. - Create ArchiveMessageCommand and ArchiveMessageCommandHandler for archiving public messages. - Implement ArchiveMessageCommandValidator to validate message ID. - Introduce PublishMessageCommand and PublishMessageCommandHandler for publishing messages. - Add PublishMessageCommandValidator for validating publish message requests. - Implement GetPublicMessageQuery and GetPublicMessageQueryHandler for retrieving public messages. - Create GetPublicMessageQueryValidator for validating public message requests. - Add ApplyDiscountToOrderCommand and ApplyDiscountToOrderCommandHandler for applying discounts to orders. - Implement ApplyDiscountToOrderCommandValidator for validating discount application requests. - Create UpdateOrderStatusCommand and UpdateOrderStatusCommandHandler for changing order statuses. - Implement UpdateOrderStatusCommandValidator for validating order status updates. - Add CalculateOrderPVQuery and CalculateOrderPVQueryHandler for calculating order PV. - Implement CalculateOrderPVQueryValidator for validating PV calculation requests. - Create GetOrdersByDateRangeQuery and GetOrdersByDateRangeQueryHandler for retrieving orders by date range. - Implement GetOrdersByDateRangeQueryValidator for validating date range queries. - Add PublicMessage entity to represent public messages in the system. - Implement PublicMessageService for handling public message operations via gRPC.
180 lines
4.4 KiB
Protocol Buffer
180 lines
4.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package package;
|
|
|
|
import "public_messages.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/wrappers.proto";
|
|
import "google/protobuf/duration.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/api/annotations.proto";
|
|
|
|
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Package";
|
|
|
|
service PackageContract
|
|
{
|
|
rpc CreateNewPackage(CreateNewPackageRequest) returns (CreateNewPackageResponse){
|
|
option (google.api.http) = {
|
|
post: "/CreateNewPackage"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc UpdatePackage(UpdatePackageRequest) returns (google.protobuf.Empty){
|
|
option (google.api.http) = {
|
|
put: "/UpdatePackage"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc DeletePackage(DeletePackageRequest) returns (google.protobuf.Empty){
|
|
option (google.api.http) = {
|
|
delete: "/DeletePackage"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc GetPackage(GetPackageRequest) returns (GetPackageResponse){
|
|
option (google.api.http) = {
|
|
get: "/GetPackage"
|
|
|
|
};
|
|
};
|
|
rpc GetAllPackageByFilter(GetAllPackageByFilterRequest) returns (GetAllPackageByFilterResponse){
|
|
option (google.api.http) = {
|
|
get: "/GetAllPackageByFilter"
|
|
|
|
};
|
|
};
|
|
|
|
// Package Purchase System
|
|
rpc PurchaseGoldenPackage(PurchaseGoldenPackageRequest) returns (PurchaseGoldenPackageResponse){
|
|
option (google.api.http) = {
|
|
post: "/PurchaseGoldenPackage"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc VerifyGoldenPackagePurchase(VerifyGoldenPackagePurchaseRequest) returns (VerifyGoldenPackagePurchaseResponse){
|
|
option (google.api.http) = {
|
|
post: "/VerifyGoldenPackagePurchase"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc GetUserPackageStatus(GetUserPackageStatusRequest) returns (GetUserPackageStatusResponse){
|
|
option (google.api.http) = {
|
|
get: "/GetUserPackageStatus"
|
|
};
|
|
};
|
|
}
|
|
message CreateNewPackageRequest
|
|
{
|
|
string title = 1;
|
|
string description = 2;
|
|
string image_path = 3;
|
|
int64 price = 4;
|
|
}
|
|
message CreateNewPackageResponse
|
|
{
|
|
int64 id = 1;
|
|
}
|
|
message UpdatePackageRequest
|
|
{
|
|
int64 id = 1;
|
|
string title = 2;
|
|
string description = 3;
|
|
string image_path = 4;
|
|
int64 price = 5;
|
|
}
|
|
message DeletePackageRequest
|
|
{
|
|
int64 id = 1;
|
|
}
|
|
message GetPackageRequest
|
|
{
|
|
int64 id = 1;
|
|
}
|
|
message GetPackageResponse
|
|
{
|
|
int64 id = 1;
|
|
string title = 2;
|
|
string description = 3;
|
|
string image_path = 4;
|
|
int64 price = 5;
|
|
}
|
|
message GetAllPackageByFilterRequest
|
|
{
|
|
messages.PaginationState pagination_state = 1;
|
|
google.protobuf.StringValue sort_by = 2;
|
|
GetAllPackageByFilterFilter filter = 3;
|
|
}
|
|
message GetAllPackageByFilterFilter
|
|
{
|
|
google.protobuf.Int64Value id = 1;
|
|
google.protobuf.StringValue title = 2;
|
|
google.protobuf.StringValue description = 3;
|
|
google.protobuf.StringValue image_path = 4;
|
|
google.protobuf.Int64Value price = 5;
|
|
}
|
|
message GetAllPackageByFilterResponse
|
|
{
|
|
messages.MetaData meta_data = 1;
|
|
repeated GetAllPackageByFilterResponseModel models = 2;
|
|
}
|
|
message GetAllPackageByFilterResponseModel
|
|
{
|
|
int64 id = 1;
|
|
string title = 2;
|
|
string description = 3;
|
|
string image_path = 4;
|
|
int64 price = 5;
|
|
}
|
|
|
|
// Package Purchase Messages
|
|
message PurchaseGoldenPackageRequest
|
|
{
|
|
int64 user_id = 1;
|
|
int64 package_id = 2;
|
|
string return_url = 3;
|
|
}
|
|
|
|
message PurchaseGoldenPackageResponse
|
|
{
|
|
bool success = 1;
|
|
string message = 2;
|
|
int64 order_id = 3;
|
|
string payment_gateway_url = 4;
|
|
string tracking_code = 5;
|
|
}
|
|
|
|
message VerifyGoldenPackagePurchaseRequest
|
|
{
|
|
int64 order_id = 1;
|
|
string authority = 2;
|
|
string status = 3;
|
|
}
|
|
|
|
message VerifyGoldenPackagePurchaseResponse
|
|
{
|
|
bool success = 1;
|
|
string message = 2;
|
|
int64 order_id = 3;
|
|
int64 transaction_id = 4;
|
|
string reference_code = 5;
|
|
int64 wallet_balance = 6;
|
|
}
|
|
|
|
message GetUserPackageStatusRequest
|
|
{
|
|
int64 user_id = 1;
|
|
}
|
|
|
|
message GetUserPackageStatusResponse
|
|
{
|
|
int64 user_id = 1;
|
|
string package_purchase_method = 2;
|
|
bool has_purchased_package = 3;
|
|
bool is_club_member_active = 4;
|
|
int64 wallet_balance = 5;
|
|
int64 discount_balance = 6;
|
|
bool can_activate_club_membership = 7;
|
|
google.protobuf.StringValue last_order_number = 8;
|
|
google.protobuf.Timestamp last_purchase_date = 9;
|
|
}
|