public BankAccountDonateViewModel DisableDonateFunction(int bankAccountId) { var bankAccount = _unitOfWork.BankAccountRepository.Get(bankAccountId); if (bankAccount != null) { bankAccount.MerchantId = null; bankAccount.MerchantPassword = null; bankAccount.IsDonationEnabled = false; _unitOfWork.BankAccountRepository.Update(bankAccount); _unitOfWork.SaveChanges(); var result = new BankAccountDonateViewModel { BankAccountId = bankAccountId, MerchantId = null, MerchantPassword = null }; return(result); } else { return(null); } }
public IActionResult ConnectExtracts([FromBody] BankAccountDonateViewModel item) { try { return(Ok(_orgAccountService.ConnectExtractsFunction(item))); } catch (BusinessLogicException ex) { return(BadRequest(ex.Message)); } }
public BankAccountDonateViewModel ExtractCredentials(int orgAccountId) { var bankAccount = _unitOfWork.OrganizationAccountRepository.GetOrgAccountById(orgAccountId)?.BankAccount; if (bankAccount == null) { throw new BusinessLogicException(ErrorMessages.CantGetInfoForAccount); } var result = new BankAccountDonateViewModel() { BankAccountId = bankAccount.Id, MerchantId = bankAccount.ExtractMerchantId.Value, MerchantPassword = bankAccount.ExtractMerchantPassword }; return(result); }
public BankAccountDonateViewModel ConnectExtractsFunction(BankAccountDonateViewModel info) { var bankAccount = _unitOfWork.BankAccountRepository.Get(info.BankAccountId); if (bankAccount != null) { bankAccount.ExtractMerchantId = (int)info.MerchantId; bankAccount.ExtractMerchantPassword = info.MerchantPassword; bankAccount.IsExtractEnabled = true; _unitOfWork.BankAccountRepository.Update(bankAccount); _unitOfWork.SaveChanges(); return(info); } else { throw new BusinessLogicException(ErrorMessages.BadRequestMessage); } }
public BankAccountDonateViewModel GetDonateCredentials(int orgAccountId) { var orgAccount = _unitOfWork.OrganizationAccountRepository.GetOrgAccountById(orgAccountId); try { var result = new BankAccountDonateViewModel() { BankAccountId = orgAccount.BankAccount.Id, MerchantId = (int)orgAccount.BankAccount.MerchantId, MerchantPassword = orgAccount.BankAccount.MerchantPassword }; return(result); } catch (Exception ex) { throw new BusinessLogicException(ErrorMessages.CantGetInfoForAccount, ex); } }
public BankAccountDonateViewModel ConnectDonateFunction(BankAccountDonateViewModel info) { var bankAccount = _unitOfWork.BankAccountRepository.Get(info.BankAccountId); if (bankAccount != null) { bankAccount.MerchantId = (int)info.MerchantId; bankAccount.MerchantPassword = info.MerchantPassword; bankAccount.IsDonationEnabled = true; _unitOfWork.BankAccountRepository.Update(bankAccount); _unitOfWork.SaveChanges(); return(info); } else { return(info); } }
public BankAccountDonateViewModel GetDonateCredentials(int orgAccountId) { var orgAccount = _unitOfWork.OrganizationAccountRepository.GetOrgAccountById(orgAccountId); try { var result = new BankAccountDonateViewModel() { BankAccountId = orgAccount.BankAccount.Id, MerchantId = (int)orgAccount.BankAccount.MerchantId, MerchantPassword = orgAccount.BankAccount.MerchantPassword }; return(result); } catch (Exception ex) { string message = string.Format("Неможливо отримати інформацію для рахунку. Помилка: {0}", ex.Message); throw new BusinessLogicException(message, ex); } }
public BankAccountDonateViewModel ConnectDonation([FromBody] BankAccountDonateViewModel item) { return(_orgAccountService.ConnectDonateFunction(item)); }