/// <summary> /// Handle SetFundingSourceConfirmed API call /// </summary> /// <param name="context"></param> private void SetFundingSourceConfirmed(HttpContext context) { // # SetFundingSourceConfirmed API // The SetFundingSourceConfirmed API operation lets your application set up bank accounts as funding sources for PayPal accounts. NameValueCollection parameters = context.Request.Params; // (Required) The funding source key returned in the AddBankAccount or AddPaymentCard response. SetFundingSourceConfirmedRequest req = new SetFundingSourceConfirmedRequest(new RequestEnvelope(), parameters["fundingSourceKey"]); //(Optional) The merchant account Id of the PayPal account to // which the funding source was added in the AddPaymentCard or // AddBankAccount request. You must specify either the accountId // or mailAddress when making this request, but never both in // the same request. if (parameters["accountId"] != string.Empty) req.accountId = parameters["accountId"]; // (Optional) The email address of the PayPal account to which // the funding source was added in the AddPaymentCard or // AddBankAccount request. You must specify either the accountId // or mailAddress when making this request, but never both in // the same request. if (parameters["emailAddress"] != string.Empty) req.emailAddress = parameters["emailAddress"]; // Create the AdaptiveAccounts service object to make the API call AdaptiveAccountsService service = null; SetFundingSourceConfirmedResponse resp = 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 AdaptiveAccountsService(configurationMap); // # API call // Invoke the CreateAccount method in service wrapper object resp = service.SetFundingSourceConfirmed(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, "SetFundingSourceConfirmed", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }
/// <summary> /// Handle SetFundingSourceConfirmed API call /// </summary> /// <param name="context"></param> private void SetFundingSourceConfirmed(HttpContext context) { NameValueCollection parameters = context.Request.Params; SetFundingSourceConfirmedRequest req = new SetFundingSourceConfirmedRequest(new RequestEnvelope(), parameters["fundingSourceKey"]); // set optional parameters if (parameters["accountId"] != "") req.accountId = parameters["accountId"]; if (parameters["emailAddress"] != "") req.emailAddress = parameters["emailAddress"]; // All set. Fire the request AdaptiveAccountsService service = new AdaptiveAccountsService(); SetFundingSourceConfirmedResponse resp = null; try { resp = service.SetFundingSourceConfirmed(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, "SetFundingSourceConfirmed", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }