本文整理汇总了Java中com.alipay.api.response.AlipayTradeQueryResponse类的典型用法代码示例。如果您正苦于以下问题:Java AlipayTradeQueryResponse类的具体用法?Java AlipayTradeQueryResponse怎么用?Java AlipayTradeQueryResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlipayTradeQueryResponse类属于com.alipay.api.response包,在下文中一共展示了AlipayTradeQueryResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AlipayTradeQueryResult
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
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());
}
示例2: tradeQuery
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
/**
* 交易状态查询
* @param query
* @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:"+json+"][result:"+BeanUtil.object2json(result)+"]");
}
return result;
}
示例3: test_trade_query
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
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;
}
}
示例4: isTradeQuery
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
/**
* 交易查询接口
* https://doc.open.alipay.com/docs/api.htm?spm=a219a.7395905.0.0.8H2JzG&docType=4&apiId=757
* @param model
* @return {boolean}
* @throws {AlipayApiException}
*/
public static boolean isTradeQuery(AlipayTradeQueryModel model) throws AlipayApiException{
AlipayTradeQueryResponse response = tradeQueryToResponse(model);
if(response.isSuccess()){
return true;
}
return false;
}
示例5: isTradeQuery
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
/**
* 交易查询接口
*
* @param model bizContent
* @return
* @throws AlipayApiException
*/
public static boolean isTradeQuery(AlipayTradeQueryModel model) throws AlipayApiException {
AlipayTradeQueryResponse response = tradeQuery(model);
if (response.isSuccess()) {
return true;
}
return false;
}
示例6: searchTreade
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public static Map<?, ?> searchTreade(String outTradeNo, String tradeNo) {
// 实例化客户端
AlipayClient alipayClient = AliPayConfig.build().getAlipayClient();
// 实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
model.setOutTradeNo(outTradeNo);
model.setTradeNo(tradeNo);
request.setBizModel(model);
Map<String, Object> result = InstanceUtil.newHashMap();
try {
AlipayTradeQueryResponse response = alipayClient.execute(request);
if (!response.isSuccess()) {
result.put("trade_state_desc", response.getSubMsg());
result.put("trade_state", "0");
} else {
Map<?, ?> body = JSON.parseObject(response.getBody(), Map.class);
Map<?, ?> resultMap = JSON.parseObject(body.get("alipay_trade_query_response").toString());
Object trade_status = resultMap.get("trade_status");
if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {
Date date = DateUtil.stringToDate((String)resultMap.get("send_pay_date"));
result.put("time_end", date);
result.put("trade_no", resultMap.get("trade_no"));
result.put("trade_state", "1");
} else {
result.put("trade_state_desc", resultMap.get("msg"));
result.put("trade_state", "2");
}
}
} catch (AlipayApiException e) {
logger.error("", e);
result.put("trade_state_desc", e.getMessage());
result.put("trade_state", "0");
}
return result;
}
示例7: queryAlipayWapPay
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
private AlipayTradeQueryResponse queryAlipayWapPay(String tradeNo, PaymentAccountInfoInterface accountInfo) throws Exception {
AlipayTradeQueryRequest queryRequest = new AlipayTradeQueryRequest();
queryRequest.setBizContent("{" +
"\"out_trade_no\":\"" + tradeNo + "\"" +
"}");
return getAlipayClient(accountInfo).execute(queryRequest);
}
示例8: queryOrder
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
@Override
public AlipayTradeQueryResponse queryOrder(String outTradeNo) throws AlipayApiException {
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
model.setOutTradeNo(outTradeNo);
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
request.setBizModel(model);
return alipayClient.execute(request);
}
示例9: queryOrderForStatus
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
@Override
public AlipayOrderTradeStatus queryOrderForStatus(String outTradeNo) throws AlipayApiException {
AlipayTradeQueryResponse response = this.queryOrder(outTradeNo);
String tradeStatus = response.getTradeStatus();
if ("WAIT_BUYER_PAY".equals(tradeStatus)) {
return AlipayOrderTradeStatus.USERPAYING;
}
else if ("TRADE_SUCCESS".equals(tradeStatus)) {
return AlipayOrderTradeStatus.SUCCESS;
}
logger.error("tradeStatus:" + tradeStatus);
return AlipayOrderTradeStatus.PAYERROR;
}
示例10: tradeQuery
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public static AlipayTradeQueryResponse tradeQuery(AlipayTradeQueryModel model) throws AlipayApiException {
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
request.setBizModel(model);
return AliPayConfig.build().getAlipayClient().execute(request);
}
示例11: tradeQuery
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public static AlipayTradeQueryResponse tradeQuery(AlipayTradeQueryModel model) throws AlipayApiException {
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
request.setBizModel(model);
return AliPayConfig.build().getAlipayClient().execute(request);
}
示例12: getResponseClass
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public Class<AlipayTradeQueryResponse> getResponseClass() {
return AlipayTradeQueryResponse.class;
}
示例13: queryPayResult
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
@Override
public PaymentStatusInfo queryPayResult(String tradeId, Long tradeTime, PaymentAccountInfoInterface accountInfo) throws Exception {
tradeId = accountInfo.getTradePrefix() + tradeId;
AlipayTradeQueryResponse response = queryAlipayWapPay(tradeId, accountInfo);
PaymentStatusInfo statusInfo = new PaymentStatusInfo();
statusInfo.setTradeIdWithPrefix(tradeId, accountInfo.getTradePrefix());
if (null == response) {
statusInfo.setServiceStatus(PaymentServiceStatus.NETWORK_ERROR);
statusInfo.setServiceErrorDesc("网络错误");
} else if (response.isSuccess()) {
statusInfo.setServiceStatus(PaymentServiceStatus.SUCCESS);
statusInfo.setErrorDesc(response.getTradeStatus());
switch (response.getTradeStatus()) {
case "WAIT_BUYER_PAY":
statusInfo.setStatus(PaymentStatus.NOT_PAY);
break;
case "TRADE_CLOSED":
statusInfo.setStatus(PaymentStatus.CLOSED);
break;
case "TRADE_SUCCESS":
statusInfo.setTradeIdWithPrefix(response.getOutTradeNo(), accountInfo.getTradePrefix());
statusInfo.setTotalAmount(response.getTotalAmount());
statusInfo.setAmountUnitIsYuan(true);
if (null != response.getSendPayDate()) {
Long payTime = response.getSendPayDate().toInstant().atZone(ZoneId.of("Asia/Shanghai")).toEpochSecond();
statusInfo.setPaymentTime(payTime);
} else {
statusInfo.setPaymentTime(Instant.now().getEpochSecond());
}
statusInfo.setStatus(PaymentStatus.SUCCESS);
break;
case "TRADE_FINISHED":
statusInfo.setStatus(PaymentStatus.SUCCESS);
break;
default:
statusInfo.setStatus(PaymentStatus.NOT_PAY);
break;
}
} else {
if (response.getSubCode().equals("ACQ.TRADE_NOT_EXIST")) {
statusInfo.setServiceStatus(PaymentServiceStatus.SUCCESS);
statusInfo.setStatus(PaymentStatus.CLOSED);
} else {
statusInfo.setServiceStatus(PaymentServiceStatus.BUSINESS_ERROR);
statusInfo.setServiceErrorCode(response.getSubCode());
statusInfo.setServiceErrorDesc(response.getSubMsg());
}
}
return statusInfo;
}
示例14: getResponse
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public AlipayTradeQueryResponse getResponse() {
return response;
}
示例15: setResponse
import com.alipay.api.response.AlipayTradeQueryResponse; //导入依赖的package包/类
public void setResponse(AlipayTradeQueryResponse response) {
this.response = response;
}