mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 13:53:42 +08:00
增加营销图片上传API
This commit is contained in:
@@ -64,7 +64,7 @@ public class WechatPayConfiguration {
|
|||||||
* @return the wechat pay v 3 api
|
* @return the wechat pay v 3 api
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public WechatPayApi wechatPayV3Api(WechatPayV3Client wechatPayV3Client, WechatMetaBean wechatMetaBean) {
|
public WechatPayApi wechatPayApi(WechatPayV3Client wechatPayV3Client, WechatMetaBean wechatMetaBean) {
|
||||||
return new WechatPayApi(wechatPayV3Client,wechatMetaBean);
|
return new WechatPayApi(wechatPayV3Client,wechatMetaBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ public enum WechatPayV3Type {
|
|||||||
/**
|
/**
|
||||||
* 查询批次详情API.
|
* 查询批次详情API.
|
||||||
*/
|
*/
|
||||||
MARKETING_FAVOR_STOCKS_DETAIL(HttpMethod.GET, "%s/v3/marketing/favor/stocks/{stock_id}");
|
MARKETING_FAVOR_STOCKS_DETAIL(HttpMethod.GET, "%s/v3/marketing/favor/stocks/{stock_id}"),
|
||||||
|
/**
|
||||||
|
* 营销图片上传API.
|
||||||
|
*/
|
||||||
|
IMAGE_UPLOAD(HttpMethod.POST, "%s/v3/marketing/favor/media/image-upload");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,6 @@ public class WechatPayApi {
|
|||||||
throw new PayException("wechat app pay json failed");
|
throw new PayException("wechat app pay json failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP下单API.
|
* APP下单API.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -46,9 +46,13 @@ public class HeaderFilter implements PayFilter {
|
|||||||
String body = requestEntity.hasBody() ? Objects.requireNonNull(requestEntity.getBody()).toString() : "";
|
String body = requestEntity.hasBody() ? Objects.requireNonNull(requestEntity.getBody()).toString() : "";
|
||||||
String authorization = signatureProvider.requestSign(httpMethod.name(), canonicalUrl, body);
|
String authorization = signatureProvider.requestSign(httpMethod.name(), canonicalUrl, body);
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = requestEntity.getHeaders();
|
||||||
|
|
||||||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
// 兼容图片上传,自定义优先级最高
|
||||||
|
if (Objects.isNull(headers.getContentType())) {
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
}
|
||||||
headers.add("Authorization", authorization);
|
headers.add("Authorization", authorization);
|
||||||
headers.add("User-Agent", "X-Pay-Service");
|
headers.add("User-Agent", "X-Pay-Service");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user