Пример #1
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 SmartException(T("Payment.CouldNotLoadMethod"));
            }

            try
            {
                return(paymentMethod.Value.CancelRecurringPayment(cancelPaymentRequest));
            }
            catch (NotSupportedException)
            {
                var result = new CancelRecurringPaymentResult();
                result.AddError(T("Common.Payment.NoRecurringPaymentSupport"));
                return(result);
            }
            catch
            {
                throw;
            }
        }
        /// <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);
        }