Пример #1
0
        public void should_return_success_when_request_and_response_encrypted()
        {
            //given
            IAopClient client = new DefaultAopClient(TestAccount.Sandbox.Gateway, TestAccount.Sandbox.AppId,
                                                     TestAccount.Sandbox.AppPrivateKey, "json", "1.0", "RSA2", TestAccount.Sandbox.AlipayPublicKey, "utf-8", TestAccount.Sandbox.AesKey);
            AlipayTradeCreateRequest request = getTradeCreateRequest();

            request.SetNeedEncrypt(true);
            //when
            AlipayTradeCreateResponse response = client.Execute(request);

            //then
            Assert.AreEqual(response.Code, "10000");
        }
Пример #2
0
        public void should_be_able_to_parse_xml_format_response_when_encrypted()
        {
            //given
            IAopClient client = new DefaultAopClient(TestAccount.Sandbox.Gateway, TestAccount.Sandbox.AppId,
                                                     TestAccount.Sandbox.AppPrivateKey, "xml", "1.0", "RSA2", TestAccount.Sandbox.AlipayPublicKey,
                                                     "utf-8", TestAccount.Sandbox.AesKey);
            AlipayTradeCreateRequest request = getTradeCreateRequest();

            request.SetNeedEncrypt(true);
            //when
            AlipayTradeCreateResponse response = client.Execute(request);

            //then
            Assert.AreEqual(response.IsError, false);
            Assert.AreEqual(response.Code, "10000");
        }