九州仙境 v3.0.0版本的 MD5 值为:7b5ce5daab0f4a38a386ae4309157477
以下内容为反编译后的 BrandProfitSharingService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.brandprofitsharing;
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.brandprofitsharing.model.AddReceiverRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.AddReceiverResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.CreateOrderRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.CreateOrderResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.CreateReturnOrderRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.CreateReturnOrderResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.DeleteReceiverRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.DeleteReceiverResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.FinishOrderRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.FinishOrderResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryBrandMerchantRatioRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryBrandMerchantRatioResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryOrderAmountRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryOrderAmountResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryOrderRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryOrderResponse;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryReturnOrderRequest;
import com.wechat.pay.java.service.brandprofitsharing.model.QueryReturnOrderResponse;
import java.util.Objects;
import java.util.function.UnaryOperator;
public class BrandProfitSharingService {
private final PrivacyEncryptor encryptor;
private final HostName hostName;
private final HttpClient httpClient;
private BrandProfitSharingService(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 BrandProfitSharingService build() {
return new BrandProfitSharingService(this.httpClient, this.hostName, this.encryptor);
}
}
public QueryBrandMerchantRatioResponse queryBrandMerchantRatio(QueryBrandMerchantRatioRequest queryBrandMerchantRatioRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/brand/profitsharing/brand-configs/{brand_mchid}".replace("{brand_mchid}", UrlEncoder.urlEncode(queryBrandMerchantRatioRequest.getBrandMchid()));
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 (QueryBrandMerchantRatioResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build(), QueryBrandMerchantRatioResponse.class).getServiceResponse();
}
public CreateOrderResponse createOrder(CreateOrderRequest createOrderRequest) {
final PrivacyEncryptor privacyEncryptor = this.encryptor;
privacyEncryptor.getClass();
CreateOrderRequest cloneWithCipher = createOrderRequest.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/brand/profitsharing/orders".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/brand/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 (CreateOrderResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(cloneWithCipher)).build(), CreateOrderResponse.class).getServiceResponse();
}
public FinishOrderResponse finishOrder(FinishOrderRequest finishOrderRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/brand/profitsharing/finish-order".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/brand/profitsharing/finish-order";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (FinishOrderResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(finishOrderRequest)).build(), FinishOrderResponse.class).getServiceResponse();
}
public QueryOrderResponse queryOrder(QueryOrderRequest queryOrderRequest) {
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()));
}
if (queryOrderRequest.getOutOrderNo() != null) {
queryParameter.add("out_order_no", UrlEncoder.urlEncode(queryOrderRequest.getOutOrderNo()));
}
String str = "https://api.mch.weixin.qq.com/v3/brand/profitsharing/orders" + 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 (QueryOrderResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), QueryOrderResponse.class).getServiceResponse();
}
public QueryOrderAmountResponse queryOrderAmount(QueryOrderAmountRequest queryOrderAmountRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/brand/profitsharing/orders/{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();
}
public AddReceiverResponse addReceiver(AddReceiverRequest addReceiverRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/brand/profitsharing/receivers/add".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/brand/profitsharing/receivers/add";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (AddReceiverResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(addReceiverRequest)).build(), AddReceiverResponse.class).getServiceResponse();
}
public DeleteReceiverResponse deleteReceiver(DeleteReceiverRequest deleteReceiverRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/brand/profitsharing/receivers/delete".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/brand/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 CreateReturnOrderResponse createReturnOrder(CreateReturnOrderRequest createReturnOrderRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/brand/profitsharing/returnorders".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/brand/profitsharing/returnorders";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (CreateReturnOrderResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(createReturnOrderRequest)).build(), CreateReturnOrderResponse.class).getServiceResponse();
}
public QueryReturnOrderResponse queryReturnOrder(QueryReturnOrderRequest queryReturnOrderRequest) {
QueryParameter queryParameter = new QueryParameter();
if (queryReturnOrderRequest.getSubMchid() != null) {
queryParameter.add("sub_mchid", UrlEncoder.urlEncode(queryReturnOrderRequest.getSubMchid()));
}
if (queryReturnOrderRequest.getOutReturnNo() != null) {
queryParameter.add("out_return_no", UrlEncoder.urlEncode(queryReturnOrderRequest.getOutReturnNo()));
}
if (queryReturnOrderRequest.getOrderId() != null) {
queryParameter.add("order_id", UrlEncoder.urlEncode(queryReturnOrderRequest.getOrderId()));
}
if (queryReturnOrderRequest.getOutOrderNo() != null) {
queryParameter.add("out_order_no", UrlEncoder.urlEncode(queryReturnOrderRequest.getOutOrderNo()));
}
String str = "https://api.mch.weixin.qq.com/v3/brand/profitsharing/returnorders" + 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 (QueryReturnOrderResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), QueryReturnOrderResponse.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}