import com.supwisdom.dlpay.paysdk.proxy.*;
import com.supwisdom.mutlitenant.client.annotations.EnableTenantJwtClient;
import com.supwisdom.mutlitenant.client.config.JwtTenantAuthentication;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
private ConsumePropxy consumePropxy;
- @org.junit.Test
+ @Test
public void citizencardPayinit() {
ApiVersionResponse version = apiCommonProxy.apiVersion();
package com.supwisdom.dlpay.agent.domain;
-import org.joda.time.DateTime;
-
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import com.supwisdom.dlpay.framework.tenant.TenantCacheKeyGen
import com.supwisdom.multitenant.TenantContextHolder
-import com.supwisdom.multitenant.annotations.EnableHttpHeaderTenantInterceptor
-import com.supwisdom.multitenant.annotations.EnableSessionTenantInterceptor
import com.supwisdom.multitenant.exceptions.TenantNotDefException
import com.supwisdom.multitenant.jwt.JwtTenantConfigAdapter
import com.supwisdom.multitenant.jwt.annotations.EnableJwtTenantInterceptor
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Component
import org.springframework.transaction.TransactionSystemException
+import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.MethodArgumentNotValidException
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.ExceptionHandler
+import org.springframework.web.bind.annotation.ResponseStatus
import org.springframework.web.bind.annotation.RestControllerAdvice
import org.springframework.web.context.request.WebRequest
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
return ResponseEntity.ok().body(ResponseBodyBuilder.create()
.exception(TradeErrorCode.BUSINESS_DEAL_ERROR, undeclared, "业务处理报错"))
}
+
}
@ControllerAdvice("com.supwisdom.dlpay")
import org.springframework.data.redis.connection.RedisConnectionFactory
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.http.HttpRequest
+import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.GetMapping
-import org.springframework.web.bind.annotation.PathVariable
-import org.springframework.web.bind.annotation.PostMapping
-import org.springframework.web.bind.annotation.RestController
+import org.springframework.validation.annotation.Validated
+import org.springframework.web.bind.annotation.*
+import javax.validation.ConstraintViolationException
import javax.validation.Valid
import kotlin.math.roundToInt
-@RestController("/api/transaction")
+@RestController
+@RequestMapping("/api/transaction")
+@Validated
class TransactionController(private val transactionServiceProxy: TransactionServiceProxy,
private val systemUtilService: SystemUtilService,
private val accountUtilServcie: AccountUtilServcie,
}
@PostMapping("/inapp/payinit")
- fun inAppPayInit(@Valid param: InAppPayParam): ResponseEntity<*> {
+ fun inAppPayInit(@Valid @RequestBody param: InAppPayParam): ResponseEntity<*> {
val response = InAppPayResponse()
if (transactionContainer.count() > 100) {
return ResponseBodyBuilder.internalServerError("第三方请求异常")
}
return ResponseBodyBuilder.successEntity(response)
}
+
}
class TransactionContainer(private val name: String,
try {
jwtTokenContext.jwt.ifPresent { jwt ->
val auth = UsernamePasswordAuthenticationToken(jwt.uid, null,
- (jwt.authorities as ArrayList<*>)
+ (jwt.authorities as ArrayList<Any>)
.map { SimpleGrantedAuthority(it as String) })
SecurityContextHolder.getContext().authentication = auth
}