Ejemplo n.º 1
0
        public ResultDto Refund(RefundVo model)
        {
            var result = new ResultDto();

            var mallDac = new MallPaymentOrderDAC();
            var order   = mallDac.GetByOrderId(model.OrderId);

            if (order.Status != OrderStatus.Completed)
            {
                result.Code    = OrderNoTrade;
                result.Message = Resource.OrderNoTrade;
                return(result);
            }

            if (order.Status == OrderStatus.Refunded)
            {
                result.Code    = RefundedError;
                result.Message = Resource.RefundedError;
                return(result);
            }

            if (order.CryptoAmount != model.CryptoAmount)
            {
                result.Code    = TradeAmountError;
                result.Message = Resource.TradeAmountError;
                return(result);
            }

            RabbitMQSender.SendMessage("PaymentGatewayRefund", order);

            result.Message = Resource.Success;
            return(result);
        }
Ejemplo n.º 2
0
        public ResultDto Refund(RefundVo model)
        {
            var result = new ResultDto();

            if (!ModelState.IsValid)
            {
                result.Code = Param_Error;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            return(new OrderComponent().Refund(model));
        }