示例#1
0
        /**
         *
         */
        public GetAllowedFundingSourcesResponse GetAllowedFundingSources(GetAllowedFundingSourcesRequest GetAllowedFundingSourcesRequest, string apiUsername)
        {
            string resp = call("GetAllowedFundingSources", GetAllowedFundingSourcesRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();
            return new GetAllowedFundingSourcesResponse(util.parseNVPString(resp), "");
        }
示例#2
0
 public GetAllowedFundingSourcesResponse GetAllowedFundingSources(GetAllowedFundingSourcesRequest GetAllowedFundingSourcesRequest)
 {
     return GetAllowedFundingSources(GetAllowedFundingSourcesRequest, null);
 }
        /// <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);
        }
	 	/// <summary>
		/// 
	 	/// </summary>
		///<param name="getAllowedFundingSourcesRequest"></param>
		///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
	 	public GetAllowedFundingSourcesResponse GetAllowedFundingSources(GetAllowedFundingSourcesRequest getAllowedFundingSourcesRequest, ICredential credential)
	 	{	 			 		
			IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getAllowedFundingSourcesRequest.ToNVPString(string.Empty), ServiceName, "GetAllowedFundingSources", credential);
	   	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
			((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
			((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptivePayments";

			NVPUtil util = new NVPUtil();
			return GetAllowedFundingSourcesResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
			
	 	}
	 	/// <summary> 
		/// 
	 	/// </summary>
		///<param name="getAllowedFundingSourcesRequest"></param>
	 	
	 	public GetAllowedFundingSourcesResponse GetAllowedFundingSources(GetAllowedFundingSourcesRequest getAllowedFundingSourcesRequest)
	 	{
	 		return GetAllowedFundingSources(getAllowedFundingSourcesRequest,(string) null);
	 	}
        /// <summary>
        /// Handle GetAllowedFundingSources API call
        /// </summary>
        /// <param name="contextHttp"></param>
        private void GetAllowedFundingSources(HttpContext contextHttp)
        {
            NameValueCollection parameters = contextHttp.Request.Params;
            // error language : (Required) RFC 3066 language in which error messages are returned; 
            // by default it is en_US, which is the only language currently supported. 
            //key : (Required) The preapproval key that identifies the preapproval
            GetAllowedFundingSourcesRequest request = 
                new GetAllowedFundingSourcesRequest(new RequestEnvelope("en_US"), parameters["key"]);

            AdaptivePaymentsService service = null;
            GetAllowedFundingSourcesResponse response = null;
            try
            {
                // Configuration map containing signature credentials and other required configuration.
                // For a full list of configuration parameters refer in wiki page 
                // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
                Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();

                // Creating service wrapper object to make an API call and loading
                // configuration map for your credentials and endpoint
                service = new AdaptivePaymentsService(configurationMap);
                response = service.GetAllowedFundingSources(request);
            }
            catch (System.Exception e)
            {
                contextHttp.Response.Write(e.Message);
                return;
            }

            Dictionary<string, string> responseValues = new Dictionary<string, string>();
            string redirectUrl = null;
            if (!(response.responseEnvelope.ack == AckCode.FAILURE) &&
                !(response.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
            {
                int idx = 1;
                foreach (FundingSource source in response.fundingSource)
                {
                    
                    responseValues.Add("Funding source id " + idx, source.fundingSourceId);

                    responseValues.Add("Funding source name " + idx, source.displayName);
                    idx++;
                }                
            }
            Display(contextHttp, "GetAllowedFundingSources", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
        }
示例#7
0
 /**
   *AUTO_GENERATED
  	  */
 public GetAllowedFundingSourcesResponse GetAllowedFundingSources(GetAllowedFundingSourcesRequest getAllowedFundingSourcesRequest, string apiUserName)
 {
     string response = Call("GetAllowedFundingSources", getAllowedFundingSourcesRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return GetAllowedFundingSourcesResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }