Introduced the SepehrPaymentGateway to replace the previous payment gateway, AqayePardakht. Added `Rrn` and `DigitalReceipt` columns to the `PaymentTransactions` table for improved payment tracking and verification. Updated the Entity Framework model and mappings to reflect these changes. Refactored payment transaction logic to support the new gateway, including creating, verifying, and handling payments. Added new request/response models for Sepehr gateway integration. Enhanced error handling and financial statement creation upon successful payment verification. Removed legacy code and updated dependency injection for the Parbad library.
66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Server.HttpSys;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.Json.Serialization;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace _0_Framework.Application.PaymentGateway;
|
|
|
|
public interface IPaymentGateway
|
|
{
|
|
Task<PaymentGatewayResponse> Create(CreatePaymentGatewayRequest command, CancellationToken cancellationToken =default);
|
|
|
|
string GetStartPayUrl(string transactionId);
|
|
Task<PaymentGatewayResponse> Verify(VerifyPaymentGateWayRequest command, CancellationToken cancellationToken=default);
|
|
Task<PaymentGatewayResponse> CreateSandBox(CreatePaymentGatewayRequest command, CancellationToken cancellationToken=default);
|
|
string GetStartPaySandBoxUrl(string transactionId);
|
|
Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken);
|
|
|
|
}
|
|
public class PaymentGatewayResponse
|
|
{
|
|
[JsonPropertyName("status")]
|
|
public string Status { get; set; }
|
|
|
|
[JsonPropertyName("code")]
|
|
public int? ErrorCode { get; set; }
|
|
|
|
[JsonPropertyName("transid")]
|
|
public string Token { get; set; }
|
|
|
|
public bool IsSuccess { get; set; }
|
|
|
|
public string Message { get; set; }
|
|
}
|
|
|
|
public class WalletAmountResponse
|
|
{
|
|
[JsonPropertyName("status")]
|
|
public string Status { get; set; }
|
|
[JsonPropertyName("money")]
|
|
public double Amount { get; set; }
|
|
[JsonPropertyName("code")]
|
|
public int Code { get; set; }
|
|
}
|
|
|
|
public class CreatePaymentGatewayRequest
|
|
{
|
|
public double Amount { get; set; }
|
|
public string CallBackUrl { get; set; }
|
|
public string InvoiceId { get; set; }
|
|
public string CardNumber { get; set; }
|
|
public string Mobile { get; set; }
|
|
public string Email { get; set; }
|
|
public string Description { get; set; }
|
|
public IDictionary<string, object> ExtraData { get; set; }
|
|
}
|
|
|
|
public class VerifyPaymentGateWayRequest
|
|
{
|
|
public string DigitalReceipt { get; set; }
|
|
public string TransactionId { get; set; }
|
|
public double Amount { get; set; }
|
|
} |