static void Main(string[] args)
        {
            var repository = new DummyAccountRepository();

            var transferFunds = new TransferFunds(repository);

            transferFunds.Perform("101", new Money(Currency.USD, 100), "201");
        }
Esempio n. 2
0
        public decimal GetBalance(int accNum)
        {
            decimal       bal;
            TransferFunds tranF = new TransferFunds();

            tranF = tranF.GetCreditingAccountBalance(accNum);
            bal   = tranF.Balance;
            return(bal);
        }
Esempio n. 3
0
        public Transfer(int accountId)
        {
            InitializeComponent();

            txtId.Text    = accountId.ToString();
            transferFunds = transferFunds.GetAccountDetails(accountId);

            txtAccNum.Text    = transferFunds.AccountNumber.ToString();
            txtBal.Text       = transferFunds.Balance.ToString();
            txtOverdraft.Text = transferFunds.Overdraft.ToString();
        }
Esempio n. 4
0
 public Fund(Client client)
     : base(client)
 {
     _accountHolderBalance         = new AccountHolderBalance(this);
     _accountHolderTransactionList = new AccountHolderTransactionList(this);
     _transferFunds             = new TransferFunds(this);
     _refundFundsTransfer       = new RefundFundsTransfer(this);
     _setupBeneficiary          = new SetupBeneficiary(this);
     _refundNotPaidOutTransfers = new RefundNotPaidOutTransfers(this);
     _payoutAccountHolder       = new PayoutAccountHolder(this);
 }
Esempio n. 5
0
        public TransactionResponse Transfer(TransferFunds transfer)
        {
            var response = new TransactionResponse();

            try
            {
                lock (thisLock)
                {
                    using (var transaction = _database.GetTransaction(3))
                    {
                        var transferToAcct = _accountService.GetBy(transfer.TransferToAccountNumber);
                        var acct           = _accountService.Get(transfer.AccountId);

                        if (transferToAcct != null)
                        {
                            response = Withdraw(new Withdrawal {
                                AccountId = transfer.AccountId, Amount = transfer.Amount, LastTransactionDate = transfer.LastTransactionDate, TransactionType = TransactionTypes.Transfer,
                            }, $"Fund transfer to Account Name: {transferToAcct.AccountName} Account Number: {transfer.TransferToAccountNumber}");
                            if (response.IsSuccess)
                            {
                                response = Deposit(new Domain.Deposit {
                                    AccountId = transferToAcct.Id, Amount = transfer.Amount, LastTransactionDate = transfer.LastTransactionDate, TransactionType = TransactionTypes.Transfer
                                }, $"Fund transfer from Account Name: {acct.AccountName}");
                                if (response.IsSuccess)
                                {
                                    transaction.Complete();
                                }
                            }
                        }
                    }
                }
            }
            catch (TransactionException ex)
            {
                response.ErrorCode = ErrorCodes.ERR_CONCURRENT;
            }
            catch (Exception ex)
            {
                response.ErrorCode = ErrorCodes.ERR_UNKOWN;
            }

            return(response);
        }
Esempio n. 6
0
 public void Transfer([FromBody] TransferFunds transfer)
 {
     _moneyCommands.TransferFunds(transfer.UserId, transfer.TargetUserId, transfer.Amount);
 }
        private void TransferMoney_Click(object sender, RoutedEventArgs e)
        {
            TransferFunds transferFunds = new TransferFunds();

            NavigationService.Navigate(transferFunds);
        }
Esempio n. 8
0
 public TransactionResponse TransferFundsTransaction([FromBody] TransferFunds transferFunds)
 {
     return(_transactionService.Transfer(transferFunds));
 }
Esempio n. 9
0
        public async Task <Result <Data> > BuyData()
        {
            var dataPackage = _DataPackages.getDatapackage(this.PackageId);

            if (dataPackage != null)
            {
                string GlobalAccount = AppsettingsManager.GetConfig("GlobalAccount");
                // string Clientid = AppsettingsManager.GetConfig("AirtimeClientID");
                string Clientkey = AppsettingsManager.GetConfig("ClientKey");

                amount = dataPackage.amount;

                this.Narration = $"Data Recharge {this.ChannelId} {dataPackage.Biller.Name} {this.phoneNumber.Value}";

                var transferFunds = new TransferFunds(transferService, transferManager).Create(this, Narration, cif, GlobalAccount, DebitAccountNumber);

                var transferfundjson = new StringContent(JsonConvert.SerializeObject(transferFunds).ToString());

                await transferManager.InsertTransferTransaction(transferFunds);

                if (AirtimeDomainAppsettingManager.UseServiceBus())
                {
                    var serviceBusTransferRequest = transferFunds.MapTo <ClientIntrabankRequest>();
                    serviceBusTransferRequest.ClientKey = Clientkey;

                    var serviceBusCall = new ServiceBusManagement(AirtimeDomainAppsettingManager.GetAirtimeTransferQueueConnectionString()).PushToQueue(serviceBusTransferRequest, AirtimeDomainAppsettingManager.GetAirtimeQueueName());
                    ResponseStatus  = PaymentSharedKernels.Models.Enums.TransactionStatus.Processing.ToString();
                    ResponseMessage = AirtimeValidationMessages.ConstantMessages.TransactionProcessing;
                }
                else
                {
                    var transferResponse = transferFunds.ExecuteTransfer();


                    if (transferResponse == null)
                    {
                        ResponseStatus  = TransactionStatus.Failed.ToString();
                        ResponseMessage = AirtimeValidationMessages.ErrorMessages.TransferError;
                    }
                    else if (transferResponse.hasError == true)
                    {
                        ResponseStatus = TransactionStatus.Failed.ToString();

                        if (transferResponse?.errorMessage?.ToString() == null)
                        {
                            string response = "";
                            foreach (var err in transferResponse.errorMessages)
                            {
                                response += err;
                            }
                            ResponseMessage = response;
                        }
                        else
                        {
                            ResponseMessage = transferResponse.errorMessage.ToString();
                        }
                    }
                    else
                    {
                        if (transferResponse.result.Status == TransactionStatus.Success.ToString() || transferResponse.result.Status == PaymentSharedKernels.Models.Enums.TransactionStatus.Pending.ToString())
                        {
                            TransferReference = transferResponse?.result?.PlatformTransactionReference;
                            TransactionStan   = transferResponse?.result?.TransactionStan;
                            TransferNarration = transferResponse?.result?.Narration;

                            var AirtimeserviceResponse = SwitchDataVendors(airtimeServices);
                            this.vendorId = int.Parse(AirtimeserviceResponse.ProccedByVendorId);

                            if (AirtimeserviceResponse.ResponseStatus == TransactionStatus.Success.ToString())
                            {
                                ResponseStatus             = TransactionStatus.Success.ToString();
                                ResponseMessage            = AirtimeValidationMessages.ConstantMessages.DataTransactionSuccessful;
                                DataRequestStatus          = true;
                                transferFunds.IsSettlement = true;

                                var vendorDetails = this.Vendors.getSingleVendorAgent(int.Parse(AirtimeserviceResponse.ProccedByVendorId));

                                string SettlementNarration = $"Data Recharge {this.ChannelId} {this._DataPackages.Biller.Name} {this.phoneNumber.Value} {transferResponse.result.TransactionStan}";

                                TransferFunds.VendorSettlement(transferFunds, transferFunds.DateCreated.ToString(), vendorDetails.suspenseAccount, SettlementNarration);
                            }
                            else
                            {
                                ResponseStatus           = TransactionStatus.Failed.ToString();
                                ResponseMessage          = AirtimeserviceResponse?.ResponseMessage;
                                DataRequestStatus        = false;
                                transferFunds.IsReversal = true;
                                TransferFunds.InitiateTransferReversal(transferFunds.DateCreated.ToString(), transferResponse.result.TransactionStan, transferResponse.result.PlatformTransactionReference);
                            }
                        }
                        else
                        {
                            ResponseStatus    = transferResponse?.result?.Status?.ToString();
                            ResponseMessage   = transferResponse?.result?.Message?.ToString();
                            DataRequestStatus = false;
                        }
                    }
                }
            }
            else
            {
                ResponseStatus  = TransactionStatus.Failed.ToString();
                ResponseMessage = AirtimeValidationMessages.ErrorMessages.InvalidDataPackageId;
                vendorId        = 0;
            }

            return(Result.Ok(this));
        }