feat: wxpay update
This commit is contained in:
@@ -489,6 +489,7 @@ INSERT INTO `sys_role_menu` VALUES (2, 2027);
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2028);
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2029);
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2030);
|
||||
INSERT INTO `sys_role_menu` VALUES (2, 2031);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user
|
||||
|
||||
@@ -11,21 +11,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import static springfox.documentation.builders.PathSelectors.regex;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Swagger配置类
|
||||
* Created by Binary Wang on 2018/9/27.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@Slf4j
|
||||
@@ -69,11 +60,7 @@ public class SwaggerConfig extends WebMvcConfigurationSupport implements Environ
|
||||
return new ApiInfoBuilder()
|
||||
.title("WeChat Pay API")
|
||||
.description("WeChat Pay API for Java")
|
||||
.contact(new Contact("Binary Wang", null, null))
|
||||
.license("Apache 2.0")
|
||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
.version("1.0.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,16 +5,12 @@ import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(WxPayService.class)
|
||||
@EnableConfigurationProperties(WxPayProperties.class)
|
||||
@@ -34,7 +30,7 @@ public class WWxPayConfig {
|
||||
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
|
||||
|
||||
// 可以指定是否使用沙箱环境
|
||||
payConfig.setUseSandboxEnv(false);
|
||||
payConfig.setUseSandboxEnv(this.properties.getUseSandboxEnv());
|
||||
|
||||
WxPayService wxPayService = new WxPayServiceImpl();
|
||||
wxPayService.setConfig(payConfig);
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
/**
|
||||
* wxpay pay properties.
|
||||
*
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "wxpay")
|
||||
@@ -41,4 +40,9 @@ public class WxPayProperties {
|
||||
*/
|
||||
private String keyPath;
|
||||
|
||||
/**
|
||||
* 可以指定是否使用沙箱环境
|
||||
*/
|
||||
private Boolean useSandboxEnv;
|
||||
|
||||
}
|
||||
@@ -18,10 +18,7 @@ import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Api("微信支付")
|
||||
@Api("WeChat Pay")
|
||||
@RestController
|
||||
@RequestMapping("/payment/wxpay")
|
||||
@AllArgsConstructor
|
||||
@@ -43,7 +40,7 @@ public class WxPayController {
|
||||
* @param transactionId 微信订单号
|
||||
* @param outTradeNo 商户系统内部的订单号,当没提供transactionId时需要传这个。
|
||||
*/
|
||||
@ApiOperation(value = "查询订单")
|
||||
@ApiOperation(value = "Query order")
|
||||
@GetMapping("/queryOrder")
|
||||
public WxPayOrderQueryResult queryOrder(@RequestParam(required = false) String transactionId,
|
||||
@RequestParam(required = false) String outTradeNo)
|
||||
@@ -51,7 +48,7 @@ public class WxPayController {
|
||||
return this.wxService.queryOrder(transactionId, outTradeNo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询订单")
|
||||
@ApiOperation(value = "Query order")
|
||||
@PostMapping("/queryOrder")
|
||||
public WxPayOrderQueryResult queryOrder(@RequestBody WxPayOrderQueryRequest wxPayOrderQueryRequest) throws WxPayException {
|
||||
return this.wxService.queryOrder(wxPayOrderQueryRequest);
|
||||
@@ -71,13 +68,13 @@ public class WxPayController {
|
||||
*
|
||||
* @param outTradeNo 商户系统内部的订单号
|
||||
*/
|
||||
@ApiOperation(value = "关闭订单")
|
||||
@ApiOperation(value = "Close order")
|
||||
@GetMapping("/closeOrder/{outTradeNo}")
|
||||
public WxPayOrderCloseResult closeOrder(@PathVariable String outTradeNo) throws WxPayException {
|
||||
return this.wxService.closeOrder(outTradeNo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "关闭订单")
|
||||
@ApiOperation(value = "Close order")
|
||||
@PostMapping("/closeOrder")
|
||||
public WxPayOrderCloseResult closeOrder(@RequestBody WxPayOrderCloseRequest wxPayOrderCloseRequest) throws WxPayException {
|
||||
return this.wxService.closeOrder(wxPayOrderCloseRequest);
|
||||
@@ -119,7 +116,7 @@ public class WxPayController {
|
||||
* @param request 请求对象
|
||||
* @return 退款操作结果
|
||||
*/
|
||||
@ApiOperation(value = "退款")
|
||||
@ApiOperation(value = "Refund")
|
||||
@PostMapping("/refund")
|
||||
public WxPayRefundResult refund(@RequestBody WxPayRefundRequest request) throws WxPayException {
|
||||
return this.wxService.refund(request);
|
||||
|
||||
@@ -4,14 +4,6 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 出错页面控制器
|
||||
* Created by Binary Wang on 2018/8/25.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/error")
|
||||
public class ErrorController {
|
||||
|
||||
@@ -6,14 +6,6 @@ import org.springframework.boot.web.server.ErrorPageRegistry;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 配置错误状态与对应访问路径
|
||||
* Created by Binary Wang on 2018/8/25.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@Component
|
||||
public class ErrorPageConfiguration implements ErrorPageRegistrar {
|
||||
@Override
|
||||
|
||||
@@ -86,3 +86,4 @@ wxpay:
|
||||
subAppId: #服务商模式下的子商户公众账号ID
|
||||
subMchId: #服务商模式下的子商户号
|
||||
keyPath: /home/wfc/config/payment/wxpay_key.pem
|
||||
useSandboxEnv: false
|
||||
|
||||
Reference in New Issue
Block a user