Ejemplo n.º 1
0
        //卡號先加密
        public static DataModel setCardEncrypt(DataModel data)
        {
            if (data.card != null)
            {
                if (data.card.cardNo != null)
                {
                    //卡別
                    int    cardNum  = Convert.ToInt32(data.card.cardNo.Substring(0, 3));
                    string cardType = data.card.cardNo.Substring(0, 1) == "4" ? "VISA" : data.card.cardNo.Substring(0, 1) == "5" ? "MASTER" :
                                      data.card.cardNo.Substring(0, 1) == "1" && data.card.cardNo.Substring(0, 4) == "1800" ? "JCB" :
                                      data.card.cardNo.Substring(0, 1) == "2" && data.card.cardNo.Substring(0, 4) == "2131" ? "JCB" :
                                      data.card.cardNo.Substring(0, 1) == "3" && cardNum >= 300 && cardNum <= 399 ? "JCB" : "";

                    data.card.cardType = cardType;
                    data.card.cardNo   = GibberishAES.OpenSSLEncrypt(data.card.cardNo, Website.Instance.Configuration["kkdayKey:cardNo"].ToString());
                }
            }

            return(data);
        }
Ejemplo n.º 2
0
        //舊版
        public static PmchSslRequest setPaymentInfo(ProductModel prod, OrderModel orderModel, string orderMid)
        {
            PmchSslRequest pmch = new PmchSslRequest();

            pmch.apiKey    = "kkdayapi";
            pmch.userOid   = "1";
            pmch.ver       = "1.0.1";
            pmch.ipaddress = "127.0.0.1";

            CallJsonPay json = new CallJsonPay();

            json.pmchOid       = orderModel.payPmchOid;
            json.is3D          = "0";
            json.payCurrency   = orderModel.currency;
            json.payAmount     = Convert.ToDouble(orderModel.currPriceTotal);
            json.returnURL     = "https://*****:*****@kkday.com";

            json.payerInfo = payer;

            PayProductInfo prodInfo = new PayProductInfo();

            prodInfo.prodName = prod.prod_name;
            prodInfo.prodOid  = prod.prod_no.ToString();

            json.productInfo = prodInfo;

            PayMember member = new PayMember();

            member.memberUuid = orderModel.memberUuid;
            member.riskStatus = "01";

            json.member = member;
            pmch.json   = json;

            return(pmch);// JsonConvert.SerializeObject(pmch);
        }