Пример #1
0
        public async Task <ActionResult> MakeMobileCarrierPaymentAsync(MobileCarrierPaymentRequestModel model)
        {
            var pinHash = HttpContext.Request.Headers["Authorization"];
            await _authorizationService.AuthorizeForAtmActionsAsync(model.AccountNumber, pinHash);

            var cheque = await _paymentService.MakeMobileCarrierPaymentAsync(model);

            return(Ok(cheque));
        }
        public async Task <MobileCarrierPaymentChequeModel> MakeMobileCarrierPaymentAsync(MobileCarrierPaymentRequestModel model)
        {
            _mobileCarrierPaymentRequestValidator.ValidateAndThrow(model);

            // For simplicity the sum will go to bank development fund
            var bankDevelopmentFund = await _accountService.GetBankDevelopmentFundAccountForCurrencyAsync(model.CurrencyId);

            var paymentTransaction = await _accountService.TransferMoneyAsync(
                model.AccountNumber,
                bankDevelopmentFund.AccountNumber,
                model.Amount);

            var cheque = _mapper.Map <MobileCarrierPaymentChequeModel>(paymentTransaction);

            cheque.CarrierId   = model.CarrierId;
            cheque.PhoneNumber = model.PhoneNumber;

            // TODO: Create an audit entry for a payment

            return(cheque);
        }