mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
factor: 营销图片上传API现在由WechatMediaApi#marketingImageUpload实现,以代替WechatMarketingFavorApi#marketingImageUpload,旧实现以被标记过时
This commit is contained in:
@@ -215,7 +215,7 @@ public class WechatCombinePayApi extends AbstractApi {
|
||||
*
|
||||
* @param outRefundNo the out refund no
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.16.RELEASE
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryRefundInfo(String outRefundNo) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
|
||||
@@ -545,13 +545,17 @@ public class WechatMarketingFavorApi extends AbstractApi {
|
||||
/**
|
||||
* 营销图片上传API
|
||||
* <p>
|
||||
* 该接口标记过时,用{@link WechatMediaApi#marketingImageUpload(MultipartFile)}代替
|
||||
* <p>
|
||||
* 媒体图片只支持JPG、BMP、PNG格式,文件大小不能超过2M。
|
||||
* <p>
|
||||
* 通过本接口上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用,包括商家券、代金券、支付有礼等。
|
||||
*
|
||||
* @param file the file
|
||||
* @return the wechat response entity
|
||||
* @see WechatMediaApi#marketingImageUpload(MultipartFile)
|
||||
*/
|
||||
@Deprecated
|
||||
public WechatResponseEntity<ObjectNode> marketingImageUpload(MultipartFile file) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.MARKETING_IMAGE_UPLOAD, file)
|
||||
|
||||
@@ -82,6 +82,7 @@ public class WechatMediaApi extends AbstractApi {
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private RequestEntity<?> uploadFunction(WechatPayV3Type type, MultipartFile file) {
|
||||
|
||||
@@ -108,4 +109,24 @@ public class WechatMediaApi extends AbstractApi {
|
||||
.header("Pay-TenantId", tenantId())
|
||||
.body(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营销图片上传API
|
||||
* <p>
|
||||
* 媒体图片只支持JPG、BMP、PNG格式,文件大小不能超过2M。
|
||||
* <p>
|
||||
* 通过本接口上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用,包括商家券、代金券、支付有礼等。
|
||||
*
|
||||
* @param file the file
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> marketingImageUpload(MultipartFile file) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.MARKETING_IMAGE_UPLOAD, file)
|
||||
.function(this::uploadFunction)
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ public class WechatPayScoreApi extends AbstractApi {
|
||||
*
|
||||
* @param refundParams the refund params
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.6.RELEASE
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> refund(RefundParams refundParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
@@ -306,7 +306,7 @@ public class WechatPayScoreApi extends AbstractApi {
|
||||
*
|
||||
* @param outRefundNo the out refund no
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.6.RELEASE
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryRefundInfo(String outRefundNo) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
|
||||
@@ -20,6 +20,7 @@ package cn.felord.payment.wechat.v3;
|
||||
import cn.felord.payment.wechat.WechatPayProperties;
|
||||
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||
import cn.felord.payment.wechat.v3.model.RefundParams;
|
||||
import cn.felord.payment.wechat.v3.model.ResponseSignVerifyParams;
|
||||
import cn.felord.payment.wechat.v3.model.payscore.parking.ParkingServiceQueryParams;
|
||||
import cn.felord.payment.wechat.v3.model.payscore.parking.ParkingParams;
|
||||
@@ -27,6 +28,7 @@ import cn.felord.payment.wechat.v3.model.payscore.parking.TransParkingParams;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
@@ -157,4 +159,53 @@ public class WechatPayScoreParkingApi extends AbstractApi {
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请退款API
|
||||
*
|
||||
* @param refundParams the refund params
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> refund(RefundParams refundParams) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.REFUND, refundParams)
|
||||
.function(((type, params) -> {
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.toUri();
|
||||
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||
String notifyUrl = params.getNotifyUrl();
|
||||
if (StringUtils.hasText(notifyUrl)) {
|
||||
params.setNotifyUrl(v3.getDomain().concat(notifyUrl));
|
||||
}
|
||||
return Post(uri, params);
|
||||
}))
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询单笔退款API
|
||||
*
|
||||
* @param outRefundNo the out refund no
|
||||
* @return the wechat response entity
|
||||
* @since 1.0.17.RELEASE
|
||||
*/
|
||||
public WechatResponseEntity<ObjectNode> queryRefundInfo(String outRefundNo) {
|
||||
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||
this.client().withType(WechatPayV3Type.QUERY_REFUND, outRefundNo)
|
||||
.function(((type, param) -> {
|
||||
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||
.build()
|
||||
.expand(param)
|
||||
.toUri();
|
||||
return Get(uri);
|
||||
}))
|
||||
.consumer(wechatResponseEntity::convert)
|
||||
.request();
|
||||
return wechatResponseEntity;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user