示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public Respbase <ThridPartyPayDto> ThridPartyPay_Pro(ThridPartyPayReq req)
        {
            if (!CheckSign(req.ReqTime, req.Sign))
            {
                return(new Respbase <ThridPartyPayDto> {
                    Result = -1, Message = PromptInfo.Message, Data = null
                });
            }

            TssoOpenUser openUser = db.TssoOpenUserSet.Where(c => c.Openid == req.Nodecode && c.Opentype == 4).FirstOrDefault();

            if (openUser == null)
            {
                return(new Respbase <ThridPartyPayDto> {
                    Result = -1, Message = "没有绑定PCN账号", Data = null
                });
            }

            PurseFactory purseFactory = new PurseFactory(wcfProxy);
            Purse        fromPurse    = new Purse(OwnerType.个人钱包, openUser.Nodeid, PurseType.现金钱包, CurrencyType.RMB, wcfProxy);
            Purse        toPurse      = purseFactory.SystemPurseRand(openUser.Nodeid);
            Currency     currency     = new Currency(CurrencyType.RMB, req.Amount);

            if (fromPurse.UsableBalance < currency.ConvertTo(fromPurse.CurrencyType).Amount)
            {
                log.Info("支付转账失败:余额不足," + fromPurse.UsableBalance);
                return(new Respbase <ThridPartyPayDto> {
                    Result = -1, Message = "余额不足", Data = null
                });
            }
            int            reasonid = 33180;//广州豪盾游戏充值
            TransferResult transferResult;

            transferResult = wcfProxy.Transfer(fromPurse, toPurse, currency, reasonid, req.Subject);
            if (!transferResult.IsSuccess)
            {
                log.Info("支付转账失败:" + transferResult.Message);
                return(new Respbase <ThridPartyPayDto> {
                    Result = -1, Message = "转账失败", Data = null
                });
            }

            if (PromptInfo.Result <= 0)
            {
                return(new Respbase <ThridPartyPayDto> {
                    Result = -1, Message = PromptInfo.Message
                });
            }
            return(new Respbase <ThridPartyPayDto> {
                Result = 1, Message = "成功", Data = new ThridPartyPayDto {
                    TransferId = transferResult.TransferId
                }
            });
        }
示例#2
0
        /// <summary>
        /// 第三方支付
        /// </summary>
        public Respbase <ThridPartyPayDto> ThridPartyPay(ThridPartyPayReq req)
        {
            BeginTransfer();
            var result = ThridPartyPay_Pro(req);

            if (result.Result <= 0)
            {
                EndTransfer(false);
                return(result);
            }

            EndTransfer(true);
            return(result);
        }
示例#3
0
        public Respbase <ThridPartyPayDto> ThridPartyPay(ThridPartyPayReq req)
        {
            var result = purseFacade.ThridPartyPay(req);

            return(result);
        }