九州世界 v1.0版本的 MD5 值为:7e82e48b69a4c36d0bdfb2a8d382d05d
以下内容为反编译后的 ProfitsharingService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.profitsharing;
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.profitsharing.model.AddReceiverRequest;
import com.wechat.pay.java.service.profitsharing.model.AddReceiverResponse;
import com.wechat.pay.java.service.profitsharing.model.CreateOrderRequest;
import com.wechat.pay.java.service.profitsharing.model.CreateReturnOrderRequest;
import com.wechat.pay.java.service.profitsharing.model.DeleteReceiverRequest;
import com.wechat.pay.java.service.profitsharing.model.DeleteReceiverResponse;
import com.wechat.pay.java.service.profitsharing.model.OrdersEntity;
import com.wechat.pay.java.service.profitsharing.model.QueryMerchantRatioRequest;
import com.wechat.pay.java.service.profitsharing.model.QueryMerchantRatioResponse;
import com.wechat.pay.java.service.profitsharing.model.QueryOrderAmountRequest;
import com.wechat.pay.java.service.profitsharing.model.QueryOrderAmountResponse;
import com.wechat.pay.java.service.profitsharing.model.QueryOrderRequest;
import com.wechat.pay.java.service.profitsharing.model.QueryReturnOrderRequest;
import com.wechat.pay.java.service.profitsharing.model.ReturnOrdersEntity;
import com.wechat.pay.java.service.profitsharing.model.SplitBillRequest;
import com.wechat.pay.java.service.profitsharing.model.SplitBillResponse;
import com.wechat.pay.java.service.profitsharing.model.UnfreezeOrderRequest;
import java.util.Objects;
import java.util.function.UnaryOperator;
public class ProfitsharingService {
private final PrivacyDecryptor decryptor;
private final PrivacyEncryptor encryptor;
private final HostName hostName;
private final HttpClient httpClient;
private ProfitsharingService(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 ProfitsharingService build() {
return new ProfitsharingService(this.httpClient, this.hostName, this.encryptor, this.decryptor);
}
}
public SplitBillResponse splitBill(SplitBillRequest splitBillRequest) {
QueryParameter queryParameter = new QueryParameter();
if (splitBillRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(splitBillRequest.getSubMchid()));
}
if (splitBillRequest.getBillDate() != null) {
queryParameter.add("bill_date", UrlEncoder.urlEncode(splitBillRequest.getBillDate()));
}
if (splitBillRequest.getTarType() != null) {
queryParameter.add("tar_type", UrlEncoder.urlEncode(splitBillRequest.getTarType().toString()));
}
String str = "https://api.mch.weixin.qq.com/v3/profitsharing/bills" + 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 (SplitBillResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), SplitBillResponse.class).getServiceResponse();
}
public QueryMerchantRatioResponse queryMerchantRatio(QueryMerchantRatioRequest queryMerchantRatioRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/profitsharing/merchant-configs/{sub_mchid}".replace("{sub_mchid}", UrlEncoder.urlEncode(queryMerchantRatioRequest.getSubMchid()));
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());
return (QueryMerchantRatioResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build(), QueryMerchantRatioResponse.class).getServiceResponse();
}
public OrdersEntity createOrder(CreateOrderRequest createOrderRequest) {
PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
CreateOrderRequest cloneWithCipher = createOrderRequest.cloneWithCipher(new $$Lambda$iUxDoiVEx5ZJF2fxlef4V1loumM(privacyEncryptor));
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/profitsharing/orders".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/profitsharing/orders";
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 (OrdersEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), OrdersEntity.class).getServiceResponse();
}
public OrdersEntity queryOrder(QueryOrderRequest queryOrderRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/profitsharing/orders/{out_order_no}".replace("{out_order_no}", UrlEncoder.urlEncode(queryOrderRequest.getOutOrderNo()));
QueryParameter queryParameter = new QueryParameter();
if (queryOrderRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(queryOrderRequest.getSubMchid()));
}
if (queryOrderRequest.getTransactionId() != null) {
queryParameter.add("transaction_id", UrlEncoder.urlEncode(queryOrderRequest.getTransactionId()));
}
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 (OrdersEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), OrdersEntity.class).getServiceResponse();
}
public OrdersEntity unfreezeOrder(UnfreezeOrderRequest unfreezeOrderRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/profitsharing/orders/unfreeze".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/profitsharing/orders/unfreeze";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (OrdersEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(unfreezeOrderRequest)).build(), OrdersEntity.class).getServiceResponse();
}
public AddReceiverResponse addReceiver(AddReceiverRequest addReceiverRequest) {
PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
AddReceiverRequest cloneWithCipher = addReceiverRequest.cloneWithCipher(new $$Lambda$iUxDoiVEx5ZJF2fxlef4V1loumM(privacyEncryptor));
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/profitsharing/receivers/add".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/profitsharing/receivers/add";
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());
HttpRequest build = new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build();
final PrivacyDecryptor privacyDecryptor = this.decryptor;
privacyDecryptor.getClass();
return ((AddReceiverResponse) this.httpClient.execute(build, AddReceiverResponse.class).getServiceResponse()).cloneWithCipher(new UnaryOperator() {
@Override
public final Object apply(Object obj) {
return PrivacyDecryptor.this.decrypt((String) obj);
}
});
}
public DeleteReceiverResponse deleteReceiver(DeleteReceiverRequest deleteReceiverRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/profitsharing/receivers/delete".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/profitsharing/receivers/delete";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (DeleteReceiverResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(deleteReceiverRequest)).build(), DeleteReceiverResponse.class).getServiceResponse();
}
public ReturnOrdersEntity createReturnOrder(CreateReturnOrderRequest createReturnOrderRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/profitsharing/return-orders".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/profitsharing/return-orders";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (ReturnOrdersEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(createReturnOrderRequest)).build(), ReturnOrdersEntity.class).getServiceResponse();
}
public ReturnOrdersEntity queryReturnOrder(QueryReturnOrderRequest queryReturnOrderRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/profitsharing/return-orders/{out_return_no}".replace("{out_return_no}", UrlEncoder.urlEncode(queryReturnOrderRequest.getOutReturnNo()));
QueryParameter queryParameter = new QueryParameter();
if (queryReturnOrderRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(queryReturnOrderRequest.getSubMchid()));
}
if (queryReturnOrderRequest.getOutOrderNo() != null) {
queryParameter.add("out_order_no", UrlEncoder.urlEncode(queryReturnOrderRequest.getOutOrderNo()));
}
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 (ReturnOrdersEntity) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ReturnOrdersEntity.class).getServiceResponse();
}
public QueryOrderAmountResponse queryOrderAmount(QueryOrderAmountRequest queryOrderAmountRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/profitsharing/transactions/{transaction_id}/amounts".replace("{transaction_id}", UrlEncoder.urlEncode(queryOrderAmountRequest.getTransactionId()));
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());
return (QueryOrderAmountResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build(), QueryOrderAmountResponse.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}