62 lines
1.9 KiB
C#
62 lines
1.9 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 TransactionId { get; set; }
|
|
|
|
public bool IsSuccess => Status == "success";
|
|
}
|
|
|
|
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 class VerifyPaymentGateWayRequest
|
|
{
|
|
public string TransactionId { get; set; }
|
|
public double Amount { get; set; }
|
|
} |