Esempio n. 1
0
        /**
         *
         */
        public GetFundingPlansResponse GetFundingPlans(GetFundingPlansRequest GetFundingPlansRequest, string apiUsername)
        {
            string resp = call("GetFundingPlans", GetFundingPlansRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();
            return new GetFundingPlansResponse(util.parseNVPString(resp), "");
        }
Esempio n. 2
0
 public GetFundingPlansResponse GetFundingPlans(GetFundingPlansRequest GetFundingPlansRequest)
 {
     return GetFundingPlans(GetFundingPlansRequest, null);
 }
        /// <summary>
        /// Handle GetFundingPlans API call
        /// </summary>
        /// <param name="context"></param>
        private void GetFundingPlans(HttpContext context)
        {
            NameValueCollection parameters = context.Request.Params;
            GetFundingPlansRequest req = new GetFundingPlansRequest(new RequestEnvelope("en_US"),
                parameters["payKey"]);

            // All set. Fire the request
            AdaptivePaymentsService service = new AdaptivePaymentsService();
            GetFundingPlansResponse resp = null;
            try
            {
                resp = service.GetFundingPlans(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 (FundingPlan plan in resp.fundingPlan) {
                    keyResponseParams.Add("Funding plan Id " + idx, plan.fundingPlanId);
                    keyResponseParams.Add("Funding plan amount " + idx,
                        plan.fundingAmount.amount + plan.fundingAmount.code );
                    idx++;
                }
            }
            displayResponse(context, "GetFundingPlans", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }
	 	/// <summary>
		/// 
	 	/// </summary>
		///<param name="getFundingPlansRequest"></param>
		///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
	 	public GetFundingPlansResponse GetFundingPlans(GetFundingPlansRequest getFundingPlansRequest, ICredential credential)
	 	{	 			 		
			IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getFundingPlansRequest.ToNVPString(string.Empty), ServiceName, "GetFundingPlans", credential);
	   	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
			((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
			((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptivePayments";

			NVPUtil util = new NVPUtil();
			return GetFundingPlansResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
			
	 	}
	 	/// <summary> 
		/// 
	 	/// </summary>
		///<param name="getFundingPlansRequest"></param>
	 	
	 	public GetFundingPlansResponse GetFundingPlans(GetFundingPlansRequest getFundingPlansRequest)
	 	{
	 		return GetFundingPlans(getFundingPlansRequest,(string) null);
	 	}
        /// <summary>
        /// Handle GetFundingPlans API call
        /// </summary>
        /// <param name="contextHttp"></param>
        private void GetFundingPlans(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. 
            // paykey : The key used to create the payment whose funding sources you want to determine. 
            GetFundingPlansRequest request = new GetFundingPlansRequest(new RequestEnvelope("en_US"),
                parameters["payKey"]);
          
            AdaptivePaymentsService service = null;
            GetFundingPlansResponse 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.GetFundingPlans(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 (FundingPlan plan in response.fundingPlan) {
                    responseValues.Add("Funding plan Id " + idx, plan.fundingPlanId);
                    responseValues.Add("Funding plan amount " + idx, 
                        plan.fundingAmount.amount + plan.fundingAmount.code );
                    idx++;
                }
            }
            Display(contextHttp, "GetFundingPlans", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
        }
Esempio n. 7
0
 /**
   *AUTO_GENERATED
  	  */
 public GetFundingPlansResponse GetFundingPlans(GetFundingPlansRequest getFundingPlansRequest, string apiUserName)
 {
     string response = Call("GetFundingPlans", getFundingPlansRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return GetFundingPlansResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }