/// <summary> /// Handle GetAvailableShippingAddresses API call /// </summary> /// <param name="context"></param> private void GetAvailableShippingAddresses(HttpContext context) { NameValueCollection parameters = context.Request.Params; GetAvailableShippingAddressesRequest req = new GetAvailableShippingAddressesRequest( new RequestEnvelope("en_US"), parameters["key"]); // All set. Fire the request AdaptivePaymentsService service = new AdaptivePaymentsService(); GetAvailableShippingAddressesResponse resp = null; try { resp = service.GetAvailableShippingAddresses(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(Address addr in resp.availableAddress) { keyResponseParams.Add("Address name " + idx, addr.addresseeName); keyResponseParams.Add("Address Id " + idx, addr.addressId); if (addr.baseAddress != null) { keyResponseParams.Add("Address line " + idx, addr.baseAddress.line1); keyResponseParams.Add("City " + idx, addr.baseAddress.city); keyResponseParams.Add("State " + idx, addr.baseAddress.state); } } } displayResponse(context, "GetAvailableShippingAddresses", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }