Exemplo n.º 1
0
        public BankCreditResponse sendCreditRequest(BankCreditRequest request)
        {
            WBankCreditSender api = new WBankCreditSender();

            WBankCreditApprove wRequest = new WBankCreditApprove();

            wRequest.Credit = (float)request.Amount;
            wRequest.Name   = request.Customer;

            api.sendCreditForValidate(wRequest, this); //nos llama aquien una vez que termina la respuesta asincrona

            do
            {
                try
                {
                    Thread.Sleep(10000);
                    Console.WriteLine("Bank W waiting for response");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            } while (wResult == null);

            BankCreditResponse response = new BankCreditResponse();

            response.Approved = wResult.Approved.ToLower().Equals("y");
            return(response);
        }
Exemplo n.º 2
0
        public BankCreditResponse sendCreditRequest(BankCreditRequest request)
        {
            XBankCreditAPI api = new XBankCreditAPI();

            XBankCreditRequest xRequest = new XBankCreditRequest();

            xRequest.setCustomerName(request.Customer);
            xRequest.setRequestAmount(request.Amount);

            XbankCreditResponse xResponse = api.sendCreditRequest(xRequest);
            BankCreditResponse  response  = new BankCreditResponse();

            response.Approved = xResponse.isApproval();

            return(response);
        }