diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusinessType.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusinessType.java new file mode 100644 index 0000000..5548a50 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusinessType.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2022 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.enumeration; + +/** + * The enum Business type. + * + * @author felord.cn + * @since 1.0.16.RELEASE + */ +public enum BusinessType { + /** + * 代金券批次(暂不支持合作方为商户的场景) + */ + FAVOR_STOCK, + /** + * 商家券批次 + */ + BUSIFAVOR_STOCK +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnerType.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnerType.java new file mode 100644 index 0000000..e163872 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnerType.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2022 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.enumeration; + +/** + * The enum Partner type. + * + * @author felord.cn + * @since 1.0.16.RELEASE + */ +public enum PartnerType { + /** + * 合作方为APPID + */ + APPID, + /** + * 合作方为商户 + */ + MERCHANT +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnershipState.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnershipState.java new file mode 100644 index 0000000..613c595 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/PartnershipState.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019-2022 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.enumeration; + +/** + * 合作状态 + * + * @author felord.cn + * @since 1.0.16.RELEASE + */ +public enum PartnershipState { + /** + * 已建立合作状态 + */ + ESTABLISHED, + /** + * 已终止合作状态 + */ + TERMINATED +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java index bed36c7..2dd3496 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java @@ -493,6 +493,20 @@ public enum WechatPayV3Type { * @since 1.0.13.RELEASES */ MARKETING_BUSI_FAVOR_SUBSIDY_QUERY(HttpMethod.GET, "%s/v3/marketing/busifavor/subsidy/pay-receipts/{subsidy_receipt_id}"), + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * 建立合作关系API. + * + * @since 1.0.16.RELEASES + */ + MARKETING_PARTNERSHIPS_BUILD(HttpMethod.POST, "%s/v3/marketing/partnerships/build"), + /** + * 查询合作关系列表API. + * + * @since 1.0.16.RELEASES + */ + MARKETING_PARTNERSHIPS_GET(HttpMethod.GET, "%s/v3/marketing/partnerships"), + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * 发起批量转账API. diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java index 5e3ad3b..9989623 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java @@ -42,17 +42,6 @@ public class WechatApiProvider { this.wechatPayClient = wechatPayClient; } - /** - * 代金券. - * - * @param tenantId the tenant id - * @return the wechat marketing favor api - * @since 1.0.0.RELEASE - */ - public WechatMarketingFavorApi favorApi(String tenantId) { - return new WechatMarketingFavorApi(this.wechatPayClient, tenantId); - } - /** * 普通支付-直连模式. * @@ -64,7 +53,6 @@ public class WechatApiProvider { return new WechatDirectPayApi(wechatPayClient, tenantId); } - /** * 普通支付-服务商模式. * @@ -120,6 +108,17 @@ public class WechatApiProvider { return new WechatDiscountCardApi(wechatPayClient, tenantId); } + /** + * 代金券. + * + * @param tenantId the tenant id + * @return the wechat marketing favor api + * @since 1.0.0.RELEASE + */ + public WechatMarketingFavorApi favorApi(String tenantId) { + return new WechatMarketingFavorApi(this.wechatPayClient, tenantId); + } + /** * 微信支付商家券. * @@ -131,6 +130,16 @@ public class WechatApiProvider { return new WechatMarketingBusiFavorApi(wechatPayClient, tenantId); } + /** + * 委托营销-直连商户 + * + * @param tenantId the tenant id + * @return the wechat marketing partnership api + */ + public WechatMarketingPartnershipApi marketingshipApi(String tenantId) { + return new WechatMarketingPartnershipApi(this.wechatPayClient, tenantId); + } + /** * 批量转账到零钱. *
@@ -198,7 +207,7 @@ public class WechatApiProvider { } /** - * 服务商微信支付分账,基于V3 + * 服务商-微信支付分账,基于V3 * * @param tenantId the tenant id * @return the wechat partner profitsharing api @@ -208,7 +217,7 @@ public class WechatApiProvider { } /** - * 服务商品牌分账 + * 服务商-品牌分账 * * @param tenantId the tenant id * @return the wechat brand profitsharing api @@ -262,7 +271,7 @@ public class WechatApiProvider { } /** - * 服务商智慧商圈 + * 服务商-智慧商圈 * * @param tenantId the tenant id * @return the wechat business circle api @@ -273,7 +282,7 @@ public class WechatApiProvider { } /** - * 直连商户智慧商圈 + * 直连商户-智慧商圈 * * @param tenantId the tenant id * @return the wechat business circle api @@ -311,7 +320,7 @@ public class WechatApiProvider { * @param tenantId the tenant id * @return the wechat complaints api */ - public WechatComplaintsApi complaintsApi(String tenantId){ + public WechatComplaintsApi complaintsApi(String tenantId) { return new WechatComplaintsApi(wechatPayClient, tenantId); } } diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingPartnershipApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingPartnershipApi.java new file mode 100644 index 0000000..28acbc8 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingPartnershipApi.java @@ -0,0 +1,127 @@ +/* + * Copyright 2019-2023 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.v3; + +import cn.felord.payment.PayException; +import cn.felord.payment.wechat.enumeration.WeChatServer; +import cn.felord.payment.wechat.enumeration.WechatPayV3Type; +import cn.felord.payment.wechat.v3.model.partnership.Partner; +import cn.felord.payment.wechat.v3.model.partnership.PartnershipParams; +import cn.felord.payment.wechat.v3.model.partnership.PartnershipQueryParams; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.http.HttpHeaders; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.web.util.UriUtils; + +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.Objects; + +/** + * 委托营销-直连商户 + * + * @author felord.cn + * @since 1.0.16.RELEASE + */ +public class WechatMarketingPartnershipApi extends AbstractApi { + /** + * Instantiates a new Abstract api. + * + * @param wechatPayClient the wechat pay client + * @param tenantId the tenant id + */ + public WechatMarketingPartnershipApi(WechatPayClient wechatPayClient, String tenantId) { + super(wechatPayClient, tenantId); + } + + /** + * 建立合作关系API + *
+ * 该接口主要为商户提供营销资源的授权能力,可授权给其他商户或小程序,方便商户间的互利合作。
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 该接口主要为商户提供合作关系列表的查询能力。
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity