當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。