Exemplo n.º 1
0
        /**
         *
         */
        public GetUserLimitsResponse GetUserLimits(GetUserLimitsRequest GetUserLimitsRequest, string apiUsername)
        {
            string resp = call("GetUserLimits", GetUserLimitsRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();
            return new GetUserLimitsResponse(util.parseNVPString(resp), "");
        }
Exemplo n.º 2
0
 public GetUserLimitsResponse GetUserLimits(GetUserLimitsRequest GetUserLimitsRequest)
 {
     return GetUserLimits(GetUserLimitsRequest, null);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handle GetUserLimits API call
        /// </summary>
        /// <param name="context"></param>
        private void GetUserLimits(HttpContext context)
        {
            NameValueCollection parameters = context.Request.Params;

            List<string> limitType = new List<string>();
            if(parameters["limitType"] != "")
                limitType.Add(parameters["limitType"]);
            AccountIdentifier accountId = new AccountIdentifier();
            if (parameters["email"] != "")
            {
                accountId.email = parameters["email"];
            }
            if (parameters["phoneCountry"] != "" && parameters["phoneNumber"] != "")
            {
                accountId.phone = new PhoneNumberType(parameters["phoneCountry"], parameters["phoneNumber"]);
                if (parameters["phoneExtension"] != "")
                    accountId.phone.extension = parameters["phoneExtension"];
            }

            GetUserLimitsRequest req = new GetUserLimitsRequest(
                    new RequestEnvelope("en_US"), accountId, parameters["country"],
                    parameters["currencyCode"], limitType);

            // All set. Fire the request
            AdaptivePaymentsService service = new AdaptivePaymentsService();
            GetUserLimitsResponse resp = null;
            try
            {
                resp = service.GetUserLimits(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 (UserLimit userLimit in resp.userLimit)
                {
                    keyResponseParams.Add("Limit amount " + idx,
                        userLimit.limitAmount.amount + userLimit.limitAmount.code);
                    keyResponseParams.Add("Limit type " + idx, userLimit.limitType);
                    idx++;
                }
            }
            displayResponse(context, "GetAvailableShippingAddresses", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }
	 	/// <summary>
		/// 
	 	/// </summary>
		///<param name="getUserLimitsRequest"></param>
		///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
	 	public GetUserLimitsResponse GetUserLimits(GetUserLimitsRequest getUserLimitsRequest, ICredential credential)
	 	{	 			 		
			IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getUserLimitsRequest.ToNVPString(string.Empty), ServiceName, "GetUserLimits", credential);
	   	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
			((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
			((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptivePayments";

			NVPUtil util = new NVPUtil();
			return GetUserLimitsResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
			
	 	}
	 	/// <summary> 
		/// 
	 	/// </summary>
		///<param name="getUserLimitsRequest"></param>
	 	
	 	public GetUserLimitsResponse GetUserLimits(GetUserLimitsRequest getUserLimitsRequest)
	 	{
	 		return GetUserLimits(getUserLimitsRequest,(string) null);
	 	}
        /// <summary>
        /// Handle GetUserLimits API call
        /// </summary>
        /// <param name="contextHttp"></param>
        private void GetUserLimits(HttpContext contextHttp)
        {
            NameValueCollection parameters = contextHttp.Request.Params;

            List<string> limitType = new List<string>();

            if (parameters["limitType"] != string.Empty)
            {
                limitType.Add(parameters["limitType"]);
            }

            AccountIdentifier accountId = new AccountIdentifier();
            if (parameters["email"] != string.Empty)
            {
                accountId.email = parameters["email"];
            }
            if (parameters["phoneCountry"] != string.Empty && parameters["phoneNumber"] != string.Empty)
            {
                accountId.phone = new PhoneNumberType(parameters["phoneCountry"], parameters["phoneNumber"]);
                if (parameters["phoneExtension"] != string.Empty)
                    accountId.phone.extension = parameters["phoneExtension"];
            }

            GetUserLimitsRequest request = new GetUserLimitsRequest(
                    new RequestEnvelope("en_US"), accountId, parameters["country"], 
                    parameters["currencyCode"], limitType);
         
            AdaptivePaymentsService service = null;
            GetUserLimitsResponse 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.GetUserLimits(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 (UserLimit userLimit in response.userLimit)
                {
                    responseValues.Add("Limit amount " + idx,
                        userLimit.limitAmount.amount + userLimit.limitAmount.code);
                    responseValues.Add("Limit type " + idx, userLimit.limitType);
                    idx++;
                }
            }
            Display(contextHttp, "GetUserLimits", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
        }       
Exemplo n.º 7
0
 /**
   *AUTO_GENERATED
  	  */
 public GetUserLimitsResponse GetUserLimits(GetUserLimitsRequest getUserLimitsRequest, string apiUserName)
 {
     string response = Call("GetUserLimits", getUserLimitsRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return GetUserLimitsResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }