com.alipay.api.response.AlipayTradeCreateResponse Java Examples

The following examples show how to use com.alipay.api.response.AlipayTradeCreateResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 5 votes vote down vote up
@Test
public void should_return_success_when_request_and_response_encrypted() throws AlipayApiException {
    //given
    alipayClient = new DefaultAlipayClient(TestAccount.Sandbox.GATEWAY, TestAccount.Sandbox.APP_ID, TestAccount.Sandbox.APP_PRIVATE_KEY,
            "json", "utf-8", TestAccount.Sandbox.ALIPAY_PUBLICKEY, "RSA2",
            TestAccount.Sandbox.AES_KEY, "AES");
    AlipayTradeCreateRequest request = getTradeCreateRequest();
    request.setNeedEncrypt(true);
    //when
    AlipayTradeCreateResponse response = alipayClient.execute(request);
    //then
    assertThat(response.isSuccess(), is(true));
    assertThat(response.getCode(), is("10000"));
}
 
Example #2
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 5 votes vote down vote up
@Test
public void should_be_able_to_parse_xml_format_response() throws AlipayApiException {
    //given
    alipayClient = new DefaultAlipayClient(TestAccount.Sandbox.GATEWAY, TestAccount.Sandbox.APP_ID, TestAccount.Sandbox.APP_PRIVATE_KEY,
            "xml", "utf-8", TestAccount.Sandbox.ALIPAY_PUBLICKEY, "RSA2");
    AlipayTradeCreateRequest request = getTradeCreateRequest();
    //when
    AlipayTradeCreateResponse response = alipayClient.execute(request);
    //then
    assertThat(response.isSuccess(), is(true));
    assertThat(response.getCode(), is("10000"));
}
 
Example #3
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 5 votes vote down vote up
@Test
public void should_be_able_to_parse_xml_format_response_when_encrypted() throws AlipayApiException {
    //given
    alipayClient = new DefaultAlipayClient(TestAccount.Sandbox.GATEWAY, TestAccount.Sandbox.APP_ID, TestAccount.Sandbox.APP_PRIVATE_KEY,
            "xml", "utf-8", TestAccount.Sandbox.ALIPAY_PUBLICKEY, "RSA2",
            TestAccount.Sandbox.AES_KEY, "AES");
    AlipayTradeCreateRequest request = getTradeCreateRequest();
    request.setNeedEncrypt(true);
    //when
    AlipayTradeCreateResponse response = alipayClient.execute(request);
    //then
    assertThat(response.isSuccess(), is(true));
    assertThat(response.getCode(), is("10000"));
}
 
Example #4
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 5 votes vote down vote up
@Test
public void should_return_false_when_app_not_set_private_key() throws AlipayApiException {
    //given
    //访问线上一个没有设置公私钥对的APP
    alipayClient = new DefaultAlipayClient(TestAccount.ProdCert.GATEWAY, TestAccount.NOT_SET_KEY_APP_ID,
            TestAccount.Sandbox.APP_PRIVATE_KEY,
            "json", "utf-8", TestAccount.Sandbox.ALIPAY_PUBLICKEY, "RSA2");
    //when
    AlipayTradeCreateResponse response = alipayClient.execute(getTradeCreateRequest());
    //then
    assertThat(response.isSuccess(), is(false));
    assertThat(response.getSubMsg(), containsString("应用未配置对应签名算法的公钥或者证书"));
}
 
Example #5
Source File: AlipayTradeCreateRequest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeCreateResponse> getResponseClass() {
	return AlipayTradeCreateResponse.class;
}
 
Example #6
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
@Test
public void should_be_able_to_send_token() throws AlipayApiException {
    AlipayTradeCreateResponse response = alipayClient.execute(getTradeCreateRequest(), "123", "456");
    assertThat(response.getSubMsg(), containsString("无效的应用授权令牌"));
}
 
Example #7
Source File: ExecuteTest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
private void sendOneNormalRequest() throws AlipayApiException {
    AlipayTradeCreateResponse response = alipayClient.execute(getTradeCreateRequest());
    assertThat(response.isSuccess(), is(true));
    assertThat(response.getCode(), is("10000"));
}
 
Example #8
Source File: AlipayTradeCreateRequest.java    From alipay-sdk with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeCreateResponse> getResponseClass() {
	return AlipayTradeCreateResponse.class;
}
 
Example #9
Source File: AlipayTradeCreateRequest.java    From pay with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeCreateResponse> getResponseClass() {
	return AlipayTradeCreateResponse.class;
}
 
Example #10
Source File: AlipayTradeCreateRequest.java    From alipay-sdk-java-all with Apache License 2.0 votes vote down vote up
public Class<AlipayTradeCreateResponse> getResponseClass() { return AlipayTradeCreateResponse.class; }