Java Code Examples for com.alipay.api.request.AlipayTradeWapPayRequest#setBizContent()
The following examples show how to use
com.alipay.api.request.AlipayTradeWapPayRequest#setBizContent() .
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: CertificatePageExecuteTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Test public void should_return_correct_signed_order_form_contains_root_cert_sn_and_app_cert_sn() throws AlipayApiException { //given AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setBizContent("{" + " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," + " \"subject\":\"大乐透\"," + " \"out_trade_no\":\"70501111111S001111119\"," + " \"timeout_express\":\"90m\"," + " \"total_amount\":9.00," + " \"product_code\":\"QUICK_WAP_WAY\"" + " }"); //when AlipayTradeWapPayResponse response = client.pageExecute(request); String orderString = response.getBody(); //then assertThat(orderString.contains("app_cert_sn"), is(true)); assertThat(orderString.contains("alipay_root_cert_sn"), is(true)); }
Example 2
Source File: CertificatePageExecuteTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Test public void should_return_query_string_contains_root_cert_sn_and_app_cert() throws AlipayApiException { //given AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setBizContent("{" + " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," + " \"subject\":\"大乐透\"," + " \"out_trade_no\":\"70501111111S001111119\"," + " \"timeout_express\":\"90m\"," + " \"total_amount\":9.00," + " \"product_code\":\"QUICK_WAP_WAY\"" + " }"); //when AlipayTradeWapPayResponse response = client.pageExecute(request, "GET"); String orderString = response.getBody(); //then assertThat(orderString.contains("app_cert_sn"), is(true)); assertThat(orderString.contains("alipay_root_cert_sn"), is(true)); }
Example 3
Source File: LoadTestAlipayClientTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Ignore public void should_get_app_id_with_load_test_flag_in_redirect_url_when_call_page_execute() throws AlipayApiException { //given AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setBizContent("{" + " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," + " \"subject\":\"大乐透\"," + " \"out_trade_no\":\"70501111111S001111119\"," + " \"timeout_express\":\"90m\"," + " \"total_amount\":9.00," + " \"product_code\":\"QUICK_WAP_WAY\"" + " }"); //when AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "GET"); String orderString = response.getBody(); //then assertThat(orderString, containsString("app_id=2021000100600007_TEST_1A")); }
Example 4
Source File: LoadTestAlipayClientTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Ignore public void should_get_app_id_with_load_test_flag_in_post_form_when_call_page_execute() throws AlipayApiException { //given AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setBizContent("{" + " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," + " \"subject\":\"大乐透\"," + " \"out_trade_no\":\"70501111111S001111119\"," + " \"timeout_express\":\"90m\"," + " \"total_amount\":9.00," + " \"product_code\":\"QUICK_WAP_WAY\"" + " }"); //when AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "POST"); String orderString = response.getBody(); //then assertThat(orderString, containsString("app_id=2021000100600007_TEST_1A")); }
Example 5
Source File: AlipayUtil.java From anyline with Apache License 2.0 | 5 votes |
public String createWapOrder(AlipayTradeOrder order){ String result = ""; AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();//创建API对应的request alipayRequest.setReturnUrl(config.RETURN_URL); alipayRequest.setNotifyUrl(config.NOTIFY_URL); alipayRequest.setBizContent(BeanUtil.object2json(order));//填充业务参数 try { result = client.pageExecute(alipayRequest).getBody(); //调用SDK生成表单 } catch (AlipayApiException e) { e.printStackTrace(); } return result; }
Example 6
Source File: AlipayConfigServiceImpl.java From yshopmall with Apache License 2.0 | 5 votes |
@Override public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception { if(alipay.getId() == null){ throw new BadRequestException("请先添加相应配置,再操作"); } AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); double money = Double.parseDouble(trade.getTotalAmount()); double maxMoney = 5000; if(money <= 0 || money >= maxMoney){ throw new BadRequestException("测试金额过大"); } // 创建API对应的request(手机网页版) AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setReturnUrl(alipay.getReturnUrl()); request.setNotifyUrl(alipay.getNotifyUrl()); request.setBizContent("{" + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + " \"total_amount\":"+trade.getTotalAmount()+"," + " \"subject\":\""+trade.getSubject()+"\"," + " \"body\":\""+trade.getBody()+"\"," + " \"extend_params\":{" + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + " }"+ " }"); return alipayClient.pageExecute(request, "GET").getBody(); }
Example 7
Source File: AliPayServiceImpl.java From eladmin with Apache License 2.0 | 5 votes |
@Override public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception { if(alipay.getId() == null){ throw new BadRequestException("请先添加相应配置,再操作"); } AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); double money = Double.parseDouble(trade.getTotalAmount()); double maxMoney = 5000; if(money <= 0 || money >= maxMoney){ throw new BadRequestException("测试金额过大"); } // 创建API对应的request(手机网页版) AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setReturnUrl(alipay.getReturnUrl()); request.setNotifyUrl(alipay.getNotifyUrl()); request.setBizContent("{" + " \"out_trade_no\":\""+trade.getOutTradeNo()+"\"," + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + " \"total_amount\":"+trade.getTotalAmount()+"," + " \"subject\":\""+trade.getSubject()+"\"," + " \"body\":\""+trade.getBody()+"\"," + " \"extend_params\":{" + " \"sys_service_provider_id\":\""+alipay.getSysServiceProviderId()+"\"" + " }"+ " }"); return alipayClient.pageExecute(request, "GET").getBody(); }
Example 8
Source File: PageExecuteTest.java From alipay-sdk-java-all with Apache License 2.0 | 5 votes |
private AlipayTradeWapPayRequest getTradeWapPayRequest() { AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setBizContent("{" + " \"body\":\"对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。\"," + " \"subject\":\"大乐透\"," + " \"out_trade_no\":\"70501111111S001111119\"," + " \"timeout_express\":\"90m\"," + " \"total_amount\":9.00," + " \"product_code\":\"QUICK_WAP_WAY\"" + " }"); return request; }
Example 9
Source File: AliPayServiceImpl.java From albedo with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception { if (alipay.getId() == null) { throw new BadRequestException("请先添加相应配置,再操作"); } AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); double money = Double.parseDouble(trade.getTotalAmount()); double maxMoney = 5000; if (money <= 0 || money >= maxMoney) { throw new BadRequestException("测试金额过大"); } // 创建API对应的request(手机网页版) AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.setReturnUrl(alipay.getReturnUrl()); request.setNotifyUrl(alipay.getNotifyUrl()); request.setBizContent("{" + " \"out_trade_no\":\"" + trade.getOutTradeNo() + "\"," + " \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," + " \"total_amount\":" + trade.getTotalAmount() + "," + " \"subject\":\"" + trade.getSubject() + "\"," + " \"body\":\"" + trade.getBody() + "\"," + " \"extend_params\":{" + " \"sys_service_provider_id\":\"" + alipay.getSysServiceProviderId() + "\"" + " }" + " }"); return alipayClient.pageExecute(request, "GET").getBody(); }