Esempio n. 1
0
        /// <summary>
        /// Handle GetAllowedFundingSources API call
        /// </summary>
        /// <param name="context"></param>
        private void GetAllowedFundingSources(HttpContext context)
        {
            NameValueCollection parameters = context.Request.Params;
            GetAllowedFundingSourcesRequest req = 
                new GetAllowedFundingSourcesRequest(new RequestEnvelope("en_US"), parameters["key"]);

            // All set. Fire the request            
            AdaptivePaymentsService service = new AdaptivePaymentsService();
            GetAllowedFundingSourcesResponse resp = null;
            try
            {
                resp = service.GetAllowedFundingSources(req);
            }
            catch (System.Exception e)
            {
                context.Response.Write(e.Message);
                return;
            }

            // Display response values. 
            Dictionary<string, string> keyResponseParams = new Dictionary<string, string>();
            string redirectUrl = null;
            if (!(resp.responseEnvelope.ack == AckCode.FAILURE) &&
                !(resp.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
            {
                int idx = 1;
                foreach (FundingSource source in resp.fundingSource)
                {
                    keyResponseParams.Add("Funding source id " + idx, source.fundingSourceId);
                    keyResponseParams.Add("Funding source name " + idx, source.displayName);
                    idx++;
                }                
            }
            displayResponse(context, "GetAllowedFundingSources", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }