Commit Graph

291 Commits

Author SHA1 Message Date
masoodafar-web bdd2c51726 fix: Update project version to 0.0.181 and adjust NuGet package path
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-02-21 20:37:14 +03:30
masoodafar-web 2a569a024f feat: Implement Magic Wallet functionality
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m36s
- Added ClubMembershipCycle entity and DbSet to IApplicationDbContext.
- Updated VAT rate from 9% to 10% in VatCalculator and related areas.
- Introduced Magic Wallet settings in SystemConstants.
- Enhanced UserWallet entity to support Magic Wallet features.
- Updated TransactionType enum to include Magic Wallet transactions.
- Configured UserWallet to handle Magic Wallet properties in ApplicationDbContext.
- Implemented OrmCommissionCalculationStrategy to exclude Magic Wallet users from commission calculations.
- Added Protobuf definitions for Magic Wallet methods and responses.
- Created PaymentCallbackController endpoint for handling Magic Wallet charge callbacks.
- Updated UserOrderService to manage Magic Wallet state transitions.
- Developed UserWalletService to support Magic Wallet operations.
- Created ChargeMagicWalletCommand and its handler for initiating Magic Wallet charges.
- Implemented VerifyMagicWalletChargeCommand and handler for payment verification.
- Added validation for ChargeMagicWalletCommand.
- Established ClubMembershipCycle configuration for EF Core.
- Introduced WalletMode enum to differentiate between Normal and Magic modes.
2026-02-21 19:50:28 +03:30
masoodafar-web 04e8c49fa7 fix: IPG DiscountBalance should be 2× BasePackageAmount (112M not 56M)
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m44s
Both VerifyBasePackagePayment and VerifyPackagePurchase handlers were
charging DiscountBalance with 1× amount instead of 2×.
Now consistent with DayaLoan and ManualPayment handlers.

- VerifyBasePackagePaymentCommandHandler: DiscountBalance += BasePackageAmount * 2
- VerifyPackagePurchaseCommandHandler: DiscountBalance += order.Amount * 2
- Change logs updated to reflect correct 2× discount value
2026-02-18 23:12:03 +03:30
masoodafar-web f968a6c005 docs: move README to totalDoc, replace with placeholder
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m50s
2026-02-18 21:44:46 +03:30
masoodafar-web bc710fdb7b feat: auto-create inventory records for new products + migration worker
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m52s
- CreateNewProductsCommandHandler: inject IInventoryService, auto-init
  inventory record with qty=0 when a new regular product is created
  (DiscountProduct handler already had this)
- InventoryInitializerService: one-time BackgroundService that runs on
  startup, finds existing products without InventoryItem records, and
  creates them (migration for legacy products)
- Register InventoryInitializerService in DI
2026-02-18 00:42:41 +03:30
masoodafar-web fd24dcebcd feat: Add SitePageSettings - simplified page management system
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m2s
- New entities: SitePageSettings + SitePageImage (4 fixed pages)
- EF Migration: AddSitePageSettings (SitePageSettings + SitePageImages tables)
- Proto: sitepagesettings.proto with 5 RPCs
- CQRS: GetPageSettings, GetAllPageSettings, SavePageSettings, SavePageImage, DeletePageImage
- gRPC Service: SitePageSettingsService (auto-registered)
- Proto NuGet bumped to 0.0.180
2026-02-17 22:34:29 +03:30
masoodafar-web 89e146bf32 fix: set Kestrel protocol to Http1AndHttp2 in appsettings — prevents 502
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m38s
2026-02-17 02:55:50 +03:30
masoodafar-web 27d995faf4 fix: production deployment — appsettings.Production.json + fix K8S_SERVER + set image
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m48s
- appsettings.Production.json: CmsBaseUrl=cms.kbs1.ir, FrontOfficeBaseUrl=kbs1.ir, DB=KBS
- prod-deploy.yml: K8S_SERVER 194.5.195.53 → 45.149.79.127
- prod-deploy.yml: kubectl set image instead of rollout restart
2026-02-17 01:58:07 +03:30
masoodafar-web ef1716e243 fix: proper DeliveryStatus mapping + cancel delivery on failed payment
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m22s
- Added MapDeliveryStatus() to correctly map Domain→Proto enum values
- Domain Pending(1) was incorrectly cast to Proto PROCESSING(1) instead of PROCESSING
- Set DeliveryStatus=Cancelled when payment fails (CompleteOrderPaymentCommandHandler)
- Set DeliveryStatus=Cancelled when order expires (ExpirePendingOrdersService)
2026-02-17 00:41:48 +03:30
masoodafar-web c2ccd32f39 fix: use DateTime.Now instead of UtcNow in ExpirePendingOrdersService
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m33s
Database stores Created timestamps using DateTime.Now (local time).
Background service was comparing with DateTime.UtcNow causing 3.5 hour offset (Iran timezone).
Orders would only expire after ~4 hours instead of 30 minutes.
2026-02-16 22:52:33 +03:30
masoodafar-web c435319025 feat: add PaymentStatus to discount order proto + expire pending orders background service
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m53s
- Added payment_status field to GetOrderByIdResponse and OrderSummaryDto in proto
- Proto version bumped to 0.0.179
- Added PaymentStatus mapping in DiscountOrderService gRPC responses
- Created ExpirePendingOrdersService: expires pending orders after 30 min, releases inventory
- Registered background service in ConfigureServices
2026-02-16 22:37:58 +03:30
masoodafar-web 18a65de8c7 fix: force 100% discount in PlaceOrder — ignore client DiscountBalanceToUse, always use max
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m51s
2026-02-16 21:52:02 +03:30
masoodafar-web e2e09ac4e8 fix: add CmsBaseUrl/FrontOfficeBaseUrl to appsettings.json for staging callback URLs
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m43s
- Added CmsBaseUrl=https://cms.se.kbs1.ir to appsettings.json
- Added FrontOfficeBaseUrl=https://foursat.se.kbs1.ir to appsettings.json
- Fixed PurchasePackageCommandHandler hardcoded yourdomain.com
- Development keeps localhost values via appsettings.Development.json
2026-02-16 02:31:27 +03:30
masoodafar-web 61a0d68b7c feat: add staging configuration file for environment-specific settings
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-02-16 02:24:22 +03:30
masoodafar-web 1c4beb5f05 chore: bump Protobuf NuGet package version to 0.0.178
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m45s
2026-02-16 01:39:49 +03:30
masoodafar-web 163a0a2f1a fix: discount store DeliveryStatus stays Pending after payment (matches regular store)
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m34s
- CompleteOrderPaymentCommandHandler: DeliveryStatus.InTransit → DeliveryStatus.Pending
- PlaceOrderCommandHandler (full discount-balance path): same fix
- Now both stores behave the same: admin must manually update delivery status
- Consistent with regular store flow where order stays Pending after payment
2026-02-16 00:45:55 +03:30
masoodafar-web e77611012b fix: PaymentStatus→PaymentCompleted mapping in DiscountOrderService
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m25s
- GetOrderById and GetUserOrders were using Mapster auto-mapping which
  could not map 'PaymentStatus' (enum: Success=0) to 'payment_completed' (bool)
- Replaced with manual mapping: PaymentStatus == Success → true
- Also maps DeliveryStatus and all other fields correctly
- Fixed FrontOfficeBaseUrl and CmsBaseUrl to use HTTP for local dev
2026-02-16 00:36:29 +03:30
masoodafar-web a39a36e66d feat: add PaymentTransaction table for gateway-level tracking
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m6s
- New PaymentTransaction entity (Domain/Entities/Payment/) with all gateway fields:
  GatewayProvider, MerchantId, Authority, CardPan, CardHash, RefId, VerificationStatusCode, etc.
- New PaymentTransactionConfiguration with indexes on Authority, GatewayProvider, UserId, TransactionId, RefId
- Added DbSet<PaymentTransaction> to IApplicationDbContext and ApplicationDbContext
- Extended PaymentVerificationResult DTO with CardPan, CardHash, VerificationCode
- Updated ZarinPalPaymentService.VerifyPayment to return CardPan/CardHash/VerificationCode
- Updated all 5 payment consumers to create/update PaymentTransaction:
  * PlaceOrderCommandHandler — creates PaymentTransaction after InitiatePayment
  * PaymentCallbackController — updates PaymentTransaction after VerifyPayment
  * ChargeDiscountWalletCommandHandler — creates PaymentTransaction + fixed callback URL
  * VerifyDiscountWalletChargeCommandHandler — updates PaymentTransaction after verify
  * TransactionsService.CustomerPaymentRequest/Verification — create/update PaymentTransaction
  * PackageService.CustomerPurchasePackage/Verify — create/update PaymentTransaction
- Transaction table untouched — PaymentTransaction is a separate table
- Pattern inspired by PYMS: create row before gateway → update after verify
- EF migration: AddPaymentTransactionTable
2026-02-15 23:53:28 +03:30
masoodafar-web 207f53ef80 refactor: remove PYMS microservice, use ZarinPal directly in CMS
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m26s
- Remove PYMSPaymentService.cs and PYMS proto files
- Remove 'pyms' case from DI ConfigureServices
- Remove PYMS config from appsettings
- Switch PaymentProvider to 'zarinpal' (direct integration)
- ZarinPalPaymentService handles sandbox/production, verify, errors
- PYMS deployment/service/ingress removed from K8s
2026-02-15 23:25:20 +03:30
masoodafar-web 2502cbbda2 feat: integrate PYMS payment gateway, add blog/sitepage/image services, local file manager
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m44s
Payment Gateway:
- Add PYMSPaymentService: IPaymentGatewayService via gRPC to PYMS microservice
- Add ZarinPalPaymentService: direct ZarinPal integration (backup)
- Register 'pyms' payment provider in DI ConfigureServices
- Add PYMS proto files (pyms_transaction.proto, pyms_public_messages.proto)
- Fix VerifyDiscountWalletCharge: pass 'OK' as status instead of Authority
- Update appsettings: PaymentProvider=pyms, sandbox mode, merchant ID

Blog System:
- Add BlogCategory, BlogPost, BlogPostImage entities and CQRS
- Add proto files and gRPC services for blog management
- Add Mapster profiles for blog responses

Content Management:
- Add SitePage entity and CQRS for static pages
- Add proto and gRPC service for site pages

Image/File Management:
- Add LocalFileManager with disk storage + base64 serving + FMS fallback
- Add ImagePathResolverInterceptor for gRPC responses
- Add ImageResolverService for explicit image resolution
- Add UploadsController for public file serving with FMS fallback
- Add PaymentCallbackController for discount order payment callbacks

Database:
- Add blog and content entity migrations
- Remove ImagePath MaxLength constraints
- Remove old FileManagementService (replaced by LocalFileManager)
2026-02-15 23:01:16 +03:30
masoodafar-web d1ca72300d refactor: Remove ICurrentUserService dependency from query handlers and update user ID handling logic
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 8s
2026-02-10 23:01:49 +03:30
masoodafar-web b42d9e141d feat: Implement file management and authorization features
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 3m9s
- Add RequiresPermissionAttribute for gRPC method access control.
- Create IFileManagementService interface for file upload and management.
- Implement AddProductImageCommand and handler for adding product images.
- Implement CreateNewProductsCommand and handler for creating new products with image uploads.
- Implement DeleteProductsCommand and handler for deleting products and their associations.
- Implement RemoveProductImageCommand and handler for removing product images from galleries.
- Implement UpdateProductsCommand and handler for updating product details and images.
- Create GetProductGalleryQuery and handler for retrieving product galleries.
- Implement PermissionService for role-based access control using JWT claims.
- Implement FileManagementService for handling file uploads and image optimization.
- Define gRPC service and messages for file management in fms.proto.
- Add FluentValidation for request validation in various commands.
- Create PermissionInterceptor for enforcing permissions on gRPC methods.
2026-02-10 22:04:54 +03:30
masoodafar-web f64b6be7da feat: Implement GetMyWeeklyBalances query and handler, enhance ClubMembership service with JWT userId handling 2026-02-08 00:24:59 +03:30
masoodafar-web 9185aa227d feat: Add discount balance and change value to wallet change log
- Added CurrentDiscountBalance and ChangeDiscountValue properties to GetCustomerWalletChangeLogResponseDto.
- Updated userwallet.proto to include current_discount_balance and change_discount_value fields.
- Enhanced CommissionProfile mapping to support GetMyCommissionPayouts requests and responses.
- Implemented GetMyCommissionPayouts query and handler to retrieve user commission payouts.
- Added validation for GetMyCommissionPayouts query.
- Updated UserOrderService to handle user orders, including VAT calculations and wallet transactions.
- Enhanced UserWalletService to include new properties in wallet change log responses.
2026-02-07 22:03:49 +03:30
masoodafar-web b2d676b555 feat: Implement customer profile and referral queries
- Add GetCustomerProfileResponseDto for retrieving customer profile information.
- Create GetCustomerReferralsQuery and GetCustomerReferralsQueryHandler to fetch customer referrals with pagination and filtering options.
- Introduce GetCustomerReferralsResponseDto to structure the response for customer referrals.
- Implement GetCustomerSettingsQuery and GetCustomerSettingsQueryHandler to retrieve user settings.
- Add GetCustomerOrder and GetCustomerOrderQueryHandler for fetching specific customer orders.
- Create GetCustomerOrderHistoryQuery and GetCustomerOrderHistoryQueryHandler to retrieve order history with filtering options.
- Implement GetCustomerOrdersQuery and GetCustomerOrdersQueryHandler for fetching multiple customer orders with filters.
- Add GetCustomerWalletChangeLogQuery and GetCustomerWalletChangeLogQueryHandler for retrieving wallet change logs.
- Implement GetCustomerWithdrawalSettingsQuery and GetCustomerWithdrawalSettingsQueryHandler for fetching withdrawal settings.
- Create GetCustomerWithdrawalsQuery and GetCustomerWithdrawalsQueryHandler to retrieve customer withdrawal requests.
2026-02-05 23:01:50 +03:30
masoodafar-web b41342dcad feat: implement JWT token generation in VerifyOtpTokenCommandHandler and update related configurations 2026-02-03 00:02:04 +03:30
masoodafar-web c3eeb16856 refactor: rename response properties in PackageService for consistency 2026-02-01 22:25:25 +03:30
masoodafar-web 794dd01ac0 feat: update Protobuf definitions and add customer-facing APIs for various services 2026-02-01 22:16:36 +03:30
masoodafar-web 658d076bdf Complete FrontOffice BFF to CMS Migration
- Migrated all 9 services from FrontOffice.BFF to CMS architecture
- Enhanced user.proto with 7 additional Customer API endpoints:
  * UpdateCustomerProfile, GetCustomerProfile
  * ChangeCustomerPassword with validation
  * GetCustomerReferrals with commission stats
  * UploadCustomerAvatar with file validation
  * GetCustomerSettings, UpdateCustomerSettings
- All services now support Customer endpoints with /Customer/ prefix
- Mock implementations with realistic Persian data
- Fixed namespace conflicts and compilation issues
- Comprehensive testing completed for all endpoints
- Services migrated: Categories, City, UserCarts, Products, UserWallet,
  Transaction, UserOrder, Package, User (enhanced)
2026-01-30 08:53:09 +03:30
masoodafar-web 20280cf07f fix: proper restore and disable auto-push in CI
Build and Deploy to Kubernetes / publish-packages (push) Successful in 1m33s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 1m7s
- Add restore step before build
- Add CI=true env to disable PushToFoursatNuget target
- Add --allow-insecure-connections to csproj push command
- Add Condition to skip push target in CI
2026-01-29 04:59:48 +03:30
masoodafar-web 4968878773 Revert: use only Nexus (no fallback)
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 3m29s
2026-01-29 03:44:38 +03:30
masoodafar-web 8ffb53996b Add nuget.org as fallback source
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-01-29 03:41:15 +03:30
masoodafar-web 1a01fd9057 Remove afrino NuGet sources - use only Nexus
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 4m24s
2026-01-29 03:14:38 +03:30
masoodafar-web 52af1bfaad chore: تنظیم Nexus برای NuGet و Docker offline
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 11m13s
- Dockerfile: استفاده از Nexus Docker (194.5.195.53:32082)
- NuGet.config: استفاده از Nexus NuGet با HTTP و allowInsecureConnections
- workflow: حذف kubectl dependency، اضافه کردن 32082 به insecure-registries
- csproj: تغییر push آدرس به Nexus foursat-nuget-hosted
2026-01-29 02:56:14 +03:30
masoodafar-web 2fd5300c1e fix: Add allowInsecureConnections attribute to Nexus package source in NuGet.config
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-01-29 02:48:03 +03:30
masoodafar-web c76af47a4c fix: Update Nexus package source URL in NuGet.config
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 45s
2026-01-29 02:46:43 +03:30
masoodafar-web 77be841221 fix: Add NuGet.config for package source configuration and update restore command in Dockerfile
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 1m5s
2026-01-29 02:44:55 +03:30
masoodafar-web 1c130b14e1 fix: Update Dockerfile to use .NET 9.0 images from internal registry
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 11s
2026-01-29 02:15:45 +03:30
masoodafar-web 793d81f1dd fix: Remove NotEmpty validation for ShortInfomation and FullInformation in discount product validators
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
2026-01-05 01:43:23 +03:30
masoodafar-web f6704eaa99 fix: Implement product lookup in RecordLoss method to accurately reduce inventory on loss
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m50s
2026-01-05 00:58:52 +03:30
masoodafar-web d03fbe0a98 fix: Remove RemainingCount property from CreateDiscountProduct and related commands, initializing inventory with zero
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m56s
2026-01-04 23:51:35 +03:30
masoodafar-web f9c90bb871 fix: Synchronize RemainingCount for Regular and Discount products in inventory commands
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m40s
2026-01-04 23:29:02 +03:30
masoodafar-web 70c4b15a23 fix: Refactor AdjustStock method to streamline inventory updates and improve response structure
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 2m18s
2026-01-04 22:58:25 +03:30
masoodafar-web 5e662b5984 fix: Implement product lookup for AddStock and AdjustStock methods in InventoryService
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-01-04 22:38:46 +03:30
masoodafar-web 16ba2fa6fb fix: Update sorting and calculation of available quantity in GetLowStockItems query
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m46s
2026-01-04 22:22:42 +03:30
masoodafar-web 389568af2b fix: Reset wallet balance and discount balance to zero in DayaLoan processing
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 2m7s
2026-01-04 21:46:37 +03:30
masoodafar-web 631646776e u
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2026-01-03 18:41:39 +03:30
masoodafar-web ca9b02a902 chore: update Protobuf project version to 0.0.169
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m4s
2026-01-03 15:38:33 +03:30
masoodafar-web dde4c68b2f feat: Implement inventory and warehouse management features
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m33s
- Add GetLowStockItemsResponseDto and LowStockItemDto for low stock item queries.
- Create CreateStockMovementCommand and its handler for managing stock movements.
- Implement CreateStockMovementCommandValidator for validating stock movement commands.
- Add GetStockMovementsQuery and its handler to retrieve stock movement records.
- Create GetStockMovementsResponseDto and StockMovementListDto for stock movement responses.
- Implement GetStockMovementsByInventoryItemQuery and its handler for fetching movements by inventory item.
- Add CreateWarehouseCommand and its handler for creating new warehouses.
- Implement CreateWarehouseCommandValidator for warehouse creation validation.
- Add DeleteWarehouseCommand and its handler for removing warehouses.
- Implement SetDefaultWarehouseCommand and its handler for setting a default warehouse.
- Create UpdateWarehouseCommand and its handler for updating warehouse details.
- Implement GetAllWarehousesQuery and its handler to retrieve all warehouses.
- Add GetWarehouseQuery and its handler for fetching a specific warehouse by ID.
- Implement SearchWarehousesQuery and its handler for searching warehouses based on criteria.
2026-01-03 11:59:08 +03:30
masoodafar-web 8c3d710253 feat(mappings): expand InventoryProfile with comprehensive CQRS mappings for warehouses and inventory items
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 1m37s
2026-01-03 10:05:47 +03:30