com.alipay.api.SignItem Java Examples
The following examples show how to use
com.alipay.api.SignItem.
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: JsonConverterTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Test public void should_extract_correct_source_data_and_sign() throws AlipayApiException { AlipayTradeCreateRequest request = new AlipayTradeCreateRequest(); String responseBody = "{\"alipay_trade_create_response\":{\"code\":\"10000\",\"msg\":\"Success\"," + "\"out_trade_no\":\"20150320010101001\",\"trade_no\":\"2019062322001446881000041395\"}," + "\"sign\":\"TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5" + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz" + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW" + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le" + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==\"}"; SignItem signItem = converter.getSignItem(request, responseBody); assertThat(signItem.getSignSourceDate(), is("{\"code\":\"10000\",\"msg\":\"Success\",\"out_trade_no\":\"20150320010101001\"," + "\"trade_no\":\"2019062322001446881000041395\"}")); assertThat(signItem.getSign(), is("TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5" + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz" + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW" + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le" + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==")); }
Example #2
Source File: JsonConverterTest.java From alipay-sdk-java-all with Apache License 2.0 | 6 votes |
@Test public void should_not_get_exception_when_has_same_response_node_nested_in_inner_map() throws AlipayApiException { AlipayTradeCreateRequest request = new AlipayTradeCreateRequest(); String responseBody = "{\"alipay_trade_create_response\":{\"code\":\"10000\",\"msg\":\"Success\"," + "\"out_trade_no\":\"20150320010101001\",\"trade_no\":\"2019062322001446881000041395\"," + "\"alipay_trade_create_response\":\"test\"}," + "\"sign\":\"TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5" + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz" + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW" + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le" + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==\"}"; SignItem signItem = converter.getSignItem(request, responseBody); assertThat(signItem.getSignSourceDate(), is("{\"code\":\"10000\",\"msg\":\"Success\",\"out_trade_no\":\"20150320010101001\"," + "\"trade_no\":\"2019062322001446881000041395\",\"alipay_trade_create_response\":\"test\"}")); assertThat(signItem.getSign(), is("TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5" + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz" + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW" + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le" + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==")); }
Example #3
Source File: JsonConverter.java From alipay-sdk with Apache License 2.0 | 6 votes |
/** * @see com.alipay.api.internal.mapping.Converter#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { // 响应为空则直接返回 if (StringUtils.isEmpty(responseBody)) { return null; } SignItem signItem = new SignItem(); // 获取签名 String sign = getSign(responseBody); signItem.setSign(sign); // 签名源串 String signSourceData = getSignSourceData(request, responseBody); signItem.setSignSourceDate(signSourceData); return signItem; }
Example #4
Source File: XmlConverter.java From alipay-sdk with Apache License 2.0 | 6 votes |
/** * @see com.alipay.api.internal.mapping.Converter#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { // 响应为空则直接返回 if (StringUtils.isEmpty(responseBody)) { return null; } SignItem signItem = new SignItem(); // 获取签名 String sign = getSign(responseBody); signItem.setSign(sign); // 签名源串 String signSourceData = getSignSourceData(request, responseBody); signItem.setSignSourceDate(signSourceData); return signItem; }
Example #5
Source File: JsonConverter.java From pay with Apache License 2.0 | 6 votes |
/** * @see com.alipay.api.internal.mapping.Converter#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { // 响应为空则直接返回 if (StringUtils.isEmpty(responseBody)) { return null; } SignItem signItem = new SignItem(); // 获取签名 String sign = getSign(responseBody); signItem.setSign(sign); // 签名源串 String signSourceData = getSignSourceData(request, responseBody); signItem.setSignSourceDate(signSourceData); return signItem; }
Example #6
Source File: XmlConverter.java From pay with Apache License 2.0 | 6 votes |
/** * @see com.alipay.api.internal.mapping.Converter#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { // 响应为空则直接返回 if (StringUtils.isEmpty(responseBody)) { return null; } SignItem signItem = new SignItem(); // 获取签名 String sign = getSign(responseBody); signItem.setSign(sign); // 签名源串 String signSourceData = getSignSourceData(request, responseBody); signItem.setSignSourceDate(signSourceData); return signItem; }
Example #7
Source File: ObjectJsonParser.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.AlipayParser#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { Converter converter = new JsonConverter(); return converter.getSignItem(request, responseBody); }
Example #8
Source File: ObjectXmlParser.java From alipay-sdk with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.AlipayParser#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { Converter converter = new XmlConverter(); return converter.getSignItem(request, responseBody); }
Example #9
Source File: ObjectJsonParser.java From pay with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.AlipayParser#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { Converter converter = new JsonConverter(); return converter.getSignItem(request, responseBody); }
Example #10
Source File: ObjectXmlParser.java From pay with Apache License 2.0 | 5 votes |
/** * @see com.alipay.api.AlipayParser#getSignItem(com.alipay.api.AlipayRequest, String) */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException { Converter converter = new XmlConverter(); return converter.getSignItem(request, responseBody); }
Example #11
Source File: Converter.java From pay with Apache License 2.0 | 4 votes |
public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException;
Example #12
Source File: Converter.java From alipay-sdk with Apache License 2.0 | 2 votes |
/** * 获取响应内的签名数据 * * @param request * @param responseBody * @return * @throws AlipayApiException */ public SignItem getSignItem(AlipayRequest<?> request, String responseBody) throws AlipayApiException;