protected void Search_Submit(object sender, EventArgs e) { // Create request object GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType(); // (Required) Unique identifier of a transaction. // Note: The details for some kinds of transactions cannot be retrieved with GetTransactionDetails. You cannot obtain details of bank transfer withdrawals, for example. request.TransactionID = transactionId.Value; // Invoke the API GetTransactionDetailsReq wrapper = new GetTransactionDetailsReq(); wrapper.GetTransactionDetailsRequest = 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 GetTransactionDetails method in service wrapper object GetTransactionDetailsResponseType transactionDetails = service.GetTransactionDetails(wrapper); // Check for API return status processResponse(service, transactionDetails); }
protected void Submit_Click(object sender, EventArgs e) { GetTransactionDetailsReq request = new GetTransactionDetailsReq(); GetTransactionDetailsRequestType requestType = new GetTransactionDetailsRequestType(); requestType.TransactionID = transactionId.Value; request.GetTransactionDetailsRequest = requestType; PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); service.GetTransactionDetails(request); }
protected void Search_Submit(object sender, EventArgs e) { // Create request object GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType(); request.TransactionID = transactionId.Value; // Invoke the API GetTransactionDetailsReq wrapper = new GetTransactionDetailsReq(); wrapper.GetTransactionDetailsRequest = request; PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); GetTransactionDetailsResponseType transactionDetails = service.GetTransactionDetails(wrapper); // Check for API return status processResponse(service, transactionDetails); }
public ActionResult VoidOrder(string authorizationId) { var service = new PayPalAPIInterfaceServiceService(); var request = new GetTransactionDetailsReq { GetTransactionDetailsRequest = new GetTransactionDetailsRequestType { TransactionID = authorizationId } }; var transactionDetailsResponse = service.GetTransactionDetails(request); if (transactionDetailsResponse.Ack == AckCodeType.SUCCESS) { //if(transactionDetailsResponse.PaymentTransactionDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.) var voidRequest = new DoVoidReq() { DoVoidRequest = new DoVoidRequestType { AuthorizationID = authorizationId, } }; var voidResponse = service.DoVoid(voidRequest); if (voidResponse.Ack == AckCodeType.SUCCESS) { return RedirectToAction("OrderVoided", new { transactionId = authorizationId }); } else { foreach (var error in voidResponse.Errors) { ModelState.AddModelError("__FORM", error.LongMessage); } } } else { foreach (var error in transactionDetailsResponse.Errors) { ModelState.AddModelError("__FORM", error.LongMessage); } } return View("Error"); }
public PartialViewResult TransactionDetails(string transactionId) { var service = new PayPalAPIInterfaceServiceService(); var request = new GetTransactionDetailsReq { GetTransactionDetailsRequest = new GetTransactionDetailsRequestType { TransactionID = transactionId } }; var response = service.GetTransactionDetails(request); if (response.Ack == AckCodeType.SUCCESS) { var viewData = new TransactionViewData { TransactionId = response.PaymentTransactionDetails.PaymentInfo.TransactionID, Payer = response.PaymentTransactionDetails.PayerInfo.Payer, DateTime = response.PaymentTransactionDetails.PaymentInfo.PaymentDate, Status = response.PaymentTransactionDetails.PaymentInfo.PaymentStatus.ToString(), Total = Convert.ToDecimal(response.PaymentTransactionDetails.PaymentInfo.GrossAmount.value) }; return PartialView("_TransactionDetails", viewData); } return null; }
public ActionResult CaptureOrder(string authorizationId) { var service = new PayPalAPIInterfaceServiceService(); var request = new GetTransactionDetailsReq { GetTransactionDetailsRequest = new GetTransactionDetailsRequestType { TransactionID = authorizationId } }; var transactionDetailsResponse = service.GetTransactionDetails(request); if (transactionDetailsResponse.Ack == AckCodeType.SUCCESS) { //if(transactionDetailsResponse.PaymentTransactionDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.) var captureRequest = new DoCaptureReq { DoCaptureRequest = new DoCaptureRequestType { AuthorizationID = authorizationId, Amount = transactionDetailsResponse.PaymentTransactionDetails.PaymentInfo.GrossAmount } }; var captureResponse = service.DoCapture(captureRequest); if (captureResponse.Ack == AckCodeType.SUCCESS) { return RedirectToAction("OrderSuccessful", new { transactionId = captureResponse.DoCaptureResponseDetails.PaymentInfo.TransactionID }); } else { foreach (var error in captureResponse.Errors) { ModelState.AddModelError("__FORM", error.LongMessage); } } } else { foreach (var error in transactionDetailsResponse.Errors) { ModelState.AddModelError("__FORM", error.LongMessage); } } return View("Error"); }
/// <summary> /// /// </summary> ///<param name="getTransactionDetailsReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq getTransactionDetailsReq, ICredential credential) { setStandardParams(getTransactionDetailsReq.GetTransactionDetailsRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, getTransactionDetailsReq.ToXMLString(null, "GetTransactionDetailsReq"), null, null); IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential); ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName; ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion; ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPI"; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Call(apiCallPreHandler)); return new GetTransactionDetailsResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='GetTransactionDetailsResponse']") ); }
/// <summary> /// /// </summary> ///<param name="getTransactionDetailsReq"></param> public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq getTransactionDetailsReq) { return GetTransactionDetails(getTransactionDetailsReq,(string) null); }
/** *AUTO_GENERATED */ public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq getTransactionDetailsReq, string apiUserName) { IAPICallPreHandler apiCallPreHandler = null; string portName = "PayPalAPI"; setStandardParams(getTransactionDetailsReq.GetTransactionDetailsRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(getTransactionDetailsReq.ToXMLString(null, "GetTransactionDetailsReq"), 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()='GetTransactionDetailsResponse']"); return new GetTransactionDetailsResponseType(xmlNode); }
/** *AUTO_GENERATED */ public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq getTransactionDetailsReq, string apiUserName) { setStandardParams(getTransactionDetailsReq.GetTransactionDetailsRequest); string response = Call("GetTransactionDetails", getTransactionDetailsReq.ToXMLString(), apiUserName); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='GetTransactionDetailsResponse']"); return new GetTransactionDetailsResponseType(xmlNode); }
public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq GetTransactionDetailsReq) { return GetTransactionDetails(GetTransactionDetailsReq, null); }
/** * */ public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq GetTransactionDetailsReq, string apiUsername) { setStandardParams(GetTransactionDetailsReq.GetTransactionDetailsRequest); string resp = call("GetTransactionDetails", GetTransactionDetailsReq.toXMLString(), apiUsername); return new GetTransactionDetailsResponseType(resp); }
// # GetTransactionDetails API Operation // The GetTransactionDetails API operation obtains information about a specific transaction. public GetTransactionDetailsResponseType GetTransactionDetailsAPIOperation() { // Create the GetTransactionDetailsResponseType object GetTransactionDetailsResponseType responseGetTransactionDetailsResponseType = new GetTransactionDetailsResponseType(); try { // Create the GetTransactionDetailsReq object GetTransactionDetailsReq getTransactionDetails = new GetTransactionDetailsReq(); GetTransactionDetailsRequestType getTransactionDetailsRequest = new GetTransactionDetailsRequestType(); // Unique identifier of a transaction. // `Note: // The details for some kinds of transactions cannot be retrieved with // GetTransactionDetails. You cannot obtain details of bank transfer // withdrawals, for example.` getTransactionDetailsRequest.TransactionID = "5AT5731435011481X"; getTransactionDetails.GetTransactionDetailsRequest = getTransactionDetailsRequest; // Create the service wrapper object to make the API call PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); // # API call // Invoke the GetTransactionDetails method in service wrapper object responseGetTransactionDetailsResponseType = service.GetTransactionDetails(getTransactionDetails); if (responseGetTransactionDetailsResponseType != null) { // Response envelope acknowledgement string acknowledgement = "GetTransactionDetails API Operation - "; acknowledgement += responseGetTransactionDetailsResponseType.Ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseGetTransactionDetailsResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { // Unique PayPal Customer Account identification number logger.Info("Payer ID : " + responseGetTransactionDetailsResponseType.PaymentTransactionDetails.PayerInfo.PayerID + "\n"); Console.WriteLine("Payer ID : " + responseGetTransactionDetailsResponseType.PaymentTransactionDetails.PayerInfo.PayerID + "\n"); } // # Error Values else { List<ErrorType> errorMessages = responseGetTransactionDetailsResponseType.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 responseGetTransactionDetailsResponseType; }