Beispiel #1
0
        /// <summary>
        /// 根据节点获取节点配置信息
        /// </summary>
        /// <param name="item">节点</param>
        /// <returns></returns>
        private static PaymentMode GetPaymentMode(XElement item)
        {
            PaymentMode paymentMode = new PaymentMode();

            paymentMode.Id                   = item.Attribute("id").Value;
            paymentMode.Name                 = item.Attribute("name").Value;
            paymentMode.RequestType          = GetElementValue(item, "requestType");
            paymentMode.ChargeProcessor      = GetElementValue(item, "chargeProcessor");
            paymentMode.PaymentUrl           = GetElementValue(item, "paymentUrl");
            paymentMode.PaymentBgCallbackUrl = GetElementValue(item, "paymentBgCallbackUrl");
            paymentMode.PaymentCallbackUrl   = GetElementValue(item, "paymentCallbackUrl");
            paymentMode.RefundUrl            = GetElementValue(item, "refundUrl");
            paymentMode.RefundCallbackUrl    = GetElementValue(item, "refundCallbackUrl");
            paymentMode.BankCert             = GetElementValue(item, "bankCert");
            paymentMode.BankCertKey          = GetElementValue(item, "bankCertKey");

            paymentMode.CustomConfigs = new Dictionary <string, string>();
            foreach (XElement customNode in item.Element("customConfigs").Elements("customConfig"))
            {
                paymentMode.CustomConfigs[customNode.Attribute("name").Value] = customNode.Value;
            }

            paymentMode.Debug = GetElementValue(item, "debug");

            paymentMode.MerchantList = new List <PaymentModeMerchant>();
            foreach (XElement node in item.Element("merchants").Elements("merchant"))
            {
                PaymentModeMerchant merchant = new PaymentModeMerchant();
                merchant.MerchantSysNo   = int.Parse(GetElementValue(node, "merchantSysNo"));
                merchant.MerchantNO      = GetElementValue(node, "merchantNO");
                merchant.MerchantCert    = GetElementValue(node, "merchantCert");
                merchant.MerchantCertKey = GetElementValue(node, "merchantCertKey");
                merchant.CurCode         = GetElementValue(node, "curCode");
                merchant.Encoding        = GetElementValue(node, "encoding");
                merchant.CustomConfigs   = new Dictionary <string, string>();
                foreach (XElement customNode in node.Element("customConfigs").Elements("customConfig"))
                {
                    merchant.CustomConfigs[customNode.Attribute("name").Value] = customNode.Value;
                }
                paymentMode.MerchantList.Add(merchant);
            }

            return(paymentMode);
        }
Beispiel #2
0
        private void UpdatePayment(int soSysNo, List <PaymentModeMerchant> paymentModeMerchants)
        {
            var customsInfo             = ShoppingOrderDA.LoadVendorCustomsInfo(soSysNo);
            PaymentModeMerchant payInfo = paymentModeMerchants.FirstOrDefault(p => p.MerchantSysNo == customsInfo.MerchantSysNo);

            if (payInfo == null)
            {
                payInfo = new PaymentModeMerchant();
                payInfo.MerchantSysNo = customsInfo.MerchantSysNo;
                payInfo.Encoding      = "utf-8";
                paymentModeMerchants.Add(payInfo);
            }
            payInfo.MerchantNO      = customsInfo.CBTMerchantCode;
            payInfo.PayCurrencyCode = customsInfo.PayCurrencyCode;
            payInfo.MerchantCertKey = customsInfo.EasiPaySecretKey;
            payInfo.CBTREC_NCode    = customsInfo.CBTREC_NCode;
            payInfo.CBTSRC_NCode    = customsInfo.CBTSRC_NCode;
            payInfo.CurCode         = customsInfo.ReceiveCurrencyCode;
            payInfo.MerchantName    = customsInfo.CBTMerchantName;
        }