public async Task <DoPaymentResponse> DoPaymentAsync(DoPaymentRequest request) { DoPaymentResponse response = new DoPaymentResponse(); using (var unitOfWork = unitOfWorkFactory.Create()) { unitOfWork.Begin(); BankBin bankBin = await bankDomainService.GetValidBankBinByCardNumberAsync(unitOfWork, request.CardNumber); BankProvider bankProvider = await bankDomainService.GetValidBankProviderByBankIdAsync(unitOfWork, bankBin.BankId); Provider provider = await providerDomainService.GetValidProviderByIdAsync(unitOfWork, bankProvider.ProviderId); PaymentProvider paymentProvider = providerDomainService.GetValidPaymentProviderByType(provider.ProviderType); PaymentRequest paymentRequest = classMapper.Map <DoPaymentRequest, PaymentRequest>(request); paymentRequest.SetConfiguration(bankProvider.Configuration); paymentProvider.DoPaymentAsync(paymentRequest); unitOfWork.Commit(); } return(response); }
public async Task <IEnumerable <ClassResponse> > GetClassesAsync() { var result = await _classRepository.GetAllAsync(); return(result.Select(x => _classMapper.Map(x))); }