Merge branch 'main' into kub-stage

This commit is contained in:
masoodafar-web
2025-12-06 14:27:42 +03:30
114 changed files with 3432 additions and 223 deletions

View File

@@ -0,0 +1,6 @@
using MediatR;
namespace BackOffice.BFF.Application.AuthorizationCQ.Queries.CheckUserPermission;
public record CheckUserPermissionQuery(string Permission) : IRequest<bool>;

View File

@@ -0,0 +1,27 @@
using System.Threading;
using System.Threading.Tasks;
using BackOffice.BFF.Application.Common.Interfaces;
using MediatR;
namespace BackOffice.BFF.Application.AuthorizationCQ.Queries.CheckUserPermission;
public class CheckUserPermissionQueryHandler : IRequestHandler<CheckUserPermissionQuery, bool>
{
private readonly IPermissionService _permissionService;
public CheckUserPermissionQueryHandler(IPermissionService permissionService)
{
_permissionService = permissionService;
}
public async Task<bool> Handle(CheckUserPermissionQuery request, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(request.Permission))
{
return true;
}
return await _permissionService.HasPermissionAsync(request.Permission, cancellationToken);
}
}

View File

@@ -0,0 +1,7 @@
using System.Collections.Generic;
using MediatR;
namespace BackOffice.BFF.Application.AuthorizationCQ.Queries.GetUserRoles;
public record GetUserRolesQuery : IRequest<IReadOnlyList<string>>;

View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BackOffice.BFF.Application.Common.Interfaces;
using MediatR;
namespace BackOffice.BFF.Application.AuthorizationCQ.Queries.GetUserRoles;
public class GetUserRolesQueryHandler : IRequestHandler<GetUserRolesQuery, IReadOnlyList<string>>
{
private readonly IPermissionService _permissionService;
public GetUserRolesQueryHandler(IPermissionService permissionService)
{
_permissionService = permissionService;
}
public async Task<IReadOnlyList<string>> Handle(GetUserRolesQuery request, CancellationToken cancellationToken)
{
return await _permissionService.GetUserRolesAsync(cancellationToken);
}
}

View File

@@ -5,6 +5,24 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- Exclude handlers that need proto fixes -->
<ItemGroup>
<!-- DiscountOrder handlers - proto mismatch with CMS -->
<Compile Remove="DiscountOrderCQ/**/*.cs" />
<!-- DiscountShoppingCart handlers - proto mismatch -->
<Compile Remove="DiscountShoppingCartCQ/**/*.cs" />
<!-- ManualPayment handlers - WellKnownTypes conversion issues -->
<Compile Remove="ManualPaymentCQ/**/*.cs" />
<!-- Configuration handlers - StringValue conversion -->
<Compile Remove="ConfigurationCQ/**/*.cs" />
<!-- Commission ProcessWithdrawal - StringValue conversion -->
<Compile Remove="CommissionCQ/Commands/ProcessWithdrawal/**/*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2" />
<PackageReference Include="Mapster" Version="7.3.0" />

View File

@@ -61,5 +61,8 @@ public interface IApplicationContractContext
// Public Messages
PublicMessageContract.PublicMessageContractClient PublicMessages { get; }
// Manual Payments (Admin) - CMS gRPC
CMSMicroservice.Protobuf.Protos.ManualPayment.ManualPaymentContract.ManualPaymentContractClient ManualPayments { get; }
#endregion
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace BackOffice.BFF.Application.Common.Interfaces;
public interface IPermissionService
{
Task<IReadOnlyList<string>> GetUserRolesAsync(CancellationToken cancellationToken);
Task<bool> HasPermissionAsync(string permission, CancellationToken cancellationToken);
}

View File

@@ -7,6 +7,8 @@ using CmsUserOrderFilter = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserO
using CmsUserOrderRequest = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterRequest;
using GetAllUserOrderByFilterFilter = BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter.GetAllUserOrderByFilterFilter;
using GetAllUserOrderByFilterResponseModel = BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter.GetAllUserOrderByFilterResponseModel;
using CmsGetUserOrderResponse = CMSMicroservice.Protobuf.Protos.UserOrder.GetUserOrderResponse;
using BffGetUserOrderResponseDto = BackOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder.GetUserOrderResponseDto;
namespace BackOffice.BFF.Application.Common.Mappings;
@@ -26,11 +28,13 @@ public class UserOrderProfile : IRegister
.IgnoreIf((src, dest) => src.Filter.PaymentStatus==null,dest => dest.Filter.PaymentStatus)
.Map(dest => dest.Filter, src => src.Filter == null || IsEmptyFilter(src.Filter) ? null : BuildFilter(src.Filter));
// config.NewConfig< CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel, GetAllUserOrderByFilterResponseModel>()
//
// .Map(dest => dest.p, src => src.PaymentMethod);
// Map VAT information from CMS GetUserOrderResponse (VatInfo) to flattened DTO fields
config.NewConfig<CmsGetUserOrderResponse, BffGetUserOrderResponseDto>()
.Map(dest => dest.VatBaseAmount, src => src.VatInfo != null ? src.VatInfo.BaseAmount : 0)
.Map(dest => dest.VatAmount, src => src.VatInfo != null ? src.VatInfo.VatAmount : 0)
.Map(dest => dest.VatTotalAmount,
src => src.VatInfo != null ? src.VatInfo.TotalAmount : src.Amount)
.Map(dest => dest.VatPercentage, src => src.VatInfo != null ? src.VatInfo.VatRate * 100 : 0);
}
private static bool IsEmptyFilter(GetAllUserOrderByFilterFilter src)

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace BackOffice.BFF.Application.Common.Models;
public static class RoleNames
{
public const string SuperAdmin = "SuperAdmin";
public const string Admin = "Admin";
public const string Inspector = "Inspector";
}
public static class PermissionNames
{
// Dashboard
public const string DashboardView = "dashboard.view";
// Orders
public const string OrdersView = "orders.view";
public const string OrdersCreate = "orders.create";
public const string OrdersUpdate = "orders.update";
public const string OrdersDelete = "orders.delete";
public const string OrdersCancel = "orders.cancel";
public const string OrdersApprove = "orders.approve";
// Products
public const string ProductsView = "products.view";
public const string ProductsCreate = "products.create";
public const string ProductsUpdate = "products.update";
public const string ProductsDelete = "products.delete";
// Users
public const string UsersView = "users.view";
public const string UsersUpdate = "users.update";
public const string UsersDelete = "users.delete";
// Commission / Withdrawal
public const string CommissionView = "commission.view";
public const string CommissionApproveWithdrawal = "commission.approve_withdrawal";
// Public Messages
public const string PublicMessagesView = "publicmessages.view";
public const string PublicMessagesCreate = "publicmessages.create";
public const string PublicMessagesUpdate = "publicmessages.update";
public const string PublicMessagesPublish = "publicmessages.publish";
// Manual Payments
public const string ManualPaymentsView = "manualpayments.view";
public const string ManualPaymentsCreate = "manualpayments.create";
public const string ManualPaymentsApprove = "manualpayments.approve";
// Settings / Configuration / VAT
public const string SettingsView = "settings.view";
public const string SettingsManageConfiguration = "settings.manage_configuration";
public const string SettingsManageVat = "settings.manage_vat";
// Reports
public const string ReportsView = "reports.view";
}
public static class RolePermissionConfig
{
private static readonly IReadOnlyDictionary<string, string[]> RolePermissions =
new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase)
{
// SuperAdmin: full access (wildcard)
[RoleNames.SuperAdmin] = new[] { "*" },
// Admin: مدیریت سفارش‌ها، محصولات، بخشی از کمیسیون و پیام‌ها
[RoleNames.Admin] = new[]
{
PermissionNames.DashboardView,
PermissionNames.OrdersView,
PermissionNames.OrdersCreate,
PermissionNames.OrdersUpdate,
PermissionNames.OrdersCancel,
PermissionNames.ProductsView,
PermissionNames.ProductsCreate,
PermissionNames.ProductsUpdate,
PermissionNames.ProductsDelete,
PermissionNames.UsersView,
PermissionNames.UsersUpdate,
PermissionNames.CommissionView,
PermissionNames.CommissionApproveWithdrawal,
PermissionNames.PublicMessagesView,
PermissionNames.PublicMessagesCreate,
PermissionNames.PublicMessagesUpdate,
PermissionNames.PublicMessagesPublish,
PermissionNames.ManualPaymentsView,
PermissionNames.ManualPaymentsCreate,
PermissionNames.ReportsView
},
// Inspector: فقط مشاهده
[RoleNames.Inspector] = new[]
{
PermissionNames.DashboardView,
PermissionNames.OrdersView,
PermissionNames.UsersView,
PermissionNames.CommissionView,
PermissionNames.PublicMessagesView,
PermissionNames.ReportsView
}
};
public static bool HasPermission(string role, string permission)
{
if (string.IsNullOrWhiteSpace(role) || string.IsNullOrWhiteSpace(permission))
{
return false;
}
if (!RolePermissions.TryGetValue(role, out var permissions))
{
return false;
}
if (permissions.Contains("*", StringComparer.OrdinalIgnoreCase))
{
return true;
}
return permissions.Contains(permission, StringComparer.OrdinalIgnoreCase);
}
}

View File

@@ -0,0 +1,10 @@
namespace BackOffice.BFF.Application.ConfigurationCQ.Commands.SetDefaultVatPercentage;
public record SetDefaultVatPercentageCommand : IRequest<Unit>
{
/// <summary>
/// درصد VAT جدید (مثلاً 10 به معنای 10٪)
/// </summary>
public int VatPercentage { get; init; }
}

View File

@@ -0,0 +1,43 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.Configuration.Protobuf;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ConfigurationCQ.Commands.SetDefaultVatPercentage;
public class SetDefaultVatPercentageCommandHandler : IRequestHandler<SetDefaultVatPercentageCommand, Unit>
{
private const string VatConfigurationKey = "DefaultVatPercentage";
private readonly IApplicationContractContext _context;
private readonly ILogger<SetDefaultVatPercentageCommandHandler> _logger;
public SetDefaultVatPercentageCommandHandler(
IApplicationContractContext context,
ILogger<SetDefaultVatPercentageCommandHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<Unit> Handle(SetDefaultVatPercentageCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new CreateOrUpdateConfigurationRequest
{
Key = VatConfigurationKey,
Value = request.VatPercentage.ToString(),
Scope = 0, // System scope
Description = new StringValue
{
Value = "درصد پیش‌فرض مالیات بر ارزش افزوده سفارش‌ها"
}
};
await _context.Configurations.CreateOrUpdateConfigurationAsync(grpcRequest, cancellationToken: cancellationToken);
_logger.LogInformation("Default VAT percentage updated to {VatPercentage}%.", request.VatPercentage);
return Unit.Value;
}
}

View File

@@ -0,0 +1,14 @@
using FluentValidation;
namespace BackOffice.BFF.Application.ConfigurationCQ.Commands.SetDefaultVatPercentage;
public class SetDefaultVatPercentageCommandValidator : AbstractValidator<SetDefaultVatPercentageCommand>
{
public SetDefaultVatPercentageCommandValidator()
{
RuleFor(x => x.VatPercentage)
.InclusiveBetween(0, 100)
.WithMessage("درصد VAT باید بین 0 تا 100 باشد.");
}
}

View File

@@ -0,0 +1,17 @@
namespace BackOffice.BFF.Application.ConfigurationCQ.Queries.GetCurrentVatPercentage;
public record GetCurrentVatPercentageQuery : IRequest<GetCurrentVatPercentageResponse>;
public class GetCurrentVatPercentageResponse
{
/// <summary>
/// درصد VAT فعلی (مثلاً 10 به معنای 10٪)
/// </summary>
public int VatPercentage { get; set; }
/// <summary>
/// آیا مقدار از تنظیمات خوانده شده (true) یا مقدار پیش‌فرض استفاده شده (false)
/// </summary>
public bool IsConfigured { get; set; }
}

View File

@@ -0,0 +1,70 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.Configuration.Protobuf;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ConfigurationCQ.Queries.GetCurrentVatPercentage;
public class GetCurrentVatPercentageQueryHandler : IRequestHandler<GetCurrentVatPercentageQuery, GetCurrentVatPercentageResponse>
{
private const string VatConfigurationKey = "DefaultVatPercentage";
private readonly IApplicationContractContext _context;
private readonly ILogger<GetCurrentVatPercentageQueryHandler> _logger;
public GetCurrentVatPercentageQueryHandler(
IApplicationContractContext context,
ILogger<GetCurrentVatPercentageQueryHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<GetCurrentVatPercentageResponse> Handle(GetCurrentVatPercentageQuery request, CancellationToken cancellationToken)
{
try
{
var grpcRequest = new GetConfigurationByKeyRequest
{
Key = VatConfigurationKey
};
var response = await _context.Configurations.GetConfigurationByKeyAsync(grpcRequest, cancellationToken: cancellationToken);
if (response == null || string.IsNullOrWhiteSpace(response.Value))
{
_logger.LogInformation("VAT configuration not found. Using default value 10%.");
return new GetCurrentVatPercentageResponse
{
VatPercentage = 10,
IsConfigured = false
};
}
if (!int.TryParse(response.Value, out var vat) || vat < 0)
{
_logger.LogWarning("Invalid VAT configuration value '{Value}'. Falling back to default 10%.", response.Value);
return new GetCurrentVatPercentageResponse
{
VatPercentage = 10,
IsConfigured = false
};
}
return new GetCurrentVatPercentageResponse
{
VatPercentage = vat,
IsConfigured = true
};
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while reading VAT configuration. Falling back to default value 10%.");
return new GetCurrentVatPercentageResponse
{
VatPercentage = 10,
IsConfigured = false
};
}
}
}

View File

@@ -0,0 +1,10 @@
using MediatR;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ApproveManualPayment;
public class ApproveManualPaymentCommand : IRequest<bool>
{
public long ManualPaymentId { get; set; }
public string? ApprovalNote { get; set; }
}

View File

@@ -0,0 +1,41 @@
using BackOffice.BFF.Application.Common.Interfaces;
using CMSMicroservice.Protobuf.Protos.ManualPayment;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ApproveManualPayment;
public class ApproveManualPaymentCommandHandler : IRequestHandler<ApproveManualPaymentCommand, bool>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<ApproveManualPaymentCommandHandler> _logger;
public ApproveManualPaymentCommandHandler(
IApplicationContractContext context,
ILogger<ApproveManualPaymentCommandHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<bool> Handle(ApproveManualPaymentCommand request, CancellationToken cancellationToken)
{
_logger.LogInformation("Approving manual payment via BFF. Id: {Id}", request.ManualPaymentId);
var grpcRequest = new ApproveManualPaymentRequest
{
ManualPaymentId = request.ManualPaymentId
};
if (!string.IsNullOrWhiteSpace(request.ApprovalNote))
{
grpcRequest.ApprovalNote = new StringValue { Value = request.ApprovalNote };
}
await _context.ManualPayments.ApproveManualPaymentAsync(grpcRequest, cancellationToken: cancellationToken);
return true;
}
}

View File

@@ -0,0 +1,14 @@
using FluentValidation;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.ApproveManualPayment;
public class ApproveManualPaymentCommandValidator : AbstractValidator<ApproveManualPaymentCommand>
{
public ApproveManualPaymentCommandValidator()
{
RuleFor(x => x.ManualPaymentId)
.GreaterThan(0)
.WithMessage("شناسه پرداخت دستی نامعتبر است.");
}
}

View File

@@ -0,0 +1,18 @@
using MediatR;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
public class CreateManualPaymentCommand : IRequest<CreateManualPaymentResponseDto>
{
public long UserId { get; set; }
public long Amount { get; set; }
public int Type { get; set; }
public string Description { get; set; } = string.Empty;
public string? ReferenceNumber { get; set; }
}
public class CreateManualPaymentResponseDto
{
public long Id { get; set; }
}

View File

@@ -0,0 +1,51 @@
using BackOffice.BFF.Application.Common.Interfaces;
using CMSMicroservice.Protobuf.Protos.ManualPayment;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
public class CreateManualPaymentCommandHandler : IRequestHandler<CreateManualPaymentCommand, CreateManualPaymentResponseDto>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<CreateManualPaymentCommandHandler> _logger;
public CreateManualPaymentCommandHandler(
IApplicationContractContext context,
ILogger<CreateManualPaymentCommandHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<CreateManualPaymentResponseDto> Handle(CreateManualPaymentCommand request, CancellationToken cancellationToken)
{
_logger.LogInformation(
"Creating manual payment via BFF for UserId {UserId}, Amount {Amount}, Type {Type}",
request.UserId,
request.Amount,
request.Type);
var grpcRequest = new CreateManualPaymentRequest
{
UserId = request.UserId,
Amount = request.Amount,
Type = (ManualPaymentType)request.Type,
Description = request.Description
};
if (!string.IsNullOrWhiteSpace(request.ReferenceNumber))
{
grpcRequest.ReferenceNumber = new StringValue { Value = request.ReferenceNumber };
}
var response = await _context.ManualPayments.CreateManualPaymentAsync(grpcRequest, cancellationToken: cancellationToken);
return new CreateManualPaymentResponseDto
{
Id = response.Id
};
}
}

View File

@@ -0,0 +1,26 @@
using FluentValidation;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
public class CreateManualPaymentCommandValidator : AbstractValidator<CreateManualPaymentCommand>
{
public CreateManualPaymentCommandValidator()
{
RuleFor(x => x.UserId)
.GreaterThan(0)
.WithMessage("شناسه کاربر باید بزرگتر از صفر باشد.");
RuleFor(x => x.Amount)
.GreaterThan(0)
.WithMessage("مبلغ باید بزرگتر از صفر باشد.");
RuleFor(x => x.Description)
.NotEmpty()
.WithMessage("توضیحات الزامی است.");
RuleFor(x => x.Type)
.GreaterThan(0)
.WithMessage("نوع پرداخت دستی نامعتبر است.");
}
}

View File

@@ -0,0 +1,10 @@
using MediatR;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
public class RejectManualPaymentCommand : IRequest<bool>
{
public long ManualPaymentId { get; set; }
public string RejectionReason { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,36 @@
using BackOffice.BFF.Application.Common.Interfaces;
using CMSMicroservice.Protobuf.Protos.ManualPayment;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
public class RejectManualPaymentCommandHandler : IRequestHandler<RejectManualPaymentCommand, bool>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<RejectManualPaymentCommandHandler> _logger;
public RejectManualPaymentCommandHandler(
IApplicationContractContext context,
ILogger<RejectManualPaymentCommandHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<bool> Handle(RejectManualPaymentCommand request, CancellationToken cancellationToken)
{
_logger.LogInformation("Rejecting manual payment via BFF. Id: {Id}", request.ManualPaymentId);
var grpcRequest = new RejectManualPaymentRequest
{
ManualPaymentId = request.ManualPaymentId,
RejectionReason = request.RejectionReason
};
await _context.ManualPayments.RejectManualPaymentAsync(grpcRequest, cancellationToken: cancellationToken);
return true;
}
}

View File

@@ -0,0 +1,18 @@
using FluentValidation;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
public class RejectManualPaymentCommandValidator : AbstractValidator<RejectManualPaymentCommand>
{
public RejectManualPaymentCommandValidator()
{
RuleFor(x => x.ManualPaymentId)
.GreaterThan(0)
.WithMessage("شناسه پرداخت دستی نامعتبر است.");
RuleFor(x => x.RejectionReason)
.NotEmpty()
.WithMessage("دلیل رد الزامی است.");
}
}

View File

@@ -0,0 +1,15 @@
using MediatR;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
public class GetManualPaymentsQuery : IRequest<GetManualPaymentsResponseDto>
{
public int PageNumber { get; set; } = 1;
public int PageSize { get; set; } = 10;
public long? UserId { get; set; }
public int? Status { get; set; }
public int? Type { get; set; }
public long? RequestedBy { get; set; }
public bool OrderByDescending { get; set; } = true;
public string? ReferenceNumber { get; set; }
}

View File

@@ -0,0 +1,114 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.Application.Common.Models;
using CMSMicroservice.Protobuf.Protos.ManualPayment;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
public class GetManualPaymentsQueryHandler : IRequestHandler<GetManualPaymentsQuery, GetManualPaymentsResponseDto>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<GetManualPaymentsQueryHandler> _logger;
public GetManualPaymentsQueryHandler(
IApplicationContractContext context,
ILogger<GetManualPaymentsQueryHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<GetManualPaymentsResponseDto> Handle(GetManualPaymentsQuery request, CancellationToken cancellationToken)
{
_logger.LogInformation(
"Getting manual payments via BFF. Page: {Page}, PageSize: {PageSize}, Status: {Status}, Type: {Type}",
request.PageNumber,
request.PageSize,
request.Status,
request.Type);
var grpcRequest = new GetAllManualPaymentsRequest
{
PageNumber = request.PageNumber,
PageSize = request.PageSize
};
if (request.UserId.HasValue)
{
grpcRequest.UserId = new Int64Value { Value = request.UserId.Value };
}
if (request.Status.HasValue)
{
grpcRequest.Status = new Int32Value { Value = request.Status.Value };
}
if (request.Type.HasValue)
{
grpcRequest.Type = new Int32Value { Value = request.Type.Value };
}
if (request.RequestedBy.HasValue)
{
grpcRequest.RequestedBy = new Int64Value { Value = request.RequestedBy.Value };
}
grpcRequest.OrderByDescending = new BoolValue { Value = request.OrderByDescending };
var response = await _context.ManualPayments.GetAllManualPaymentsAsync(grpcRequest, cancellationToken: cancellationToken);
var meta = response.MetaData;
var models = response.Models?
.Select(m => new ManualPaymentModel
{
Id = m.Id,
UserId = m.UserId,
UserFullName = m.UserFullName,
UserMobile = m.UserMobile,
Amount = m.Amount,
Type = (int)m.Type,
TypeDisplay = m.TypeDisplay,
Description = m.Description,
ReferenceNumber = m.ReferenceNumber,
Status = (int)m.Status,
StatusDisplay = m.StatusDisplay,
RequestedBy = m.RequestedBy,
RequestedByName = m.RequestedByName,
ApprovedBy = m.ApprovedBy?.Value,
ApprovedByName = m.ApprovedByName,
ApprovedAt = m.ApprovedAt?.ToDateTime(),
RejectionReason = m.RejectionReason,
TransactionId = m.TransactionId?.Value,
Created = m.Created.ToDateTime()
})
.ToList()
?? new List<ManualPaymentModel>();
if (!string.IsNullOrWhiteSpace(request.ReferenceNumber))
{
models = models
.Where(m => !string.IsNullOrWhiteSpace(m.ReferenceNumber) &&
m.ReferenceNumber.Contains(request.ReferenceNumber!, StringComparison.OrdinalIgnoreCase))
.ToList();
}
var result = new GetManualPaymentsResponseDto
{
MetaData = new MetaData
{
CurrentPage = meta.CurrentPage,
TotalPage = meta.TotalPage,
PageSize = meta.PageSize,
TotalCount = meta.TotalCount,
HasPrevious = meta.HasPrevious,
HasNext = meta.HasNext
},
Models = models
};
return result;
}
}

View File

@@ -0,0 +1,33 @@
using BackOffice.BFF.Application.Common.Models;
namespace BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
public class GetManualPaymentsResponseDto
{
public MetaData MetaData { get; set; } = new();
public List<ManualPaymentModel>? Models { get; set; }
}
public class ManualPaymentModel
{
public long Id { get; set; }
public long UserId { get; set; }
public string UserFullName { get; set; } = string.Empty;
public string UserMobile { get; set; } = string.Empty;
public long Amount { get; set; }
public int Type { get; set; }
public string TypeDisplay { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string? ReferenceNumber { get; set; }
public int Status { get; set; }
public string StatusDisplay { get; set; } = string.Empty;
public long RequestedBy { get; set; }
public string RequestedByName { get; set; } = string.Empty;
public long? ApprovedBy { get; set; }
public string? ApprovedByName { get; set; }
public DateTime? ApprovedAt { get; set; }
public string? RejectionReason { get; set; }
public long? TransactionId { get; set; }
public DateTime Created { get; set; }
}

View File

@@ -1,12 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.Package.Protobuf.Protos.Package;
using CMSMicroservice.Protobuf.Protos.Package;
using MediatR;
using Microsoft.Extensions.Logging;
using BffPackage = BackOffice.BFF.Package.Protobuf.Protos.Package;
using CmsPackage = CMSMicroservice.Protobuf.Protos.Package;
namespace BackOffice.BFF.Application.PackageCQ.Queries.GetUserPackageStatus;
public class GetUserPackageStatusQueryHandler : IRequestHandler<GetUserPackageStatusQuery, GetUserPackageStatusResponse>
public class GetUserPackageStatusQueryHandler : IRequestHandler<GetUserPackageStatusQuery, BffPackage.GetUserPackageStatusResponse>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<GetUserPackageStatusQueryHandler> _logger;
@@ -19,9 +19,9 @@ public class GetUserPackageStatusQueryHandler : IRequestHandler<GetUserPackageSt
_logger = logger;
}
public async Task<GetUserPackageStatusResponse> Handle(GetUserPackageStatusQuery request, CancellationToken cancellationToken)
public async Task<BffPackage.GetUserPackageStatusResponse> Handle(GetUserPackageStatusQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetUserPackageStatusRequest
var grpcRequest = new CmsPackage.GetUserPackageStatusRequest
{
UserId = request.UserId
};
@@ -30,7 +30,7 @@ public class GetUserPackageStatusQueryHandler : IRequestHandler<GetUserPackageSt
_logger.LogInformation("Retrieved package status for user {UserId}", request.UserId);
var result = new GetUserPackageStatusResponse
var result = new BffPackage.GetUserPackageStatusResponse
{
UserId = response.UserId,
PackagePurchaseMethod = response.PackagePurchaseMethod,

View File

@@ -1,10 +1,15 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.ArchiveMessage;
public class ArchiveMessageCommandHandler : IRequestHandler<ArchiveMessageRequest, ArchiveMessageResponse>
public class ArchiveMessageCommand : IRequest<BffProto.ArchiveMessageResponse>
{
public long MessageId { get; set; }
}
public class ArchiveMessageCommandHandler : IRequestHandler<ArchiveMessageCommand, BffProto.ArchiveMessageResponse>
{
private readonly IApplicationContractContext _context;
@@ -13,9 +18,9 @@ public class ArchiveMessageCommandHandler : IRequestHandler<ArchiveMessageReques
_context = context;
}
public async Task<ArchiveMessageResponse> Handle(ArchiveMessageRequest request, CancellationToken cancellationToken)
public async Task<BffProto.ArchiveMessageResponse> Handle(ArchiveMessageCommand request, CancellationToken cancellationToken)
{
var cmsRequest = new ArchiveMessageRequest
var cmsRequest = new CmsProto.ArchiveMessageRequest
{
MessageId = request.MessageId
};
@@ -24,7 +29,7 @@ public class ArchiveMessageCommandHandler : IRequestHandler<ArchiveMessageReques
cmsRequest,
cancellationToken: cancellationToken);
return new ArchiveMessageResponse
return new BffProto.ArchiveMessageResponse
{
Success = cmsResponse.Success,
Message = cmsResponse.Message,

View File

@@ -0,0 +1,14 @@
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.CreatePublicMessage;
public record CreatePublicMessageCommand : IRequest<BffProto.CreatePublicMessageResponse>
{
public string Title { get; init; } = string.Empty;
public string Content { get; init; } = string.Empty;
public int MessageType { get; init; }
public int Priority { get; init; }
public DateTime StartsAt { get; init; }
public DateTime ExpiresAt { get; init; }
}

View File

@@ -1,11 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.CreatePublicMessage;
public class CreatePublicMessageCommandHandler : IRequestHandler<CreatePublicMessageRequest, CreatePublicMessageResponse>
public class CreatePublicMessageCommandHandler : IRequestHandler<CreatePublicMessageCommand, BffProto.CreatePublicMessageResponse>
{
private readonly IApplicationContractContext _context;
@@ -14,9 +15,9 @@ public class CreatePublicMessageCommandHandler : IRequestHandler<CreatePublicMes
_context = context;
}
public async Task<CreatePublicMessageResponse> Handle(CreatePublicMessageRequest request, CancellationToken cancellationToken)
public async Task<BffProto.CreatePublicMessageResponse> Handle(CreatePublicMessageCommand request, CancellationToken cancellationToken)
{
var cmsRequest = new CreatePublicMessageRequest
var cmsRequest = new CmsProto.CreatePublicMessageRequest
{
Title = request.Title,
Content = request.Content,
@@ -30,7 +31,7 @@ public class CreatePublicMessageCommandHandler : IRequestHandler<CreatePublicMes
cmsRequest,
cancellationToken: cancellationToken);
return new CreatePublicMessageResponse
return new BffProto.CreatePublicMessageResponse
{
Success = true,
Message = "پیام با موفقیت ایجاد شد",

View File

@@ -0,0 +1,9 @@
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.DeletePublicMessage;
public record DeletePublicMessageCommand : IRequest<BffProto.DeletePublicMessageResponse>
{
public long MessageId { get; init; }
}

View File

@@ -1,10 +1,11 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.DeletePublicMessage;
public class DeletePublicMessageCommandHandler : IRequestHandler<DeletePublicMessageRequest, DeletePublicMessageRequest>
public class DeletePublicMessageCommandHandler : IRequestHandler<DeletePublicMessageCommand, BffProto.DeletePublicMessageResponse>
{
private readonly IApplicationContractContext _context;
@@ -13,9 +14,9 @@ public class DeletePublicMessageCommandHandler : IRequestHandler<DeletePublicMes
_context = context;
}
public async Task<DeletePublicMessageRequest> Handle(DeletePublicMessageRequest request, CancellationToken cancellationToken)
public async Task<BffProto.DeletePublicMessageResponse> Handle(DeletePublicMessageCommand request, CancellationToken cancellationToken)
{
var cmsRequest = new DeletePublicMessageRequest
var cmsRequest = new CmsProto.DeletePublicMessageRequest
{
MessageId = request.MessageId
};
@@ -24,7 +25,11 @@ public class DeletePublicMessageCommandHandler : IRequestHandler<DeletePublicMes
cmsRequest,
cancellationToken: cancellationToken);
return request;
return new BffProto.DeletePublicMessageResponse
{
Success = true,
Message = "پیام با موفقیت حذف شد"
};
}
}

View File

@@ -0,0 +1,9 @@
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.PublishMessage;
public record PublishMessageCommand : IRequest<BffProto.PublishMessageResponse>
{
public long MessageId { get; init; }
}

View File

@@ -1,10 +1,11 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.PublishMessage;
public class PublishMessageCommandHandler : IRequestHandler<PublishMessageRequest, PublishMessageResponse>
public class PublishMessageCommandHandler : IRequestHandler<PublishMessageCommand, BffProto.PublishMessageResponse>
{
private readonly IApplicationContractContext _context;
@@ -13,9 +14,9 @@ public class PublishMessageCommandHandler : IRequestHandler<PublishMessageReques
_context = context;
}
public async Task<PublishMessageResponse> Handle(PublishMessageRequest request, CancellationToken cancellationToken)
public async Task<BffProto.PublishMessageResponse> Handle(PublishMessageCommand request, CancellationToken cancellationToken)
{
var cmsRequest = new PublishMessageRequest
var cmsRequest = new CmsProto.PublishMessageRequest
{
MessageId = request.MessageId
};
@@ -24,7 +25,7 @@ public class PublishMessageCommandHandler : IRequestHandler<PublishMessageReques
cmsRequest,
cancellationToken: cancellationToken);
return new PublishMessageResponse
return new BffProto.PublishMessageResponse
{
Success = cmsResponse.Success,
Message = cmsResponse.Message,

View File

@@ -0,0 +1,15 @@
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.UpdatePublicMessage;
public record UpdatePublicMessageCommand : IRequest<BffProto.UpdatePublicMessageResponse>
{
public long MessageId { get; init; }
public string Title { get; init; } = string.Empty;
public string Content { get; init; } = string.Empty;
public int MessageType { get; init; }
public int Priority { get; init; }
public DateTime StartsAt { get; init; }
public DateTime ExpiresAt { get; init; }
}

View File

@@ -1,11 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Commands.UpdatePublicMessage;
public class UpdatePublicMessageCommandHandler : IRequestHandler<UpdatePublicMessageRequest, UpdatePublicMessageRequest>
public class UpdatePublicMessageCommandHandler : IRequestHandler<UpdatePublicMessageCommand, BffProto.UpdatePublicMessageResponse>
{
private readonly IApplicationContractContext _context;
@@ -14,9 +15,9 @@ public class UpdatePublicMessageCommandHandler : IRequestHandler<UpdatePublicMes
_context = context;
}
public async Task<UpdatePublicMessageRequest> Handle(UpdatePublicMessageRequest request, CancellationToken cancellationToken)
public async Task<BffProto.UpdatePublicMessageResponse> Handle(UpdatePublicMessageCommand request, CancellationToken cancellationToken)
{
var cmsRequest = new UpdatePublicMessageRequest
var cmsRequest = new CmsProto.UpdatePublicMessageRequest
{
Id = request.MessageId,
Title = request.Title,
@@ -31,8 +32,11 @@ public class UpdatePublicMessageCommandHandler : IRequestHandler<UpdatePublicMes
cmsRequest,
cancellationToken: cancellationToken);
// در حال حاضر پاسخ خاصی از CMS دریافت نمی‌کنیم؛ همان ورودی را برمی‌گردانیم
return request;
return new BffProto.UpdatePublicMessageResponse
{
Success = true,
Message = "پیام با موفقیت به‌روزرسانی شد"
};
}
}

View File

@@ -1,19 +1,18 @@
// GetActiveMessages - Public view
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Queries.GetActiveMessages;
public record GetActiveMessagesQuery : IRequest<GetActiveMessagesResponse>
public record GetActiveMessagesQuery : IRequest<BffProto.GetActiveMessagesResponse>
{
public int? MessageType { get; init; }
public string? TargetAudience { get; init; }
}
public class GetActiveMessagesQueryHandler : IRequestHandler<GetActiveMessagesQuery, GetActiveMessagesResponse>
public class GetActiveMessagesQueryHandler : IRequestHandler<GetActiveMessagesQuery, BffProto.GetActiveMessagesResponse>
{
private readonly IApplicationContractContext _context;
@@ -22,18 +21,18 @@ public class GetActiveMessagesQueryHandler : IRequestHandler<GetActiveMessagesQu
_context = context;
}
public async Task<GetActiveMessagesResponse> Handle(GetActiveMessagesQuery request, CancellationToken cancellationToken)
public async Task<BffProto.GetActiveMessagesResponse> Handle(GetActiveMessagesQuery request, CancellationToken cancellationToken)
{
var cmsRequest = new GetActiveMessagesRequest();
var cmsRequest = new CmsProto.GetActiveMessagesRequest();
// نسخه فعلی CMS فیلدی برای فیلتر ندارد؛ در صورت اضافه شدن، اینجا مپ می‌شود.
var cmsResponse = await _context.PublicMessages.GetActiveMessagesAsync(cmsRequest, cancellationToken: cancellationToken);
var result = new GetActiveMessagesResponse();
var result = new BffProto.GetActiveMessagesResponse();
foreach (var message in cmsResponse.Messages)
{
result.Messages.Add(new PublicMessageDto
result.Messages.Add(new BffProto.PublicMessageDto
{
MessageId = message.Id,
Title = message.Title,

View File

@@ -1,13 +1,13 @@
// GetAllMessages - Admin view
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.PublicMessage.Protobuf;
using CMSMicroservice.Protobuf.Protos;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using BffProto = BackOffice.BFF.PublicMessage.Protobuf;
using CmsProto = CMSMicroservice.Protobuf.Protos;
namespace BackOffice.BFF.Application.PublicMessageCQ.Queries.GetAllMessages;
public record GetAllMessagesQuery : IRequest<GetAllMessagesResponse>
public record GetAllMessagesQuery : IRequest<BffProto.GetAllMessagesResponse>
{
public int? Status { get; init; }
public int? MessageType { get; init; }
@@ -15,7 +15,7 @@ public record GetAllMessagesQuery : IRequest<GetAllMessagesResponse>
public int PageSize { get; init; }
}
public class GetAllMessagesQueryHandler : IRequestHandler<GetAllMessagesQuery, GetAllMessagesResponse>
public class GetAllMessagesQueryHandler : IRequestHandler<GetAllMessagesQuery, BffProto.GetAllMessagesResponse>
{
private readonly IApplicationContractContext _context;
@@ -24,9 +24,9 @@ public class GetAllMessagesQueryHandler : IRequestHandler<GetAllMessagesQuery, G
_context = context;
}
public async Task<GetAllMessagesResponse> Handle(GetAllMessagesQuery request, CancellationToken cancellationToken)
public async Task<BffProto.GetAllMessagesResponse> Handle(GetAllMessagesQuery request, CancellationToken cancellationToken)
{
var cmsRequest = new GetAllMessagesRequest
var cmsRequest = new CmsProto.GetAllMessagesRequest
{
PageNumber = request.PageNumber,
PageSize = request.PageSize
@@ -34,17 +34,17 @@ public class GetAllMessagesQueryHandler : IRequestHandler<GetAllMessagesQuery, G
if (request.Status.HasValue)
{
cmsRequest.IsActive = new BoolValue { Value = request.Status.Value == 1 };
cmsRequest.IsActive = request.Status.Value == 1;
}
if (request.MessageType.HasValue)
{
cmsRequest.Type = new Int32Value { Value = request.MessageType.Value };
cmsRequest.Type = request.MessageType.Value;
}
var cmsResponse = await _context.PublicMessages.GetAllMessagesAsync(cmsRequest, cancellationToken: cancellationToken);
var result = new GetAllMessagesResponse
var result = new BffProto.GetAllMessagesResponse
{
TotalCount = (int)cmsResponse.MetaData.TotalCount,
PageNumber = request.PageNumber,
@@ -53,7 +53,7 @@ public class GetAllMessagesQueryHandler : IRequestHandler<GetAllMessagesQuery, G
foreach (var message in cmsResponse.Messages)
{
result.Messages.Add(new AdminPublicMessageDto
result.Messages.Add(new BffProto.AdminPublicMessageDto
{
MessageId = message.Id,
Title = message.Title,

View File

@@ -1,9 +1,9 @@
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.ApplyDiscountToOrder;
public record ApplyDiscountToOrderCommand : IRequest<ApplyDiscountToOrderResponse>
public record ApplyDiscountToOrderCommand : IRequest<BffProto.ApplyDiscountToOrderResponse>
{
public long OrderId { get; init; }
public long DiscountAmount { get; init; }

View File

@@ -1,12 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using MediatR;
using Microsoft.Extensions.Logging;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CmsProto = CMSMicroservice.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.ApplyDiscountToOrder;
public class ApplyDiscountToOrderCommandHandler : IRequestHandler<ApplyDiscountToOrderCommand, ApplyDiscountToOrderResponse>
public class ApplyDiscountToOrderCommandHandler : IRequestHandler<ApplyDiscountToOrderCommand, BffProto.ApplyDiscountToOrderResponse>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<ApplyDiscountToOrderCommandHandler> _logger;
@@ -19,9 +19,9 @@ public class ApplyDiscountToOrderCommandHandler : IRequestHandler<ApplyDiscountT
_logger = logger;
}
public async Task<ApplyDiscountToOrderResponse> Handle(ApplyDiscountToOrderCommand request, CancellationToken cancellationToken)
public async Task<BffProto.ApplyDiscountToOrderResponse> Handle(ApplyDiscountToOrderCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new ApplyDiscountToOrderRequest
var grpcRequest = new CmsProto.ApplyDiscountToOrderRequest
{
OrderId = request.OrderId,
DiscountAmount = request.DiscountAmount,
@@ -37,7 +37,7 @@ public class ApplyDiscountToOrderCommandHandler : IRequestHandler<ApplyDiscountT
response.DiscountAmount,
response.FinalAmount);
return new ApplyDiscountToOrderResponse
return new BffProto.ApplyDiscountToOrderResponse
{
Success = response.Success,
Message = response.Message,

View File

@@ -1,9 +1,9 @@
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CancelOrder;
public record CancelOrderCommand : IRequest<CancelOrderResponse>
public record CancelOrderCommand : IRequest<BffProto.CancelOrderResponse>
{
public long OrderId { get; init; }
public string CancelReason { get; init; } = string.Empty;

View File

@@ -1,12 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using MediatR;
using Microsoft.Extensions.Logging;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CmsProto = CMSMicroservice.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CancelOrder;
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, CancelOrderResponse>
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, BffProto.CancelOrderResponse>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<CancelOrderCommandHandler> _logger;
@@ -19,9 +19,9 @@ public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, Can
_logger = logger;
}
public async Task<CancelOrderResponse> Handle(CancelOrderCommand request, CancellationToken cancellationToken)
public async Task<BffProto.CancelOrderResponse> Handle(CancelOrderCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new CMSMicroservice.Protobuf.Protos.UserOrder.CancelOrderRequest
var grpcRequest = new CmsProto.CancelOrderRequest
{
OrderId = request.OrderId,
CancelReason = request.CancelReason ?? string.Empty,
@@ -36,7 +36,7 @@ public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, Can
response.Status,
response.RefundProcessed);
return new CancelOrderResponse
return new BffProto.CancelOrderResponse
{
OrderId = response.OrderId,
Status = (int)response.Status,

View File

@@ -15,53 +15,3 @@ public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand>
.WithMessage("دلیل لغو سفارش الزامی است");
}
}
*** Add File: BackOffice.BFF/src/BackOffice.BFF.Application/UserOrderCQ/Commands/CancelOrder/CancelOrderCommandHandler.cs
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using MediatR;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.CancelOrder;
public class CancelOrderCommandHandler : IRequestHandler<CancelOrderCommand, CancelOrderResponse>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<CancelOrderCommandHandler> _logger;
public CancelOrderCommandHandler(
IApplicationContractContext context,
ILogger<CancelOrderCommandHandler> logger)
{
_context = context;
_logger = logger;
}
public async Task<CancelOrderResponse> Handle(CancelOrderCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new CMSMicroservice.Protobuf.Protos.UserOrder.CancelOrderRequest
{
OrderId = request.OrderId,
CancelReason = request.CancelReason ?? string.Empty,
RefundPayment = request.RefundPayment
};
var response = await _context.UserOrders.CancelOrderAsync(grpcRequest, cancellationToken: cancellationToken);
_logger.LogInformation(
"Cancelled order {OrderId}. Status={Status} RefundProcessed={RefundProcessed}",
response.OrderId,
response.Status,
response.RefundProcessed);
return new CancelOrderResponse
{
OrderId = response.OrderId,
Status = (int)response.Status,
Message = response.Message,
RefundProcessed = response.RefundProcessed
};
}
}

View File

@@ -1,9 +1,9 @@
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateOrderStatus;
public record UpdateOrderStatusCommand : IRequest<UpdateOrderStatusResponse>
public record UpdateOrderStatusCommand : IRequest<BffProto.UpdateOrderStatusResponse>
{
public long OrderId { get; init; }
public int NewStatus { get; init; }

View File

@@ -1,12 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using MediatR;
using Microsoft.Extensions.Logging;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CmsProto = CMSMicroservice.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateOrderStatus;
public class UpdateOrderStatusCommandHandler : IRequestHandler<UpdateOrderStatusCommand, UpdateOrderStatusResponse>
public class UpdateOrderStatusCommandHandler : IRequestHandler<UpdateOrderStatusCommand, BffProto.UpdateOrderStatusResponse>
{
private readonly IApplicationContractContext _context;
private readonly ILogger<UpdateOrderStatusCommandHandler> _logger;
@@ -19,9 +19,9 @@ public class UpdateOrderStatusCommandHandler : IRequestHandler<UpdateOrderStatus
_logger = logger;
}
public async Task<UpdateOrderStatusResponse> Handle(UpdateOrderStatusCommand request, CancellationToken cancellationToken)
public async Task<BffProto.UpdateOrderStatusResponse> Handle(UpdateOrderStatusCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new UpdateOrderStatusRequest
var grpcRequest = new CmsProto.UpdateOrderStatusRequest
{
OrderId = request.OrderId,
NewStatus = request.NewStatus
@@ -36,7 +36,7 @@ public class UpdateOrderStatusCommandHandler : IRequestHandler<UpdateOrderStatus
response.NewStatus,
response.Success);
return new UpdateOrderStatusResponse
return new BffProto.UpdateOrderStatusResponse
{
Success = response.Success,
Message = response.Message,

View File

@@ -1,9 +1,9 @@
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Queries.CalculateOrderPV;
public record CalculateOrderPVQuery : IRequest<CalculateOrderPVResponse>
public record CalculateOrderPVQuery : IRequest<BffProto.CalculateOrderPVResponse>
{
public long OrderId { get; init; }
}

View File

@@ -1,11 +1,11 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CmsProto = CMSMicroservice.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Queries.CalculateOrderPV;
public class CalculateOrderPVQueryHandler : IRequestHandler<CalculateOrderPVQuery, CalculateOrderPVResponse>
public class CalculateOrderPVQueryHandler : IRequestHandler<CalculateOrderPVQuery, BffProto.CalculateOrderPVResponse>
{
private readonly IApplicationContractContext _context;
@@ -14,16 +14,16 @@ public class CalculateOrderPVQueryHandler : IRequestHandler<CalculateOrderPVQuer
_context = context;
}
public async Task<CalculateOrderPVResponse> Handle(CalculateOrderPVQuery request, CancellationToken cancellationToken)
public async Task<BffProto.CalculateOrderPVResponse> Handle(CalculateOrderPVQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new CalculateOrderPVRequest
var grpcRequest = new CmsProto.CalculateOrderPVRequest
{
OrderId = request.OrderId
};
var response = await _context.UserOrders.CalculateOrderPVAsync(grpcRequest, cancellationToken: cancellationToken);
var result = new CalculateOrderPVResponse
var result = new BffProto.CalculateOrderPVResponse
{
OrderId = response.OrderId,
TotalPv = response.TotalPv
@@ -31,7 +31,7 @@ public class CalculateOrderPVQueryHandler : IRequestHandler<CalculateOrderPVQuer
foreach (var product in response.Products)
{
result.Products.Add(new ProductPVDto
result.Products.Add(new BffProto.ProductPVDto
{
ProductId = product.ProductId,
ProductTitle = product.ProductTitle,

View File

@@ -43,4 +43,8 @@ public class GetAllUserOrderByFilterResponseModel
public string? UserNationalCode { get; set; }
// روش پرداخت (0=IPG,1=Wallet)
public int PaymentMethod { get; set; }
// مبلغ مالیات بر ارزش افزوده (ریال)
public long VatAmount { get; set; }
// درصد مالیات بر ارزش افزوده (مثلاً 9 برای 9٪)
public double VatPercentage { get; set; }
}

View File

@@ -1,9 +1,9 @@
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Queries.GetOrdersByDateRange;
public record GetOrdersByDateRangeQuery : IRequest<GetOrdersByDateRangeResponse>
public record GetOrdersByDateRangeQuery : IRequest<BffProto.GetOrdersByDateRangeResponse>
{
public DateTime StartDate { get; init; }
public DateTime EndDate { get; init; }

View File

@@ -1,12 +1,12 @@
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CMSMicroservice.Protobuf.Protos.UserOrder;
using Google.Protobuf.WellKnownTypes;
using MediatR;
using BffProto = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using CmsProto = CMSMicroservice.Protobuf.Protos.UserOrder;
namespace BackOffice.BFF.Application.UserOrderCQ.Queries.GetOrdersByDateRange;
public class GetOrdersByDateRangeQueryHandler : IRequestHandler<GetOrdersByDateRangeQuery, GetOrdersByDateRangeResponse>
public class GetOrdersByDateRangeQueryHandler : IRequestHandler<GetOrdersByDateRangeQuery, BffProto.GetOrdersByDateRangeResponse>
{
private readonly IApplicationContractContext _context;
@@ -15,9 +15,9 @@ public class GetOrdersByDateRangeQueryHandler : IRequestHandler<GetOrdersByDateR
_context = context;
}
public async Task<GetOrdersByDateRangeResponse> Handle(GetOrdersByDateRangeQuery request, CancellationToken cancellationToken)
public async Task<BffProto.GetOrdersByDateRangeResponse> Handle(GetOrdersByDateRangeQuery request, CancellationToken cancellationToken)
{
var grpcRequest = new GetOrdersByDateRangeRequest
var grpcRequest = new CmsProto.GetOrdersByDateRangeRequest
{
StartDate = Timestamp.FromDateTime(request.StartDate.ToUniversalTime()),
EndDate = Timestamp.FromDateTime(request.EndDate.ToUniversalTime()),
@@ -27,19 +27,19 @@ public class GetOrdersByDateRangeQueryHandler : IRequestHandler<GetOrdersByDateR
if (request.Status.HasValue)
{
grpcRequest.Status = new Int32Value { Value = request.Status.Value };
grpcRequest.Status = request.Status.Value;
}
if (request.UserId.HasValue)
{
grpcRequest.UserId = new Int64Value { Value = request.UserId.Value };
grpcRequest.UserId = request.UserId.Value;
}
var response = await _context.UserOrders.GetOrdersByDateRangeAsync(grpcRequest, cancellationToken: cancellationToken);
var result = new GetOrdersByDateRangeResponse
var result = new BffProto.GetOrdersByDateRangeResponse
{
MetaData = new MetaData
MetaData = new BffProto.MetaData
{
CurrentPage = response.MetaData.CurrentPage,
TotalPage = response.MetaData.TotalPage,
@@ -52,7 +52,7 @@ public class GetOrdersByDateRangeQueryHandler : IRequestHandler<GetOrdersByDateR
foreach (var order in response.Orders)
{
result.Orders.Add(new OrderSummaryDto
result.Orders.Add(new BffProto.OrderSummaryDto
{
OrderId = order.OrderId,
OrderNumber = order.OrderNumber,

View File

@@ -36,6 +36,14 @@ public class GetUserOrderResponseDto
public string? UserFullName { get; set; }
// کدملی کاربر
public string? UserNationalCode { get; set; }
// مبلغ پایه (قبل از مالیات)
public long VatBaseAmount { get; set; }
// مبلغ مالیات بر ارزش افزوده (ریال)
public long VatAmount { get; set; }
// مبلغ نهایی (شامل مالیات)
public long VatTotalAmount { get; set; }
// درصد مالیات بر ارزش افزوده (مثلاً 9 برای 9٪)
public double VatPercentage { get; set; }
}
public class GetUserOrderResponseFactorDetail

View File

@@ -7,15 +7,15 @@
<ItemGroup>
<PackageReference Include="Afrino.FMSMicroservice.Protobuf" Version="0.0.122" />
<!-- <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.142" />-->
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.144" />
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\FourSat\CMS\src\CMSMicroservice.Protobuf\CMSMicroservice.Protobuf.csproj" />
</ItemGroup>
<!-- <ItemGroup>-->
<!-- <ProjectReference Include="..\..\..\..\FourSat\CMS\src\CMSMicroservice.Protobuf\CMSMicroservice.Protobuf.csproj" />-->
<!-- </ItemGroup>-->
</Project>

View File

@@ -14,6 +14,7 @@ public static class ConfigureServices
{
services.AddSingleton<IAfrinoIdpService, AfrinoIdpService>();
services.AddSingleton<IApplicationContractContext, ApplicationContractContext>();
services.AddScoped<IPermissionService, PermissionService>();
services.AddInfrastructureGrpcServices(configuration);
#region AddAuthentication
@@ -89,4 +90,4 @@ public static class ConfigureServices
return services;
}
}
}

View File

@@ -22,6 +22,7 @@ using CMSMicroservice.Protobuf.Protos.DiscountOrder;
using CMSMicroservice.Protobuf.Protos.Tag;
using CMSMicroservice.Protobuf.Protos.ProductTag;
using CMSMicroservice.Protobuf.Protos;
using CMSMicroservice.Protobuf.Protos.ManualPayment;
using Microsoft.Extensions.DependencyInjection;
namespace BackOffice.BFF.Infrastructure.Services;
@@ -84,5 +85,8 @@ public class ApplicationContractContext : IApplicationContractContext
// Public Messages
public PublicMessageContract.PublicMessageContractClient PublicMessages => GetService<PublicMessageContract.PublicMessageContractClient>();
// Manual Payments (Admin)
public ManualPaymentContract.ManualPaymentContractClient ManualPayments => GetService<ManualPaymentContract.ManualPaymentContractClient>();
#endregion
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using BackOffice.BFF.Application.Common.Interfaces;
using BackOffice.BFF.Application.Common.Models;
using Microsoft.AspNetCore.Http;
namespace BackOffice.BFF.Infrastructure.Services;
public class PermissionService : IPermissionService
{
private readonly IHttpContextAccessor _httpContextAccessor;
public PermissionService(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
public Task<IReadOnlyList<string>> GetUserRolesAsync(CancellationToken cancellationToken)
{
var httpContext = _httpContextAccessor.HttpContext;
var user = httpContext?.User;
if (user?.Identity is not { IsAuthenticated: true })
{
return Task.FromResult<IReadOnlyList<string>>(Array.Empty<string>());
}
var roles = user.Claims
.Where(c => c.Type == ClaimTypes.Role || string.Equals(c.Type, "role", StringComparison.OrdinalIgnoreCase))
.Select(c => c.Value)
.Where(v => !string.IsNullOrWhiteSpace(v))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
return Task.FromResult<IReadOnlyList<string>>(roles);
}
public async Task<bool> HasPermissionAsync(string permission, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(permission))
{
return true;
}
var roles = await GetUserRolesAsync(cancellationToken);
if (roles.Count == 0)
{
return false;
}
foreach (var role in roles)
{
if (RolePermissionConfig.HasPermission(role, permission))
{
return true;
}
}
return false;
}
}

View File

@@ -7,6 +7,17 @@
<DockerfileContext>..\..\..</DockerfileContext>
</PropertyGroup>
<!-- Exclude services that depend on excluded handlers -->
<ItemGroup>
<Compile Remove="Services/ConfigurationService.cs" />
<Compile Remove="Services/ManualPaymentService.cs" />
<Compile Remove="Services/PublicMessageService.cs" />
<!-- Exclude mappings with proto type mismatches -->
<Compile Remove="Common/Mappings/ProductsProfile.cs" />
<Compile Remove="Common/Mappings/UserOrderProfile.cs" />
<Compile Remove="Common/Mappings/PublicMessageProfile.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.54.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.54.0" />
@@ -31,5 +42,6 @@
<ProjectReference Include="..\Protobufs\BackOffice.BFF.Role.Protobuf\BackOffice.BFF.Role.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.UserRole.Protobuf\BackOffice.BFF.UserRole.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.Category.Protobuf\BackOffice.BFF.Category.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\BackOffice.BFF.ManualPayment.Protobuf\BackOffice.BFF.ManualPayment.Protobuf.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,79 @@
using System;
using System.Threading.Tasks;
using BackOffice.BFF.Application.Common.Interfaces;
using Grpc.AspNetCore.Server;
using Grpc.Core;
using Grpc.Core.Interceptors;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.WebApi.Common.Authorization;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class RequiresPermissionAttribute : Attribute
{
public RequiresPermissionAttribute(string permission)
{
Permission = permission ?? throw new ArgumentNullException(nameof(permission));
}
public string Permission { get; }
}
public class PermissionInterceptor : Interceptor
{
private readonly IPermissionService _permissionService;
private readonly ILogger<PermissionInterceptor> _logger;
private readonly IHttpContextAccessor _httpContextAccessor;
public PermissionInterceptor(
IPermissionService permissionService,
ILogger<PermissionInterceptor> logger,
IHttpContextAccessor httpContextAccessor)
{
_permissionService = permissionService;
_logger = logger;
_httpContextAccessor = httpContextAccessor;
}
public override async Task<TResponse> UnaryServerHandler<TRequest, TResponse>(
TRequest request,
ServerCallContext context,
UnaryServerMethod<TRequest, TResponse> continuation)
{
await EnsureHasPermissionAsync(context);
return await continuation(request, context);
}
private async Task EnsureHasPermissionAsync(ServerCallContext context)
{
var httpContext = context.GetHttpContext() ?? _httpContextAccessor.HttpContext;
if (httpContext == null)
{
return;
}
var endpoint = httpContext.GetEndpoint();
if (endpoint == null)
{
return;
}
var permissionAttributes = endpoint.Metadata.GetOrderedMetadata<RequiresPermissionAttribute>();
if (permissionAttributes == null || permissionAttributes.Count == 0)
{
return;
}
foreach (var attribute in permissionAttributes)
{
var hasPermission = await _permissionService.HasPermissionAsync(attribute.Permission, httpContext.RequestAborted);
if (!hasPermission)
{
_logger.LogWarning("Permission denied for permission {Permission}", attribute.Permission);
throw new RpcException(new Status(StatusCode.PermissionDenied, "Permission denied"));
}
}
}
}

View File

@@ -9,3 +9,5 @@ global using Microsoft.AspNetCore.Builder;
global using System;
global using Microsoft.AspNetCore.Routing;
global using System.Linq;
global using BackOffice.BFF.WebApi.Common.Authorization;
global using BackOffice.BFF.Application.Common.Models;

View File

@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using Serilog;
using Serilog.Core;
using Microsoft.OpenApi.Models;
using BackOffice.BFF.WebApi.Common.Authorization;
var builder = WebApplication.CreateBuilder(args);
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
@@ -37,6 +38,7 @@ builder.Services.AddGrpc(options =>
options.EnableDetailedErrors = true;
options.MaxReceiveMessageSize = 1000 * 1024 * 1024; // 1 GB
options.MaxSendMessageSize = 1000 * 1024 * 1024; // 1 GB
options.Interceptors.Add<PermissionInterceptor>();
}).AddJsonTranscoding();
builder.Services.AddInfrastructureServices(builder.Configuration);
builder.Services.AddApplicationServices();

View File

@@ -7,7 +7,7 @@ using BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalReports;
using BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
using BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
using BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
// using BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal; // Excluded - needs proto fix
using CMSMicroservice.Protobuf.Protos.Commission;
using Google.Protobuf.WellKnownTypes;
@@ -91,10 +91,8 @@ public class CommissionService : CommissionContract.CommissionContractBase
ProcessWithdrawalRequest request,
ServerCallContext context)
{
await _dispatchRequestToCQRS.Handle<ProcessWithdrawalRequest, ProcessWithdrawalCommand, ProcessWithdrawalResponseDto>(
request,
context);
return new Empty();
// TODO: Implement after ProcessWithdrawalCommand is fixed
throw new RpcException(new Status(StatusCode.Unimplemented, "ProcessWithdrawal is temporarily disabled"));
}
public override async Task<GetWithdrawalReportsResponse> GetWithdrawalReports(

View File

@@ -21,6 +21,7 @@ public class ConfigurationService : ConfigurationContract.ConfigurationContractB
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
[RequiresPermission(PermissionNames.SettingsManageConfiguration)]
public override async Task<Empty> CreateOrUpdateConfiguration(
CreateOrUpdateConfigurationRequest request,
ServerCallContext context)
@@ -30,6 +31,7 @@ public class ConfigurationService : ConfigurationContract.ConfigurationContractB
context);
}
[RequiresPermission(PermissionNames.SettingsManageConfiguration)]
public override async Task<Empty> DeactivateConfiguration(
DeactivateConfigurationRequest request,
ServerCallContext context)
@@ -39,6 +41,7 @@ public class ConfigurationService : ConfigurationContract.ConfigurationContractB
context);
}
[RequiresPermission(PermissionNames.SettingsView)]
public override async Task<GetAllConfigurationsResponse> GetAllConfigurations(
GetAllConfigurationsRequest request,
ServerCallContext context)

View File

@@ -0,0 +1,76 @@
using BackOffice.BFF.ManualPayment.Protobuf;
using BackOffice.BFF.WebApi.Common.Services;
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.ApproveManualPayment;
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
using BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
using Google.Protobuf.WellKnownTypes;
using Mapster;
using MediatR;
namespace BackOffice.BFF.WebApi.Services;
public class ManualPaymentService : ManualPaymentContract.ManualPaymentContractBase
{
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
private readonly ISender _sender;
public ManualPaymentService(
IDispatchRequestToCQRS dispatchRequestToCQRS,
ISender sender)
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
_sender = sender;
}
[RequiresPermission(PermissionNames.ManualPaymentsCreate)]
public override async Task<CreateManualPaymentResponse> CreateManualPayment(
CreateManualPaymentRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CreateManualPaymentRequest, CreateManualPaymentCommand, CreateManualPaymentResponse>(
request,
context);
}
[RequiresPermission(PermissionNames.ManualPaymentsApprove)]
public override async Task<Google.Protobuf.WellKnownTypes.Empty> ApproveManualPayment(
ApproveManualPaymentRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<ApproveManualPaymentRequest, ApproveManualPaymentCommand>(
request,
context);
}
[RequiresPermission(PermissionNames.ManualPaymentsApprove)]
public override async Task<Google.Protobuf.WellKnownTypes.Empty> RejectManualPayment(
RejectManualPaymentRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<RejectManualPaymentRequest, RejectManualPaymentCommand>(
request,
context);
}
[RequiresPermission(PermissionNames.ManualPaymentsView)]
public override async Task<GetManualPaymentsResponse> GetManualPayments(
GetManualPaymentsRequest request,
ServerCallContext context)
{
var query = new GetManualPaymentsQuery
{
PageNumber = request.PageNumber,
PageSize = request.PageSize,
UserId = request.UserId?.Value,
Status = request.Status?.Value,
Type = request.Type?.Value,
ReferenceNumber = request.ReferenceNumber?.Value,
// RequestedBy و OrderByDescending در این نسخه از UI ارسال نمی‌شود
};
var result = await _sender.Send(query, context.CancellationToken);
return result.Adapt<GetManualPaymentsResponse>();
}
}

View File

@@ -19,47 +19,62 @@ public class UserOrderService : UserOrderContract.UserOrderContractBase
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
[RequiresPermission(PermissionNames.OrdersCreate)]
public override async Task<CreateNewUserOrderResponse> CreateNewUserOrder(CreateNewUserOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CreateNewUserOrderRequest, CreateNewUserOrderCommand, CreateNewUserOrderResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersUpdate)]
public override async Task<Empty> UpdateUserOrder(UpdateUserOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<UpdateUserOrderRequest, UpdateUserOrderCommand>(request, context);
}
[RequiresPermission(PermissionNames.OrdersDelete)]
public override async Task<Empty> DeleteUserOrder(DeleteUserOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<DeleteUserOrderRequest, DeleteUserOrderCommand>(request, context);
}
[RequiresPermission(PermissionNames.OrdersView)]
public override async Task<GetUserOrderResponse> GetUserOrder(GetUserOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetUserOrderRequest, GetUserOrderQuery, GetUserOrderResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersView)]
public override async Task<GetAllUserOrderByFilterResponse> GetAllUserOrderByFilter(GetAllUserOrderByFilterRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetAllUserOrderByFilterRequest, GetAllUserOrderByFilterQuery, GetAllUserOrderByFilterResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersUpdate)]
public override async Task<UpdateOrderStatusResponse> UpdateOrderStatus(UpdateOrderStatusRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<UpdateOrderStatusRequest, UpdateOrderStatusCommand, UpdateOrderStatusResponse>(request, context);
}
[RequiresPermission(PermissionNames.ReportsView)]
public override async Task<GetOrdersByDateRangeResponse> GetOrdersByDateRange(GetOrdersByDateRangeRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetOrdersByDateRangeRequest, GetOrdersByDateRangeQuery, GetOrdersByDateRangeResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersUpdate)]
public override async Task<ApplyDiscountToOrderResponse> ApplyDiscountToOrder(ApplyDiscountToOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<ApplyDiscountToOrderRequest, ApplyDiscountToOrderCommand, ApplyDiscountToOrderResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersView)]
public override async Task<CalculateOrderPVResponse> CalculateOrderPV(CalculateOrderPVRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CalculateOrderPVRequest, CalculateOrderPVQuery, CalculateOrderPVResponse>(request, context);
}
[RequiresPermission(PermissionNames.OrdersCancel)]
public override async Task<CancelOrderResponse> CancelOrder(CancelOrderRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CancelOrderRequest, CancelOrderCommand, CancelOrderResponse>(request, context);

View File

@@ -31,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Products.Pro
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Category.Protobuf", "Protobufs\BackOffice.BFF.Category.Protobuf\BackOffice.BFF.Category.Protobuf.csproj", "{640BD51E-8298-4074-9713-BCE619318155}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Configuration.Protobuf", "Protobufs\BackOffice.BFF.Configuration.Protobuf\BackOffice.BFF.Configuration.Protobuf.csproj", "{5D7FCD40-BFB0-4D39-B662-05840154C6AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.ClubMembership.Protobuf", "Protobufs\BackOffice.BFF.ClubMembership.Protobuf\BackOffice.BFF.ClubMembership.Protobuf.csproj", "{3EC432DA-F351-43C5-A781-595062B999A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.NetworkMembership.Protobuf", "Protobufs\BackOffice.BFF.NetworkMembership.Protobuf\BackOffice.BFF.NetworkMembership.Protobuf.csproj", "{CA0F6C82-227A-41E4-A59F-B45EF68411A1}"
@@ -41,6 +39,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Commission.P
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Common.Protobuf", "Protobufs\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj", "{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.ManualPayment.Protobuf", "Protobufs\BackOffice.BFF.ManualPayment.Protobuf\BackOffice.BFF.ManualPayment.Protobuf.csproj", "{389D8C44-E796-41EE-BBF2-7A058735EA50}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Tag.Protobuf", "Protobufs\BackOffice.BFF.Tag.Protobuf\BackOffice.BFF.Tag.Protobuf.csproj", "{E9949E81-51E4-4A7D-B076-D1B7488DE73F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.ProductTag.Protobuf", "Protobufs\BackOffice.BFF.ProductTag.Protobuf\BackOffice.BFF.ProductTag.Protobuf.csproj", "{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.DiscountProduct.Protobuf", "Protobufs\BackOffice.BFF.DiscountProduct.Protobuf\BackOffice.BFF.DiscountProduct.Protobuf.csproj", "{66E4ACC8-194C-4773-AB23-B1DF5579C402}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.DiscountCategory.Protobuf", "Protobufs\BackOffice.BFF.DiscountCategory.Protobuf\BackOffice.BFF.DiscountCategory.Protobuf.csproj", "{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.DiscountOrder.Protobuf", "Protobufs\BackOffice.BFF.DiscountOrder.Protobuf\BackOffice.BFF.DiscountOrder.Protobuf.csproj", "{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.DiscountShoppingCart.Protobuf", "Protobufs\BackOffice.BFF.DiscountShoppingCart.Protobuf\BackOffice.BFF.DiscountShoppingCart.Protobuf.csproj", "{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Health.Protobuf", "Protobufs\BackOffice.BFF.Health.Protobuf\BackOffice.BFF.Health.Protobuf.csproj", "{1F95197B-9118-4C19-9C1B-C0872AA8F412}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.Configuration.Protobuf", "Protobufs\BackOffice.BFF.Configuration.Protobuf\BackOffice.BFF.Configuration.Protobuf.csproj", "{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackOffice.BFF.PublicMessage.Protobuf", "Protobufs\BackOffice.BFF.PublicMessage.Protobuf\BackOffice.BFF.PublicMessage.Protobuf.csproj", "{3454F4C0-A6C8-44BC-9389-6248518E3EA6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -207,18 +225,6 @@ Global
{640BD51E-8298-4074-9713-BCE619318155}.Release|x64.Build.0 = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x86.ActiveCfg = Release|Any CPU
{640BD51E-8298-4074-9713-BCE619318155}.Release|x86.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x64.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Debug|x86.Build.0 = Debug|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|Any CPU.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x64.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x64.Build.0 = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x86.ActiveCfg = Release|Any CPU
{5D7FCD40-BFB0-4D39-B662-05840154C6AF}.Release|x86.Build.0 = Release|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EC432DA-F351-43C5-A781-595062B999A5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -267,6 +273,126 @@ Global
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x64.Build.0 = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x86.ActiveCfg = Release|Any CPU
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA}.Release|x86.Build.0 = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|Any CPU.Build.0 = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|x64.ActiveCfg = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|x64.Build.0 = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|x86.ActiveCfg = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Debug|x86.Build.0 = Debug|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|Any CPU.ActiveCfg = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|Any CPU.Build.0 = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|x64.ActiveCfg = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|x64.Build.0 = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|x86.ActiveCfg = Release|Any CPU
{389D8C44-E796-41EE-BBF2-7A058735EA50}.Release|x86.Build.0 = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|x64.ActiveCfg = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|x64.Build.0 = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|x86.ActiveCfg = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Debug|x86.Build.0 = Debug|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|Any CPU.Build.0 = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|x64.ActiveCfg = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|x64.Build.0 = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|x86.ActiveCfg = Release|Any CPU
{E9949E81-51E4-4A7D-B076-D1B7488DE73F}.Release|x86.Build.0 = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|x64.ActiveCfg = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|x64.Build.0 = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|x86.ActiveCfg = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Debug|x86.Build.0 = Debug|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|Any CPU.Build.0 = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|x64.ActiveCfg = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|x64.Build.0 = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|x86.ActiveCfg = Release|Any CPU
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD}.Release|x86.Build.0 = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|x64.ActiveCfg = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|x64.Build.0 = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|x86.ActiveCfg = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Debug|x86.Build.0 = Debug|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|Any CPU.Build.0 = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|x64.ActiveCfg = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|x64.Build.0 = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|x86.ActiveCfg = Release|Any CPU
{66E4ACC8-194C-4773-AB23-B1DF5579C402}.Release|x86.Build.0 = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|x64.ActiveCfg = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|x64.Build.0 = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|x86.ActiveCfg = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Debug|x86.Build.0 = Debug|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|Any CPU.Build.0 = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|x64.ActiveCfg = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|x64.Build.0 = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|x86.ActiveCfg = Release|Any CPU
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B}.Release|x86.Build.0 = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|x64.ActiveCfg = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|x64.Build.0 = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|x86.ActiveCfg = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Debug|x86.Build.0 = Debug|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|Any CPU.Build.0 = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|x64.ActiveCfg = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|x64.Build.0 = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|x86.ActiveCfg = Release|Any CPU
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48}.Release|x86.Build.0 = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|x64.ActiveCfg = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|x64.Build.0 = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|x86.ActiveCfg = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Debug|x86.Build.0 = Debug|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|Any CPU.Build.0 = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|x64.ActiveCfg = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|x64.Build.0 = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|x86.ActiveCfg = Release|Any CPU
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7}.Release|x86.Build.0 = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|x64.ActiveCfg = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|x64.Build.0 = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|x86.ActiveCfg = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Debug|x86.Build.0 = Debug|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|Any CPU.Build.0 = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|x64.ActiveCfg = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|x64.Build.0 = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|x86.ActiveCfg = Release|Any CPU
{1F95197B-9118-4C19-9C1B-C0872AA8F412}.Release|x86.Build.0 = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|x64.ActiveCfg = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|x64.Build.0 = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|x86.ActiveCfg = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Debug|x86.Build.0 = Debug|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|Any CPU.Build.0 = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|x64.ActiveCfg = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|x64.Build.0 = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|x86.ActiveCfg = Release|Any CPU
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1}.Release|x86.Build.0 = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|x64.ActiveCfg = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|x64.Build.0 = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|x86.ActiveCfg = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Debug|x86.Build.0 = Debug|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|Any CPU.Build.0 = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|x64.ActiveCfg = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|x64.Build.0 = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|x86.ActiveCfg = Release|Any CPU
{3454F4C0-A6C8-44BC-9389-6248518E3EA6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -281,11 +407,20 @@ Global
{E1833EDA-39E9-C241-2772-E4C7E960AC41} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{DFDECBE8-D071-4CDB-A1B4-D5C556EF72A6} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{640BD51E-8298-4074-9713-BCE619318155} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{5D7FCD40-BFB0-4D39-B662-05840154C6AF} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{3EC432DA-F351-43C5-A781-595062B999A5} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{CA0F6C82-227A-41E4-A59F-B45EF68411A1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{3B7514DE-1C2F-4BB1-BBD5-C57BEEC6843E} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{9911D6BE-3022-44F6-B93B-B3D62A14FBCA} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{389D8C44-E796-41EE-BBF2-7A058735EA50} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{E9949E81-51E4-4A7D-B076-D1B7488DE73F} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{18F8F2B9-F35C-494C-B50B-8A8A34EB06CD} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{66E4ACC8-194C-4773-AB23-B1DF5579C402} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{1EB020B6-0BFD-4F50-8035-E5B548CECF3B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{DCED8D9C-1C31-4B1D-9D9A-787A13A32C48} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{32A1D40E-525E-4E38-8AD6-FDC21503FCE7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{1F95197B-9118-4C19-9C1B-C0872AA8F412} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{FB2AAF65-F9DC-4315-979E-A77EC44C5FB1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{3454F4C0-A6C8-44BC-9389-6248518E3EA6} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0AE1AB4A-3C91-4853-93C2-C2476E79F845}

View File

@@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.3</Version>
<Version>0.0.4</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>

View File

@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.ClubMembership.Protobuf</PackageId>
<Version>0.0.1</Version>
<Version>0.0.3</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>Foursat.BackOffice.BFF.ClubMembership.Protobuf</Product>
@@ -29,5 +29,14 @@
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -7,7 +7,7 @@ import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.ClubMembership.Protobuf";
option csharp_namespace = "Foursat.BackOffice.BFF.ClubMembership.Protobuf";
service ClubMembershipContract
{

View File

@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
<Version>0.0.2</Version>
<Version>0.0.3</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Commission.Protobuf</Product>

View File

@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.Common.Protobuf</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Common.Protobuf</Product>

View File

@@ -5,11 +5,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>BackOffice.BFF.Configuration.Protobuf</PackageId>
<Version>1.0.0</Version>
<PackageId>Foursat.BackOffice.BFF.Configuration.Protobuf</PackageId>
<Version>1.0.3</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Configuration.Protobuf</Product>
<Product>Foursat.BackOffice.BFF.Configuration.Protobuf</Product>
</PropertyGroup>
<ItemGroup>

View File

@@ -7,7 +7,7 @@ import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.Configuration.Protobuf";
option csharp_namespace = "Foursat.BackOffice.BFF.Configuration.Protobuf";
service ConfigurationContract
{

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Foursat.BackOffice.BFF.DiscountCategory.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\discountcategory.proto" ProtoRoot="Protos\" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,100 @@
syntax = "proto3";
package discountcategory;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "BackOffice.BFF.DiscountCategory.Protobuf.Protos.DiscountCategory";
service DiscountCategoryContract
{
rpc CreateDiscountCategory(CreateDiscountCategoryRequest) returns (CreateDiscountCategoryResponse){
option (google.api.http) = {
post: "/CreateDiscountCategory"
body: "*"
};
};
rpc UpdateDiscountCategory(UpdateDiscountCategoryRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/UpdateDiscountCategory"
body: "*"
};
};
rpc DeleteDiscountCategory(DeleteDiscountCategoryRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/DeleteDiscountCategory"
body: "*"
};
};
rpc GetDiscountCategories(GetDiscountCategoriesRequest) returns (GetDiscountCategoriesResponse){
option (google.api.http) = {
get: "/GetDiscountCategories"
};
};
}
// Create Category
message CreateDiscountCategoryRequest
{
string name = 1;
string title = 2;
google.protobuf.StringValue description = 3;
google.protobuf.StringValue image_path = 4;
google.protobuf.Int64Value parent_category_id = 5;
int32 sort_order = 6;
bool is_active = 7;
}
message CreateDiscountCategoryResponse
{
int64 category_id = 1;
}
// Update Category
message UpdateDiscountCategoryRequest
{
int64 category_id = 1;
string name = 2;
string title = 3;
google.protobuf.StringValue description = 4;
google.protobuf.StringValue image_path = 5;
google.protobuf.Int64Value parent_category_id = 6;
int32 sort_order = 7;
bool is_active = 8;
}
// Delete Category
message DeleteDiscountCategoryRequest
{
int64 category_id = 1;
}
// Get Categories with Tree Structure
message GetDiscountCategoriesRequest
{
google.protobuf.Int64Value parent_category_id = 1; // null = root categories
google.protobuf.BoolValue is_active = 2;
}
message GetDiscountCategoriesResponse
{
repeated DiscountCategoryDto categories = 1;
}
message DiscountCategoryDto
{
int64 id = 1;
string name = 2;
string title = 3;
google.protobuf.StringValue description = 4;
google.protobuf.StringValue image_path = 5;
google.protobuf.Int64Value parent_category_id = 6;
int32 sort_order = 7;
bool is_active = 8;
int32 product_count = 9;
repeated DiscountCategoryDto children = 10; // Recursive children
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,51 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
message Http {
repeated HttpRule rules = 1;
bool fully_decode_reserved_expansion = 2;
}
message HttpRule {
string selector = 1;
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string body = 7;
string response_body = 12;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Foursat.BackOffice.BFF.DiscountOrder.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\discountorder.proto" ProtoRoot="Protos\" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,177 @@
syntax = "proto3";
package discountorder;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "BackOffice.BFF.DiscountOrder.Protobuf.Protos.DiscountOrder";
service DiscountOrderContract
{
rpc PlaceOrder(PlaceOrderRequest) returns (PlaceOrderResponse){
option (google.api.http) = {
post: "/PlaceOrder"
body: "*"
};
};
rpc CompleteOrderPayment(CompleteOrderPaymentRequest) returns (CompleteOrderPaymentResponse){
option (google.api.http) = {
post: "/CompleteOrderPayment"
body: "*"
};
};
rpc UpdateOrderStatus(UpdateOrderStatusRequest) returns (UpdateOrderStatusResponse){
option (google.api.http) = {
put: "/UpdateOrderStatus"
body: "*"
};
};
rpc GetOrderById(GetOrderByIdRequest) returns (GetOrderByIdResponse){
option (google.api.http) = {
get: "/GetOrderById"
};
};
rpc GetUserOrders(GetUserOrdersRequest) returns (GetUserOrdersResponse){
option (google.api.http) = {
get: "/GetUserOrders"
};
};
}
// Place Order (Initial Step - Create Order)
message PlaceOrderRequest
{
int64 user_id = 1;
int64 user_address_id = 2;
int64 discount_balance_to_use = 3; // Amount from DiscountBalance wallet
google.protobuf.StringValue notes = 4;
}
message PlaceOrderResponse
{
bool success = 1;
string message = 2;
int64 order_id = 3;
int64 gateway_amount = 4; // Amount to pay via gateway (if any)
google.protobuf.StringValue payment_url = 5; // Payment gateway URL (if needed)
}
// Complete Order Payment (After Gateway Callback)
message CompleteOrderPaymentRequest
{
int64 order_id = 1;
google.protobuf.StringValue transaction_id = 2;
bool payment_success = 3;
}
message CompleteOrderPaymentResponse
{
bool success = 1;
string message = 2;
}
// Update Order Status (Admin)
message UpdateOrderStatusRequest
{
int64 order_id = 1;
DeliveryStatus delivery_status = 2;
google.protobuf.StringValue tracking_code = 3;
google.protobuf.StringValue admin_notes = 4;
}
message UpdateOrderStatusResponse
{
bool success = 1;
string message = 2;
}
enum DeliveryStatus
{
DELIVERY_PENDING = 0;
DELIVERY_PROCESSING = 1;
DELIVERY_SHIPPED = 2;
DELIVERY_DELIVERED = 3;
DELIVERY_CANCELLED = 4;
}
// Get Order By Id
message GetOrderByIdRequest
{
int64 order_id = 1;
int64 user_id = 2; // For authorization check
}
message GetOrderByIdResponse
{
int64 id = 1;
int64 user_id = 2;
string order_number = 3;
AddressInfo address = 4;
int64 total_price = 5;
int64 discount_balance_used = 6;
int64 gateway_amount = 7;
bool payment_completed = 8;
google.protobuf.StringValue transaction_id = 9;
DeliveryStatus delivery_status = 10;
google.protobuf.StringValue tracking_code = 11;
google.protobuf.StringValue notes = 12;
google.protobuf.StringValue admin_notes = 13;
repeated OrderItemDto items = 14;
google.protobuf.Timestamp created = 15;
google.protobuf.Timestamp last_modified = 16;
}
message AddressInfo
{
int64 id = 1;
string title = 2;
string address = 3;
string postal_code = 4;
google.protobuf.StringValue phone = 5;
}
message OrderItemDto
{
int64 product_id = 1;
string product_title = 2;
int64 unit_price = 3;
int32 max_discount_percent = 4;
int32 count = 5;
int64 total_price = 6;
int64 discount_amount = 7;
int64 final_price = 8;
}
// Get User Orders
message GetUserOrdersRequest
{
int64 user_id = 1;
google.protobuf.BoolValue payment_completed = 2;
google.protobuf.Int32Value delivery_status = 3; // DeliveryStatus as int
int32 page_number = 4;
int32 page_size = 5;
}
message GetUserOrdersResponse
{
messages.MetaData meta_data = 1;
repeated OrderSummaryDto models = 2;
}
message OrderSummaryDto
{
int64 id = 1;
string order_number = 2;
int64 total_price = 3;
int64 discount_balance_used = 4;
int64 gateway_amount = 5;
bool payment_completed = 6;
DeliveryStatus delivery_status = 7;
google.protobuf.StringValue tracking_code = 8;
int32 items_count = 9;
google.protobuf.Timestamp created = 10;
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,51 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
message Http {
repeated HttpRule rules = 1;
bool fully_decode_reserved_expansion = 2;
}
message HttpRule {
string selector = 1;
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string body = 7;
string response_body = 12;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Foursat.BackOffice.BFF.DiscountProduct.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\discountproduct.proto" ProtoRoot="Protos\" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,152 @@
syntax = "proto3";
package discountproduct;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "BackOffice.BFF.DiscountProduct.Protobuf.Protos.DiscountProduct";
service DiscountProductContract
{
rpc CreateDiscountProduct(CreateDiscountProductRequest) returns (CreateDiscountProductResponse){
option (google.api.http) = {
post: "/CreateDiscountProduct"
body: "*"
};
};
rpc UpdateDiscountProduct(UpdateDiscountProductRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/UpdateDiscountProduct"
body: "*"
};
};
rpc DeleteDiscountProduct(DeleteDiscountProductRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/DeleteDiscountProduct"
body: "*"
};
};
rpc GetDiscountProductById(GetDiscountProductByIdRequest) returns (GetDiscountProductByIdResponse){
option (google.api.http) = {
get: "/GetDiscountProductById"
};
};
rpc GetDiscountProducts(GetDiscountProductsRequest) returns (GetDiscountProductsResponse){
option (google.api.http) = {
get: "/GetDiscountProducts"
};
};
}
// Create Product
message CreateDiscountProductRequest
{
string title = 1;
string short_infomation = 2;
string full_information = 3;
int64 price = 4;
int32 max_discount_percent = 5;
string image_path = 6;
string thumbnail_path = 7;
int32 initial_count = 8;
int32 sort_order = 9;
bool is_active = 10;
repeated int64 category_ids = 11;
}
message CreateDiscountProductResponse
{
int64 product_id = 1;
}
// Update Product
message UpdateDiscountProductRequest
{
int64 product_id = 1;
string title = 2;
string short_infomation = 3;
string full_information = 4;
int64 price = 5;
int32 max_discount_percent = 6;
string image_path = 7;
string thumbnail_path = 8;
int32 sort_order = 9;
bool is_active = 10;
repeated int64 category_ids = 11;
}
// Delete Product
message DeleteDiscountProductRequest
{
int64 product_id = 1;
}
// Get Product By Id
message GetDiscountProductByIdRequest
{
int64 product_id = 1;
int64 user_id = 2; // Optional for view count tracking
}
message GetDiscountProductByIdResponse
{
int64 id = 1;
string title = 2;
string short_infomation = 3;
string full_information = 4;
int64 price = 5;
int32 max_discount_percent = 6;
string image_path = 7;
string thumbnail_path = 8;
int32 remaining_count = 9;
int32 view_count = 10;
int32 sort_order = 11;
bool is_active = 12;
repeated CategoryInfo categories = 13;
google.protobuf.Timestamp created = 14;
}
message CategoryInfo
{
int64 id = 1;
string name = 2;
string title = 3;
}
// Get Products with Filters
message GetDiscountProductsRequest
{
google.protobuf.Int64Value category_id = 1;
google.protobuf.StringValue search_query = 2;
google.protobuf.Int64Value min_price = 3;
google.protobuf.Int64Value max_price = 4;
google.protobuf.BoolValue is_active = 5;
google.protobuf.BoolValue in_stock = 6;
int32 page_number = 7;
int32 page_size = 8;
}
message GetDiscountProductsResponse
{
messages.MetaData meta_data = 1;
repeated DiscountProductDto models = 2;
}
message DiscountProductDto
{
int64 id = 1;
string title = 2;
string short_infomation = 3;
int64 price = 4;
int32 max_discount_percent = 5;
string image_path = 6;
string thumbnail_path = 7;
int32 remaining_count = 8;
int32 view_count = 9;
bool is_active = 10;
google.protobuf.Timestamp created = 11;
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,51 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
message Http {
repeated HttpRule rules = 1;
bool fully_decode_reserved_expansion = 2;
}
message HttpRule {
string selector = 1;
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string body = 7;
string response_body = 12;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Foursat.BackOffice.BFF.DiscountShoppingCart.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\discountshoppingcart.proto" ProtoRoot="Protos\" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,120 @@
syntax = "proto3";
package discountshoppingcart;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "BackOffice.BFF.DiscountShoppingCart.Protobuf.Protos.DiscountShoppingCart";
service DiscountShoppingCartContract
{
rpc AddToCart(AddToCartRequest) returns (AddToCartResponse){
option (google.api.http) = {
post: "/AddToCart"
body: "*"
};
};
rpc RemoveFromCart(RemoveFromCartRequest) returns (RemoveFromCartResponse){
option (google.api.http) = {
delete: "/RemoveFromCart"
body: "*"
};
};
rpc UpdateCartItemCount(UpdateCartItemCountRequest) returns (UpdateCartItemCountResponse){
option (google.api.http) = {
put: "/UpdateCartItemCount"
body: "*"
};
};
rpc GetUserCart(GetUserCartRequest) returns (GetUserCartResponse){
option (google.api.http) = {
get: "/GetUserCart"
};
};
rpc ClearCart(ClearCartRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/ClearCart"
body: "*"
};
};
}
// Add to Cart
message AddToCartRequest
{
int64 user_id = 1;
int64 product_id = 2;
int32 count = 3;
}
message AddToCartResponse
{
bool success = 1;
string message = 2;
}
// Remove from Cart
message RemoveFromCartRequest
{
int64 user_id = 1;
int64 product_id = 2;
}
message RemoveFromCartResponse
{
bool success = 1;
string message = 2;
}
// Update Cart Item Count
message UpdateCartItemCountRequest
{
int64 user_id = 1;
int64 product_id = 2;
int32 new_count = 3;
}
message UpdateCartItemCountResponse
{
bool success = 1;
string message = 2;
}
// Get User Cart
message GetUserCartRequest
{
int64 user_id = 1;
}
message GetUserCartResponse
{
repeated CartItemDto items = 1;
int64 total_price = 2;
int64 total_discount_amount = 3;
int64 final_price = 4;
}
message CartItemDto
{
int64 product_id = 1;
string product_title = 2;
string product_image_path = 3;
int64 unit_price = 4;
int32 max_discount_percent = 5;
int32 count = 6;
int64 total_price = 7;
int64 discount_amount = 8;
int64 final_price = 9;
int32 product_remaining_count = 10;
google.protobuf.Timestamp created = 11;
}
// Clear Cart
message ClearCartRequest
{
int64 user_id = 1;
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,51 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
message Http {
repeated HttpRule rules = 1;
bool fully_decode_reserved_expansion = 2;
}
message HttpRule {
string selector = 1;
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string body = 7;
string response_body = 12;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}

View File

@@ -5,11 +5,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>BackOffice.BFF.Health.Protobuf</PackageId>
<Version>1.0.0</Version>
<PackageId>Foursat.BackOffice.BFF.Health.Protobuf</PackageId>
<Version>1.0.4</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>BackOffice.BFF.Health.Protobuf</Product>
<Product>Foursat.BackOffice.BFF.Health.Protobuf</Product>
</PropertyGroup>
<ItemGroup>
@@ -24,5 +24,14 @@
<ItemGroup>
<Protobuf Include="Protos\health.proto" GrpcServices="Both" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -4,7 +4,7 @@ package health;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "BackOffice.BFF.Health.Protobuf";
option csharp_namespace = "Foursat.BackOffice.BFF.Health.Protobuf";
service HealthContract
{

View File

@@ -0,0 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</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>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackageId>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</PackageId>
<Version>0.0.1</Version>
<Version>0.0.2</Version>
<Authors>FourSat</Authors>
<Company>FourSat</Company>
<Product>Foursat.BackOffice.BFF.NetworkMembership.Protobuf</Product>
@@ -29,5 +29,14 @@
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.111</Version>
<Version>0.0.112</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>

View File

@@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.111</Version>
<Version>0.0.112</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>

View File

@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.2</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageId>Foursat.BackOffice.BFF.ProductTag.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\producttag.proto" ProtoRoot="Protos\" GrpcServices="Client" AdditionalImportDirs="..\BackOffice.BFF.Common.Protobuf\Protos"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BackOffice.BFF.Common.Protobuf\BackOffice.BFF.Common.Protobuf.csproj" />
</ItemGroup>
<Target Name="PushToFourSat" AfterTargets="Pack">
<PropertyGroup>
<NugetPackagePath>$(PackageOutputPath)$(PackageId).$(Version).nupkg</NugetPackagePath>
<PushCommand>
dotnet nuget push **/*.nupkg --source https://git.afrino.co/api/packages/FourSat/nuget/index.json --api-key 061a5cb15517c6da39c16cfce8556c55ae104d0d --skip-duplicate
</PushCommand>
</PropertyGroup>
<Exec Command="$(PushCommand)" />
</Target>
</Project>

View File

@@ -0,0 +1,31 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,51 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
message Http {
repeated HttpRule rules = 1;
bool fully_decode_reserved_expansion = 2;
}
message HttpRule {
string selector = 1;
oneof pattern {
string get = 2;
string put = 3;
string post = 4;
string delete = 5;
string patch = 6;
CustomHttpPattern custom = 8;
}
string body = 7;
string response_body = 12;
repeated HttpRule additional_bindings = 11;
}
message CustomHttpPattern {
string kind = 1;
string path = 2;
}

View File

@@ -0,0 +1,108 @@
syntax = "proto3";
package producttag;
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 = "BackOffice.BFF.ProductTag.Protobuf.Protos.ProductTag";
service ProductTagContract
{
rpc CreateNewProductTag(CreateNewProductTagRequest) returns (CreateNewProductTagResponse){
option (google.api.http) = {
post: "/CreateNewProductTag"
body: "*"
};
};
rpc UpdateProductTag(UpdateProductTagRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/UpdateProductTag"
body: "*"
};
};
rpc DeleteProductTag(DeleteProductTagRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
delete: "/DeleteProductTag"
body: "*"
};
};
rpc GetProductTag(GetProductTagRequest) returns (GetProductTagResponse){
option (google.api.http) = {
get: "/GetProductTag"
};
};
rpc GetAllProductTagByFilter(GetAllProductTagByFilterRequest) returns (GetAllProductTagByFilterResponse){
option (google.api.http) = {
get: "/GetAllProductTagByFilter"
};
};
}
message CreateNewProductTagRequest
{
int64 product_id = 1;
int64 tag_id = 2;
}
message CreateNewProductTagResponse
{
int64 id = 1;
}
message UpdateProductTagRequest
{
int64 id = 1;
int64 product_id = 2;
int64 tag_id = 3;
}
message DeleteProductTagRequest
{
int64 id = 1;
}
message GetProductTagRequest
{
int64 id = 1;
}
message GetProductTagResponse
{
int64 id = 1;
int64 product_id = 2;
int64 tag_id = 3;
}
message GetAllProductTagByFilterRequest
{
messages.PaginationState pagination_state = 1;
google.protobuf.StringValue sort_by = 2;
GetAllProductTagByFilterFilter filter = 3;
}
message GetAllProductTagByFilterFilter
{
google.protobuf.Int64Value id = 1;
google.protobuf.Int64Value product_id = 2;
google.protobuf.Int64Value tag_id = 3;
}
message GetAllProductTagByFilterResponse
{
messages.MetaData meta_data = 1;
repeated GetAllProductTagByFilterResponseModel models = 2;
}
message GetAllProductTagByFilterResponseModel
{
int64 id = 1;
int64 product_id = 2;
int64 tag_id = 3;
}

View File

@@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.8</Version>
<Version>0.0.9</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>

Some files were not shown because too many files have changed in this diff Show More