com.alipay.api.response.AlipayTradeQueryResponse Java Examples

The following examples show how to use com.alipay.api.response.AlipayTradeQueryResponse. 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: AliPayUtil.java    From roncoo-pay with Apache License 2.0 6 votes vote down vote up
/**
 * 订单查询
 *
 * @return
 */
public static Map<String, Object> tradeQuery(String outTradeNo) {
    logger.info("======>支付宝交易查询");
    String charset = "UTF-8";
    String format = "json";
    String signType = "RSA2";
    AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfigUtil.trade_query_url, AlipayConfigUtil.app_id, AlipayConfigUtil.mch_private_key, format, charset, AlipayConfigUtil.ali_public_key, signType);

    SortedMap<String, Object> bizContentMap = new TreeMap<>();
    bizContentMap.put("out_trade_no", outTradeNo);
    AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
    request.setBizContent(JSONObject.toJSONString(bizContentMap));
    try {
        AlipayTradeQueryResponse response = alipayClient.execute(request);
        JSONObject responseJSON = JSONObject.parseObject(JSONObject.toJSONString(response));
        logger.info("支付宝订单查询返回结果:{}", responseJSON);
        return responseJSON;
    } catch (AlipayApiException e) {
        logger.error("支付宝交易查询异常:{}", e);
        return null;
    }
}
 
Example #2
Source File: AlipayTradeQueryResult.java    From anyline with Apache License 2.0 6 votes vote down vote up
public AlipayTradeQueryResult(AlipayTradeQueryResponse res){ 
	this.response = res; 
	setSuccess(res.isSuccess()); 
	setCode(res.getCode()); 
	setSub_code(res.getSubCode()); 
	setMsg(res.getMsg()); 
	setSub_msg(res.getSubMsg()); 
	this.setTrade_no(res.getTradeNo()); 
	this.setOut_trade_no(res.getOutTradeNo()); 
	this.setOpen_id(res.getOpenId()); 
	this.setBuyer_logon_id(res.getBuyerLogonId()); 
	this.setTrade_status(res.getTradeStatus()); 
	this.setTotal_amount(res.getTotalAmount()); 
	this.setReceipt_amount(res.getReceiptAmount()); 
	this.setBuyer_pay_amount(res.getBuyerPayAmount()); 
	this.setPoint_amount(res.getPointAmount()); 
	this.setInvoice_amount(res.getIndustrySepcDetail()); 
	this.setSend_pay_date(DateUtil.format(res.getSendPayDate())); 
	this.setAlipay_store_id(res.getAlipayStoreId()); 
	this.setStore_id(res.getStoreId()); 
	this.setTerminal_id(res.getTerminalId()); 
	this.setStore_name(res.getStoreName()); 
	this.setBuyer_user_id(res.getBuyerUserId()); 
	this.setDiscount_goods_detail(res.getDiscountGoodsDetail()); 
	this.setIndustry_sepc_detail(res.getIndustrySepcDetail()); 
}
 
Example #3
Source File: AlipayUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
/** 
 * 交易状态查询 
 * @param query 查询参数
 * @return return
 */ 
public AlipayTradeQueryResult tradeQuery(AlipayTradeQuery query){ 
	AlipayTradeQueryResult result = null;  
	AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); 
	String json = BeanUtil.object2json(query); 
	request.setBizContent(json); 
	try { 
		AlipayTradeQueryResponse res = client.execute(request); 
		result = new AlipayTradeQueryResult(res); 
	} catch (AlipayApiException e) { 
		result = new AlipayTradeQueryResult(); 
		e.printStackTrace(); 
	}finally{ 
		log.warn("[单笔转账到支付宝账户][data:{}][result:{}]", json,BeanUtil.object2json(result)); 
	} 
	return result; 
}
 
Example #4
Source File: PayUtil.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询
 *
 * @param out_trade_no 商户订单号,商户网站订单系统中唯一订单号,必填
 * @param trade_no     支付宝交易号
 */
public static void TradeQuery(String out_trade_no, String trade_no) {
    /**********************/
    // SDK 公共请求类,包含公共请求参数,以及封装了签名与验签,开发者无需关注签名与验签
    AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);
    AlipayTradeQueryRequest alipay_request = new AlipayTradeQueryRequest();

    AlipayTradeQueryModel model = new AlipayTradeQueryModel();
    model.setOutTradeNo(out_trade_no);
    model.setTradeNo(trade_no);
    alipay_request.setBizModel(model);

    AlipayTradeQueryResponse alipay_response = null;
    try {
        alipay_response = client.execute(alipay_request);
    } catch (AlipayApiException e) {
        e.printStackTrace();
    }
    System.out.println(alipay_response.getBody());
}
 
Example #5
Source File: Main.java    From MMall_JAVA with GNU General Public License v3.0 5 votes vote down vote up
public void test_trade_query() {
    // (必填) 商户订单号,通过此商户订单号查询当面付的交易状态
    String outTradeNo = "tradepay14817938139942440181";

    // 创建查询请求builder,设置请求参数
    AlipayTradeQueryRequestBuilder builder = new AlipayTradeQueryRequestBuilder()
        .setOutTradeNo(outTradeNo);

    AlipayF2FQueryResult result = tradeService.queryTradeResult(builder);
    switch (result.getTradeStatus()) {
        case SUCCESS:
            log.info("查询返回该订单支付成功: )");

            AlipayTradeQueryResponse response = result.getResponse();
            dumpResponse(response);

            log.info(response.getTradeStatus());
            if (Utils.isListNotEmpty(response.getFundBillList())) {
                for (TradeFundBill bill : response.getFundBillList()) {
                    log.info(bill.getFundChannel() + ":" + bill.getAmount());
                }
            }
            break;

        case FAILED:
            log.error("查询返回该订单支付失败或被关闭!!!");
            break;

        case UNKNOWN:
            log.error("系统异常,订单支付状态未知!!!");
            break;

        default:
            log.error("不支持的交易状态,交易返回异常!!!");
            break;
    }
}
 
Example #6
Source File: Main.java    From mmall-kay-Java with Apache License 2.0 5 votes vote down vote up
public void test_trade_query() {
    // (必填) 商户订单号,通过此商户订单号查询当面付的交易状态
    String outTradeNo = "tradepay14817938139942440181";

    // 创建查询请求builder,设置请求参数
    AlipayTradeQueryRequestBuilder builder = new AlipayTradeQueryRequestBuilder()
        .setOutTradeNo(outTradeNo);

    AlipayF2FQueryResult result = tradeService.queryTradeResult(builder);
    switch (result.getTradeStatus()) {
        case SUCCESS:
            log.info("查询返回该订单支付成功: )");

            AlipayTradeQueryResponse response = result.getResponse();
            dumpResponse(response);

            log.info(response.getTradeStatus());
            if (Utils.isListNotEmpty(response.getFundBillList())) {
                for (TradeFundBill bill : response.getFundBillList()) {
                    log.info(bill.getFundChannel() + ":" + bill.getAmount());
                }
            }
            break;

        case FAILED:
            log.error("查询返回该订单支付失败或被关闭!!!");
            break;

        case UNKNOWN:
            log.error("系统异常,订单支付状态未知!!!");
            break;

        default:
            log.error("不支持的交易状态,交易返回异常!!!");
            break;
    }
}
 
Example #7
Source File: Main.java    From mmall20180107 with Apache License 2.0 5 votes vote down vote up
public void test_trade_query() {
    // (必填) 商户订单号,通过此商户订单号查询当面付的交易状态
    String outTradeNo = "tradepay14817938139942440181";

    // 创建查询请求builder,设置请求参数
    AlipayTradeQueryRequestBuilder builder = new AlipayTradeQueryRequestBuilder()
            .setOutTradeNo(outTradeNo);

    AlipayF2FQueryResult result = tradeService.queryTradeResult(builder);
    switch (result.getTradeStatus()) {
        case SUCCESS:
            log.info("查询返回该订单支付成功: )");

            AlipayTradeQueryResponse response = result.getResponse();
            dumpResponse(response);

            log.info(response.getTradeStatus());
            if (Utils.isListNotEmpty(response.getFundBillList())) {
                for (TradeFundBill bill : response.getFundBillList()) {
                    log.info(bill.getFundChannel() + ":" + bill.getAmount());
                }
            }
            break;

        case FAILED:
            log.error("查询返回该订单支付失败或被关闭!!!");
            break;

        case UNKNOWN:
            log.error("系统异常,订单支付状态未知!!!");
            break;

        default:
            log.error("不支持的交易状态,交易返回异常!!!");
            break;
    }
}
 
Example #8
Source File: AliPayServiceImpl.java    From common-project with Apache License 2.0 5 votes vote down vote up
@Override
public OrderQueryResponse orderQuery(String orderNum) throws AlipayApiException {
    //TODO 根据实际业务参数填写
    Integer orderFrom=0;
    AliPayConfig aliPayConfig= (AliPayConfig) getPayConfig(orderFrom);
    AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",aliPayConfig.getAppId(),aliPayConfig.getAppPrivateKey(),"json",aliPayConfig.getCharset(),aliPayConfig.getAliPayPublicKey(),"RSA2");
    AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
    request.setBizContent("{\"out_trade_no\":\""+orderNum+"\"}");
    AlipayTradeQueryResponse response = alipayClient.execute(request);
    if(!response.isSuccess()){
        return null;
    }
    return null;
}
 
Example #9
Source File: AlipayServiceImpl.java    From fast-family-master with Apache License 2.0 4 votes vote down vote up
@Override
public AlipayTradeQueryResponse selectOrder(AlipayTradeQueryModel model) throws AlipayApiException {
    AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
    request.setBizModel(model);
    return alipayClient.execute(request);
}
 
Example #10
Source File: AlipayTradeQueryRequest.java    From pay with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeQueryResponse> getResponseClass() {
	return AlipayTradeQueryResponse.class;
}
 
Example #11
Source File: AlipayTradeQueryRequest.java    From alipay-sdk with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeQueryResponse> getResponseClass() {
	return AlipayTradeQueryResponse.class;
}
 
Example #12
Source File: AlipayTradeQueryRequest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
public Class<AlipayTradeQueryResponse> getResponseClass() {
	return AlipayTradeQueryResponse.class;
}
 
Example #13
Source File: AlipayF2FQueryResult.java    From MeetingFilm with Apache License 2.0 4 votes vote down vote up
public AlipayF2FQueryResult(AlipayTradeQueryResponse response) {
    this.response = response;
}
 
Example #14
Source File: AlipayTradeQueryResult.java    From anyline with Apache License 2.0 4 votes vote down vote up
public void setResponse(AlipayTradeQueryResponse response) { 
	this.response = response; 
}
 
Example #15
Source File: AlipayTradeQueryResult.java    From anyline with Apache License 2.0 4 votes vote down vote up
public AlipayTradeQueryResponse getResponse() { 
	return response; 
}
 
Example #16
Source File: AlipayF2FQueryResult.java    From MeetingFilm with Apache License 2.0 4 votes vote down vote up
public AlipayTradeQueryResponse getResponse() {
    return response;
}
 
Example #17
Source File: AlipayF2FQueryResult.java    From MeetingFilm with Apache License 2.0 4 votes vote down vote up
public void setResponse(AlipayTradeQueryResponse response) {
    this.response = response;
}
 
Example #18
Source File: AlipayService.java    From fast-family-master with Apache License 2.0 2 votes vote down vote up
/**
 * 查询订单
 *
 * @param model
 * @return
 * @throws AlipayApiException
 */
AlipayTradeQueryResponse selectOrder(AlipayTradeQueryModel model) throws AlipayApiException;