style: copy right

This commit is contained in:
felord
2021-03-31 13:36:49 +08:00
parent c9ed68fa80
commit 6086dd5101
20 changed files with 400 additions and 11 deletions

View File

@@ -18,6 +18,7 @@
package cn.felord.payment.wechat.v2;
import cn.felord.payment.wechat.WechatPayProperties;
import cn.felord.payment.wechat.v2.model.BaseModel;
import cn.felord.payment.wechat.v2.model.allocation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -83,7 +84,7 @@ public class WechatAllocationApi {
profitSharingSModel.setOutOrderNo(profitSharingModel.getOutOrderNo());
profitSharingSModel.certPath(v3.getCertPath());
profitSharingSModel.signType("HMAC-SHA256");
profitSharingSModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingSModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/secapi/pay/profitsharing");
@@ -109,7 +110,7 @@ public class WechatAllocationApi {
multiProfitSharingSModel.setOutOrderNo(multiProfitSharingModel.getOutOrderNo());
multiProfitSharingSModel.certPath(v3.getCertPath());
multiProfitSharingSModel.signType("HMAC-SHA256");
multiProfitSharingSModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(multiProfitSharingSModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/secapi/pay/multiprofitsharing");
@@ -125,7 +126,7 @@ public class WechatAllocationApi {
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
profitSharingQueryModel.setMchId(v3.getMchId());
profitSharingQueryModel.certPath(v3.getCertPath());
profitSharingQueryModel.signType("HMAC-SHA256");
profitSharingQueryModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingQueryModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/pay/profitsharingquery");
@@ -148,7 +149,7 @@ public class WechatAllocationApi {
profitSharingAddReceiverSModel.setMchId(v3.getMchId());
profitSharingAddReceiverSModel.certPath(v3.getCertPath());
profitSharingAddReceiverSModel.signType("HMAC-SHA256");
profitSharingAddReceiverSModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingAddReceiverSModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver");
@@ -171,7 +172,7 @@ public class WechatAllocationApi {
profitSharingRemoveReceiverSModel.setMchId(v3.getMchId());
profitSharingRemoveReceiverSModel.certPath(v3.getCertPath());
profitSharingRemoveReceiverSModel.signType("HMAC-SHA256");
profitSharingRemoveReceiverSModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingRemoveReceiverSModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver");
@@ -188,7 +189,7 @@ public class WechatAllocationApi {
profitSharingFinishModel.setAppid(v3.getAppId());
profitSharingFinishModel.setMchId(v3.getMchId());
profitSharingFinishModel.certPath(v3.getCertPath());
profitSharingFinishModel.signType("HMAC-SHA256");
profitSharingFinishModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingFinishModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/secapi/pay/profitsharingfinish");
@@ -204,7 +205,7 @@ public class WechatAllocationApi {
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
profitSharingOrderAmountQueryModel.setMchId(v3.getMchId());
profitSharingOrderAmountQueryModel.certPath(v3.getCertPath());
profitSharingOrderAmountQueryModel.signType("HMAC-SHA256");
profitSharingOrderAmountQueryModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingOrderAmountQueryModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/pay/profitsharingorderamountquery");
@@ -221,7 +222,7 @@ public class WechatAllocationApi {
profitSharingReturnModel.setAppid(v3.getAppId());
profitSharingReturnModel.setMchId(v3.getMchId());
profitSharingReturnModel.certPath(v3.getCertPath());
profitSharingReturnModel.signType("HMAC-SHA256");
profitSharingReturnModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingReturnModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn");
@@ -238,7 +239,7 @@ public class WechatAllocationApi {
profitSharingReturnQueryModel.setAppid(v3.getAppId());
profitSharingReturnQueryModel.setMchId(v3.getMchId());
profitSharingReturnQueryModel.certPath(v3.getCertPath());
profitSharingReturnQueryModel.signType("HMAC-SHA256");
profitSharingReturnQueryModel.signType(BaseModel.HMAC_SHA256);
return wechatV2Client.wechatPayRequest(profitSharingReturnQueryModel,
HttpMethod.POST,
"https://api.mch.weixin.qq.com/pay/profitsharingreturnquery");

View File

@@ -65,6 +65,7 @@ import java.security.cert.CertificateException;
*/
@Getter
public abstract class BaseModel {
public static final String HMAC_SHA256="HMAC-SHA256";
private static final XmlMapper XML_MAPPER = new XmlMapper();
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@@ -115,7 +116,7 @@ public abstract class BaseModel {
@SneakyThrows
private String xml() {
String link = link(this);
if ("HMAC-SHA256".equals(signType)) {
if (HMAC_SHA256.equals(signType)) {
this.sign = this.hmacSha256(link);
} else {
this.sign = this.md5(link);

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Base profit sharing model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Base profit sharing receiver model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,6 +1,26 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
/**
* The type Multi profit sharing model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
public class MultiProfitSharingModel extends ProfitSharingModel {

View File

@@ -1,6 +1,26 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
/**
* The type Multi profit sharing s model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
public class MultiProfitSharingSModel extends ProfitSharingSModel {

View File

@@ -1,9 +1,29 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing add receiver model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)
@@ -12,6 +32,9 @@ public class ProfitSharingAddReceiverModel extends BaseProfitSharingReceiverMode
private Receiver receiver;
/**
* The type Receiver.
*/
@Data
public static class Receiver {

View File

@@ -1,9 +1,29 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing add receiver s model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing finish model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
@@ -9,6 +26,7 @@ import java.util.List;
* 单次分账请求按照传入的分账接收方账号和资金进行分账,同时会将订单剩余的待分账金额解冻给本商户。
* 故操作成功后,订单不能再进行分账,也不能进行分账完结。
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing order amount query model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing query model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,9 +1,29 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing remove receiver model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)
@@ -12,6 +32,9 @@ public class ProfitSharingRemoveReceiverModel extends BaseProfitSharingReceiverM
private Receiver receiver;
/**
* The type Receiver.
*/
@Data
public static class Receiver {

View File

@@ -1,9 +1,29 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing remove receiver s model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing return model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,3 +1,20 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import cn.felord.payment.wechat.v2.model.BaseModel;
@@ -5,6 +22,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing return query model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,9 +1,28 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* The type Profit sharing s model.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@EqualsAndHashCode(callSuper = true)

View File

@@ -1,7 +1,30 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
import lombok.Data;
/**
* The type Receiver.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
@Data
public class Receiver {

View File

@@ -1,17 +1,72 @@
/*
* Copyright 2019-2021 felord.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* Website:
* https://felord.cn
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.felord.payment.wechat.v2.model.allocation;
/**
* The enum Relation type.
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
public enum RelationType {
/**
* Service provider relation type.
*/
SERVICE_PROVIDER,
/**
* Store relation type.
*/
STORE,
/**
* Staff relation type.
*/
STAFF,
/**
* Store owner relation type.
*/
STORE_OWNER,
/**
* Partner relation type.
*/
PARTNER,
/**
* Headquarter relation type.
*/
HEADQUARTER,
/**
* Brand relation type.
*/
BRAND,
/**
* Distributor relation type.
*/
DISTRIBUTOR,
/**
* User relation type.
*/
USER,
/**
* Supplier relation type.
*/
SUPPLIER,
/**
* Custom relation type.
*/
CUSTOM
}

View File

@@ -1,5 +1,11 @@
package cn.felord.payment.wechat.v2.model.allocation;
/**
* The enum Type.
*
* @author wangzecheng
* @since 1.0.10.RELEASE
*/
public enum Type {
/**
@@ -10,5 +16,5 @@ public enum Type {
/**
* 个人openid
*/
PERSONAL_OPENID;
PERSONAL_OPENID
}