本文整理匯總了C#中PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.DoVoid方法的典型用法代碼示例。如果您正苦於以下問題:C# PayPalAPIInterfaceServiceService.DoVoid方法的具體用法?C# PayPalAPIInterfaceServiceService.DoVoid怎麽用?C# PayPalAPIInterfaceServiceService.DoVoid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService
的用法示例。
在下文中一共展示了PayPalAPIInterfaceServiceService.DoVoid方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoVoidRequestType request =
new DoVoidRequestType();
// (Required) Original authorization ID specifying the authorization to void or, to void an order, the order ID.
// Important: If you are voiding a transaction that has been reauthorized, use the ID from the original authorization, and not the reauthorization.
request.AuthorizationID = authorizationId.Value;
// (Optional) Informational note about this void that is displayed to the buyer in email and in their transaction history.
if (note.Value != string.Empty)
{
request.Note = note.Value;
}
// Invoke the API
DoVoidReq wrapper = new DoVoidReq();
wrapper.DoVoidRequest = 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 DoVoid method in service wrapper object
DoVoidResponseType doVoidResponse =
service.DoVoid(wrapper);
// Check for API return status
setKeyResponseObjects(service, doVoidResponse);
}
示例2: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
DoVoidRequestType request =
new DoVoidRequestType();
request.AuthorizationID = authorizationId.Value;
if (note.Value != "")
{
request.Note = note.Value;
}
// Invoke the API
DoVoidReq wrapper = new DoVoidReq();
wrapper.DoVoidRequest = request;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
DoVoidResponseType doVoidResponse =
service.DoVoid(wrapper);
// Check for API return status
setKeyResponseObjects(service, doVoidResponse);
}
示例3: VoidOrder
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");
}
示例4: VoidProcessPayment
public override VoidProcessPaymentResult VoidProcessPayment(VoidProcessPaymentEvaluationContext context)
{
if (context.Payment == null)
throw new ArgumentNullException("context.Payment is null");
VoidProcessPaymentResult retVal = new VoidProcessPaymentResult();
if(!context.Payment.IsApproved && context.Payment.PaymentStatus == PaymentStatus.Authorized)
{
try
{
var config = GetConfigMap();
var service = new PayPalAPIInterfaceServiceService(config);
var doVoidResponse = service.DoVoid(new DoVoidReq { DoVoidRequest = new DoVoidRequestType { AuthorizationID = context.Payment.OuterId, Note = "Cancel payment" } });
CheckResponse(doVoidResponse);
if(context.Payment.OuterId == doVoidResponse.AuthorizationID)
{
retVal.NewPaymentStatus = context.Payment.PaymentStatus = PaymentStatus.Voided;
context.Payment.VoidedDate = context.Payment.CancelledDate = DateTime.UtcNow;
context.Payment.IsCancelled = true;
retVal.IsSuccess = true;
}
}
catch(Exception ex)
{
retVal.ErrorMessage = ex.Message;
}
}
return retVal;
}
示例5: DoVoidAPIOperation
//#DoVoid API Operation
//#Void an order or an authorization.
public DoVoidResponseType DoVoidAPIOperation()
{
// Create the DoVoidResponseType object
DoVoidResponseType responseDoVoidResponseType = new DoVoidResponseType();
try
{
// Create the DoVoidReq object
DoVoidReq doVoid = new DoVoidReq();
// DoVoidRequest which takes mandatory params:
//
// * `Authorization ID` - Original authorization ID specifying the
// authorization to void or, to void an order, the order ID.
// `Important:
// If you are voiding a transaction that has been reauthorized, use the
// ID from the original authorization, and not the reauthorization.`
DoVoidRequestType doVoidRequest = new DoVoidRequestType("9B2288061E685550E");
doVoid.DoVoidRequest = doVoidRequest;
// Create the service wrapper object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
// # API call
// Invoke the DoVoid method in service wrapper object
responseDoVoidResponseType = service.DoVoid(doVoid);
if (responseDoVoidResponseType != null)
{
// Response envelope acknowledgement
string acknowledgement = "DoVoid API Operation - ";
acknowledgement += responseDoVoidResponseType.Ack.ToString();
logger.Info(acknowledgement + "\n");
Console.WriteLine(acknowledgement + "\n");
// # Success values
if (responseDoVoidResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
{
// Authorization identification number you specified in the request
logger.Info("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n");
Console.WriteLine("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n");
}
// # Error Values
else
{
List<ErrorType> errorMessages = responseDoVoidResponseType.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 responseDoVoidResponseType;
}