|
1 | 1 | package cn.binarywang.wx.miniapp.api.impl;
|
2 | 2 |
|
3 | 3 | import cn.binarywang.wx.miniapp.api.WxMaService;
|
4 |
| -import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; |
5 |
| -import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; |
6 | 4 | import cn.binarywang.wx.miniapp.api.WxMaXPayService;
|
| 5 | +import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; |
7 | 6 | import cn.binarywang.wx.miniapp.bean.xpay.*;
|
| 7 | +import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; |
8 | 8 | import lombok.RequiredArgsConstructor;
|
9 | 9 | import lombok.extern.slf4j.Slf4j;
|
10 | 10 | import me.chanjar.weixin.common.enums.WxType;
|
@@ -235,4 +235,217 @@ public WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishG
|
235 | 235 |
|
236 | 236 | return getDetailResponse;
|
237 | 237 | }
|
| 238 | + |
| 239 | + @Override |
| 240 | + public WxMaXPayQueryBizBalanceResponse queryBizBalance(WxMaXPayQueryBizBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 241 | + final String postBody = request.toJson(); |
| 242 | + final String uri = sigParams.signUriWithPay(QUERY_BIZ_BALANCE_URL, postBody); |
| 243 | + String responseContent = this.service.post(uri, postBody); |
| 244 | + WxMaXPayQueryBizBalanceResponse getDetailResponse = WxMaGsonBuilder.create() |
| 245 | + .fromJson(responseContent, WxMaXPayQueryBizBalanceResponse.class); |
| 246 | + |
| 247 | + if (getDetailResponse.getErrcode() != 0) { |
| 248 | + throw new WxErrorException( |
| 249 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 250 | + } |
| 251 | + |
| 252 | + return getDetailResponse; |
| 253 | + } |
| 254 | + |
| 255 | + @Override |
| 256 | + public WxMaXPayQueryTransferAccountResponse queryTransferAccount(WxMaXPayQueryTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 257 | + final String postBody = request.toJson(); |
| 258 | + final String uri = sigParams.signUriWithPay(QUERY_TRANSFER_ACCOUNT_URL, postBody); |
| 259 | + String responseContent = this.service.post(uri, postBody); |
| 260 | + WxMaXPayQueryTransferAccountResponse getDetailResponse = WxMaGsonBuilder.create() |
| 261 | + .fromJson(responseContent, WxMaXPayQueryTransferAccountResponse.class); |
| 262 | + if (getDetailResponse.getErrcode() != 0) { |
| 263 | + throw new WxErrorException( |
| 264 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 265 | + } |
| 266 | + return getDetailResponse; |
| 267 | + } |
| 268 | + |
| 269 | + @Override |
| 270 | + public WxMaXPayQueryAdverFundsResponse queryAdverFunds(WxMaXPayQueryAdverFundsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 271 | + final String postBody = request.toJson(); |
| 272 | + final String uri = sigParams.signUriWithPay(QUERY_ADVER_FUNDS_URL, postBody); |
| 273 | + String responseContent = this.service.post(uri, postBody); |
| 274 | + WxMaXPayQueryAdverFundsResponse getDetailResponse = WxMaGsonBuilder.create() |
| 275 | + .fromJson(responseContent, WxMaXPayQueryAdverFundsResponse.class); |
| 276 | + if (getDetailResponse.getErrcode() != 0) { |
| 277 | + throw new WxErrorException( |
| 278 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 279 | + } |
| 280 | + return getDetailResponse; |
| 281 | + } |
| 282 | + |
| 283 | + @Override |
| 284 | + public WxMaXPayCreateFundsBillResponse createFundsBill(WxMaXPayCreateFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 285 | + final String postBody = request.toJson(); |
| 286 | + final String uri = sigParams.signUriWithPay(CREATE_FUNDS_BILL_URL, postBody); |
| 287 | + String responseContent = this.service.post(uri, postBody); |
| 288 | + WxMaXPayCreateFundsBillResponse getDetailResponse = WxMaGsonBuilder.create() |
| 289 | + .fromJson(responseContent, WxMaXPayCreateFundsBillResponse.class); |
| 290 | + if (getDetailResponse.getErrcode() != 0) { |
| 291 | + throw new WxErrorException( |
| 292 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 293 | + } |
| 294 | + return getDetailResponse; |
| 295 | + } |
| 296 | + |
| 297 | + @Override |
| 298 | + public WxMaBaseResponse bindTransferAccount(WxMaXPayBindTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 299 | + final String postBody = request.toJson(); |
| 300 | + final String uri = sigParams.signUriWithPay(BIND_TRANSFER_ACCOUNT_URL, postBody); |
| 301 | + String responseContent = this.service.post(uri, postBody); |
| 302 | + WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create() |
| 303 | + .fromJson(responseContent, WxMaBaseResponse.class); |
| 304 | + if (getDetailResponse.getErrcode() != 0) { |
| 305 | + throw new WxErrorException( |
| 306 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 307 | + } |
| 308 | + return getDetailResponse; |
| 309 | + } |
| 310 | + |
| 311 | + @Override |
| 312 | + public WxMaXPayQueryFundsBillResponse queryFundsBill(WxMaXPayQueryFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 313 | + final String postBody = request.toJson(); |
| 314 | + final String uri = sigParams.signUriWithPay(QUERY_FUNDS_BILL_URL, postBody); |
| 315 | + String responseContent = this.service.post(uri, postBody); |
| 316 | + WxMaXPayQueryFundsBillResponse getDetailResponse = WxMaGsonBuilder.create() |
| 317 | + .fromJson(responseContent, WxMaXPayQueryFundsBillResponse.class); |
| 318 | + if (getDetailResponse.getErrcode() != 0) { |
| 319 | + throw new WxErrorException( |
| 320 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 321 | + } |
| 322 | + return getDetailResponse; |
| 323 | + } |
| 324 | + |
| 325 | + @Override |
| 326 | + public WxMaXPayQueryRecoverBillResponse queryRecoverBill(WxMaXPayQueryRecoverBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 327 | + final String postBody = request.toJson(); |
| 328 | + final String uri = sigParams.signUriWithPay(QUERY_RECOVER_BILL_URL, postBody); |
| 329 | + String responseContent = this.service.post(uri, postBody); |
| 330 | + WxMaXPayQueryRecoverBillResponse getDetailResponse = WxMaGsonBuilder.create() |
| 331 | + .fromJson(responseContent, WxMaXPayQueryRecoverBillResponse.class); |
| 332 | + if (getDetailResponse.getErrcode() != 0) { |
| 333 | + throw new WxErrorException( |
| 334 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 335 | + } |
| 336 | + return getDetailResponse; |
| 337 | + } |
| 338 | + |
| 339 | + |
| 340 | + @Override |
| 341 | + public WxMaXPayGetComplaintListResponse getComplaintList(WxMaXPayGetComplaintListRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 342 | + final String postBody = request.toJson(); |
| 343 | + final String uri = sigParams.signUriWithPay(GET_COMPLAINT_LIST_URL, postBody); |
| 344 | + String responseContent = this.service.post(uri, postBody); |
| 345 | + WxMaXPayGetComplaintListResponse getDetailResponse = WxMaGsonBuilder.create() |
| 346 | + .fromJson(responseContent, WxMaXPayGetComplaintListResponse.class); |
| 347 | + if (getDetailResponse.getErrcode() != 0) { |
| 348 | + throw new WxErrorException( |
| 349 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 350 | + } |
| 351 | + return getDetailResponse; |
| 352 | + } |
| 353 | + |
| 354 | + @Override |
| 355 | + public WxMaXPayGetComplaintDetailResponse getComplaintDetail(WxMaXPayGetComplaintDetailRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 356 | + final String postBody = request.toJson(); |
| 357 | + final String uri = sigParams.signUriWithPay(GET_COMPLAINT_DETAIL_URL, postBody); |
| 358 | + String responseContent = this.service.post(uri, postBody); |
| 359 | + WxMaXPayGetComplaintDetailResponse getDetailResponse = WxMaGsonBuilder.create() |
| 360 | + .fromJson(responseContent, WxMaXPayGetComplaintDetailResponse.class); |
| 361 | + if (getDetailResponse.getErrcode() != 0) { |
| 362 | + throw new WxErrorException( |
| 363 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 364 | + } |
| 365 | + return getDetailResponse; |
| 366 | + } |
| 367 | + |
| 368 | + @Override |
| 369 | + public WxMaXPayGetNegotiationHistoryResponse getNegotiationHistory(WxMaXPayGetNegotiationHistoryRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 370 | + final String postBody = request.toJson(); |
| 371 | + final String uri = sigParams.signUriWithPay(GET_NEGOTIATION_HISTORY_URL, postBody); |
| 372 | + String responseContent = this.service.post(uri, postBody); |
| 373 | + WxMaXPayGetNegotiationHistoryResponse getDetailResponse = WxMaGsonBuilder.create() |
| 374 | + .fromJson(responseContent, WxMaXPayGetNegotiationHistoryResponse.class); |
| 375 | + if (getDetailResponse.getErrcode() != 0) { |
| 376 | + throw new WxErrorException( |
| 377 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 378 | + } |
| 379 | + return getDetailResponse; |
| 380 | + } |
| 381 | + |
| 382 | + @Override |
| 383 | + public WxMaBaseResponse responseComplaint(WxMaXPayResponseComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 384 | + final String postBody = request.toJson(); |
| 385 | + final String uri = sigParams.signUriWithPay(RESPONSE_COMPLAINT_URL, postBody); |
| 386 | + String responseContent = this.service.post(uri, postBody); |
| 387 | + WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create() |
| 388 | + .fromJson(responseContent, WxMaBaseResponse.class); |
| 389 | + if (getDetailResponse.getErrcode() != 0) { |
| 390 | + throw new WxErrorException( |
| 391 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 392 | + } |
| 393 | + return getDetailResponse; |
| 394 | + } |
| 395 | + |
| 396 | + @Override |
| 397 | + public WxMaBaseResponse completeComplaint(WxMaXPayCompleteComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 398 | + final String postBody = request.toJson(); |
| 399 | + final String uri = sigParams.signUriWithPay(COMPLETE_COMPLAINT_URL, postBody); |
| 400 | + String responseContent = this.service.post(uri, postBody); |
| 401 | + WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create() |
| 402 | + .fromJson(responseContent, WxMaBaseResponse.class); |
| 403 | + if (getDetailResponse.getErrcode() != 0) { |
| 404 | + throw new WxErrorException( |
| 405 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 406 | + } |
| 407 | + return getDetailResponse; |
| 408 | + } |
| 409 | + |
| 410 | + @Override |
| 411 | + public WxMaXPayUploadVpFileResponse uploadVpFile(WxMaXPayUploadVpFileRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 412 | + final String postBody = request.toJson(); |
| 413 | + final String uri = sigParams.signUriWithPay(UPLOAD_VP_FILE_URL, postBody); |
| 414 | + String responseContent = this.service.post(uri, postBody); |
| 415 | + WxMaXPayUploadVpFileResponse getDetailResponse = WxMaGsonBuilder.create() |
| 416 | + .fromJson(responseContent, WxMaXPayUploadVpFileResponse.class); |
| 417 | + if (getDetailResponse.getErrcode() != 0) { |
| 418 | + throw new WxErrorException( |
| 419 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 420 | + } |
| 421 | + return getDetailResponse; |
| 422 | + } |
| 423 | + |
| 424 | + @Override |
| 425 | + public WxMaXPayGetUploadFileSignResponse getUploadFileSign(WxMaXPayGetUploadFileSignRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 426 | + final String postBody = request.toJson(); |
| 427 | + final String uri = sigParams.signUriWithPay(GET_UPLOAD_FILE_SIGN_URL, postBody); |
| 428 | + String responseContent = this.service.post(uri, postBody); |
| 429 | + WxMaXPayGetUploadFileSignResponse getDetailResponse = WxMaGsonBuilder.create() |
| 430 | + .fromJson(responseContent, WxMaXPayGetUploadFileSignResponse.class); |
| 431 | + if (getDetailResponse.getErrcode() != 0) { |
| 432 | + throw new WxErrorException( |
| 433 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 434 | + } |
| 435 | + return getDetailResponse; |
| 436 | + } |
| 437 | + |
| 438 | + @Override |
| 439 | + public WxMaXPayDownloadAdverfundsOrderResponse downloadAdverfundsOrder(WxMaXPayDownloadAdverfundsOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException { |
| 440 | + final String postBody = request.toJson(); |
| 441 | + final String uri = sigParams.signUriWithPay(DOWNLOAD_ADVERFUNDS_ORDER_URL, postBody); |
| 442 | + String responseContent = this.service.post(uri, postBody); |
| 443 | + WxMaXPayDownloadAdverfundsOrderResponse getDetailResponse = WxMaGsonBuilder.create() |
| 444 | + .fromJson(responseContent, WxMaXPayDownloadAdverfundsOrderResponse.class); |
| 445 | + if (getDetailResponse.getErrcode() != 0) { |
| 446 | + throw new WxErrorException( |
| 447 | + new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg())); |
| 448 | + } |
| 449 | + return getDetailResponse; |
| 450 | + } |
238 | 451 | }
|
0 commit comments