/// <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); }