Пример #1
0
        public void getBalance()
        {
            APIBanking.com.quantiguous.api.FundsTransferByCustomerService2.getBalance request = new APIBanking.com.quantiguous.api.FundsTransferByCustomerService2.getBalance();

            request.customerID    = "505";
            request.appID         = "12345";
            request.AccountNumber = "000180100000244";

            String userName           = System.Environment.GetEnvironmentVariable("API_YBL_USER");
            String userPassword       = System.Environment.GetEnvironmentVariable("API_YBL_PASSWORD");
            String clientId           = System.Environment.GetEnvironmentVariable("API_YBL_CLIENT_ID");
            String clientSecret       = System.Environment.GetEnvironmentVariable("API_YBL_CLIENT_SECRET");
            String clientCert         = System.Environment.GetEnvironmentVariable("API_YBL_CLIENT_CERT");
            String clientCertPassword = System.Environment.GetEnvironmentVariable("API_YBL_CLIENT_CERT_PASSWORD");

            APIBanking.Environment env = new APIBanking.Environments.YBL.UAT(userName, userPassword,
                                                                             clientId, clientSecret, clientCert, clientCertPassword);

            try
            {
                APIBanking.com.quantiguous.api.FundsTransferByCustomerService2.getBalanceResponse response = FundsTransferByCustomerService2.getBalance(env, request);
                Assert.IsNotNull(response);
            }
            catch (Fault e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        public static com.quantiguous.api.FundsTransferByCustomerService2.getBalanceResponse getBalance(Environment env, APIBanking.com.quantiguous.api.FundsTransferByCustomerService2.getBalance request)
        {
            request.version = VERSION;
            com.quantiguous.api.FundsTransferByCustomerService2.fundsTransferByCustomerService2Client client = createClient(env);

            try
            {
                using (new System.ServiceModel.OperationContextScope((System.ServiceModel.IClientChannel)client.InnerChannel))
                {
                    System.Net.ServicePointManager.SecurityProtocol = env.getSecurityProtocol();

                    System.ServiceModel.Web.WebOperationContext.Current.OutgoingRequest.UserAgent = "APIBanking.NET";


                    IDictionaryEnumerator headers = env.getHeaders().GetEnumerator();
                    while (headers.MoveNext())
                    {
                        System.ServiceModel.Web.WebOperationContext.Current.OutgoingRequest.Headers.Add(headers.Key.ToString(), headers.Value.ToString());
                    }

                    com.quantiguous.api.FundsTransferByCustomerService2.getBalanceResponse response = client.getBalance(request);

                    return(response);
                }
            }
            catch (MessageSecurityException e)
            {
                throw new Fault(e);
            }
            catch (FaultException e)
            {
                throw new Fault(e);
            }
            catch (Exception e)
            {
                throw new Fault(e);
            }
        }