九州世界 v1.0版本的 MD5 值为:7e82e48b69a4c36d0bdfb2a8d382d05d

以下内容为反编译后的 TransferBatchService.java 源代码,内容仅作参考


package com.wechat.pay.java.service.transferbatch;

import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.cipher.PrivacyDecryptor;
import com.wechat.pay.java.core.cipher.PrivacyEncryptor;
import com.wechat.pay.java.core.http.Constant;
import com.wechat.pay.java.core.http.DefaultHttpClientBuilder;
import com.wechat.pay.java.core.http.HostName;
import com.wechat.pay.java.core.http.HttpClient;
import com.wechat.pay.java.core.http.HttpHeaders;
import com.wechat.pay.java.core.http.HttpMethod;
import com.wechat.pay.java.core.http.HttpRequest;
import com.wechat.pay.java.core.http.JsonRequestBody;
import com.wechat.pay.java.core.http.MediaType;
import com.wechat.pay.java.core.http.QueryParameter;
import com.wechat.pay.java.core.http.RequestBody;
import com.wechat.pay.java.core.http.UrlEncoder;
import com.wechat.pay.java.core.util.GsonUtil;
import com.wechat.pay.java.service.transferbatch.model.GetTransferBatchByNoRequest;
import com.wechat.pay.java.service.transferbatch.model.GetTransferBatchByOutNoRequest;
import com.wechat.pay.java.service.transferbatch.model.GetTransferDetailByNoRequest;
import com.wechat.pay.java.service.transferbatch.model.GetTransferDetailByOutNoRequest;
import com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferRequest;
import com.wechat.pay.java.service.transferbatch.model.InitiateBatchTransferResponse;
import com.wechat.pay.java.service.transferbatch.model.TransferBatchEntity;
import com.wechat.pay.java.service.transferbatch.model.TransferDetailEntity;
import java.util.Objects;
import java.util.function.UnaryOperator;
public class TransferBatchService {
    private final PrivacyDecryptor decryptor;
    private final PrivacyEncryptor encryptor;
    private final HostName hostName;
    private final HttpClient httpClient;

    private TransferBatchService(HttpClient httpClient, HostName hostName, PrivacyEncryptor privacyEncryptor, PrivacyDecryptor privacyDecryptor) {
        this.httpClient = (HttpClient) Objects.requireNonNull(httpClient);
        this.hostName = hostName;
        this.encryptor = (PrivacyEncryptor) Objects.requireNonNull(privacyEncryptor);
        this.decryptor = (PrivacyDecryptor) Objects.requireNonNull(privacyDecryptor);
    }

    public static class Builder {
        private PrivacyDecryptor decryptor;
        private PrivacyEncryptor encryptor;
        private HostName hostName;
        private HttpClient httpClient;

        public Builder config(Config config) {
            this.httpClient = new DefaultHttpClientBuilder().config(config).build();
            this.encryptor = config.createEncryptor();
            this.decryptor = config.createDecryptor();
            return this;
        }

        public Builder hostName(HostName hostName) {
            this.hostName = hostName;
            return this;
        }

        public Builder httpClient(HttpClient httpClient) {
            this.httpClient = httpClient;
            return this;
        }

        public Builder encryptor(PrivacyEncryptor privacyEncryptor) {
            this.encryptor = privacyEncryptor;
            return this;
        }

        public Builder decryptor(PrivacyDecryptor privacyDecryptor) {
            this.decryptor = privacyDecryptor;
            return this;
        }

        public TransferBatchService build() {
            return new TransferBatchService(this.httpClient, this.hostName, this.encryptor, this.decryptor);
        }
    }

    public TransferBatchEntity getTransferBatchByNo(GetTransferBatchByNoRequest getTransferBatchByNoRequest) {
        String replace = "https://api.mch.weixin.qq.com/v3/transfer/batches/batch-id/{batch_id}".replace("{batch_id}", UrlEncoder.urlEncode(getTransferBatchByNoRequest.getBatchId()));
        QueryParameter queryParameter = new QueryParameter();
        if (getTransferBatchByNoRequest.getNeedQueryDetail() != null) {
            queryParameter.add("need_query_detail", UrlEncoder.urlEncode(getTransferBatchByNoRequest.getNeedQueryDetail().toString()));
        }
        if (getTransferBatchByNoRequest.getOffset() != null) {
            queryParameter.add("offset", UrlEncoder.urlEncode(getTransferBatchByNoRequest.getOffset().toString()));
        }
        if (getTransferBatchByNoRequest.getLimit() != null) {
            queryParameter.add("limit", UrlEncoder.urlEncode(getTransferBatchByNoRequest.getLimit().toString()));
        }
        if (getTransferBatchByNoRequest.getDetailStatus() != null) {
            queryParameter.add("detail_status", UrlEncoder.urlEncode(getTransferBatchByNoRequest.getDetailStatus()));
        }
        String str = replace + queryParameter.getQueryStr();
        if (this.hostName != null) {
            str = str.replaceFirst(HostName.API.getValue(), this.hostName.getValue());
        }
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
        return (TransferBatchEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), TransferBatchEntity.class).getServiceResponse();
    }

    public TransferBatchEntity getTransferBatchByOutNo(GetTransferBatchByOutNoRequest getTransferBatchByOutNoRequest) {
        String replace = "https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/{out_batch_no}".replace("{out_batch_no}", UrlEncoder.urlEncode(getTransferBatchByOutNoRequest.getOutBatchNo()));
        QueryParameter queryParameter = new QueryParameter();
        if (getTransferBatchByOutNoRequest.getNeedQueryDetail() != null) {
            queryParameter.add("need_query_detail", UrlEncoder.urlEncode(getTransferBatchByOutNoRequest.getNeedQueryDetail().toString()));
        }
        if (getTransferBatchByOutNoRequest.getOffset() != null) {
            queryParameter.add("offset", UrlEncoder.urlEncode(getTransferBatchByOutNoRequest.getOffset().toString()));
        }
        if (getTransferBatchByOutNoRequest.getLimit() != null) {
            queryParameter.add("limit", UrlEncoder.urlEncode(getTransferBatchByOutNoRequest.getLimit().toString()));
        }
        if (getTransferBatchByOutNoRequest.getDetailStatus() != null) {
            queryParameter.add("detail_status", UrlEncoder.urlEncode(getTransferBatchByOutNoRequest.getDetailStatus()));
        }
        String str = replace + queryParameter.getQueryStr();
        if (this.hostName != null) {
            str = str.replaceFirst(HostName.API.getValue(), this.hostName.getValue());
        }
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
        return (TransferBatchEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), TransferBatchEntity.class).getServiceResponse();
    }

    public InitiateBatchTransferResponse initiateBatchTransfer(InitiateBatchTransferRequest initiateBatchTransferRequest) {
        final PrivacyEncryptor privacyEncryptor = this.encryptor;
        privacyEncryptor.getClass();
        InitiateBatchTransferRequest cloneWithCipher = initiateBatchTransferRequest.cloneWithCipher(new UnaryOperator() {
            @Override
            public final Object apply(Object obj) {
                return PrivacyEncryptor.this.encrypt((String) obj);
            }
        });
        String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/transfer/batches".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/transfer/batches";
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.WECHAT_PAY_SERIAL, this.encryptor.getWechatpaySerial());
        return (InitiateBatchTransferResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), InitiateBatchTransferResponse.class).getServiceResponse();
    }

    public TransferDetailEntity getTransferDetailByNo(GetTransferDetailByNoRequest getTransferDetailByNoRequest) {
        String replace = "https://api.mch.weixin.qq.com/v3/transfer/batches/batch-id/{batch_id}/details/detail-id/{detail_id}".replace("{batch_id}", UrlEncoder.urlEncode(getTransferDetailByNoRequest.getBatchId())).replace("{detail_id}", UrlEncoder.urlEncode(getTransferDetailByNoRequest.getDetailId()));
        if (this.hostName != null) {
            replace = replace.replaceFirst(HostName.API.getValue(), this.hostName.getValue());
        }
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
        HttpRequest build = new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build();
        PrivacyDecryptor privacyDecryptor = this.decryptor;
        privacyDecryptor.getClass();
        return ((TransferDetailEntity) this.httpClient.execute(build, TransferDetailEntity.class).getServiceResponse()).cloneWithCipher(new $$Lambda$wBw1mpLIw48zywMsm4q3HJCx8FE(privacyDecryptor));
    }

    public TransferDetailEntity getTransferDetailByOutNo(GetTransferDetailByOutNoRequest getTransferDetailByOutNoRequest) {
        String replace = "https://api.mch.weixin.qq.com/v3/transfer/batches/out-batch-no/{out_batch_no}/details/out-detail-no/{out_detail_no}".replace("{out_detail_no}", UrlEncoder.urlEncode(getTransferDetailByOutNoRequest.getOutDetailNo())).replace("{out_batch_no}", UrlEncoder.urlEncode(getTransferDetailByOutNoRequest.getOutBatchNo()));
        if (this.hostName != null) {
            replace = replace.replaceFirst(HostName.API.getValue(), this.hostName.getValue());
        }
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
        httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
        HttpRequest build = new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build();
        PrivacyDecryptor privacyDecryptor = this.decryptor;
        privacyDecryptor.getClass();
        return ((TransferDetailEntity) this.httpClient.execute(build, TransferDetailEntity.class).getServiceResponse()).cloneWithCipher(new $$Lambda$wBw1mpLIw48zywMsm4q3HJCx8FE(privacyDecryptor));
    }

    private RequestBody createRequestBody(Object obj) {
        return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
    }
}