feat: Implement user permission checks and manual payment functionalities
- Added CheckUserPermissionQuery and CheckUserPermissionQueryHandler for permission validation. - Introduced GetUserRolesQuery and GetUserRolesQueryHandler to retrieve user roles. - Created IPermissionService interface and its implementation in PermissionService. - Defined permission and role constants in PermissionDefinitions. - Developed SetDefaultVatPercentageCommand and its handler for VAT configuration. - Implemented GetCurrentVatPercentageQuery and handler to fetch current VAT settings. - Added manual payment commands: CreateManualPayment, ApproveManualPayment, and RejectManualPayment with respective handlers and validators. - Created GetManualPaymentsQuery and handler for retrieving manual payment records. - Integrated gRPC services for manual payments with appropriate permission checks. - Established Protobuf definitions for manual payment operations and metadata.
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.1</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
<PackageId>Foursat.BackOffice.BFF.ManualPayment.Protobuf</PackageId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Core.Api" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.72.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
|
||||
<PackageReference Include="Google.Api.CommonProtos" Version="2.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Protos\manualpayment.proto"
|
||||
ProtoRoot="Protos\"
|
||||
GrpcServices="Both"
|
||||
AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,84 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package manualpayment;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option csharp_namespace = "BackOffice.BFF.ManualPayment.Protobuf";
|
||||
|
||||
service ManualPaymentContract
|
||||
{
|
||||
rpc CreateManualPayment(CreateManualPaymentRequest) returns (CreateManualPaymentResponse);
|
||||
rpc ApproveManualPayment(ApproveManualPaymentRequest) returns (google.protobuf.Empty);
|
||||
rpc RejectManualPayment(RejectManualPaymentRequest) returns (google.protobuf.Empty);
|
||||
rpc GetManualPayments(GetManualPaymentsRequest) returns (GetManualPaymentsResponse);
|
||||
}
|
||||
|
||||
message GetManualPaymentsRequest
|
||||
{
|
||||
int32 page_number = 1;
|
||||
int32 page_size = 2;
|
||||
google.protobuf.Int64Value user_id = 3;
|
||||
google.protobuf.Int32Value status = 4;
|
||||
google.protobuf.Int32Value type = 5;
|
||||
google.protobuf.StringValue reference_number = 6;
|
||||
}
|
||||
|
||||
message GetManualPaymentsResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated ManualPaymentModel models = 2;
|
||||
}
|
||||
|
||||
message ManualPaymentModel
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 user_id = 2;
|
||||
string user_full_name = 3;
|
||||
string user_mobile = 4;
|
||||
int64 amount = 5;
|
||||
int32 type = 6;
|
||||
string type_display = 7;
|
||||
string description = 8;
|
||||
string reference_number = 9;
|
||||
int32 status = 10;
|
||||
string status_display = 11;
|
||||
int64 requested_by = 12;
|
||||
string requested_by_name = 13;
|
||||
google.protobuf.Int64Value approved_by = 14;
|
||||
google.protobuf.StringValue approved_by_name = 15;
|
||||
google.protobuf.Timestamp approved_at = 16;
|
||||
string rejection_reason = 17;
|
||||
google.protobuf.Int64Value transaction_id = 18;
|
||||
google.protobuf.Timestamp created = 19;
|
||||
}
|
||||
|
||||
message CreateManualPaymentRequest
|
||||
{
|
||||
int64 user_id = 1;
|
||||
int64 amount = 2;
|
||||
int32 type = 3;
|
||||
string description = 4;
|
||||
google.protobuf.StringValue reference_number = 5;
|
||||
}
|
||||
|
||||
message CreateManualPaymentResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message ApproveManualPaymentRequest
|
||||
{
|
||||
int64 manual_payment_id = 1;
|
||||
google.protobuf.StringValue approval_note = 2;
|
||||
}
|
||||
|
||||
message RejectManualPaymentRequest
|
||||
{
|
||||
int64 manual_payment_id = 1;
|
||||
string rejection_reason = 2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package messages;
|
||||
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos";
|
||||
service PublicMessageContract{}
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
Success = 0;
|
||||
Reject = 1;
|
||||
Pending = 2;
|
||||
}
|
||||
// وضعیت ارسال سفارش
|
||||
enum DeliveryStatus
|
||||
{
|
||||
// نامشخص / نیاز به ارسال ندارد (مثلا سفارش پکیج)
|
||||
DeliveryStatus_None = 0;
|
||||
// ثبت شده و در انتظار آمادهسازی/ارسال
|
||||
DeliveryStatus_Pending = 1;
|
||||
// تحویل پست/حملونقل شده است
|
||||
DeliveryStatus_InTransit = 2;
|
||||
// توسط مشتری دریافت شده است
|
||||
DeliveryStatus_Delivered = 3;
|
||||
// مرجوع شده
|
||||
DeliveryStatus_Returned = 4;
|
||||
}
|
||||
enum TransactionType
|
||||
{
|
||||
Buy = 0;
|
||||
DepositIpg = 1;
|
||||
DepositExternal1 = 2;
|
||||
Withdraw = 3;
|
||||
}
|
||||
enum ContractType
|
||||
{
|
||||
Main = 0;
|
||||
CMS = 1;
|
||||
}
|
||||
enum PaymentMethod
|
||||
{
|
||||
IPG = 0;
|
||||
Wallet = 1;
|
||||
}
|
||||
@@ -165,6 +165,11 @@ message GetUserOrderResponse
|
||||
{
|
||||
PaymentMethod payment_method = 16;
|
||||
}
|
||||
// اطلاعات مالیات بر ارزش افزوده
|
||||
int64 vat_amount = 17;
|
||||
double vat_percentage = 18;
|
||||
int64 vat_base_amount = 19;
|
||||
int64 vat_total_amount = 20;
|
||||
}
|
||||
message GetAllUserOrderByFilterRequest
|
||||
{
|
||||
@@ -226,6 +231,9 @@ message GetAllUserOrderByFilterResponseModel
|
||||
{
|
||||
PaymentMethod payment_method = 15;
|
||||
}
|
||||
// مبلغ و درصد مالیات بر ارزش افزوده
|
||||
int64 vat_amount = 16;
|
||||
double vat_percentage = 17;
|
||||
}
|
||||
|
||||
// جزئیات فاکتور سفارش
|
||||
|
||||
Reference in New Issue
Block a user