Search in sources :

Example 6 with AnonymousAccess

use of com.albedo.java.common.core.annotation.AnonymousAccess in project albedo by somowhere.

the class AliPayResource method returnPage.

@GetMapping("/return")
@AnonymousAccess
@Operation(hidden = true, summary = "支付之后跳转的链接")
public ResponseEntity<String> returnPage(HttpServletRequest request, HttpServletResponse response) {
    AlipayConfigDo alipay = alipayService.find();
    response.setContentType("text/html;charset=" + alipay.getCharset());
    // 内容验签,防止黑客篡改参数
    if (alipayUtils.rsaCheck(request, alipay)) {
        // 商户订单号
        String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
        // 支付宝交易号
        String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
        System.out.println("商户订单号" + outTradeNo + "  " + "第三方交易号" + tradeNo);
        // 根据业务需要返回数据,这里统一返回OK
        return new ResponseEntity<>("payment successful", HttpStatus.OK);
    } else {
        // 根据业务需要返回数据
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) AlipayConfigDo(com.albedo.java.modules.tool.domain.AlipayConfigDo) AnonymousAccess(com.albedo.java.common.core.annotation.AnonymousAccess) Operation(io.swagger.v3.oas.annotations.Operation)

Aggregations

AnonymousAccess (com.albedo.java.common.core.annotation.AnonymousAccess)6 Operation (io.swagger.v3.oas.annotations.Operation)5 AlipayConfigDo (com.albedo.java.modules.tool.domain.AlipayConfigDo)2 ResponseEntity (org.springframework.http.ResponseEntity)2 Authentication (org.springframework.security.core.Authentication)2 RequestMethodEnum (com.albedo.java.common.security.enums.RequestMethodEnum)1 ArithmeticCaptcha (com.pig4cloud.captcha.ArithmeticCaptcha)1 Date (java.util.Date)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 BadCredentialsException (org.springframework.security.authentication.BadCredentialsException)1 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)1 AuthenticationException (org.springframework.security.core.AuthenticationException)1 SecurityContextLogoutHandler (org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler)1 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)1 HandlerMethod (org.springframework.web.method.HandlerMethod)1 RequestMappingInfo (org.springframework.web.servlet.mvc.method.RequestMappingInfo)1