コード例 #1
0
        /**
         *
         */
        public GetShippingAddressesResponse GetShippingAddresses(GetShippingAddressesRequest GetShippingAddressesRequest, string apiUsername)
        {
            string resp = call("GetShippingAddresses", GetShippingAddressesRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();
            return new GetShippingAddressesResponse(util.parseNVPString(resp), "");
        }
コード例 #2
0
 public GetShippingAddressesResponse GetShippingAddresses(GetShippingAddressesRequest GetShippingAddressesRequest)
 {
     return GetShippingAddresses(GetShippingAddressesRequest, null);
 }
コード例 #3
0
        /// <summary>
        /// Handle GetShippingAddresses API call
        /// </summary>
        /// <param name="context"></param>
        private void GetShippingAddresses(HttpContext context)
        {
            NameValueCollection parameters = context.Request.Params;
            GetShippingAddressesRequest req = new GetShippingAddressesRequest(new RequestEnvelope("en_US"),
                parameters["key"]);

            // All set. Fire the request
            AdaptivePaymentsService service = new AdaptivePaymentsService();
            GetShippingAddressesResponse resp = null;
            try
            {
                resp = service.GetShippingAddresses(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))
            {
                if (resp.selectedAddress != null)
                {
                    keyResponseParams.Add("Address name", resp.selectedAddress.addresseeName);
                    keyResponseParams.Add("Address Id", resp.selectedAddress.addressId);
                    if (resp.selectedAddress.baseAddress != null)
                    {
                        keyResponseParams.Add("Address line", resp.selectedAddress.baseAddress.line1);
                        keyResponseParams.Add("City", resp.selectedAddress.baseAddress.city);
                        keyResponseParams.Add("State", resp.selectedAddress.baseAddress.state);
                    }
                }
            }
            displayResponse(context, "GetShippingAddresses", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }
コード例 #4
0
	 	/// <summary>
		/// 
	 	/// </summary>
		///<param name="getShippingAddressesRequest"></param>
		///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
	 	public GetShippingAddressesResponse GetShippingAddresses(GetShippingAddressesRequest getShippingAddressesRequest, ICredential credential)
	 	{	 			 		
			IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getShippingAddressesRequest.ToNVPString(string.Empty), ServiceName, "GetShippingAddresses", credential);
	   	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
			((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
			((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptivePayments";

			NVPUtil util = new NVPUtil();
			return GetShippingAddressesResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
			
	 	}
コード例 #5
0
	 	/// <summary> 
		/// 
	 	/// </summary>
		///<param name="getShippingAddressesRequest"></param>
	 	
	 	public GetShippingAddressesResponse GetShippingAddresses(GetShippingAddressesRequest getShippingAddressesRequest)
	 	{
	 		return GetShippingAddresses(getShippingAddressesRequest,(string) null);
	 	}
        /// <summary>
        /// Handle GetShippingAddresses API call
        /// </summary>
        /// <param name="contextHttp"></param>
        private void GetShippingAddresses(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 payment paykey that identifies the account holder for whom you want 
            // to obtain the selected shipping address.
            //  Note:
            //  Shipping information can only be retrieved through the payment payKey; not through the preapprovalKey.
            GetShippingAddressesRequest request = new GetShippingAddressesRequest(new RequestEnvelope("en_US"),
                parameters["key"]);
        
            AdaptivePaymentsService service = null;
            GetShippingAddressesResponse 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.GetShippingAddresses(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))
            {
                if (response.selectedAddress != null)
                {
                    // The name associated with the address.
                    responseValues.Add("Address name", response.selectedAddress.addresseeName);

                    // The ID associated with the address.
                    responseValues.Add("Address Id", response.selectedAddress.addressId);
                    if (response.selectedAddress.baseAddress != null)
                    {
                        // Street address.
                        responseValues.Add("Address line", response.selectedAddress.baseAddress.line1);
                        // The city of the address.
                        responseValues.Add("City", response.selectedAddress.baseAddress.city);
                        // The state for the address
                        responseValues.Add("State", response.selectedAddress.baseAddress.state);                       
                    }
                }
            }
            Display(contextHttp, "GetShippingAddresses", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
        }
コード例 #7
0
 /**
   *AUTO_GENERATED
  	  */
 public GetShippingAddressesResponse GetShippingAddresses(GetShippingAddressesRequest getShippingAddressesRequest, string apiUserName)
 {
     string response = Call("GetShippingAddresses", getShippingAddressesRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return GetShippingAddressesResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }