customer/api/proto/discount/service.proto
2023-09-14 10:07:28 +00:00

96 lines
2.1 KiB
Protocol Buffer

syntax = "proto3";
package discount;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "discount/discount.model.proto";
option go_package = "./discount";
service DiscountService {
rpc GetAllDiscounts(google.protobuf.Empty) returns (Discounts) {
option (google.api.http) = {
get: "/discounts"
};
}
rpc GetUserDiscounts(GetDiscountByIDRequest) returns (Discounts) {
option (google.api.http) = {
get: "/discount/user/{ID}"
};
}
rpc DetermineDiscounts(ApplyDiscountRequest) returns (Discounts) {
option (google.api.http) = {
post: "/discount/determine"
body: "*"
};
}
rpc ApplyDiscounts(ApplyDiscountRequest) returns (ApplyDiscountResponse) {
option (google.api.http) = {
post: "/discount/apply"
body: "*"
};
}
rpc GetDiscountByID(GetDiscountByIDRequest) returns (Discount) {
option (google.api.http) = {
get: "/discount/{ID}"
};
}
rpc CreateDiscount(CreateDiscountRequest) returns (Discount) {
option (google.api.http) = {
post: "/discount"
body: "*"
};
}
rpc ReplaceDiscount(DiscountOptional) returns (Discount) {
option (google.api.http) = {
put: "/discount/{ID}"
body: "*"
};
}
rpc UpdateDiscount(DiscountOptional) returns (Discount) {
option (google.api.http) = {
patch: "/discount/{ID}"
body: "*"
};
}
rpc DeleteDiscount(GetDiscountByIDRequest) returns (Discount) {
option (google.api.http) = {
delete: "/discount/{ID}"
};
}
}
message GetDiscountByIDRequest {
string ID = 1;
}
message ApplyDiscountRequest {
UserInformation UserInformation = 1;
repeated ProductInformation Products = 2;
google.protobuf.Timestamp Date = 3;
optional string Coupon = 4;
}
message ApplyDiscountResponse {
uint64 Price = 1;
repeated Discount AppliedDiscounts = 2;
}
message CreateDiscountRequest {
string Name = 1;
uint32 Layer = 2;
string Description = 3;
DiscountCondition Condition = 4;
DiscountCalculationTarget Target = 5;
}