コード例 #1
0
ファイル: OrderComponent.cs プロジェクト: BryceStory/BS.FPApp
        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);
        }
コード例 #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));
        }