protected void Submit_Click(object sender, EventArgs e) { // Create request object DoReauthorizationRequestType request = new DoReauthorizationRequestType(); // (Required) Value of a previously authorized transaction identification number returned by PayPal. request.AuthorizationID = authorizationId.Value; // (Required) Amount to reauthorize. CurrencyCodeType currency = (CurrencyCodeType) Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue); request.Amount = new BasicAmountType(currency, amount.Value); // Invoke the API DoReauthorizationReq wrapper = new DoReauthorizationReq(); wrapper.DoReauthorizationRequest = request; // 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(); // Create the PayPalAPIInterfaceServiceService service object to make the API call PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); // # API call // Invoke the DoReauthorization method in service wrapper object DoReauthorizationResponseType doReauthorizationResponse = service.DoReauthorization(wrapper); // Check for API return status setKeyResponseObjects(service, doReauthorizationResponse); }
protected void Submit_Click(object sender, EventArgs e) { // Create request object DoReauthorizationRequestType request = new DoReauthorizationRequestType(); request.AuthorizationID = authorizationId.Value; CurrencyCodeType currency = (CurrencyCodeType) Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue); request.Amount = new BasicAmountType(currency, amount.Value); // Invoke the API DoReauthorizationReq wrapper = new DoReauthorizationReq(); wrapper.DoReauthorizationRequest = request; PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); DoReauthorizationResponseType doReauthorizationResponse = service.DoReauthorization(wrapper); // Check for API return status setKeyResponseObjects(service, doReauthorizationResponse); }
/// <summary> /// /// </summary> ///<param name="doReauthorizationReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq doReauthorizationReq, ICredential credential) { setStandardParams(doReauthorizationReq.DoReauthorizationRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, doReauthorizationReq.ToXMLString(null, "DoReauthorizationReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new DoReauthorizationResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoReauthorizationResponse']") ); }
/// <summary> /// /// </summary> ///<param name="doReauthorizationReq"></param> public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq doReauthorizationReq) { return DoReauthorization(doReauthorizationReq,(string) null); }
/** *AUTO_GENERATED */ public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq doReauthorizationReq, string apiUserName) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPIAA"; setStandardParams(doReauthorizationReq.DoReauthorizationRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(doReauthorizationReq.ToXMLString(null, "DoReauthorizationReq"), null, null); apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret()); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName; string response = Call(apiCallPreHandler); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoReauthorizationResponse']"); return new DoReauthorizationResponseType(xmlNode); }
// # DoReauthorization API Operation // Authorize a payment public DoReauthorizationResponseType DoReauthorizationAPIOperation() { // Create the DoReauthorizationResponseType object DoReauthorizationResponseType responseDoReauthorizationResponseType = new DoReauthorizationResponseType(); try { // Create the DoAuthorizationReq object DoReauthorizationReq requestDoReauthorization = new DoReauthorizationReq(); // `Amount` to reauthorize which takes mandatory params: // // * `currencyCode` // * `amount` BasicAmountType amount = new BasicAmountType(CurrencyCodeType.USD, "3.00"); // `DoReauthorizationRequest` which takes mandatory params: // // * `Authorization Id` - Value of a previously authorized transaction // identification number returned by PayPal. // * `amount` DoReauthorizationRequestType doReauthorizationRequest = new DoReauthorizationRequestType("9B2288061E685550E", amount); requestDoReauthorization.DoReauthorizationRequest = doReauthorizationRequest; // Create the service wrapper object to make the API call PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); // # API call // Invoke the DoReauthorization method in service wrapper object responseDoReauthorizationResponseType = service.DoReauthorization(requestDoReauthorization); if (responseDoReauthorizationResponseType != null) { // Response envelope acknowledgement string acknowledgement = "DoReauthorization API Operation - "; acknowledgement += responseDoReauthorizationResponseType.Ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseDoReauthorizationResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { // Authorization identification number logger.Info("Authorization ID : " + responseDoReauthorizationResponseType.AuthorizationID + "\n"); Console.WriteLine("Authorization ID : " + responseDoReauthorizationResponseType.AuthorizationID + "\n"); } // # Error Values else { List<ErrorType> errorMessages = responseDoReauthorizationResponseType.Errors; foreach (ErrorType error in errorMessages) { logger.Debug("API Error Message : " + error.LongMessage); Console.WriteLine("API Error Message : " + error.LongMessage + "\n"); } } } } // # Exception log catch (System.Exception ex) { // Log the exception message logger.Debug("Error Message : " + ex.Message); Console.WriteLine("Error Message : " + ex.Message); } return responseDoReauthorizationResponseType; }
/** *AUTO_GENERATED */ public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq doReauthorizationReq, string apiUserName) { setStandardParams(doReauthorizationReq.DoReauthorizationRequest); string response = Call("DoReauthorization", doReauthorizationReq.ToXMLString(), apiUserName); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoReauthorizationResponse']"); return new DoReauthorizationResponseType(xmlNode); }
public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq DoReauthorizationReq) { return DoReauthorization(DoReauthorizationReq, null); }
/** * */ public DoReauthorizationResponseType DoReauthorization(DoReauthorizationReq DoReauthorizationReq, string apiUsername) { setStandardParams(DoReauthorizationReq.DoReauthorizationRequest); string resp = call("DoReauthorization", DoReauthorizationReq.toXMLString(), apiUsername); return new DoReauthorizationResponseType(resp); }