Exemplo n.º 1
0
 internal void PaySuccess(string payAccount, string payTradeNo, PayInterface payInterface, PayAccountType payAccountType, DateTime payTime, string channelTradeNo)
 {
     Tradement.PaySuccess(payAccount, payTradeNo, payInterface, payAccountType, channelTradeNo);
     Applier.TradeSuccess(payTime);
     Applier.Owner.Account = payAccount;
     Accepter.TradeSuccess(payTime);
 }
Exemplo n.º 2
0
 internal string GetPayInterfaceValue(PayInterface payInterface) {
     if(PayInterfaces.ContainsKey(payInterface)) {
         return PayInterfaces[payInterface];
     } else {
         throw new NotSupportedException();
     }
 }
Exemplo n.º 3
0
    static void Main(string[] args)
    {
        System.Console.WriteLine("Welcome to the Main method of the GCD program.");
        PayInterface payapp = new PayInterface();

        Application.Run(payapp);
        System.Console.WriteLine("Main method will now shutdown.");
    } //End of Main
Exemplo n.º 4
0
 internal void PaySuccess(string payAccount, string tradeNo, PayInterface payInterface, PayAccountType payAccountType, string channelTradeNo)
 {
     PayAccount     = payAccount;
     TradeNo        = tradeNo;
     IsPoolpay      = payInterface == DataTransferObject.Common.PayInterface.Virtual;
     PayInterface   = payInterface;
     PayAccountType = payAccountType;
     ChannelTradeNo = channelTradeNo;
 }
Exemplo n.º 5
0
    static void LoadPayService(string serviceName)
    {
        if (serviceName == "null")
        {
            return;
        }

        Type serviceType = Type.GetType(serviceName);

        s_payService = (PayInterface)Activator.CreateInstance(serviceType);

        s_payService.m_callBack = PayCallBack;
    }
Exemplo n.º 6
0
        /// <summary>
        /// 当前对象名称是否重名
        /// </summary>
        /// <param name="entity">业务实体</param>
        /// <returns></returns>
        public PayInterface PayIsExist(int orgid, PayInterface entity)
        {
            PayInterface mm = null;
            WhereClip    wc = new WhereClip();

            if (orgid > -1)
            {
                wc.And(PayInterface._.Org_ID == orgid);
            }
            mm = Gateway.Default.From <PayInterface>()
                 .Where(PayInterface._.Org_ID == orgid && PayInterface._.Pai_Name == entity.Pai_Name && PayInterface._.Pai_ID != entity.Pai_ID)
                 .ToFirst <PayInterface>();
            return(mm);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">业务实体</param>
        public void PayAdd(PayInterface entity)
        {
            if (entity.Org_ID < 1)
            {
                Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
                if (org != null)
                {
                    entity.Org_ID = org.Org_ID;
                }
            }
            //添加对象,并设置排序号
            object obj = Gateway.Default.Max <PayInterface>(PayInterface._.Pai_Tax, PayInterface._.Pai_Tax > -1 && PayInterface._.Org_ID == entity.Org_ID);

            entity.Pai_Tax = obj is int?(int)obj + 1 : 1;
            Gateway.Default.Save <PayInterface>(entity);
        }
Exemplo n.º 8
0
    static void LoadService(SchemeData data)
    {
        s_loginService = (LoginInterface)AnalysisConfig(data.LoginScheme);
        s_ADService    = (ADInterface)AnalysisConfig(data.ADScheme);
        s_payService   = (PayInterface)AnalysisConfig(data.PayScheme);

        s_logServiceList = new List <LogInterface>();
        for (int i = 0; i < data.LogScheme.Count; i++)
        {
            s_logServiceList.Add((LogInterface)AnalysisConfig(data.LogScheme[i]));
        }

        s_otherServiceList = new List <OtherSDKInterface>();
        for (int i = 0; i < data.OtherScheme.Count; i++)
        {
            s_otherServiceList.Add((OtherSDKInterface)AnalysisConfig(data.OtherScheme[i]));
        }
    }
Exemplo n.º 9
0
        /// <summary>
        /// 将当前项目向下移动;仅在当前对象的同层移动,即同一父节点下的对象这前移动;
        /// </summary>
        /// <param name="id"></param>
        /// <returns>如果已经处于顶端,则返回false;移动成功,返回true</returns>
        public bool PayRemoveDown(int id)
        {
            //当前对象
            PayInterface current = Gateway.Default.From <PayInterface>().Where(PayInterface._.Pai_ID == id).ToFirst <PayInterface>();
            //当前对象排序号
            int orderValue = (int)current.Pai_Tax;
            //下一个对象,即弟弟对象;
            PayInterface down = Gateway.Default.From <PayInterface>().Where(PayInterface._.Pai_Tax > orderValue)
                                .OrderBy(PayInterface._.Pai_Tax.Asc).ToFirst <PayInterface>();

            if (down == null)
            {
                return(false);
            }
            //交换排序号
            current.Pai_Tax = down.Pai_Tax;
            down.Pai_Tax    = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <PayInterface>(current);
                    tran.Save <PayInterface>(down);
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
            return(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 将当前项目向上移动;仅在当前对象的同层移动,即同一父节点下的对象这前移动;
        /// </summary>
        /// <param name="id"></param>
        /// <returns>如果已经处于顶端,则返回false;移动成功,返回true</returns>
        public bool PayRemoveUp(int orgid, int id)
        {
            //当前对象
            PayInterface current = Gateway.Default.From <PayInterface>().Where(PayInterface._.Pai_ID == id).ToFirst <PayInterface>();
            //当前对象排序号
            int orderValue = (int)current.Pai_Tax;;
            //上一个对象,即兄长对象;
            PayInterface up = Gateway.Default.From <PayInterface>().Where(PayInterface._.Org_ID == orgid && PayInterface._.Pai_Tax < orderValue)
                              .OrderBy(PayInterface._.Pai_Tax.Desc).ToFirst <PayInterface>();

            if (up == null)
            {
                return(false);
            }
            //交换排序号
            current.Pai_Tax = up.Pai_Tax;
            up.Pai_Tax      = orderValue;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <PayInterface>(current);
                    tran.Save <PayInterface>(up);
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
            return(true);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 采购支付改期费成功
        /// </summary>
        /// <param name="postponeApplyformId">改期申请单号</param>
        /// <param name="payAccount">支付账号</param>
        /// <param name="payTradeNo">支付交易流水号</param>
        /// <param name="payInterface">支付接口</param>
        /// <param name="payAccountType">支付账号类型</param>
        /// <param name="payTime">支付时间</param>
        public static Distribution.Domain.Bill.Pay.PostponePayBill PurchaserPaySuccessForPostpone(decimal postponeApplyformId, string payAccount, string payTradeNo, PayInterface payInterface, PayAccountType payAccountType, DateTime payTime, string channelTradeNo)
        {
            var payBill = DistributionQueryService.QueryPostponePayBill(postponeApplyformId);

            if (payBill == null)
            {
                throw new NotFoundException("无 " + postponeApplyformId + " 的记录");
            }
            payBill.PaySuccess(payAccount, payTradeNo, payInterface, payAccountType, payTime, channelTradeNo);
            return(payBill);
        }
Exemplo n.º 12
0
        public RequestResult <AutoPayResult> AutoPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            RequestResult <AutoPayResult> result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var platform = new IBEService {
                    Url = Platform.Address
                };
                var amountText        = amount.ToString("F2");
                var payInterfaceValue = Platform.GetPayInterfaceValue(payInterface);
                var signValue         = new Dictionary <string, string>
                {
                    { "userName", Platform.UserName },
                    { "orderid", externalOrderId },
                    { "totalPrice", amountText },
                    { "payPlatform", payInterfaceValue },
                    { "pay_notify_url", Platform.NotifyUrl },
                    { "out_notify_url", Platform.NotifyUrl }
                };
                var signText = Sign(externalOrderId + Platform.NotifyUrl + payInterfaceValue + Platform.NotifyUrl + amountText + Platform.UserName);
                request  = GetRequestValue(signValue, signText);
                response = platform.PayOut(Platform.UserName, externalOrderId, amountText, payInterfaceValue, Platform.NotifyUrl, Platform.NotifyUrl, signText);
                result   = parseAutoPayResponse(response);
                if (result.Success)
                {
                    result.Result.Id = orderId;
                    result.Result.Payment.PayInterface = payInterface;
                    result.Result.Payment.IsAutoPay    = true;
                    result.Result.Payment.PayTime      = DateTime.Now;
                }
            } catch (Exception ex) {
                result = new RequestResult <AutoPayResult> {
                    Success    = false,
                    ErrMessage = ex.Message == "The operation has timed out"?"代扣超时,请稍后再试!":"系统错误,请联系平台"
                };
                LogService.SaveExceptionLog(ex, "易行" + payInterface.GetDescription() + "代扣");
                response = ex.Message;
            }
            SaveRequestLog(response, request, "代扣");
            return(result);
        }
Exemplo n.º 13
0
        public RequestResult <string> ManualPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            RequestResult <string> result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var platform = new IBEService {
                    Url = Platform.Address
                };
                var amountText        = amount.ToString("F2");
                var payInterfaceValue = Platform.GetPayInterfaceValue(payInterface);
                var signValue         = new Dictionary <string, string>
                {
                    { "userName", Platform.UserName },
                    { "orderid", externalOrderId },
                    { "totalPrice", amountText },
                    { "payPlatform", payInterfaceValue },
                    { "pay_notify_url", Platform.NotifyUrl },
                    { "out_notify_url", Platform.NotifyUrl }
                };
                var signText = Sign(externalOrderId + Platform.NotifyUrl + payInterfaceValue + Platform.NotifyUrl + amountText + Platform.UserName);
                request  = GetRequestValue(signValue, signText);
                response = platform.Pay(Platform.UserName, externalOrderId, amountText, payInterfaceValue, Platform.NotifyUrl, Platform.NotifyUrl, signText);
                result   = parseManualPayResponse(response);
            } catch (Exception ex) {
                result = new RequestResult <string> {
                    Success    = false,
                    ErrMessage = "系统错误,请联系平台"
                };
                LogService.SaveExceptionLog(ex, "易行" + payInterface.GetDescription() + "手动支付");
                response = ex.Message;
            }
            SaveRequestLog(response, request, "手动支付");
            return(result);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取手动支付地址
        /// </summary>
        public static RequestResult <string> GetPayUrl(Common.Enums.PlatformType platformType, decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            if (string.IsNullOrWhiteSpace(externalOrderId))
            {
                throw new ArgumentNullException("externalOrderId");
            }

            var platform = Processor.PlatformBase.GetPlatform(platformType);

            if (platform.SuportManualPay())
            {
                var processor = platform.GetOrderProcessor();
                return(processor.ManualPay(orderId, externalOrderId, payInterface, amount));
            }
            else
            {
                return(new RequestResult <string> {
                    Success = false,
                    ErrMessage = "不支持手动支付,请到" + platform.PlatformInfo.GetDescription() + "平台进行支付"
                });
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void PayDelete(PayInterface entity)
 {
     Gateway.Default.Delete <PayInterface>(entity);
 }
Exemplo n.º 16
0
        public RequestResult <string> ManualPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            RequestResult <string> result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var requestModel = new _51bookManualPay.getPaymentUrlRequest {
                    agencyCode = Platform.UserName,
                    orderNo    = externalOrderId,
                    payType    = Platform.GetPayInterfaceValue(payInterface),
                    payBank    = string.Empty
                };
                var signValue = new Dictionary <string, string>
                {
                    { "agencyCode", Platform.UserName },
                    { "orderNo", requestModel.orderNo },
                    { "payType", requestModel.payType },
                    { "payBank", requestModel.payBank }
                };
                requestModel.sign = Sign(signValue);
                var platform = new _51bookManualPay.GetPaymentUrlServiceImpl_1_0Service {
                    Url = Platform.Address_ManualPayOrder
                };
                request = GetModelString(requestModel);
                var responseModel = platform.getPaymentUrl(requestModel);
                response = GetModelString(responseModel);
                result   = parseManualPayResponse(responseModel);
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "51book" + payInterface.GetDescription() + "手动支付");
                result = new RequestResult <string> {
                    Success    = false,
                    ErrMessage = "系统错误,请联系平台"
                };
                response = ex.Message;
            }
            SaveRequestLog(response, request, "手动支付");
            return(result);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 采购支付订单金额成功
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="account">支付账号</param>
        /// <param name="payTradeNo">支付交易流水号</param>
        /// <param name="payInterface">支付接口</param>
        /// <param name="payAccountType">支付账号类型</param>
        /// <param name="payTime">支付时间</param>
        public static Distribution.Domain.Bill.Pay.NormalPayBill PurchaserPaySuccessForOrder(decimal orderId, string account, string payTradeNo, PayInterface payInterface, PayAccountType payAccountType, DateTime payTime, string channelTradeNo)
        {
            var payBill = DistributionQueryService.QueryNormalPayBill(orderId);

            if (payBill == null)
            {
                throw new NotFoundException("无 " + orderId + " 的记录");
            }
            payBill.PaySuccess(account, payTradeNo, payInterface, payAccountType, payTime, channelTradeNo);
            return(payBill);
        }
Exemplo n.º 18
0
 public RequestResult <string> ManualPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 19
0
        public RequestResult <AutoPayResult> AutoPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            RequestResult <AutoPayResult> result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var signValue = new Dictionary <string, string>
                {
                    { "orderid", externalOrderId },
                    { "amount", amount.ToString("F2") }
                };
                request = GetRequest("pay_order", signValue);
                var platform = new _517Na.BenefitInterface {
                    Url             = Platform.Address,
                    Timeout         = Platform.Timeout,
                    RequestEncoding = Platform.Encoding
                };
                response = platform.InterfaceFacade(request);
                result   = parseAutoPayResponse(response);
                if (result.Success)
                {
                    result.Result.Id                   = orderId;
                    result.Result.ExternalId           = externalOrderId;
                    result.Result.Payment.PayInterface = payInterface;
                    result.Result.Payment.IsAutoPay    = true;
                    result.Result.Payment.PayTime      = DateTime.Now;
                }
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "517Na代扣");
                result = new RequestResult <AutoPayResult> {
                    Success    = false,
                    ErrMessage = ex.Message == "The operation has timed out" ? "代扣超时,请稍后再试!" : "系统错误,请联系平台"
                };
                response = ex.Message;
            }
            SaveRequestLog(response, request, "代扣");
            return(result);
        }
Exemplo n.º 20
0
 /// <summary>
 /// 自动支付
 /// </summary>
 public static RequestResult <AutoPayResult> Pay(Common.Enums.PlatformType platformType, decimal orderId, string externalOrderId, decimal amount, PayInterface payInterface)
 {
     return(Pay(platformType, orderId, externalOrderId, amount, new[] { payInterface }));
 }
Exemplo n.º 21
0
        static bool OrderPaySuccess(decimal orderId, string payAccount, string payTradeNo, string channelTradeNo, DateTime payTime, PayInterface payInterface, PayAccountType payAccountType, string operatorAccount)
        {
            var result  = false;
            var request = string.Format("订单:{0} 支付账号:{1} 流水号:{2} 支付时间:{3} 支付接口:{4} 支付账号类型:{5} 操作员账号:{6} 通道流水号:{7} ",
                                        orderId, payAccount, payTradeNo, payTime, payInterface.GetDescription(), payAccountType.GetDescription(), operatorAccount, channelTradeNo);
            var response = string.Empty;

            try {
                OrderProcessService.PaySuccess(orderId, payAccount, payTradeNo, channelTradeNo, payTime, payInterface, payAccountType, operatorAccount);
                result   = true;
                response = "处理成功";
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "订单支付通知 " + request);
                response = "处理失败 " + ex.Message;
            }
            var tradementLog = new Log.Domain.TradementLog {
                OrderId  = orderId,
                Request  = request,
                Response = response,
                Time     = DateTime.Now,
                Remark   = "支付成功通知",
            };

            LogService.SaveTradementLog(tradementLog);
            return(result);
        }
Exemplo n.º 22
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void PaySave(PayInterface entity)
 {
     Gateway.Default.Save <PayInterface>(entity);
 }
Exemplo n.º 23
0
        static bool PostponeApplyformPaySuccess(decimal applyformId, string payAccount, string payTradeNo, string channelTradeNo, DateTime payTime, PayInterface payInterface, PayAccountType payAccountType, string account)
        {
            var     result  = false;
            decimal?orderId = null;
            var     request = string.Format("申请单:{0} 支付账号:{1} 流水号:{2} 支付时间:{3} 支付接口:{4} 支付账号类型:{5} 操作员账号:{6}  通道流水号:{7} ",
                                            applyformId, payAccount, payTradeNo, payTime, payInterface.GetDescription(), payAccountType.GetDescription(), account, channelTradeNo);
            var response = string.Empty;

            try {
                orderId  = ApplyformProcessService.PostponeFeePaySuccess(applyformId, payAccount, payTradeNo, channelTradeNo, payTime, payInterface, payAccountType, account);
                result   = true;
                response = "处理成功";
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "申请单支付通知 " + request);
                response = "处理失败 " + ex.Message;
            }
            if (orderId.HasValue)
            {
                var tradementLog = new Log.Domain.TradementLog {
                    OrderId     = orderId.Value,
                    ApplyformId = applyformId,
                    Request     = request,
                    Response    = response,
                    Time        = DateTime.Now,
                    Remark      = "支付成功通知"
                };
                LogService.SaveTradementLog(tradementLog);
            }
            return(result);
        }
Exemplo n.º 24
0
        public RequestResult <DataTransferObject.Order.External.AutoPayResult> AutoPay(decimal orderId, string externalOrderId, PayInterface payInterface, decimal amount)
        {
            RequestResult <DataTransferObject.Order.External.AutoPayResult> result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var requestModel = new _51bookAutoPay.payRequest {
                    agencyCode     = Platform.UserName,
                    orderNo        = externalOrderId,
                    payType        = "1",
                    payerLoginName = Platform.UserName,
                    param1         = Platform.GetPayInterfaceValue(payInterface)
                };
                var signValue = new Dictionary <string, string>
                {
                    { "agencyCode", Platform.UserName },
                    { "orderNo", requestModel.orderNo },
                    { "payerLoginName", requestModel.payerLoginName },
                    { "payType", requestModel.payType }
                };
                requestModel.sign = Sign(signValue);
                var platform = new _51bookAutoPay.PayServiceImpl_1_0Service {
                    Url = Platform.Address_AutoPayOrder
                };
                request = GetModelString(requestModel);
                var responseModel = platform.pay(requestModel);
                response = GetModelString(responseModel);
                result   = parseAutoPayResponse(responseModel);
                if (result.Success)
                {
                    result.Result.Id = orderId;
                    result.Result.Payment.PayInterface = payInterface;
                    result.Result.Payment.IsAutoPay    = true;
                }
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "51book" + payInterface.GetDescription() + "代扣");
                result = new RequestResult <DataTransferObject.Order.External.AutoPayResult> {
                    Success    = false,
                    ErrMessage = ex.Message == "The operation has timed out" ? "代扣超时,请稍后再试!" : "系统错误,请联系平台"
                };
                response = ex.Message;
            }
            SaveRequestLog(response, request, "代扣");
            return(result);
        }