2502cbbda2
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)
213 lines
6.1 KiB
C#
213 lines
6.1 KiB
C#
namespace CMSMicroservice.Application.Common.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Interface برای یکپارچهسازی با درگاههای پرداخت
|
|
/// </summary>
|
|
public interface IPaymentGatewayService
|
|
{
|
|
/// <summary>
|
|
/// شروع تراکنش پرداخت (ارسال به درگاه)
|
|
/// </summary>
|
|
/// <param name="request">اطلاعات تراکنش</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns>URL درگاه برای هدایت کاربر + RefId تراکنش</returns>
|
|
Task<PaymentInitiateResult> InitiatePaymentAsync(
|
|
PaymentRequest request,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// تأیید پرداخت (بعد از بازگشت از درگاه)
|
|
/// </summary>
|
|
/// <param name="refId">شماره مرجع تراکنش</param>
|
|
/// <param name="verificationToken">توکن تأیید از درگاه</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns>وضعیت نهایی تراکنش</returns>
|
|
Task<PaymentVerificationResult> VerifyPaymentAsync(
|
|
string refId,
|
|
string verificationToken,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// تأیید پرداخت با مبلغ — برای درگاههایی مثل زرینپال که مبلغ را در Verify نیاز دارند
|
|
/// </summary>
|
|
/// <param name="refId">شماره مرجع تراکنش (Authority در زرینپال)</param>
|
|
/// <param name="verificationToken">توکن تأیید از درگاه (Status در زرینپال)</param>
|
|
/// <param name="amountInToman">مبلغ تراکنش به تومان</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns>وضعیت نهایی تراکنش</returns>
|
|
Task<PaymentVerificationResult> VerifyPaymentAsync(
|
|
string refId,
|
|
string verificationToken,
|
|
decimal amountInToman,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
// پیشفرض: درگاههایی که Amount نمیخواهند، از overload بدون amount استفاده کنند
|
|
return VerifyPaymentAsync(refId, verificationToken, cancellationToken);
|
|
}
|
|
|
|
/// <summary>
|
|
/// واریز مبلغ به حساب کاربر (برداشت از کیف پول)
|
|
/// </summary>
|
|
/// <param name="request">اطلاعات واریز</param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns>وضعیت واریز</returns>
|
|
Task<PayoutResult> ProcessPayoutAsync(
|
|
PayoutRequest request,
|
|
CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// درخواست شروع تراکنش پرداخت
|
|
/// </summary>
|
|
public class PaymentRequest
|
|
{
|
|
/// <summary>
|
|
/// مبلغ (تومان)
|
|
/// </summary>
|
|
public decimal Amount { get; set; }
|
|
|
|
/// <summary>
|
|
/// شناسه کاربر
|
|
/// </summary>
|
|
public long UserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// شماره موبایل
|
|
/// </summary>
|
|
public string Mobile { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// شرح تراکنش
|
|
/// </summary>
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// URL بازگشت بعد از پرداخت
|
|
/// </summary>
|
|
public string CallbackUrl { get; set; } = string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// نتیجه شروع تراکنش
|
|
/// </summary>
|
|
public class PaymentInitiateResult
|
|
{
|
|
/// <summary>
|
|
/// موفق بودن درخواست
|
|
/// </summary>
|
|
public bool IsSuccess { get; set; }
|
|
|
|
/// <summary>
|
|
/// شماره مرجع تراکنش (RefId)
|
|
/// </summary>
|
|
public string? RefId { get; set; }
|
|
|
|
/// <summary>
|
|
/// URL درگاه برای هدایت کاربر
|
|
/// </summary>
|
|
public string? GatewayUrl { get; set; }
|
|
|
|
/// <summary>
|
|
/// پیام خطا (در صورت ناموفق بودن)
|
|
/// </summary>
|
|
public string? ErrorMessage { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// نتیجه تأیید تراکنش
|
|
/// </summary>
|
|
public class PaymentVerificationResult
|
|
{
|
|
/// <summary>
|
|
/// موفق بودن تراکنش
|
|
/// </summary>
|
|
public bool IsSuccess { get; set; }
|
|
|
|
/// <summary>
|
|
/// شماره مرجع تراکنش
|
|
/// </summary>
|
|
public string RefId { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// کد پیگیری بانک
|
|
/// </summary>
|
|
public string? TrackingCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// مبلغ تراکنش
|
|
/// </summary>
|
|
public decimal Amount { get; set; }
|
|
|
|
/// <summary>
|
|
/// پیام
|
|
/// </summary>
|
|
public string? Message { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// درخواست واریز
|
|
/// </summary>
|
|
public class PayoutRequest
|
|
{
|
|
/// <summary>
|
|
/// مبلغ (تومان)
|
|
/// </summary>
|
|
public decimal Amount { get; set; }
|
|
|
|
/// <summary>
|
|
/// شناسه کاربر
|
|
/// </summary>
|
|
public long UserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// شماره شبا
|
|
/// </summary>
|
|
public string Iban { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// نام صاحب حساب
|
|
/// </summary>
|
|
public string AccountHolderName { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// شرح واریز
|
|
/// </summary>
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// شماره مرجع داخلی
|
|
/// </summary>
|
|
public string InternalRefId { get; set; } = string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// نتیجه واریز
|
|
/// </summary>
|
|
public class PayoutResult
|
|
{
|
|
/// <summary>
|
|
/// موفق بودن واریز
|
|
/// </summary>
|
|
public bool IsSuccess { get; set; }
|
|
|
|
/// <summary>
|
|
/// شماره مرجع تراکنش بانکی
|
|
/// </summary>
|
|
public string? BankRefId { get; set; }
|
|
|
|
/// <summary>
|
|
/// کد پیگیری
|
|
/// </summary>
|
|
public string? TrackingCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// پیام
|
|
/// </summary>
|
|
public string? Message { get; set; }
|
|
|
|
/// <summary>
|
|
/// زمان پردازش
|
|
/// </summary>
|
|
public DateTime ProcessedAt { get; set; }
|
|
}
|