예제 #1
0
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     return(new CancelRecurringPaymentResult {
         Errors = new[] { "Recurring payment not supported" }
     });
 }
예제 #2
0
        public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
        {
            var result = new CancelRecurringPaymentResult();

            return(result);
        }
예제 #3
0
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     //always success
     return(new CancelRecurringPaymentResult());
 }
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>
 /// A task that represents the asynchronous operation
 /// The task result contains the result
 /// </returns>
 public Task <CancelRecurringPaymentResult> CancelRecurringPaymentAsync(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     return(Task.FromResult(new CancelRecurringPaymentResult {
         Errors = new[] { "Recurring payment not supported" }
     }));
 }
예제 #5
0
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     return(_paymentService.CancelRecurringPayment(cancelPaymentRequest));
 }
예제 #6
0
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     throw new System.NotImplementedException();
 }
예제 #7
0
 public override CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     return(new CancelRecurringPaymentResult());
 }
예제 #8
0
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     //always success (cancel only on PayPal site)
     return(new CancelRecurringPaymentResult());
 }
        /// <summary>
        /// Cancels a recurring payment
        /// </summary>
        /// <param name="recurringPayment">Recurring payment</param>
        public virtual async Task <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 = await _paymentService.CancelRecurringPayment(request);

                if (result.Success)
                {
                    //update recurring payment
                    recurringPayment.IsActive = false;
                    await _orderService.UpdateRecurringPayment(recurringPayment);

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

                    //notify a store owner
                    await _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));
            }


            //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
                await _orderService.InsertOrderNote(new OrderNote {
                    Note = string.Format("Unable to cancel recurring payment. {0}", error),
                    DisplayToCustomer = false,
                    CreatedOnUtc      = DateTime.UtcNow,
                    OrderId           = initialOrder.Id,
                });

                //log it
                string logError = string.Format("Error cancelling recurring payment. Order #{0}. Error: {1}", initialOrder.Id, error);
                await _logger.InsertLog(LogLevel.Error, logError, logError);
            }
            return(result.Errors);
        }
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest) => new CancelRecurringPaymentResult();
 public CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     var result = new CancelRecurringPaymentResult();
     result.AddError("Recurring payment not supported");
     return result;
 }
 /// <summary>
 /// Cancels a recurring payment
 /// </summary>
 /// <param name="cancelPaymentRequest">Request</param>
 /// <returns>
 /// A task that represents the asynchronous operation
 /// The task result contains the result
 /// </returns>
 public Task <CancelRecurringPaymentResult> CancelRecurringPaymentAsync(CancelRecurringPaymentRequest cancelPaymentRequest)
 {
     //always success
     return(Task.FromResult(new CancelRecurringPaymentResult()));
 }