/// <summary>
        /// Voids order (from admin panel)
        /// </summary>
        /// <param name="order">Order</param>
        /// <returns>Voided order</returns>
        public virtual IList<string> Void(Order order)
        {
            if (order == null)
                throw new ArgumentNullException("order");

            if (!CanVoid(order))
                throw new SmartException("Cannot do void for order.");

            var request = new VoidPaymentRequest();
            VoidPaymentResult result = null;
            try
            {
                request.Order = order;
                result = _paymentService.Void(request);

                if (result.Success)
                {
                    //update order info
                    order.PaymentStatus = result.NewPaymentStatus;
                    _orderService.UpdateOrder(order);

                    //add a note
                    order.OrderNotes.Add(new OrderNote()
                    {
                        Note = T("OrderVoided"),
                        DisplayToCustomer = false,
                        CreatedOnUtc = DateTime.UtcNow
                    });
                    _orderService.UpdateOrder(order);

                    //check order status
                    CheckOrderStatus(order);
                }
            }
            catch (Exception exc)
            {
                if (result == null)
                    result = new VoidPaymentResult();
                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
                order.OrderNotes.Add(new OrderNote()
                {
                    Note = string.Format(T("OrderVoidError"), error),
                    DisplayToCustomer = false,
                    CreatedOnUtc = DateTime.UtcNow
                });
                _orderService.UpdateOrder(order);

                //log it
                string logError = string.Format("Error voiding order '{0}'. Error: {1}", order.GetOrderNumber(), error);
                _logger.InsertLog(LogLevel.Error, logError, logError);
            }
            return result.Errors;
        }
        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public virtual VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var paymentMethod = LoadPaymentMethodBySystemName(voidPaymentRequest.Order.PaymentMethodSystemName);
            if (paymentMethod == null)
                throw new SmartException("Payment method couldn't be loaded");

			try
			{
				return paymentMethod.Value.Void(voidPaymentRequest);
			}
			catch (NotSupportedException)
			{
				var result = new VoidPaymentResult();
				result.AddError(_localizationService.GetResource("Common.Payment.NoVoidSupport"));
				return result;
			}
			catch
			{
				throw;
			}
        }
        public VoidPaymentResult Void(VoidPaymentRequest request)
        {
            var result = new VoidPaymentResult()
            {
                NewPaymentStatus = request.Order.PaymentStatus
            };

            // redundant... cause payment infrastructure hides "void" and displays "refund" instead.
            //if (request.Order.PaymentStatus == PaymentStatus.Paid)
            //{
            //	var refundRequest = new RefundPaymentRequest()
            //	{
            //		Order = request.Order,
            //		IsPartialRefund = false,
            //		AmountToRefund = request.Order.OrderTotal
            //	};

            //	var refundResult = Refund(refundRequest);

            //	result.Errors.AddRange(refundResult.Errors);
            //	return result;
            //}

            try
            {
                if (request.Order.PaymentStatus == PaymentStatus.Pending || request.Order.PaymentStatus == PaymentStatus.Authorized)
                {
                    var settings = _services.Settings.LoadSetting<AmazonPaySettings>(request.Order.StoreId);
                    var client = new AmazonPayClient(settings);

                    var orderAttribute = DeserializeOrderAttribute(request.Order);

                    _api.CancelOrderReference(client, orderAttribute.OrderReferenceId);
                }
            }
            catch (OffAmazonPaymentsServiceException exc)
            {
                LogAmazonError(exc, errors: result.Errors);
            }
            catch (Exception exc)
            {
                LogError(exc, errors: result.Errors);
            }
            return result;
        }
		/// <summary>
		/// Voids a payment
		/// </summary>
		/// <param name="voidPaymentRequest">Request</param>
		/// <returns>Result</returns>
		public virtual VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
		{
			throw Error.NotSupported();
		}
        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public virtual VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var paymentMethod = LoadPaymentMethodBySystemName(voidPaymentRequest.Order.PaymentMethodSystemName);
            if (paymentMethod == null)
                throw new SmartException(T("Payment.CouldNotLoadMethod"));

            try
            {
                return paymentMethod.Value.Void(voidPaymentRequest);
            }
            catch (NotSupportedException)
            {
                var result = new VoidPaymentResult();
                result.AddError(T("Common.Payment.NoVoidSupport"));
                return result;
            }
            catch
            {
                throw;
            }
        }
		/// <summary>
		/// Voids a payment
		/// </summary>
		/// <param name="voidPaymentRequest">Request</param>
		/// <returns>Result</returns>
		public virtual VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
		{
			var result = new VoidPaymentResult();
			result.AddError(T("Common.Payment.NoVoidSupport"));
			return result;
		}
 /// <summary>
 /// Voids a payment
 /// </summary>
 /// <param name="voidPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public override VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
 {
     var result = new VoidPaymentResult();
     result.AddError(_localizationService.GetResource("Common.Payment.NoVoidSupport"));
     return result;
 }
 /// <summary>
 /// Voids a payment
 /// </summary>
 /// <param name="voidPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public override VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
 {
     var result = new VoidPaymentResult();
     result.AddError("Void method not supported");
     return result;
 }
		public override VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
		{
			var result = _apiService.Void(voidPaymentRequest);
			return result;
		}
        public PayPalResponse Void(PayPalApiSettingsBase settings, PayPalSessionData session, VoidPaymentRequest request)
        {
            var path = "/v1/payments/authorization/{0}/void".FormatInvariant(request.Order.AuthorizationTransactionId);

            var result = CallApi("POST", path, session.AccessToken, settings, null);

            if (result.Success && result.Json != null)
            {
                result.Id = (string)result.Json.id;
            }

            return result;
        }
        /// <summary>
        /// Voids order (from admin panel)
        /// </summary>
        /// <param name="order">Order</param>
        /// <returns>Voided order</returns>
        public virtual IList<string> Void(Order order)
        {
            if (order == null)
                throw new ArgumentNullException("order");

            if (!CanVoid(order))
                throw new SmartException(T("Order.CannotVoid"));

            var request = new VoidPaymentRequest();
            VoidPaymentResult result = null;

            try
            {
                request.Order = order;
                result = _paymentService.Void(request);

                if (result.Success)
                {
                    //update order info
                    order.PaymentStatus = result.NewPaymentStatus;

                    _orderService.UpdateOrder(order);

                    _orderService.AddOrderNote(order, T("Admin.OrderNotice.OrderVoided"));

                    //check order status
                    CheckOrderStatus(order);
                }
            }
            catch (Exception exception)
            {
                if (result == null)
                {
                    result = new VoidPaymentResult();
                }

                result.AddError(exception.ToAllMessages());
            }

            ProcessErrors(order, result.Errors, "Admin.OrderNotice.OrderVoidError");

            return result.Errors;
        }