set create payment transaction for sandbox creation
This commit is contained in:
@@ -30,7 +30,7 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
invoice_id = command.InvoiceId,
|
||||
mobile = command.Mobile,
|
||||
email = command.Email,
|
||||
description = command.Email,
|
||||
description = command.Description,
|
||||
});
|
||||
|
||||
var result = await response.Content.ReadFromJsonAsync<PaymentGatewayResponse>();
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace Company.Domain.PaymentTransactionAgg
|
||||
/// <param name="status">وضعیت تراکنش پرداخت</param>
|
||||
/// <param name="amount">مبلغ تراکنش</param>
|
||||
/// <param name="transactionId">شناسه یکتای تراکنش</param>
|
||||
public PaymentTransaction(
|
||||
long contractingPartyId,
|
||||
/// <param name="contractingPartyName"></param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
string bankAccountHolderName,
|
||||
string bankName,
|
||||
string cardNumber,
|
||||
@@ -30,7 +30,8 @@ namespace Company.Domain.PaymentTransactionAgg
|
||||
string accountNumber,
|
||||
PaymentTransactionStatus status,
|
||||
double amount,
|
||||
string transactionId)
|
||||
string transactionId,
|
||||
string contractingPartyName)
|
||||
{
|
||||
TransactionDate = DateTime.Now;
|
||||
ContractingPartyId = contractingPartyId;
|
||||
@@ -42,6 +43,7 @@ namespace Company.Domain.PaymentTransactionAgg
|
||||
Status = status;
|
||||
Amount = amount;
|
||||
TransactionId = transactionId;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -46,4 +46,9 @@ public class CreatePaymentTransaction
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
}
|
||||
@@ -34,7 +34,8 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
command.AccountNumber,
|
||||
command.Status,
|
||||
command.Amount,
|
||||
command.TransactionId);
|
||||
command.TransactionId,
|
||||
command.ContractingPartyName);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
|
||||
10018
CompanyManagment.EFCore/Migrations/20250709090803_init payment transaction.Designer.cs
generated
Normal file
10018
CompanyManagment.EFCore/Migrations/20250709090803_init payment transaction.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class initpaymenttransaction : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PaymentTransactions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TransactionDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ContractingPartyId = table.Column<long>(type: "bigint", nullable: false),
|
||||
ContractingPartyName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
||||
BankAccountHolderName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
||||
BankName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
CardNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
|
||||
ShebaNumber = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
|
||||
AccountNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
|
||||
Status = table.Column<string>(type: "nvarchar(35)", maxLength: 35, nullable: false),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
TransactionId = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PaymentTransactions", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PaymentTransactions");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4295,6 +4295,64 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("PaymentToEmployeeItems", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.PaymentTransactionAgg.PaymentTransaction", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("BankAccountHolderName")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<long>("ContractingPartyId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ContractingPartyName")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ShebaNumber")
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<DateTime>("TransactionDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("TransactionId")
|
||||
.HasMaxLength(60)
|
||||
.HasColumnType("nvarchar(60)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("PaymentTransactions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.PenaltyTitle.PenaltyTitle", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace CompanyManagment.EFCore.Repository;
|
||||
public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransaction>,IPaymentTransactionRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
public PaymentTransactionRepository(DbContext context, CompanyContext companyContext) : base(context)
|
||||
public PaymentTransactionRepository(CompanyContext companyContext) : base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,9 @@ using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace PersonalContractingParty.Config;
|
||||
|
||||
@@ -431,6 +433,9 @@ public class PersonalBootstrapper
|
||||
|
||||
services.AddTransient<IAdminMonthlyOverviewRepository, AdminMonthlyOverviewRepository>();
|
||||
services.AddTransient<IAdminMonthlyOverviewApplication, AdminMonthlyOverviewApplication>();
|
||||
|
||||
services.AddTransient<IPaymentTransactionRepository, PaymentTransactionRepository>();
|
||||
services.AddTransient<IPaymentTransactionApplication, PaymentTransactionApplication>();
|
||||
#endregion
|
||||
#region Pooya
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace ServiceHost.Pages.CallBack
|
||||
@@ -6,6 +8,13 @@ namespace ServiceHost.Pages.CallBack
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
|
||||
public IndexModel(IPaymentTransactionApplication paymentTransactionApplication)
|
||||
{
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
}
|
||||
|
||||
public void OnGet(string? transid, string? cardnumber, string? tracking_number, string status)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
||||
@@ -22,18 +31,33 @@ namespace ServiceHost.Pages.CallBack
|
||||
}
|
||||
public void OnPost(string? transid, string? cardnumber, string? tracking_number, string? status)
|
||||
{
|
||||
var command = new CreatePaymentTransaction()
|
||||
{
|
||||
CardNumber = cardnumber,
|
||||
Amount = 10000,
|
||||
BankAccountHolderName = "تست",
|
||||
ShebaNumber = "",
|
||||
TransactionId = transid,
|
||||
ContractingPartyId = 0,
|
||||
ContractingPartyName = "نام طرف حساب",
|
||||
AccountNumber = "",
|
||||
BankName = "سامان"
|
||||
|
||||
};
|
||||
if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
||||
{
|
||||
ViewData["message"] = "پرداخت ناموفق بوده است";
|
||||
return;
|
||||
command.Status = PaymentTransactionStatus.Failed;
|
||||
}
|
||||
else if (status == "1")
|
||||
{
|
||||
ViewData["message"] = "پرداخت موفق بوده است";
|
||||
return;
|
||||
command.Status = PaymentTransactionStatus.Success;
|
||||
|
||||
}
|
||||
|
||||
|
||||
_paymentTransactionApplication.Create(command);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user