diff --git a/CompanyManagment.App.Contracts/PaymentInstrument/IPaymentInstrumentApplication.cs b/CompanyManagment.App.Contracts/PaymentInstrument/IPaymentInstrumentApplication.cs
index b82da2f6..65ec1098 100644
--- a/CompanyManagment.App.Contracts/PaymentInstrument/IPaymentInstrumentApplication.cs
+++ b/CompanyManagment.App.Contracts/PaymentInstrument/IPaymentInstrumentApplication.cs
@@ -16,6 +16,7 @@ public interface IPaymentInstrumentApplication
///
///
Task CreateBankAccount(CreateBankPaymentInstrument command);
+ Task CreateBankAccount(List commands);
///
/// ایجاد اطلاعات دستگاه پوز
@@ -23,6 +24,7 @@ public interface IPaymentInstrumentApplication
///
///
Task CreatePos(CreatePosPaymentInstrument command);
+ Task CreatePos(List commands);
///
/// گرفتن لیست
diff --git a/CompanyManagment.Application/PaymentInstrumentApplication.cs b/CompanyManagment.Application/PaymentInstrumentApplication.cs
index 41a15417..ff9e4daa 100644
--- a/CompanyManagment.Application/PaymentInstrumentApplication.cs
+++ b/CompanyManagment.Application/PaymentInstrumentApplication.cs
@@ -51,6 +51,41 @@ public class PaymentInstrumentApplication:IPaymentInstrumentApplication
}
+ public async Task CreateBankAccount(List commands)
+ {
+ var op = new OperationResult();
+ foreach (var command in commands)
+ {
+ if (command.IsAuth)
+ {
+ if (string.IsNullOrWhiteSpace(command.AccountNumber))
+ {
+ return op.Failed("شماره حساب نمیتواند خالی باشد");
+ }
+
+ if (string.IsNullOrWhiteSpace(command.IBan))
+ {
+ return op.Failed("شماره شبا نمیتواند خالی باشد");
+ }
+
+ if (string.IsNullOrWhiteSpace(command.CardNumber))
+ {
+ return op.Failed("شماره کارت نمیتواند خالی باشد");
+ }
+
+ if (string.IsNullOrWhiteSpace(command.AccountHolderName))
+ {
+ return op.Failed("نام صاحب حساب نمیتواند خالی باشد");
+ }
+ }
+ var entity = PaymentInstrument.CreateBankAccount(command.CardNumber, command.AccountHolderName, command.AccountNumber,
+ command.IBan, command.IsAuth,command.PaymentInstrumentGroupId);
+ await _paymentInstrumentRepository.CreateAsync(entity);
+ }
+ await _paymentInstrumentRepository.SaveChangesAsync();
+ return op.Succcedded();
+ }
+
public async Task CreatePos(CreatePosPaymentInstrument command)
{
var op = new OperationResult();
@@ -65,6 +100,24 @@ public class PaymentInstrumentApplication:IPaymentInstrumentApplication
return op.Succcedded();
}
+ public async Task CreatePos(List commands)
+ {
+ var op = new OperationResult();
+ foreach (var command in commands)
+ {
+ if (string.IsNullOrWhiteSpace(command.PosTerminalId))
+ {
+ return op.Failed("شناسه دستگاه یوزر نمیتواند خالی باشد");
+ }
+
+ var entity = PaymentInstrument.CreatePosType(command.PosTerminalId, command.Description,command.PaymentInstrumentGroupId);
+ await _paymentInstrumentRepository.CreateAsync(entity);
+ }
+
+ await _paymentInstrumentRepository.SaveChangesAsync();
+ return op.Succcedded();
+ }
+
public async Task GetList(PaymentInstrumentSearchModel searchModel)
{
return await _paymentInstrumentRepository.GetList(searchModel);
diff --git a/ServiceHost/Areas/Admin/Controllers/PaymentInstrumentController.cs b/ServiceHost/Areas/Admin/Controllers/PaymentInstrumentController.cs
index fcba0a4a..56845739 100644
--- a/ServiceHost/Areas/Admin/Controllers/PaymentInstrumentController.cs
+++ b/ServiceHost/Areas/Admin/Controllers/PaymentInstrumentController.cs
@@ -34,7 +34,7 @@ public class PaymentInstrumentController:AdminBaseController
///
///
[HttpPost("bankAccount")]
- public async Task> CreateBankAccount([FromBody] CreateBankPaymentInstrument command)
+ public async Task> CreateBankAccount([FromBody] List command)
{
var result = await _paymentInstrumentApplication.CreateBankAccount(command);
return result;
@@ -230,20 +230,17 @@ public class PaymentInstrumentController:AdminBaseController
[HttpPost("bank-account-inquiry")]
public async Task>> GetBankInquiry(BankInquiryRequest command)
{
- if ((!string.IsNullOrWhiteSpace(command.AccountNumber) && command.AccountNumber.StartsWith("111111")) || (!string.IsNullOrWhiteSpace(command.AccountNumber)&&command.BankNumber.StartsWith("111111")) || (!string.IsNullOrWhiteSpace(command.AccountNumber)&&command.IBan.StartsWith("1111111")))
+ if ((!string.IsNullOrWhiteSpace(command.AccountNumber) && command.AccountNumber.StartsWith("111111")) || (!string.IsNullOrWhiteSpace(command.BankNumber)&&command.BankNumber.StartsWith("111111")) || (!string.IsNullOrWhiteSpace(command.IBan)&&command.IBan.StartsWith("1111111")))
{
- return new OperationResult()
+ return new OperationResult().Succcedded(new BankInquiryResponse()
{
- Data = new BankInquiryResponse()
- {
- AccountNumber = "1111111",
- IBan = "111111111111111111111111",
- BankNumber = "1111111111111111",
- AccountHolderName = "تست تستی",
- BankName = "تست بانک",
- }
- };
- }else if (command.AccountNumber.StartsWith("2222222") || command.BankNumber.StartsWith("2222222") || command.IBan.StartsWith("2222222"))
+ AccountNumber = "1111111",
+ IBan = "111111111111111111111111",
+ BankNumber = "1111111111111111",
+ AccountHolderName = "تست تستی",
+ BankName = "تست بانک",
+ });
+ }else if ((!string.IsNullOrWhiteSpace(command.AccountNumber) && command.AccountNumber.StartsWith("222222")) || (!string.IsNullOrWhiteSpace(command.AccountNumber)&&command.BankNumber.StartsWith("222222")) || (!string.IsNullOrWhiteSpace(command.AccountNumber)&&command.IBan.StartsWith("222222")))
{
return new OperationResult().Failed("دیتای وارد شده نامعتبر است");
}