本文整理匯總了C#中Nop.Services.Payments.CancelRecurringPaymentResult.AddError方法的典型用法代碼示例。如果您正苦於以下問題:C# CancelRecurringPaymentResult.AddError方法的具體用法?C# CancelRecurringPaymentResult.AddError怎麽用?C# CancelRecurringPaymentResult.AddError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nop.Services.Payments.CancelRecurringPaymentResult
的用法示例。
在下文中一共展示了CancelRecurringPaymentResult.AddError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CancelRecurringPayment
/// <summary>
/// Cancels a recurring payment
/// </summary>
/// <param name="cancelPaymentRequest">Request</param>
/// <returns>Result</returns>
public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
{
var result = new CancelRecurringPaymentResult();
result.AddError("Recurring payment not supported");
return result;
}
示例2: CancelRecurringPayment
/// <summary>
/// Cancels a recurring payment
/// </summary>
/// <param name="cancelPaymentRequest">Request</param>
/// <returns>Result</returns>
public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
{
var result = new CancelRecurringPaymentResult();
var order = cancelPaymentRequest.Order;
var req = new ManageRecurringPaymentsProfileStatusReq();
req.ManageRecurringPaymentsProfileStatusRequest = new ManageRecurringPaymentsProfileStatusRequestType();
req.ManageRecurringPaymentsProfileStatusRequest.Version = GetApiVersion();
var details = new ManageRecurringPaymentsProfileStatusRequestDetailsType();
req.ManageRecurringPaymentsProfileStatusRequest.ManageRecurringPaymentsProfileStatusRequestDetails = details;
details.Action = StatusChangeActionType.CANCEL;
//Recurring payments profile ID returned in the CreateRecurringPaymentsProfile response
details.ProfileID = order.SubscriptionTransactionId;
var service = GetService();
var response = service.ManageRecurringPaymentsProfileStatus(req);
string error;
if (!PaypalHelper.CheckSuccess(response, out error))
{
result.AddError(error);
}
return result;
}
示例3: CancelRecurringPayment
/// <summary>
/// Cancels a recurring payment
/// </summary>
/// <param name="cancelPaymentRequest">Request</param>
/// <returns>Result</returns>
public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
{
var result = new CancelRecurringPaymentResult();
long subscriptionId;
long.TryParse(cancelPaymentRequest.Order.SubscriptionTransactionId, out subscriptionId);
using (var webService = new net.authorize.api.Service())
{
if (_authorizeNetPaymentSettings.UseSandbox)
webService.Url = "https://apitest.authorize.net/soap/v1/Service.asmx";
else
webService.Url = "https://api.authorize.net/soap/v1/Service.asmx";
var authentication = PopulateMerchantAuthentication();
var response = webService.ARBCancelSubscription(authentication, subscriptionId);
if (response.resultCode == MessageTypeEnum.Ok)
{
//ok
}
else
{
result.AddError("Error cancelling subscription, please contact customer support. " + GetErrors(response));
}
}
return result;
}
示例4: CancelRecurringPayment
/// <summary>
/// Cancels a recurring payment
/// </summary>
/// <param name="cancelPaymentRequest">Request</param>
/// <returns>Result</returns>
public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
{
var result = new CancelRecurringPaymentResult();
var order = cancelPaymentRequest.Order;
var req = new ManageRecurringPaymentsProfileStatusReq();
req.ManageRecurringPaymentsProfileStatusRequest = new ManageRecurringPaymentsProfileStatusRequestType();
req.ManageRecurringPaymentsProfileStatusRequest.Version = GetApiVersion();
var details = new ManageRecurringPaymentsProfileStatusRequestDetailsType();
req.ManageRecurringPaymentsProfileStatusRequest.ManageRecurringPaymentsProfileStatusRequestDetails = details;
details.Action = StatusChangeActionType.Cancel;
//Recurring payments profile ID returned in the CreateRecurringPaymentsProfile response
details.ProfileID = order.SubscriptionTransactionId;
using (var service2 = new PayPalAPIAASoapBinding())
{
if (!_paypalDirectPaymentSettings.UseSandbox)
service2.Url = "https://api-3t.paypal.com/2.0/";
else
service2.Url = "https://api-3t.sandbox.paypal.com/2.0/";
service2.RequesterCredentials = new CustomSecurityHeaderType();
service2.RequesterCredentials.Credentials = new UserIdPasswordType();
service2.RequesterCredentials.Credentials.Username = _paypalDirectPaymentSettings.ApiAccountName;
service2.RequesterCredentials.Credentials.Password = _paypalDirectPaymentSettings.ApiAccountPassword;
service2.RequesterCredentials.Credentials.Signature = _paypalDirectPaymentSettings.Signature;
service2.RequesterCredentials.Credentials.Subject = "";
var response = service2.ManageRecurringPaymentsProfileStatus(req);
string error = "";
if (!PaypalHelper.CheckSuccess(response, out error))
{
result.AddError(error);
}
}
return result;
}