Exemplo n.º 1
0
        /// <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 WorkException("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;
			}
        }