当前位置: 首页>>代码示例>>C#>>正文


C# Payments.CancelRecurringPaymentRequest类代码示例

本文整理汇总了C#中Nop.Services.Payments.CancelRecurringPaymentRequest的典型用法代码示例。如果您正苦于以下问题:C# CancelRecurringPaymentRequest类的具体用法?C# CancelRecurringPaymentRequest怎么用?C# CancelRecurringPaymentRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CancelRecurringPaymentRequest类属于Nop.Services.Payments命名空间,在下文中一共展示了CancelRecurringPaymentRequest类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CancelRecurringPayment

        /// <summary>
        /// Cancels a recurring payment
        /// </summary>
        /// <param name="cancelPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public virtual CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
        {
            if (cancelPaymentRequest.Order.OrderTotal == decimal.Zero)
                return new CancelRecurringPaymentResult();

            var paymentMethod = LoadPaymentMethodBySystemName(cancelPaymentRequest.Order.PaymentMethodSystemName);
            if (paymentMethod == null)
                throw new NopException("Payment method couldn't be loaded");
            return paymentMethod.CancelRecurringPayment(cancelPaymentRequest);
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:15,代码来源:PaymentService.cs

示例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();
     result.AddError("Recurring payment not supported");
     return result;
 }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:11,代码来源:CheckMoneyOrderPaymentProcessor.cs

示例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();
            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;
        }
开发者ID:NALSS,项目名称:grandnode,代码行数:30,代码来源:PayPalDirectPaymentProcessor.cs

示例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;
        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:45,代码来源:PayPalDirectPaymentProcessor.cs

示例5: CancelRecurringPayment

        /// <summary>
        /// Cancels a recurring payment
        /// </summary>
        /// <param name="recurringPayment">Recurring payment</param>
        public virtual IList<string> CancelRecurringPayment(RecurringPayment recurringPayment)
        {
            if (recurringPayment == null)
                throw new ArgumentNullException("recurringPayment");

            var initialOrder = recurringPayment.InitialOrder;
            if (initialOrder == null)
                return new List<string> { "Initial order could not be loaded" };

            var request = new CancelRecurringPaymentRequest();
            CancelRecurringPaymentResult result = null;
            try
            {
                request.Order = initialOrder;
                result = _paymentService.CancelRecurringPayment(request);
                if (result.Success)
                {
                    //update recurring payment
                    recurringPayment.IsActive = false;
                    _orderService.UpdateRecurringPayment(recurringPayment);

                    //add a note
                    initialOrder.OrderNotes.Add(new OrderNote
                    {
                        Note = "Recurring payment has been cancelled",
                        DisplayToCustomer = false,
                        CreatedOnUtc = DateTime.UtcNow
                    });
                    _orderService.UpdateOrder(initialOrder);

                    //notify a store owner
                    _workflowMessageService
                        .SendRecurringPaymentCancelledStoreOwnerNotification(recurringPayment,
                        _localizationSettings.DefaultAdminLanguageId);
                }
            }
            catch (Exception exc)
            {
                if (result == null)
                    result = new CancelRecurringPaymentResult();
                result.AddError(string.Format("Error: {0}. Full exception: {1}", exc.Message, exc.ToString()));
            }

            //process errors
            string error = "";
            for (int i = 0; i < result.Errors.Count; i++)
            {
                error += string.Format("Error {0}: {1}", i, result.Errors[i]);
                if (i != result.Errors.Count - 1)
                    error += ". ";
            }
            if (!String.IsNullOrEmpty(error))
            {
                //add a note
                initialOrder.OrderNotes.Add(new OrderNote
                {
                    Note = string.Format("Unable to cancel recurring payment. {0}", error),
                    DisplayToCustomer = false,
                    CreatedOnUtc = DateTime.UtcNow
                });
                _orderService.UpdateOrder(initialOrder);

                //log it
                string logError = string.Format("Error cancelling recurring payment. Order #{0}. Error: {1}", initialOrder.Id, error);
                _logger.InsertLog(LogLevel.Error, logError, logError);
            }
            return result.Errors;
        }
开发者ID:LaOrigin,项目名称:Leorigin,代码行数:72,代码来源:OrderProcessingService.cs

示例6: CancelRecurringPayment

 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     //always success
     return new CancelRecurringPaymentResult();
 }
开发者ID:cmcginn,项目名称:StoreFront,代码行数:10,代码来源:ManualPaymentProcessor.cs

示例7: 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;
        }
开发者ID:Rustemt,项目名称:Nopcommerce-with-Couchbase,代码行数:32,代码来源:AuthorizeNetPaymentProcessor.cs

示例8: CancelRecurringPayment

 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     
     return null;
 }
开发者ID:vivian-ho,项目名称:nopstripe,代码行数:10,代码来源:StripePaymentProcessor.cs

示例9: CancelRecurringPayment

 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     throw new Exception("not implemented");
 }
开发者ID:JacobSteelsmith,项目名称:heartland-nopcommerce-plugin,代码行数:9,代码来源:SecureSubmitPaymentProcessor.cs

示例10: CancelRecurringPayment

 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     throw new NotImplementedException();
 }
开发者ID:mhsohail,项目名称:Livetameion_3.7,代码行数:4,代码来源:PluginConfig.cs


注:本文中的Nop.Services.Payments.CancelRecurringPaymentRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。