/// <summary> /// Handle ConfirmPreapproval API call /// </summary> /// <param name="context"></param> private void ConfirmPreapproval(HttpContext context) { NameValueCollection parameters = context.Request.Params; ConfirmPreapprovalRequest req = new ConfirmPreapprovalRequest(new RequestEnvelope("en_US"), parameters["preapprovalKey"]); // Set optional parameters if (parameters["pin"] != "") req.pin = parameters["pin"]; if (parameters["fundingSourceId"] != "") req.fundingSourceId = parameters["fundingSourceId"]; // All set. Fire the request AdaptivePaymentsService service = new AdaptivePaymentsService(); ConfirmPreapprovalResponse resp = null; try { resp = service.ConfirmPreapproval(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)) { //nothing to add } displayResponse(context, "ConfirmPreapproval", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }