add list create for payment instrument
This commit is contained in:
@@ -16,6 +16,7 @@ public interface IPaymentInstrumentApplication
|
|||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<OperationResult> CreateBankAccount(CreateBankPaymentInstrument command);
|
Task<OperationResult> CreateBankAccount(CreateBankPaymentInstrument command);
|
||||||
|
Task<OperationResult> CreateBankAccount(List<CreateBankPaymentInstrument> commands);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ایجاد اطلاعات دستگاه پوز
|
/// ایجاد اطلاعات دستگاه پوز
|
||||||
@@ -23,6 +24,7 @@ public interface IPaymentInstrumentApplication
|
|||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<OperationResult> CreatePos(CreatePosPaymentInstrument command);
|
Task<OperationResult> CreatePos(CreatePosPaymentInstrument command);
|
||||||
|
Task<OperationResult> CreatePos(List<CreatePosPaymentInstrument> commands);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// گرفتن لیست
|
/// گرفتن لیست
|
||||||
|
|||||||
@@ -51,6 +51,41 @@ public class PaymentInstrumentApplication:IPaymentInstrumentApplication
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> CreateBankAccount(List<CreateBankPaymentInstrument> 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<OperationResult> CreatePos(CreatePosPaymentInstrument command)
|
public async Task<OperationResult> CreatePos(CreatePosPaymentInstrument command)
|
||||||
{
|
{
|
||||||
var op = new OperationResult();
|
var op = new OperationResult();
|
||||||
@@ -65,6 +100,24 @@ public class PaymentInstrumentApplication:IPaymentInstrumentApplication
|
|||||||
return op.Succcedded();
|
return op.Succcedded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<OperationResult> CreatePos(List<CreatePosPaymentInstrument> 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<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel)
|
public async Task<GetPaymentInstrumentListViewModel> GetList(PaymentInstrumentSearchModel searchModel)
|
||||||
{
|
{
|
||||||
return await _paymentInstrumentRepository.GetList(searchModel);
|
return await _paymentInstrumentRepository.GetList(searchModel);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class PaymentInstrumentController:AdminBaseController
|
|||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("bankAccount")]
|
[HttpPost("bankAccount")]
|
||||||
public async Task<ActionResult<OperationResult>> CreateBankAccount([FromBody] CreateBankPaymentInstrument command)
|
public async Task<ActionResult<OperationResult>> CreateBankAccount([FromBody] List<CreateBankPaymentInstrument> command)
|
||||||
{
|
{
|
||||||
var result = await _paymentInstrumentApplication.CreateBankAccount(command);
|
var result = await _paymentInstrumentApplication.CreateBankAccount(command);
|
||||||
return result;
|
return result;
|
||||||
@@ -230,20 +230,17 @@ public class PaymentInstrumentController:AdminBaseController
|
|||||||
[HttpPost("bank-account-inquiry")]
|
[HttpPost("bank-account-inquiry")]
|
||||||
public async Task<ActionResult<OperationResult<BankInquiryResponse>>> GetBankInquiry(BankInquiryRequest command)
|
public async Task<ActionResult<OperationResult<BankInquiryResponse>>> 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<BankInquiryResponse>()
|
return new OperationResult<BankInquiryResponse>().Succcedded(new BankInquiryResponse()
|
||||||
{
|
{
|
||||||
Data = new BankInquiryResponse()
|
AccountNumber = "1111111",
|
||||||
{
|
IBan = "111111111111111111111111",
|
||||||
AccountNumber = "1111111",
|
BankNumber = "1111111111111111",
|
||||||
IBan = "111111111111111111111111",
|
AccountHolderName = "تست تستی",
|
||||||
BankNumber = "1111111111111111",
|
BankName = "تست بانک",
|
||||||
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")))
|
||||||
}
|
|
||||||
};
|
|
||||||
}else if (command.AccountNumber.StartsWith("2222222") || command.BankNumber.StartsWith("2222222") || command.IBan.StartsWith("2222222"))
|
|
||||||
{
|
{
|
||||||
return new OperationResult<BankInquiryResponse>().Failed("دیتای وارد شده نامعتبر است");
|
return new OperationResult<BankInquiryResponse>().Failed("دیتای وارد شده نامعتبر است");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user