public void GetApiSignatureTest_Null() { string actual = AlibabaHelper.GetApiSignature("param2", "1", "system", "currentTime", "2988940", new Dictionary <string, string> { { "client_id", "2988940" }, { "site", "china" }, { "redirect_uri", "http://www.xphter.com" }, { "state", string.Empty }, }, "3tzdn2c9CU"); Assert.AreEqual <string>("AA4B09182881EBC69D9CC718AB992696A658B153", actual); }
public void GetApiSignatureTest_Object() { string actual = AlibabaHelper.GetApiSignature("param2", "1", "system", "currentTime", "2988940", new { client_id = "2988940", site = "china", redirect_uri = "http://www.xphter.com", state = "xphter", }, "3tzdn2c9CU"); Assert.AreEqual <string>("A70625750557474FFD0F65973D3CA23D237CF472", actual); }
public void GetApiSignatureTest_Absolute() { string actual = AlibabaHelper.GetApiSignature("http://gw.open.1688.com/openapi/param2/1/system/currentTime/2988940", new { client_id = "2988940", site = "china", redirect_uri = "http://www.xphter.com", state = "xphter", }, "3tzdn2c9CU"); Assert.AreEqual <string>("A70625750557474FFD0F65973D3CA23D237CF472", actual); }
public void GetApiSignatureTest() { string actual = AlibabaHelper.GetApiSignature("param2", "1", "system", "currentTime", "2988940", new Dictionary <string, string> { { "client_id", "2988940" }, { "site", "china" }, { "redirect_uri", "http://www.xphter.com" }, { "state", "xphter" }, }, "3tzdn2c9CU"); Assert.AreEqual <string>("A70625750557474FFD0F65973D3CA23D237CF472", actual); }
private void SendApiRequest(IChinaAlibabaApi api, object args, Action <Exception, string> callback) { string apiUri = api.GetRequestUri(this.m_appKey); IDictionary <string, string> arguments = AlibabaHelper.GetArgumentsDictionary(args); if (api.NeedAuthroized) { arguments[ACCESS_TOKEN_ARGUMENT_NAME] = this.m_accessToken; } if (api.NeedTimestamp) { arguments[TIMESTAMP_ARGUMENT_NAME] = (DateTime.Now - this.m_timestampBase).TotalMilliseconds + this.m_timeError.ToString(); } if (api.NeedSignature) { arguments[SIGNATURE_ARGUMENT_NAME] = AlibabaHelper.GetApiSignature(apiUri, arguments, this.m_appSecret); } this.SendPostRequest(apiUri, arguments, api.Encoding, callback); }