九州世界 v1.0版本的 MD5 值为:7e82e48b69a4c36d0bdfb2a8d382d05d
以下内容为反编译后的 PayrollCardService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.payrollcard;
import com.alipay.sdk.m.p0.c;
import com.wechat.pay.java.core.Config;
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.payrollcard.model.AuthenticationEntity;
import com.wechat.pay.java.service.payrollcard.model.CreateTokenRequest;
import com.wechat.pay.java.service.payrollcard.model.CreateTransferBatchRequest;
import com.wechat.pay.java.service.payrollcard.model.GetAuthenticationRequest;
import com.wechat.pay.java.service.payrollcard.model.GetRelationRequest;
import com.wechat.pay.java.service.payrollcard.model.ListAuthenticationsRequest;
import com.wechat.pay.java.service.payrollcard.model.ListAuthenticationsResponse;
import com.wechat.pay.java.service.payrollcard.model.PreOrderAuthenticationRequest;
import com.wechat.pay.java.service.payrollcard.model.PreOrderAuthenticationResponse;
import com.wechat.pay.java.service.payrollcard.model.PreOrderAuthenticationWithAuthRequest;
import com.wechat.pay.java.service.payrollcard.model.PreOrderAuthenticationWithAuthResponse;
import com.wechat.pay.java.service.payrollcard.model.RelationEntity;
import com.wechat.pay.java.service.payrollcard.model.TokenEntity;
import com.wechat.pay.java.service.payrollcard.model.TransferBatchEntity;
import java.util.Objects;
public class PayrollCardService {
private final PrivacyEncryptor encryptor;
private final HostName hostName;
private final HttpClient httpClient;
private PayrollCardService(HttpClient httpClient, HostName hostName, PrivacyEncryptor privacyEncryptor) {
this.httpClient = (HttpClient) Objects.requireNonNull(httpClient);
this.hostName = hostName;
this.encryptor = (PrivacyEncryptor) Objects.requireNonNull(privacyEncryptor);
}
public static class Builder {
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();
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 PayrollCardService build() {
return new PayrollCardService(this.httpClient, this.hostName, this.encryptor);
}
}
public AuthenticationEntity getAuthentication(GetAuthenticationRequest getAuthenticationRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/payroll-card/authentications/{authenticate_number}".replace("{authenticate_number}", UrlEncoder.urlEncode(getAuthenticationRequest.getAuthenticateNumber()));
QueryParameter queryParameter = new QueryParameter();
if (getAuthenticationRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(getAuthenticationRequest.getSubMchid()));
}
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 (AuthenticationEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), AuthenticationEntity.class).getServiceResponse();
}
public ListAuthenticationsResponse listAuthentications(ListAuthenticationsRequest listAuthenticationsRequest) {
QueryParameter queryParameter = new QueryParameter();
if (listAuthenticationsRequest.getOpenid() != null) {
queryParameter.add("openid", UrlEncoder.urlEncode(listAuthenticationsRequest.getOpenid()));
}
if (listAuthenticationsRequest.getAppid() != null) {
queryParameter.add(c.d, UrlEncoder.urlEncode(listAuthenticationsRequest.getAppid()));
}
if (listAuthenticationsRequest.getSubAppid() != null) {
queryParameter.add("sub_appid", UrlEncoder.urlEncode(listAuthenticationsRequest.getSubAppid()));
}
if (listAuthenticationsRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(listAuthenticationsRequest.getSubMchid()));
}
if (listAuthenticationsRequest.getAuthenticateDate() != null) {
queryParameter.add("authenticate_date", UrlEncoder.urlEncode(listAuthenticationsRequest.getAuthenticateDate()));
}
if (listAuthenticationsRequest.getAuthenticateState() != null) {
queryParameter.add("authenticate_state", UrlEncoder.urlEncode(listAuthenticationsRequest.getAuthenticateState()));
}
if (listAuthenticationsRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listAuthenticationsRequest.getOffset().toString()));
}
if (listAuthenticationsRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listAuthenticationsRequest.getLimit().toString()));
}
String str = "https://api.mch.weixin.qq.com/v3/payroll-card/authentications" + 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 (ListAuthenticationsResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListAuthenticationsResponse.class).getServiceResponse();
}
public PreOrderAuthenticationResponse preOrderAuthentication(PreOrderAuthenticationRequest preOrderAuthenticationRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/payroll-card/authentications/pre-order".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/payroll-card/authentications/pre-order";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (PreOrderAuthenticationResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(preOrderAuthenticationRequest)).build(), PreOrderAuthenticationResponse.class).getServiceResponse();
}
public PreOrderAuthenticationWithAuthResponse preOrderAuthenticationWithAuth(PreOrderAuthenticationWithAuthRequest preOrderAuthenticationWithAuthRequest) {
PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
PreOrderAuthenticationWithAuthRequest cloneWithCipher = preOrderAuthenticationWithAuthRequest.cloneWithCipher(new $$Lambda$iUxDoiVEx5ZJF2fxlef4V1loumM(privacyEncryptor));
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/payroll-card/authentications/pre-order-with-auth".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/payroll-card/authentications/pre-order-with-auth";
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 (PreOrderAuthenticationWithAuthResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), PreOrderAuthenticationWithAuthResponse.class).getServiceResponse();
}
public RelationEntity getRelation(GetRelationRequest getRelationRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/payroll-card/relations/{openid}".replace("{openid}", UrlEncoder.urlEncode(getRelationRequest.getOpenid()));
QueryParameter queryParameter = new QueryParameter();
if (getRelationRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(getRelationRequest.getSubMchid()));
}
if (getRelationRequest.getAppid() != null) {
queryParameter.add(c.d, UrlEncoder.urlEncode(getRelationRequest.getAppid()));
}
if (getRelationRequest.getSubAppid() != null) {
queryParameter.add("sub_appid", UrlEncoder.urlEncode(getRelationRequest.getSubAppid()));
}
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 (RelationEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), RelationEntity.class).getServiceResponse();
}
public TokenEntity createToken(CreateTokenRequest createTokenRequest) {
PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
CreateTokenRequest cloneWithCipher = createTokenRequest.cloneWithCipher(new $$Lambda$iUxDoiVEx5ZJF2fxlef4V1loumM(privacyEncryptor));
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/payroll-card/tokens".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/payroll-card/tokens";
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 (TokenEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), TokenEntity.class).getServiceResponse();
}
public TransferBatchEntity createTransferBatch(CreateTransferBatchRequest createTransferBatchRequest) {
PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
CreateTransferBatchRequest cloneWithCipher = createTransferBatchRequest.cloneWithCipher(new $$Lambda$iUxDoiVEx5ZJF2fxlef4V1loumM(privacyEncryptor));
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/payroll-card/transfer-batches".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/payroll-card/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 (TransferBatchEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), TransferBatchEntity.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}