protected void Page_Load(object sender, EventArgs e)
        {
            InvoiceLoveCode qinv = new InvoiceLoveCode();

            qinv.MerchantID = "2000132";//廠商編號。
            qinv.LoveCode   = "329580";

            Invoice <InvoiceLoveCode> inv = new Invoice <InvoiceLoveCode>();

            inv.Environment = Ecpay.EInvoice.Integration.Enumeration.EnvironmentEnum.Stage;
            inv.HashIV      = "q9jcZX8Ib9LM8wYk";
            inv.HashKey     = "ejCk326UnaZWKisg";
            string json = inv.post(qinv);

            Dictionary <string, string> values = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);


            string temp = string.Empty;

            temp = string.Format("結果<br> Data={0} ", values["IsExist"].ToString());
            Response.Write(temp);
            temp = string.Format("結果<br> RtnCode={0} ", values["RtnCode"].ToString());
            Response.Write(temp);
            // temp = string.Format("結果<br> RtnMsg={2} ", values["RtnMsg "].ToString());
            // Response.Write(temp);
        }
예제 #2
0
        public void TestCheckLoveCodeUnit()
        {
            //1. 建立愛心碼驗證物件
            var invoiceLoveCode = new InvoiceLoveCode
            {
                //廠商編號。
                MerchantID = "2000132",

                //愛心碼
                LoveCode = "329580"
            };

            //2. 執行API的回傳結果
            var response = Client.Post <InvoiceLoveCodeReturn, InvoiceLoveCode>(invoiceLoveCode);

            //表示成功
            Assert.AreEqual("1", response.RtnCode);

            //表示存在
            Assert.AreEqual("Y", response.IsExist);

            Assert.AreEqual("B12E2D8EBEAEC0EA37173BB65B77150F", response.CheckMacValue);
        }