增加营销图片上传API

This commit is contained in:
xiafang
2020-11-25 15:32:38 +08:00
parent 7f7e365005
commit c307ea12c2
4 changed files with 12 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ public class WechatPayConfiguration {
* @return the wechat pay v 3 api
*/
@Bean
public WechatPayApi wechatPayV3Api(WechatPayV3Client wechatPayV3Client, WechatMetaBean wechatMetaBean) {
public WechatPayApi wechatPayApi(WechatPayV3Client wechatPayV3Client, WechatMetaBean wechatMetaBean) {
return new WechatPayApi(wechatPayV3Client,wechatMetaBean);
}

View File

@@ -58,7 +58,11 @@ public enum WechatPayV3Type {
/**
* 查询批次详情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");

View File

@@ -253,7 +253,6 @@ public class WechatPayApi {
throw new PayException("wechat app pay json failed");
}
/**
* APP下单API.
*

View File

@@ -46,9 +46,13 @@ public class HeaderFilter implements PayFilter {
String body = requestEntity.hasBody() ? Objects.requireNonNull(requestEntity.getBody()).toString() : "";
String authorization = signatureProvider.requestSign(httpMethod.name(), canonicalUrl, body);
HttpHeaders headers = new HttpHeaders();
HttpHeaders headers = requestEntity.getHeaders();
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("User-Agent", "X-Pay-Service");