Ejemplo n.º 1
0
        /// <summary>
        /// Cancels a recurring payment
        /// </summary>
        /// <param name="cancelPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public virtual CancelRecurringPaymentResult CancelRecurringPayment(CancelRecurringPaymentRequest cancelPaymentRequest)
        {
            var result = new CancelRecurringPaymentResult();

            result.AddError(T("Common.Payment.NoRecurringPaymentSupport"));
            return(result);
        }
Ejemplo n.º 2
0
        /// <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 WorkException("Payment method couldn't be loaded");
            }

            try
            {
                return(paymentMethod.Value.CancelRecurringPayment(cancelPaymentRequest));
            }
            catch (NotSupportedException)
            {
                var result = new CancelRecurringPaymentResult();
                result.AddError(_localizationService.GetResource("Common.Payment.NoRecurringPaymentSupport"));
                return(result);
            }
            catch
            {
                throw;
            }
        }