Compare commits
11 Commits
9fe93e04d8
...
663b357d10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
663b357d10 | ||
|
|
b51a24d307 | ||
|
|
a47be9f585 | ||
|
|
e651e5a292 | ||
|
|
ce091044c0 | ||
|
|
6e70031691 | ||
|
|
13037e9533 | ||
|
|
d7ae666468 | ||
|
|
609f79723f | ||
|
|
07f7819820 | ||
|
|
13e33e7b1f |
17
.gitea/workflows/frontoffice-stage.yml
Normal file
17
.gitea/workflows/frontoffice-stage.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
name: Push nuget and docker image Actions Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- stage
|
||||
jobs:
|
||||
Deploy:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://git.afrino.co/actions/checkout@v3
|
||||
- name: Setup dotnet
|
||||
uses: https://git.afrino.co/actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Build and Deploy
|
||||
name: Build and Deploy to Kubernetes
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,33 +6,60 @@ on:
|
||||
- kub-stage
|
||||
|
||||
env:
|
||||
REGISTRY: 194.5.195.53:30080
|
||||
REGISTRY: gitea-svc:3000
|
||||
IMAGE_NAME: admin/frontoffice-bff
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker:latest
|
||||
options: --privileged
|
||||
env:
|
||||
HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
|
||||
HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
|
||||
NO_PROXY: localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8
|
||||
steps:
|
||||
- name: Install git
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
apk add --no-cache git curl
|
||||
|
||||
# Install kubectl
|
||||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
mv kubectl /usr/local/bin/
|
||||
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone --depth 1 --branch kub-stage http://194.5.195.53:30080/admin/FrontOffice.BFF.git .
|
||||
git log -1 --format="%H %s"
|
||||
|
||||
- name: Start Docker daemon
|
||||
- name: Start Docker daemon with insecure registry
|
||||
run: |
|
||||
mkdir -p /etc/docker
|
||||
cat > /etc/docker/daemon.json << 'DAEMON'
|
||||
{
|
||||
"insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"]
|
||||
}
|
||||
DAEMON
|
||||
mkdir -p ~/.docker
|
||||
cat > ~/.docker/config.json << 'CONF'
|
||||
{
|
||||
"proxies": {
|
||||
"default": {
|
||||
"httpProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
|
||||
"httpsProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
|
||||
"noProxy": "localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8"
|
||||
}
|
||||
}
|
||||
}
|
||||
CONF
|
||||
dockerd &
|
||||
for i in $(seq 1 30); do
|
||||
docker info >/dev/null 2>&1 && break || sleep 2
|
||||
done
|
||||
docker info
|
||||
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/FrontOffice.BFF.git .
|
||||
git log -1 --format="%H %s"
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
cd src
|
||||
@@ -43,8 +70,22 @@ jobs:
|
||||
--build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
|
||||
.
|
||||
|
||||
|
||||
- name: Push to Registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
run: |
|
||||
# Setup kubeconfig
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
|
||||
|
||||
# Restart deployment to pull new image
|
||||
kubectl rollout restart deployment/frontoffice-bff || echo "Deployment doesn't exist yet"
|
||||
|
||||
# Wait for rollout to complete
|
||||
kubectl rollout status deployment/frontoffice-bff --timeout=5m || echo "Deployment rollout pending"
|
||||
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -492,5 +492,5 @@ fabric.properties
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
/src/.idea
|
||||
/.gitea
|
||||
|
||||
src/.dockerignore
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Category.Protobuf\FrontOffice.BFF.Category.Protobuf.csproj" />
|
||||
<!-- CMS Protobuf for Commission, ClubMembership, NetworkMembership, Configuration -->
|
||||
<ProjectReference Include="..\..\..\CMS\src\CMSMicroservice.Protobuf\CMSMicroservice.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -25,8 +25,38 @@ public class GetUserOrderResponseDto
|
||||
public string? UserAddressText { get; set; }
|
||||
//
|
||||
public List<GetUserOrderResponseFactorDetail>? FactorDetails { get; set; }
|
||||
// اطلاعات مالیات بر ارزش افزوده
|
||||
public OrderVATInfoDto? VatInfo { get; set; }
|
||||
}
|
||||
|
||||
}public class GetUserOrderResponseFactorDetail
|
||||
/// <summary>
|
||||
/// اطلاعات مالیات بر ارزش افزوده
|
||||
/// </summary>
|
||||
public class OrderVATInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// نرخ مالیات (مثلاً 0.09 = 9%)
|
||||
/// </summary>
|
||||
public double VatRate { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ پایه (قبل از مالیات)
|
||||
/// </summary>
|
||||
public long BaseAmount { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ مالیات
|
||||
/// </summary>
|
||||
public long VatAmount { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ کل (پایه + مالیات)
|
||||
/// </summary>
|
||||
public long TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// آیا پرداخت شده
|
||||
/// </summary>
|
||||
public bool IsPaid { get; set; }
|
||||
}
|
||||
|
||||
public class GetUserOrderResponseFactorDetail
|
||||
{
|
||||
//شناسه
|
||||
public long ProductId { get; set; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.139" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.144" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.76.0">
|
||||
|
||||
@@ -1,44 +1,40 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
EXPOSE 8081
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
|
||||
# Copy main projects
|
||||
COPY ["FrontOffice.BFF.WebApi/NuGet.config", "NuGet.config"]
|
||||
COPY ["FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj", "FrontOffice.BFF.WebApi/"]
|
||||
COPY ["FrontOffice.BFF.WebApi/NuGet.config", "FrontOffice.BFF.WebApi/"]
|
||||
COPY ["FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj", "FrontOffice.BFF.Application/"]
|
||||
COPY ["FrontOffice.BFF.Infrastructure/FrontOffice.BFF.Infrastructure.csproj", "FrontOffice.BFF.Infrastructure/"]
|
||||
COPY ["FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj", "FrontOffice.BFF.Domain/"]
|
||||
|
||||
# Copy all Protobuf projects
|
||||
COPY ["Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Category.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Commission.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj", "Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Package.Protobuf/"]
|
||||
COPY ["FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj", "FrontOffice.BFF.Application/"]
|
||||
COPY ["FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj", "FrontOffice.BFF.Domain/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserOrder.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Category.Protobuf/"]
|
||||
COPY ["FrontOffice.BFF.Infrastructure/FrontOffice.BFF.Infrastructure.csproj", "FrontOffice.BFF.Infrastructure/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Products.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Transaction.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserWallet.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj", "Protobufs/FrontOffice.BFF.User.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserAddress.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserOrder.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserWallet.Protobuf/"]
|
||||
|
||||
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile "FrontOffice.BFF.WebApi/NuGet.config"
|
||||
|
||||
COPY ["Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Package.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Commission.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/"]
|
||||
COPY ["Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/"]
|
||||
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile NuGet.config
|
||||
COPY . .
|
||||
WORKDIR "/src/FrontOffice.BFF.WebApi"
|
||||
RUN dotnet build "FrontOffice.BFF.WebApi.csproj" -c Release -o /app/build
|
||||
RUN dotnet build "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "FrontOffice.BFF.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080
|
||||
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]
|
||||
|
||||
@@ -36,4 +36,9 @@
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.ClubMembership.Protobuf\FrontOffice.BFF.ClubMembership.Protobuf.csproj" />
|
||||
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.NetworkMembership.Protobuf\FrontOffice.BFF.NetworkMembership.Protobuf.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -13,14 +13,14 @@ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
// Setup a HTTP/2 endpoint without TLS.
|
||||
options.ListenLocalhost(5000, o => o.Protocols =
|
||||
options.ListenLocalhost(5002, o => o.Protocols =
|
||||
HttpProtocols.Http2);
|
||||
});
|
||||
}
|
||||
|
||||
var levelSwitch = new LoggingLevelSwitch();
|
||||
var logger = new LoggerConfiguration()
|
||||
//.WriteTo.Console()
|
||||
.WriteTo.Console()
|
||||
//.WriteTo.MSSqlServer(builder.Configuration.GetConnectionString("LogConnection"),
|
||||
// sinkOptions: new MSSqlServerSinkOptions
|
||||
// {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
},
|
||||
"GrpcChannelOptions": {
|
||||
"CMSMSAddress": "https://cms.kbs1.ir",
|
||||
"CMSMSAddress": "http://cms-svd",
|
||||
"PYMSMSAddress": "https://ipg.afrino.co"
|
||||
},
|
||||
"Authentication": {
|
||||
|
||||
@@ -94,6 +94,18 @@ message GetUserOrderResponse
|
||||
}
|
||||
google.protobuf.StringValue user_address_text = 10;
|
||||
repeated GetUserOrderResponseFactorDetail factor_details = 11;
|
||||
// VAT information
|
||||
OrderVATInfo vat_info = 12;
|
||||
}
|
||||
|
||||
// اطلاعات مالیات بر ارزش افزوده
|
||||
message OrderVATInfo
|
||||
{
|
||||
double vat_rate = 1; // نرخ مالیات (مثلاً 0.09)
|
||||
int64 base_amount = 2; // مبلغ پایه (قبل از مالیات)
|
||||
int64 vat_amount = 3; // مبلغ مالیات
|
||||
int64 total_amount = 4; // مبلغ کل (پایه + مالیات)
|
||||
bool is_paid = 5; // آیا پرداخت شده
|
||||
}
|
||||
enum PaymentStatus
|
||||
{
|
||||
@@ -173,6 +185,8 @@ message SubmitShopBuyOrderRequest
|
||||
message SubmitShopBuyOrderResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
// VAT information for checkout confirmation
|
||||
OrderVATInfo vat_info = 2;
|
||||
}
|
||||
|
||||
message PaginationState
|
||||
|
||||
Reference in New Issue
Block a user