Ejemplo n.º 1
0
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            GetBankListRequestBody  request  = requestObject as GetBankListRequestBody;
            GetBankListResponseBody response = null;

            getBankListResponse utibaGetBankListResponse = utibaClientProxy.getBankList(new getBankList()
            {
                getBankListRequest = new getBankListRequestType()
                {
                    sessionid       = sessionID,
                    device_type     = request.DeviceType,
                    agent_reference = request.Agent
                }
            });

            if (utibaGetBankListResponse != null)
            {
                response = new GetBankListResponseBody()
                {
                    ResponseCode    = Utils.BuildResponseCode(utibaGetBankListResponse.getBankListReturn.result, utibaGetBankListResponse.getBankListReturn.result_namespace),
                    ResponseMessage = utibaGetBankListResponse.getBankListReturn.result_message,
                    TransactionID   = utibaGetBankListResponse.getBankListReturn.transid
                };

                if (utibaGetBankListResponse.getBankListReturn.banks.Length > 0)
                {
                    response.BankList = new BankList();
                    foreach (KeyValuePair1 kvp in utibaGetBankListResponse.getBankListReturn.banks)
                    {
                        response.BankList.Add(int.Parse(kvp.key), kvp.value);
                    }
                }
            }
            return(response);
        }
Ejemplo n.º 2
0
        public override IMovilwayApiResponse PerformKinacuOperation(IMovilwayApiRequest requestObject, SaleInterface kinacuWS, String sessionID)
        {
            if (sessionID.Equals("0"))
            {
                return new GetBankListResponseBody()
                       {
                           ResponseCode    = 90,
                           ResponseMessage = "error session",
                           TransactionID   = 0,
                           BankList        = new BankList()
                       }
            }
            ;

            GetBankListRequestBody  request  = requestObject as GetBankListRequestBody;
            GetBankListResponseBody response = null;
            string message;

            logger.InfoLow("[KIN] " + base.LOG_PREFIX + "[GetBankListProvider] [SEND-DATA] getAccountBankParameters {UserId=" + sessionID + "}");

            BankAccount[] banks;

            if (request.ParentValues ?? false)
            {
                banks = Utils.GetAccountBanks(request.Agent, out message);
            }
            else
            {
                banks = kinacuWS.GetAccountBank(int.Parse(sessionID), out message);
            }

            if (banks == null || banks.Length == 0)
            {
                logger.InfoLow("[KIN] " + base.LOG_PREFIX + "[GetBankListProvider] [RECV-DATA] getAccountBankResult {No posee cuentas" + (banks == null ? " (null)" : String.Empty) + "}");
            }
            else
            {
                logger.InfoLow("[KIN] " + base.LOG_PREFIX + "[GetBankListProvider] [RECV-DATA] getAccountBankResult {response={Count=" + banks.Length + "}}");
            }

            response = new GetBankListResponseBody()
            {
                ResponseCode    = 0,
                ResponseMessage = "exito",
                TransactionID   = 0
            };

            response.BankList = new BankList();
            string[] ignoreList = string.IsNullOrEmpty(ConfigurationManager.AppSettings["BankIgnoreList"]) ? new string[0] : ConfigurationManager.AppSettings["BankIgnoreList"].ToString().Split(',');
            foreach (var bank in banks)
            {
                if (!ignoreList.Contains(bank.BankId.ToString()))
                {
                    //if(response.BankList.Count(b => b.Key == bank.BankId) == 0)
                    response.BankList.Add(bank.Id, bank.BankName + " - " + bank.Number);
                }
            }

            return(response);
        }
    }