mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-03 12:17:46 +08:00
🆕 #3122 【小程序】增加小程序虚拟支付的相关接口,以及修复短剧点播相关接口字段信息
This commit is contained in:
parent
e61cf93a12
commit
7bcb04a383
@ -548,4 +548,10 @@ public interface WxMaService extends WxService {
|
||||
* @return getWxMaVodService
|
||||
*/
|
||||
WxMaVodService getWxMaVodService();
|
||||
/**
|
||||
* 小程序虚拟支付
|
||||
*
|
||||
* @return getWxMaXPayService
|
||||
*/
|
||||
WxMaXPayService getWxMaXPayService();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.binarywang.wx.miniapp.api;
|
||||
import cn.binarywang.wx.miniapp.bean.vod.*;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public interface WxMaVodService {
|
||||
@ -20,4 +21,24 @@ public interface WxMaVodService {
|
||||
|
||||
Integer auditDrama(WxMaVodAuditDramaRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodGetCdnUsageResponse getCdnUsageData(WxMaVodGetCdnUsageRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodGetCdnLogResponse getCdnLogs(WxMaVodGetCdnLogRequest request) throws WxErrorException;
|
||||
|
||||
|
||||
WxMaVodPullUploadResponse pullUpload(WxMaVodPullUploadRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodGetTaskResponse getTask(WxMaVodGetTaskRequest request) throws WxErrorException;
|
||||
|
||||
|
||||
WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType) throws WxErrorException;
|
||||
|
||||
WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) throws WxErrorException;
|
||||
|
||||
WxMaVodApplyUploadResponse applyUpload(WxMaVodApplyUploadRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodCommitUploadResponse commitUpload(WxMaVodCommitUploadRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodUploadPartResult uploadPart(File file, String uploadId, Integer partNumber, Integer resourceType) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.xpay.*;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
public interface WxMaXPayService {
|
||||
|
||||
WxMaXPayQueryUserBalanceResponse queryUserBalance(WxMaXPayQueryUserBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayCurrencyPayResponse currencyPay(WxMaXPayCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayQueryOrderResponse queryOrder(WxMaXPayQueryOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayCancelCurrencyPayResponse cancelCurrencyPay(WxMaXPayCancelCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
boolean notifyProvideGoods(WxMaXPayNotifyProvideGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayPresentCurrencyResponse presentCurrency(WxMaXPayPresentCurrencyRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
|
||||
WxMaXPayDownloadBillResponse downloadBill(WxMaXPayDownloadBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayRefundOrderResponse refundOrder(WxMaXPayRefundOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayCreateWithdrawOrderResponse createWithdrawOrder(WxMaXPayCreateWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayQueryWithdrawOrderResponse queryWithdrawOrder(WxMaXPayQueryWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
boolean startUploadGoods(WxMaXPayStartUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayQueryUploadGoodsResponse queryUploadGoods(WxMaXPayQueryUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
boolean startPublishGoods(WxMaXPayStartPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
|
||||
|
||||
}
|
@ -90,6 +90,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
|
||||
private final WxMaOpenApiService wxMaOpenApiService = new WxMaOpenApiServiceImpl(this);
|
||||
private final WxMaVodService wxMaVodService = new WxMaVodServiceImpl(this);
|
||||
private final WxMaXPayService wxMaXPayService = new WxMaXPayServiceImpl(this);
|
||||
|
||||
private Map<String, WxMaConfig> configMap = new HashMap<>();
|
||||
private int retrySleepMillis = 1000;
|
||||
@ -669,5 +670,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
public WxMaVodService getWxMaVodService() {
|
||||
return this.wxMaVodService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayService getWxMaXPayService() {
|
||||
return this.wxMaXPayService;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaVodService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.vod.*;
|
||||
import cn.binarywang.wx.miniapp.executor.VodSingleUploadRequestExecutor;
|
||||
import cn.binarywang.wx.miniapp.executor.VodUploadPartRequestExecutor;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@ -14,6 +16,7 @@ import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Vod.*;
|
||||
@ -124,4 +127,103 @@ public class WxMaVodServiceImpl implements WxMaVodService {
|
||||
return getDetailResponse.getDramaId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodGetCdnUsageResponse getCdnUsageData(WxMaVodGetCdnUsageRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_CDN_USAGE_DATA_URL, request.toJson());
|
||||
WxMaVodGetCdnUsageResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetCdnUsageResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodGetCdnLogResponse getCdnLogs(WxMaVodGetCdnLogRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_CDN_LOGS_URL, request.toJson());
|
||||
WxMaVodGetCdnLogResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetCdnLogResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodGetTaskResponse getTask(WxMaVodGetTaskRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_TASK_URL, request.toJson());
|
||||
WxMaVodGetTaskResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetTaskResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodPullUploadResponse pullUpload(WxMaVodPullUploadRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(PULL_UPLOAD_URL, request.toJson());
|
||||
WxMaVodPullUploadResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodPullUploadResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType) throws WxErrorException {
|
||||
WxMaVodSingleFileUploadResult result = this.service.execute(
|
||||
VodSingleUploadRequestExecutor.create(this.service.getRequestHttp(), mediaName, mediaType, null, null, null), SINGLE_FILE_UPLOAD_URL, file);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) throws WxErrorException {
|
||||
WxMaVodSingleFileUploadResult result = this.service.execute(
|
||||
VodSingleUploadRequestExecutor.create(this.service.getRequestHttp(), mediaName, mediaType, coverType, coverData, sourceContext), SINGLE_FILE_UPLOAD_URL, file);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodApplyUploadResponse applyUpload(WxMaVodApplyUploadRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(APPLY_UPLOAD_URL, request.toJson());
|
||||
WxMaVodApplyUploadResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodApplyUploadResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodCommitUploadResponse commitUpload(WxMaVodCommitUploadRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(COMMIT_UPLOAD_URL, request.toJson());
|
||||
WxMaVodCommitUploadResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodCommitUploadResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodUploadPartResult uploadPart(File file, String uploadId, Integer partNumber, Integer resourceType) throws WxErrorException {
|
||||
WxMaVodUploadPartResult result = this.service.execute(
|
||||
VodUploadPartRequestExecutor.create(this.service.getRequestHttp(), uploadId, partNumber, resourceType), UPLOAD_PART_URL, file);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,238 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaXPayService;
|
||||
import cn.binarywang.wx.miniapp.bean.xpay.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.XPay.*;
|
||||
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaXPayServiceImpl implements WxMaXPayService {
|
||||
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public WxMaXPayQueryUserBalanceResponse queryUserBalance(WxMaXPayQueryUserBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithBoth(QUERY_USER_BALANCE_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayQueryUserBalanceResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayQueryUserBalanceResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayCurrencyPayResponse currencyPay(WxMaXPayCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithBoth(CURRENCY_PAY_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayCurrencyPayResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayCurrencyPayResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayQueryOrderResponse queryOrder(WxMaXPayQueryOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(QUERY_ORDER_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayQueryOrderResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayQueryOrderResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayCancelCurrencyPayResponse cancelCurrencyPay(WxMaXPayCancelCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithBoth(CANCEL_CURRENCY_PAY_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayCancelCurrencyPayResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayCancelCurrencyPayResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean notifyProvideGoods(WxMaXPayNotifyProvideGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(NOTIFY_PROVIDE_GOODS_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaBaseResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayPresentCurrencyResponse presentCurrency(WxMaXPayPresentCurrencyRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(PRESENT_CURRENCY_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayPresentCurrencyResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayPresentCurrencyResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayDownloadBillResponse downloadBill(WxMaXPayDownloadBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(DOWNLOAD_BILL_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayDownloadBillResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayDownloadBillResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayRefundOrderResponse refundOrder(WxMaXPayRefundOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(REFUND_ORDER_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayRefundOrderResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayRefundOrderResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayCreateWithdrawOrderResponse createWithdrawOrder(WxMaXPayCreateWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(CREATE_WITHDRAW_ORDER_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayCreateWithdrawOrderResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayCreateWithdrawOrderResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayQueryWithdrawOrderResponse queryWithdrawOrder(WxMaXPayQueryWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(QUERY_WITHDRAW_ORDER_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayQueryWithdrawOrderResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayQueryWithdrawOrderResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startUploadGoods(WxMaXPayStartUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(START_UPLOAD_GOODS_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaBaseResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayQueryUploadGoodsResponse queryUploadGoods(WxMaXPayQueryUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(QUERY_UPLOAD_GOODS_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayQueryUploadGoodsResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayQueryUploadGoodsResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startPublishGoods(WxMaXPayStartPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(START_PUBLISH_GOODS_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaBaseResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
|
||||
final String postBody = request.toJson();
|
||||
final String uri = sigParams.signUriWithPay(QUERY_PUBLISH_GOODS_URL, postBody);
|
||||
String responseContent = this.service.post(uri, postBody);
|
||||
WxMaXPayQueryPublishGoodsResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaXPayQueryPublishGoodsResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodApplyUploadRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_name")
|
||||
private String mediaName;
|
||||
@SerializedName("media_type")
|
||||
private String mediaType;
|
||||
@SerializedName("cover_type")
|
||||
private String coverType;
|
||||
|
||||
@SerializedName("source_context")
|
||||
private String sourceContext;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodApplyUploadResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("upload_id")
|
||||
private String uploadId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodCdnLogRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("offset")
|
||||
private Integer offset;
|
||||
@SerializedName("limit")
|
||||
private Integer limit;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodCdnLogResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
@SerializedName("total_count")
|
||||
private Integer totalCount;
|
||||
@SerializedName("domestic_cdn_logs")
|
||||
private List<CdnLogInfo> domesticCdnLogs;
|
||||
|
||||
@Data
|
||||
public static class CdnLogInfo {
|
||||
@SerializedName("date")
|
||||
private Long date;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodCdnUsageRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("data_interval")
|
||||
private Integer dataInterval;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodCdnUsageResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
@SerializedName("data_interval")
|
||||
private Integer dataInterval;
|
||||
@SerializedName("item_list")
|
||||
private List<DataItem> itemList;
|
||||
|
||||
@Data
|
||||
public static class DataItem {
|
||||
|
||||
@SerializedName("value")
|
||||
private Long value;
|
||||
@SerializedName("time")
|
||||
private Long time;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodCommitUploadRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("upload_id")
|
||||
private String uploadId;
|
||||
@SerializedName("media_part_infos")
|
||||
private List<PartInfo> mediaPartInfos;
|
||||
@SerializedName("cover_part_infos")
|
||||
private List<PartInfo> coverPartInfos;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PartInfo {
|
||||
|
||||
@SerializedName("part_number")
|
||||
private Integer partNumber;
|
||||
@SerializedName("etag")
|
||||
private String etag;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodCommitUploadResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetCdnLogRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("offset")
|
||||
private Integer offset;
|
||||
@SerializedName("limit")
|
||||
private Integer limit;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodGetCdnLogResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
@SerializedName("total_count")
|
||||
private Integer totalCount;
|
||||
@SerializedName("domestic_cdn_logs")
|
||||
private List<CdnLogInfo> domesticCdnLogs;
|
||||
|
||||
@Data
|
||||
public static class CdnLogInfo {
|
||||
@SerializedName("date")
|
||||
private Long date;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetCdnUsageRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("data_interval")
|
||||
private Integer dataInterval;
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodGetCdnUsageResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
@SerializedName("data_interval")
|
||||
private Integer dataInterval;
|
||||
@SerializedName("item_list")
|
||||
private List<DataItem> itemList;
|
||||
|
||||
@Data
|
||||
public static class DataItem {
|
||||
|
||||
@SerializedName("value")
|
||||
private Long value;
|
||||
@SerializedName("time")
|
||||
private Long time;
|
||||
|
||||
}
|
||||
}
|
@ -37,7 +37,7 @@ public class WxMaVodGetTaskResponse extends WxMaBaseResponse implements Serializ
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("finish_time")
|
||||
private Long finish_time;
|
||||
private Long finishTime;
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodPullUploadRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("cover_url")
|
||||
private String coverUrl;
|
||||
@SerializedName("media_url")
|
||||
private String mediaUrl;
|
||||
@SerializedName("media_name")
|
||||
private String mediaName;
|
||||
|
||||
@SerializedName("source_context")
|
||||
private String sourceContext;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodPullUploadResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("task_id")
|
||||
private Integer taskId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMaVodSingleFileUploadResult extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
public static WxMaVodSingleFileUploadResult fromJson(String json) {
|
||||
return WxGsonBuilder.create().fromJson(json, WxMaVodSingleFileUploadResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class WxMaVodUploadPartResult extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("etag")
|
||||
private String etag;
|
||||
|
||||
public static WxMaVodUploadPartResult fromJson(String json) {
|
||||
return WxGsonBuilder.create().fromJson(json, WxMaVodUploadPartResult.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCancelCurrencyPayRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
@SerializedName("user_ip")
|
||||
private String userIp;
|
||||
|
||||
/*
|
||||
* 退款单的单号
|
||||
*/
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
/*
|
||||
* 代币支付时传的order_id
|
||||
*/
|
||||
@SerializedName("pay_order_id")
|
||||
private String payOrderId;
|
||||
/*
|
||||
* 退款金额
|
||||
*/
|
||||
@SerializedName("amount")
|
||||
private Long amount;
|
||||
@SerializedName("device_type")
|
||||
private Integer deviceType;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCancelCurrencyPayResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCreateWithdrawOrderRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("withdraw_no")
|
||||
private String withdrawNo;
|
||||
@SerializedName("withdraw_amount")
|
||||
private String withdrawAmount; //提现的金额,单位元,不传的情况下表示全额提现
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCreateWithdrawOrderResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("withdraw_no")
|
||||
private String withdrawNo;
|
||||
@SerializedName("wx_withdraw_no")
|
||||
private String wxWithdrawNo;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCurrencyPayRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
@SerializedName("user_ip")
|
||||
private String userIp;
|
||||
|
||||
@SerializedName("amount")
|
||||
private Long amount;
|
||||
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
|
||||
@SerializedName("device_type")
|
||||
private Integer deviceType;
|
||||
|
||||
@SerializedName("payitem")
|
||||
private String payitem;//物品信息。记录到账户流水中。如:[{"productid":"物品id", "unit_price": 单价, "quantity": 数量}]
|
||||
|
||||
@SerializedName("remark")
|
||||
private String remark;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayCurrencyPayResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("balance")
|
||||
private Long balance;
|
||||
|
||||
@SerializedName("used_present_amount")
|
||||
private Long usedPresentAmount;
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayDownloadBillRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("begin_ds")
|
||||
private Integer beginDs;
|
||||
@SerializedName("end_ds")
|
||||
private Integer endDs;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayDownloadBillResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayNotifyProvideGoodsRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
@SerializedName("wx_order_id")
|
||||
private String wxOrderId;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayPresentCurrencyRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
|
||||
@SerializedName("device_type")
|
||||
private Integer deviceType;
|
||||
|
||||
@SerializedName("amount")
|
||||
private Long amount;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayPresentCurrencyResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("balance")
|
||||
private Long balance;
|
||||
|
||||
@SerializedName("present_balance")
|
||||
private Long presentBalance;
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryOrderRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
/*
|
||||
* 创建的订单号
|
||||
*/
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
/*
|
||||
* 微信内部单号(与order_id二选一)
|
||||
*/
|
||||
@SerializedName("wx_order_id")
|
||||
private String wxOrderId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryOrderResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("order")
|
||||
private OrderInfo order;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class OrderInfo {
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("update_time")
|
||||
private Long updateTime;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("biz_type")
|
||||
private Integer bizType;
|
||||
@SerializedName("order_fee")
|
||||
private Long orderFee;
|
||||
@SerializedName("coupon_fee")
|
||||
private Long couponFee;
|
||||
@SerializedName("paid_fee")
|
||||
private Long paidFee;
|
||||
@SerializedName("order_type")
|
||||
private Integer orderType;
|
||||
@SerializedName("refund_fee")
|
||||
private Long refundFee;
|
||||
@SerializedName("paid_time")
|
||||
private Long paidTime;//unix秒级时间戳
|
||||
@SerializedName("provide_time")
|
||||
private Long provideTime;
|
||||
@SerializedName("env_type")
|
||||
private Long envType;
|
||||
@SerializedName("biz_meta")
|
||||
private String bizMeta;
|
||||
@SerializedName("token")
|
||||
private String token;
|
||||
|
||||
@SerializedName("leftFee")
|
||||
private Long leftFee; //支付单类型时表示此单经过退款还剩余的金额,单位分
|
||||
@SerializedName("wxOrderId")
|
||||
private String wxOrderId;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryPublishGoodsRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryPublishGoodsResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("publish_item")
|
||||
private List<PublishItem> publishItem;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PublishItem {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("publish_status")
|
||||
private Integer publishStatus;
|
||||
@SerializedName("errmsg")
|
||||
private String errmsg;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryUploadGoodsRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryUploadGoodsResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("upload_item")
|
||||
private List<UploadItem> uploadItem;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UploadItem {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("price")
|
||||
private Integer price;
|
||||
@SerializedName("remark")
|
||||
private String remark;
|
||||
@SerializedName("item_url")
|
||||
private String itemUrl;
|
||||
@SerializedName("upload_status")
|
||||
private Integer uploadStatus;
|
||||
@SerializedName("errmsg")
|
||||
private String errmsg;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryUserBalanceRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("user_ip")
|
||||
private String userIp;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryUserBalanceResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("balance")
|
||||
private Long balance;
|
||||
|
||||
@SerializedName("present_balance")
|
||||
private Long presentBalance;
|
||||
@SerializedName("sum_save")
|
||||
private Long sumSave;
|
||||
@SerializedName("sum_present")
|
||||
private Long sumPresent;
|
||||
@SerializedName("sum_balance")
|
||||
private Long sumBalance;
|
||||
@SerializedName("sum_cost")
|
||||
private Long sumCost;
|
||||
@SerializedName("first_save_flag")
|
||||
private Boolean firstSaveFlag;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryWithdrawOrderRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("withdraw_no")
|
||||
private String withdrawNo;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayQueryWithdrawOrderResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("withdraw_no")
|
||||
private String withdrawNo;
|
||||
@SerializedName("withdraw_amount")
|
||||
private String withdrawAmount; //提现的金额,单位元,不传的情况下表示全额提现
|
||||
|
||||
@SerializedName("wx_withdraw_no")
|
||||
private String wxWithdrawNo;
|
||||
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("withdraw_success_timestamp")
|
||||
private String withdrawSuccessTimestamp;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("fail_reason")
|
||||
private String failReason;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayRefundOrderRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("openid")
|
||||
private String openid;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
@SerializedName("order_id")
|
||||
private String orderId;
|
||||
@SerializedName("wx_order_id")
|
||||
private String wxOrderId;
|
||||
@SerializedName("refund_order_id")
|
||||
private String refundOrderId;
|
||||
|
||||
|
||||
@SerializedName("left_fee")
|
||||
private Long leftFee;
|
||||
@SerializedName("refund_fee")
|
||||
private Long refundFee;
|
||||
@SerializedName("biz_meta")
|
||||
private String bizMeta;
|
||||
|
||||
@SerializedName("refund_reason")
|
||||
private String refundReason;
|
||||
|
||||
@SerializedName("req_from")
|
||||
private String reqFrom;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayRefundOrderResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("refund_order_id")
|
||||
private String refundOrderId;
|
||||
@SerializedName("refund_wx_order_id")
|
||||
private String refundWxOrderId;
|
||||
@SerializedName("pay_order_id")
|
||||
private String payOrderId;
|
||||
|
||||
@SerializedName("pay_wx_order_id")
|
||||
private String payWxOrderId;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import me.chanjar.weixin.common.util.SignUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPaySigParams implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
private String sessionKey;
|
||||
private String appKey;
|
||||
|
||||
public String signUriWithBoth(String url, String postData) {
|
||||
final String sig = this.calcSig(postData);
|
||||
final String paySig = this.calcPaySig(url, postData);
|
||||
final String uri = String.format(url, paySig, sig);
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String signUriWithPay(String url, String postData) {
|
||||
final String paySig = this.calcPaySig(url, postData);
|
||||
final String uri = String.format(url, paySig);
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String signUriWithUser(String url, String postData) {
|
||||
final String sig = this.calcSig(postData);
|
||||
final String uri = String.format(url, sig);
|
||||
return uri;
|
||||
}
|
||||
|
||||
protected String convUrlToSigUri(String url) {
|
||||
if (url == null) return "";
|
||||
|
||||
String t = url.replace("https://api.weixin.qq.com", "");
|
||||
if (t.contains("?")) {
|
||||
t = t.substring(0, t.indexOf("?"));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public String calcPaySig(String url, String postBody) {
|
||||
String ak = StringUtils.trimToEmpty(this.appKey);
|
||||
final String sigUri = convUrlToSigUri(url);
|
||||
final String paySig = calcPaySignature(sigUri, postBody, ak);
|
||||
return paySig;
|
||||
}
|
||||
|
||||
public String calcSig(String postBody) {
|
||||
String sk = StringUtils.trimToEmpty(this.sessionKey);
|
||||
final String sig = calcSignature(postBody, sk);
|
||||
return sig;
|
||||
}
|
||||
|
||||
protected String calcSignature(String postBody, String sessionKey) {
|
||||
// """ 用户登录态signature签名算法
|
||||
// Args:
|
||||
// postBody - http POST的数据包体
|
||||
// sessionKey - 当前用户有效的session_key,参考auth.code2Session接口
|
||||
// Returns:
|
||||
// 用户登录态签名signature
|
||||
// """
|
||||
String needSignData = postBody;
|
||||
String signature = SignUtils.createHmacSha256Sign(needSignData, sessionKey);
|
||||
return signature;
|
||||
}
|
||||
|
||||
|
||||
protected String calcPaySignature(String uri, String postBody, String appKey) {
|
||||
// """ pay_sig签名算法
|
||||
// Args:
|
||||
// uri - 当前请求的API的uri部分,不带query_string 例如:/xpay/query_user_balance
|
||||
// postBody - http POST的数据包体
|
||||
// appKey - 对应环境的AppKey
|
||||
// Returns:
|
||||
// 支付请求签名pay_sig
|
||||
// """
|
||||
String needSignData = uri + '&' + postBody;
|
||||
String paySig = SignUtils.createHmacSha256Sign(needSignData, appKey);
|
||||
return paySig;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayStartPublishGoodsRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("publish_item")
|
||||
private List<PublishItem> publishItem;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PublishItem {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.binarywang.wx.miniapp.bean.xpay;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaXPayStartUploadGoodsRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("env")
|
||||
private Integer env;
|
||||
|
||||
@SerializedName("upload_item")
|
||||
private List<UploadItem> uploadItem;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UploadItem {
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("price")
|
||||
private Integer price;
|
||||
@SerializedName("remark")
|
||||
private String remark;
|
||||
@SerializedName("item_url")
|
||||
private String itemUrl;
|
||||
|
||||
}
|
||||
}
|
@ -848,6 +848,28 @@ public class WxMaApiUrlConstants {
|
||||
String GET_CDN_USAGE_DATA_URL = "https://api.weixin.qq.com/wxa/sec/vod/getcdnusagedata";
|
||||
String GET_CDN_LOGS_URL = "https://api.weixin.qq.com/wxa/sec/vod/getcdnlogs";
|
||||
|
||||
}
|
||||
/**
|
||||
* 小程序虚拟支付服务相关接口
|
||||
* <pre>
|
||||
* 文档地址: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html#_2-3-%E6%9C%8D%E5%8A%A1%E5%99%A8API
|
||||
* </pre>
|
||||
*/
|
||||
public interface XPay {
|
||||
String QUERY_USER_BALANCE_URL = "https://api.weixin.qq.com/xpay/query_user_balance?pay_sig=%s&signature=%s";
|
||||
String CURRENCY_PAY_URL = "https://api.weixin.qq.com/xpay/currency_pay?pay_sig=%s&signature=%s";
|
||||
String QUERY_ORDER_URL = "https://api.weixin.qq.com/xpay/query_order?pay_sig=%s";
|
||||
String CANCEL_CURRENCY_PAY_URL = "https://api.weixin.qq.com/xpay/cancel_currency_pay?pay_sig=%s&signature=%s";
|
||||
String NOTIFY_PROVIDE_GOODS_URL = "https://api.weixin.qq.com/xpay/notify_provide_goods?pay_sig=%s";
|
||||
String PRESENT_CURRENCY_URL = "https://api.weixin.qq.com/xpay/present_currency?pay_sig=%s";
|
||||
String DOWNLOAD_BILL_URL = "https://api.weixin.qq.com/xpay/download_bill?pay_sig=%s";
|
||||
String REFUND_ORDER_URL = "https://api.weixin.qq.com/xpay/refund_order?pay_sig=%s";
|
||||
String CREATE_WITHDRAW_ORDER_URL = "https://api.weixin.qq.com/xpay/create_withdraw_order?pay_sig=%s";
|
||||
String QUERY_WITHDRAW_ORDER_URL = "https://api.weixin.qq.com/xpay/query_withdraw_order?pay_sig=%s";
|
||||
String START_UPLOAD_GOODS_URL = "https://api.weixin.qq.com/xpay/start_upload_goods?pay_sig=%s";
|
||||
String QUERY_UPLOAD_GOODS_URL = "https://api.weixin.qq.com/xpay/query_upload_goods?pay_sig=%s";
|
||||
String START_PUBLISH_GOODS_URL = "https://api.weixin.qq.com/xpay/start_publish_goods?pay_sig=%s";
|
||||
String QUERY_PUBLISH_GOODS_URL = "https://api.weixin.qq.com/xpay/query_publish_goods?pay_sig=%s";
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -218,4 +218,89 @@ public class WxMaConstants {
|
||||
public static final int DONE = 3;
|
||||
public static final int FAILED = 4;
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class UploadResourceType {
|
||||
public static final int MEDIA = 1;
|
||||
public static final int COVER = 2;
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayEnv {
|
||||
public static final int PRODUCT = 0;
|
||||
public static final int SANDBOX = 1;
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayFirstCharge {
|
||||
public static final int NO = 0;
|
||||
public static final int YES = 1;
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayDeviceType {
|
||||
public static final int ANDROID = 1;
|
||||
public static final int IOS = 2;
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayBizType {
|
||||
public static final int SHORT_DRAMA = 1;
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayOrderType {
|
||||
public static final int PAY_ORDER = 0;//0-支付单
|
||||
public static final int REFUND_ORDER = 1;//1-退款单
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayOrderStatus {
|
||||
public static final int INIT = 0;//0-订单初始化(未创建成功,不可用于支付)
|
||||
public static final int CREATED = 1;// 1-订单创建成功
|
||||
public static final int PAID = 2;//2-订单已经支付,待发货
|
||||
public static final int PROVIDING = 3;// 3-订单发货中
|
||||
public static final int PROVIDED = 4;// 4-订单已发货
|
||||
public static final int REFUNDED = 5;// 5-订单已经退款
|
||||
public static final int CLOSED = 6;// 6-订单已经关闭(不可再使用)
|
||||
public static final int REFUND_FAILED = 7;// 7-订单退款失败
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayNotifyEvent {
|
||||
public static String COIN_PAY = "xpay_coin_pay_notify";
|
||||
public static String GOODS_DELIVER = "xpay_goods_deliver_notify";
|
||||
|
||||
}
|
||||
@UtilityClass
|
||||
public static final class XPayPaymentMode {
|
||||
public static String COIN = "short_series_coin";
|
||||
public static String GOODS = "short_series_goods";
|
||||
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class XPayPlatform {
|
||||
public static String ANDROID = "android";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class XPayCurrencyType {
|
||||
public static String CNY = "CNY";
|
||||
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class XPayWxApiSigUri {
|
||||
public static String WXAPI = "requestVirtualPayment";
|
||||
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class XPayRefundReqFrom {
|
||||
public static final String FROM_CS = "1";//人工客服退款
|
||||
public static final String FROM_USER = "2";//用户自己发起
|
||||
public static final String FROM_MISC = "3";//1-其它
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class XPayPublishStatus {
|
||||
public static final int PUBLISH_UPLOADING = 0;//0-上传中
|
||||
public static final int PUBLISH_EXISTED = 1;//1-id已经存在
|
||||
public static final int PUBLISH_SUCCESSFUL = 2;// 2-发布成功
|
||||
public static final int PUBLISH_FAILED = 3;//3-发布失败
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodSingleFileUploadResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.mime.HttpMultipartMode;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ApacheVodSingleUploadRequestExecutor extends VodSingleUploadRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
|
||||
public ApacheVodSingleUploadRequestExecutor(RequestHttp requestHttp, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) {
|
||||
super(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodSingleFileUploadResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
HttpPost httpPost = new HttpPost(uri);
|
||||
if (requestHttp.getRequestHttpProxy() != null) {
|
||||
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
|
||||
httpPost.setConfig(config);
|
||||
}
|
||||
if (file != null) {
|
||||
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder
|
||||
.create()
|
||||
.setMode(HttpMultipartMode.RFC6532)
|
||||
.addTextBody("media_name", mediaName)
|
||||
.addTextBody("media_type", mediaType)
|
||||
.addBinaryBody("media_data", file);
|
||||
|
||||
if (coverType != null) {
|
||||
entityBuilder.addTextBody("cover_type", coverType);
|
||||
}
|
||||
if (coverData != null) {
|
||||
entityBuilder.addBinaryBody("cover_data", coverData);
|
||||
}
|
||||
if (sourceContext != null) {
|
||||
entityBuilder.addTextBody("source_context", sourceContext);
|
||||
}
|
||||
|
||||
httpPost.setEntity(entityBuilder.build());
|
||||
}
|
||||
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) {
|
||||
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodSingleFileUploadResult.fromJson(responseContent);
|
||||
} finally {
|
||||
httpPost.releaseConnection();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodUploadPartResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.mime.HttpMultipartMode;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ApacheVodUploadPartRequestExecutor extends VodUploadPartRequestExecutor<CloseableHttpClient, HttpHost> {
|
||||
|
||||
public ApacheVodUploadPartRequestExecutor(RequestHttp requestHttp, String uploadId, Integer partNumber, Integer resourceType) {
|
||||
super(requestHttp, uploadId, partNumber, resourceType);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodUploadPartResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
HttpPost httpPost = new HttpPost(uri);
|
||||
if (requestHttp.getRequestHttpProxy() != null) {
|
||||
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
|
||||
httpPost.setConfig(config);
|
||||
}
|
||||
if (file != null) {
|
||||
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder
|
||||
.create()
|
||||
.setMode(HttpMultipartMode.RFC6532)
|
||||
.addTextBody("upload_id", uploadId)
|
||||
.addTextBody("part_number", String.valueOf(partNumber))
|
||||
.addTextBody("resource_type", String.valueOf(resourceType))
|
||||
.addBinaryBody("data", file);
|
||||
|
||||
httpPost.setEntity(entityBuilder.build());
|
||||
}
|
||||
try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) {
|
||||
String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodUploadPartResult.fromJson(responseContent);
|
||||
} finally {
|
||||
httpPost.releaseConnection();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodSingleFileUploadResult;
|
||||
import jodd.http.HttpConnectionProvider;
|
||||
import jodd.http.HttpRequest;
|
||||
import jodd.http.HttpResponse;
|
||||
import jodd.http.ProxyInfo;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class JoddHttpVodSingleUploadRequestExecutor extends VodSingleUploadRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
|
||||
public JoddHttpVodSingleUploadRequestExecutor(RequestHttp requestHttp, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) {
|
||||
super(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodSingleFileUploadResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
HttpRequest request = HttpRequest.post(uri);
|
||||
if (requestHttp.getRequestHttpProxy() != null) {
|
||||
requestHttp.getRequestHttpClient().useProxy(requestHttp.getRequestHttpProxy());
|
||||
}
|
||||
request.withConnectionProvider(requestHttp.getRequestHttpClient());
|
||||
request.form("media_data", file);
|
||||
request.form("media_name", mediaName);
|
||||
request.form("media_type", mediaType);
|
||||
if (coverType != null) {
|
||||
request.form("cover_type", coverType);
|
||||
}
|
||||
if (coverData != null) {
|
||||
request.form("cover_data", coverData);
|
||||
}
|
||||
if (sourceContext != null) {
|
||||
request.form("source_context", sourceContext);
|
||||
}
|
||||
|
||||
|
||||
HttpResponse response = request.send();
|
||||
response.charset(StandardCharsets.UTF_8.name());
|
||||
|
||||
String responseContent = response.bodyText();
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodSingleFileUploadResult.fromJson(responseContent);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodUploadPartResult;
|
||||
import jodd.http.HttpConnectionProvider;
|
||||
import jodd.http.HttpRequest;
|
||||
import jodd.http.HttpResponse;
|
||||
import jodd.http.ProxyInfo;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class JoddHttpVodUploadPartRequestExecutor extends VodUploadPartRequestExecutor<HttpConnectionProvider, ProxyInfo> {
|
||||
|
||||
public JoddHttpVodUploadPartRequestExecutor(RequestHttp requestHttp, String uploadId, Integer partNumber, Integer resourceType) {
|
||||
super(requestHttp, uploadId, partNumber, resourceType);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodUploadPartResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
HttpRequest request = HttpRequest.post(uri);
|
||||
if (requestHttp.getRequestHttpProxy() != null) {
|
||||
requestHttp.getRequestHttpClient().useProxy(requestHttp.getRequestHttpProxy());
|
||||
}
|
||||
request.withConnectionProvider(requestHttp.getRequestHttpClient());
|
||||
request.form("data", file);
|
||||
request.form("upload_id", uploadId);
|
||||
request.form("part_number", partNumber);
|
||||
request.form("resource_type", resourceType);
|
||||
|
||||
HttpResponse response = request.send();
|
||||
response.charset(StandardCharsets.UTF_8.name());
|
||||
|
||||
String responseContent = response.bodyText();
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodUploadPartResult.fromJson(responseContent);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodSingleFileUploadResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
|
||||
import okhttp3.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class OkHttpVodSingleUploadRequestExecutor extends VodSingleUploadRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
|
||||
public OkHttpVodSingleUploadRequestExecutor(RequestHttp requestHttp, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) {
|
||||
super(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodSingleFileUploadResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
|
||||
MultipartBody.Builder bodyBuilder = new MultipartBody.Builder()
|
||||
.setType(MediaType.parse("multipart/form-data"))
|
||||
.addFormDataPart("media_data",
|
||||
file.getName(),
|
||||
RequestBody.create(MediaType.parse("application/octet-stream"), file));
|
||||
bodyBuilder.addFormDataPart("media_type", this.mediaType)
|
||||
.addFormDataPart("media_name", this.mediaName);
|
||||
|
||||
if (coverType != null) {
|
||||
bodyBuilder.addFormDataPart("cover_type", this.coverType);
|
||||
}
|
||||
if (coverData != null) {
|
||||
bodyBuilder.addFormDataPart("cover_data",
|
||||
coverData.getName(),
|
||||
RequestBody.create(MediaType.parse("application/octet-stream"), coverData));
|
||||
}
|
||||
if (sourceContext != null) {
|
||||
bodyBuilder.addFormDataPart("source_context", this.sourceContext);
|
||||
}
|
||||
Request request = new Request.Builder().url(uri).post(bodyBuilder.build()).build();
|
||||
|
||||
Response response = requestHttp.getRequestHttpClient().newCall(request).execute();
|
||||
String responseContent = response.body().string();
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodSingleFileUploadResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodUploadPartResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.okhttp.OkHttpProxyInfo;
|
||||
import okhttp3.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class OkHttpVodUploadPartRequestExecutor extends VodUploadPartRequestExecutor<OkHttpClient, OkHttpProxyInfo> {
|
||||
|
||||
public OkHttpVodUploadPartRequestExecutor(RequestHttp requestHttp, String uploadId, Integer partNumber, Integer resourceType) {
|
||||
super(requestHttp, uploadId, partNumber, resourceType);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodUploadPartResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {
|
||||
|
||||
MultipartBody.Builder bodyBuilder = new MultipartBody.Builder()
|
||||
.setType(MediaType.parse("multipart/form-data"))
|
||||
.addFormDataPart("data",
|
||||
file.getName(),
|
||||
RequestBody.create(MediaType.parse("application/octet-stream"), file));
|
||||
bodyBuilder.addFormDataPart("upload_id", uploadId)
|
||||
.addFormDataPart("part_number", String.valueOf(this.partNumber))
|
||||
.addFormDataPart("resource_type", String.valueOf(this.resourceType));
|
||||
|
||||
Request request = new Request.Builder().url(uri).post(bodyBuilder.build()).build();
|
||||
|
||||
Response response = requestHttp.getRequestHttpClient().newCall(request).execute();
|
||||
String responseContent = response.body().string();
|
||||
WxError error = WxError.fromJson(responseContent, wxType);
|
||||
if (error.getErrorCode() != 0) {
|
||||
throw new WxErrorException(error);
|
||||
}
|
||||
return WxMaVodUploadPartResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodSingleFileUploadResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.ResponseHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 小程序 提审素材上传接口
|
||||
* 上传媒体文件请求执行器.
|
||||
* 请求的参数是File, 返回的结果是String
|
||||
*
|
||||
* @author yangyh22
|
||||
* @since 2020/11/14
|
||||
*/
|
||||
public abstract class VodSingleUploadRequestExecutor<H, P> implements RequestExecutor<WxMaVodSingleFileUploadResult, File> {
|
||||
|
||||
protected RequestHttp<H, P> requestHttp;
|
||||
protected String mediaName;
|
||||
protected String mediaType;
|
||||
protected String coverType;
|
||||
protected String sourceContext;
|
||||
protected File coverData;
|
||||
|
||||
public VodSingleUploadRequestExecutor(RequestHttp requestHttp, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) {
|
||||
this.requestHttp = requestHttp;
|
||||
this.mediaName = mediaName;
|
||||
this.mediaType = mediaType;
|
||||
this.coverType = coverType;
|
||||
this.coverData = coverData;
|
||||
this.sourceContext = sourceContext;
|
||||
|
||||
}
|
||||
|
||||
public static RequestExecutor<WxMaVodSingleFileUploadResult, File> create(RequestHttp requestHttp, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) {
|
||||
switch (requestHttp.getRequestType()) {
|
||||
case APACHE_HTTP:
|
||||
return new ApacheVodSingleUploadRequestExecutor(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
case JODD_HTTP:
|
||||
return new JoddHttpVodSingleUploadRequestExecutor(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
case OK_HTTP:
|
||||
return new OkHttpVodSingleUploadRequestExecutor(requestHttp, mediaName, mediaType, coverType, coverData, sourceContext);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String uri, File data, ResponseHandler<WxMaVodSingleFileUploadResult> handler, WxType wxType) throws WxErrorException, IOException {
|
||||
handler.handle(this.execute(uri, data, wxType));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.binarywang.wx.miniapp.executor;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.WxMaVodUploadPartResult;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.common.util.http.ResponseHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class VodUploadPartRequestExecutor<H, P> implements RequestExecutor<WxMaVodUploadPartResult, File> {
|
||||
|
||||
protected RequestHttp<H, P> requestHttp;
|
||||
protected String uploadId;
|
||||
protected Integer partNumber;
|
||||
protected Integer resourceType;
|
||||
|
||||
public VodUploadPartRequestExecutor(RequestHttp requestHttp, String uploadId, Integer partNumber, Integer resourceType) {
|
||||
this.requestHttp = requestHttp;
|
||||
this.uploadId = uploadId;
|
||||
this.partNumber = partNumber;
|
||||
this.resourceType = resourceType;
|
||||
|
||||
}
|
||||
|
||||
public static RequestExecutor<WxMaVodUploadPartResult, File> create(RequestHttp requestHttp, String uploadId, Integer partNumber, Integer resourceType) {
|
||||
switch (requestHttp.getRequestType()) {
|
||||
case APACHE_HTTP:
|
||||
return new ApacheVodUploadPartRequestExecutor(requestHttp, uploadId, partNumber, resourceType);
|
||||
case JODD_HTTP:
|
||||
return new JoddHttpVodUploadPartRequestExecutor(requestHttp, uploadId, partNumber, resourceType);
|
||||
case OK_HTTP:
|
||||
return new OkHttpVodUploadPartRequestExecutor(requestHttp, uploadId, partNumber, resourceType);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String uri, File data, ResponseHandler<WxMaVodUploadPartResult> handler, WxType wxType) throws WxErrorException, IOException {
|
||||
handler.handle(this.execute(uri, data, wxType));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -84,4 +84,46 @@ public class WxMaVodServiceImplTest {
|
||||
Integer response = this.wxService.getWxMaVodService().auditDrama(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTask() throws Exception {
|
||||
WxMaVodGetTaskRequest request = WxMaVodGetTaskRequest.builder()
|
||||
.taskId(0)
|
||||
.build();
|
||||
WxMaVodGetTaskResponse response = this.wxService.getWxMaVodService().getTask(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPullUpload() throws Exception {
|
||||
WxMaVodPullUploadRequest request = WxMaVodPullUploadRequest.builder()
|
||||
.coverUrl("")
|
||||
.mediaUrl("")
|
||||
.mediaName("我的中国梦 - 第1集")
|
||||
.sourceContext("")
|
||||
.build();
|
||||
WxMaVodPullUploadResponse response = this.wxService.getWxMaVodService().pullUpload(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
@Test
|
||||
public void testGetCdnUsageData() throws Exception {
|
||||
WxMaVodGetCdnUsageRequest request = WxMaVodGetCdnUsageRequest.builder()
|
||||
.startTime(0L)
|
||||
.endTime(0L)
|
||||
.dataInterval(1440)
|
||||
.build();
|
||||
WxMaVodGetCdnUsageResponse response = this.wxService.getWxMaVodService().getCdnUsageData(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCdnLogs() throws Exception {
|
||||
WxMaVodGetCdnLogRequest request = WxMaVodGetCdnLogRequest.builder()
|
||||
.startTime(0L).endTime(0L)
|
||||
.offset(0).limit(100)
|
||||
.build();
|
||||
WxMaVodGetCdnLogResponse response = this.wxService.getWxMaVodService().getCdnLogs(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,220 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.xpay.*;
|
||||
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMaXPayServiceImplTest {
|
||||
@Inject
|
||||
private WxMaService wxService;
|
||||
|
||||
@Test
|
||||
public void testQueryUserBalance() throws Exception {
|
||||
WxMaXPayQueryUserBalanceRequest request = WxMaXPayQueryUserBalanceRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.userIp("127.0.0.1")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayQueryUserBalanceResponse response = this.wxService.getWxMaXPayService().queryUserBalance(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurrencyPay() throws Exception {
|
||||
WxMaXPayCurrencyPayRequest request = WxMaXPayCurrencyPayRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.userIp("127.0.0.1")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayCurrencyPayResponse response = this.wxService.getWxMaXPayService().currencyPay(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryOrder() throws Exception {
|
||||
WxMaXPayQueryOrderRequest request = WxMaXPayQueryOrderRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.orderId("")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayQueryOrderResponse response = this.wxService.getWxMaXPayService().queryOrder(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCancelCurrencyPay() throws Exception {
|
||||
WxMaXPayCancelCurrencyPayRequest request = WxMaXPayCancelCurrencyPayRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.userIp("127.0.0.1")
|
||||
.orderId("")
|
||||
.payOrderId("")
|
||||
.amount(1000L)
|
||||
.deviceType(WxMaConstants.XPayDeviceType.ANDROID)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayCancelCurrencyPayResponse response = this.wxService.getWxMaXPayService().cancelCurrencyPay(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotifyProvideGoods() throws Exception {
|
||||
WxMaXPayNotifyProvideGoodsRequest request = WxMaXPayNotifyProvideGoodsRequest.builder()
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.orderId("")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
boolean response = this.wxService.getWxMaXPayService().notifyProvideGoods(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPresentCurrency() throws Exception {
|
||||
WxMaXPayPresentCurrencyRequest request = WxMaXPayPresentCurrencyRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.orderId("").deviceType(WxMaConstants.XPayDeviceType.ANDROID)
|
||||
.amount(100L)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayPresentCurrencyResponse response = this.wxService.getWxMaXPayService().presentCurrency(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDownloadBill() throws Exception {
|
||||
WxMaXPayDownloadBillRequest request = WxMaXPayDownloadBillRequest.builder()
|
||||
.beginDs(20230801)
|
||||
.endDs(20230810)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayDownloadBillResponse response = this.wxService.getWxMaXPayService().downloadBill(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
@Test
|
||||
public void testRefundOrder() throws Exception {
|
||||
WxMaXPayRefundOrderRequest request = WxMaXPayRefundOrderRequest.builder()
|
||||
.openid("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.orderId("")
|
||||
.refundOrderId("")
|
||||
.leftFee(100L)
|
||||
.refundFee(10L)
|
||||
.bizMeta("").refundReason("").reqFrom("")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayRefundOrderResponse response = this.wxService.getWxMaXPayService().refundOrder(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateWithdrawOrder() throws Exception {
|
||||
WxMaXPayCreateWithdrawOrderRequest request = WxMaXPayCreateWithdrawOrderRequest.builder()
|
||||
.withdrawNo("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.withdrawAmount("0.01")
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayCreateWithdrawOrderResponse response = this.wxService.getWxMaXPayService().createWithdrawOrder(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testQueryWithdrawOrder() throws Exception {
|
||||
WxMaXPayQueryWithdrawOrderRequest request = WxMaXPayQueryWithdrawOrderRequest.builder()
|
||||
.withdrawNo("")
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayQueryWithdrawOrderResponse response = this.wxService.getWxMaXPayService().queryWithdrawOrder(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStartUploadGoods() throws Exception {
|
||||
WxMaXPayStartUploadGoodsRequest request = WxMaXPayStartUploadGoodsRequest.builder()
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.uploadItem(new ArrayList<>())
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
boolean response = this.wxService.getWxMaXPayService().startUploadGoods(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryUploadGoods() throws Exception {
|
||||
WxMaXPayQueryUploadGoodsRequest request = WxMaXPayQueryUploadGoodsRequest.builder()
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayQueryUploadGoodsResponse response = this.wxService.getWxMaXPayService().queryUploadGoods(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testStartPublishGoods() throws Exception {
|
||||
WxMaXPayStartPublishGoodsRequest request = WxMaXPayStartPublishGoodsRequest.builder()
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.publishItem(new ArrayList<>())
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
boolean response = this.wxService.getWxMaXPayService().startPublishGoods(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryPublishGoods() throws Exception {
|
||||
WxMaXPayQueryPublishGoodsRequest request = WxMaXPayQueryPublishGoodsRequest.builder()
|
||||
.env(WxMaConstants.XPayEnv.PRODUCT)
|
||||
.build();
|
||||
WxMaXPaySigParams sigParams = new WxMaXPaySigParams();
|
||||
sigParams.setSessionKey("");
|
||||
sigParams.setAppKey("");
|
||||
WxMaXPayQueryPublishGoodsResponse response = this.wxService.getWxMaXPayService().queryPublishGoods(request, sigParams);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user