Fix party id (#6)

This commit is contained in:
struga 2023-01-11 14:19:03 +07:00 committed by GitHub
parent c92c524574
commit 209b5c5ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 24 deletions

13
pom.xml
View File

@ -28,15 +28,14 @@
<dockerfile.registry>${env.REGISTRY}</dockerfile.registry>
<swag-claim-management.version>1.1-18ebff9-server</swag-claim-management.version>
<org-management-proto.version>1.6-abb4b4d</org-management-proto.version>
<bouncer-proto.version>1.36-96bd74d</bouncer-proto.version>
<org-management-proto.version>1.17-04de2f4</org-management-proto.version>
<bouncer-proto.version>1.49-fa8fb0f</bouncer-proto.version>
<keycloak-spring-security.version>14.0.0</keycloak-spring-security.version>
<bouncycastle-jdk15on.version>1.68</bouncycastle-jdk15on.version>
<spring-cloud-contract-wiremock.version>2.2.4.RELEASE</spring-cloud-contract-wiremock.version>
<spring-security.version>5.4.7</spring-security.version>
<jjwt.version>0.9.1</jjwt.version>
<random-beans.version>3.6.0</random-beans.version>
<shared-resources.version>1.4.0</shared-resources.version>
</properties>
<dependencies>
@ -69,15 +68,15 @@
<dependency>
<groupId>dev.vality</groupId>
<artifactId>damsel</artifactId>
<version>1.586-7218614</version>
</dependency>
<dependency>
<groupId>dev.vality.geck</groupId>
<artifactId>serializer</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>shared-resources</artifactId>
<version>${shared-resources.version}</version>
<groupId>dev.vality.geck</groupId>
<artifactId>filter</artifactId>
</dependency>
<dependency>
<groupId>dev.vality</groupId>
@ -297,7 +296,7 @@
</dependencies>
<configuration>
<resourceBundles>
<resourceBundle>com.rbkmoney:shared-resources:${shared-resources.version}</resourceBundle>
<resourceBundle>dev.vality:shared-resources:${shared-resources.version}</resourceBundle>
</resourceBundles>
<attachToMain>false</attachToMain>
<attachToTest>false</attachToTest>

View File

@ -5,7 +5,6 @@ import com.rbkmoney.claimmanagementapi.exception.client.BadRequestException
import com.rbkmoney.claimmanagementapi.exception.client.NotFoundException
import com.rbkmoney.claimmanagementapi.exception.server.DarkApi5xxException
import com.rbkmoney.claimmanagementapi.security.BouncerAccessService
import com.rbkmoney.claimmanagementapi.security.KeycloakService
import com.rbkmoney.claimmanagementapi.service.ClaimManagementService
import com.rbkmoney.claimmanagementapi.service.PartyManagementService
import com.rbkmoney.claimmanagementapi.util.DeadlineChecker
@ -33,7 +32,6 @@ import javax.validation.constraints.Size
class ClaimManagementController(
private val claimManagementService: ClaimManagementService,
private val partyManagementService: PartyManagementService,
private val keycloakService: KeycloakService,
private val deadlineChecker: DeadlineChecker,
private val bouncerAccessService: BouncerAccessService
) : ProcessingApi {
@ -53,7 +51,7 @@ class ClaimManagementController(
log.info { "Process 'createClaim' get started, xRequestId=$xRequestId" }
partyManagementService.checkStatus(xRequestId)
deadlineChecker.checkDeadline(xRequestDeadline, xRequestId)
val claim = claimManagementService.createClaim(keycloakService.partyId, changeset!!)
val claim = claimManagementService.createClaim(partyId, changeset!!)
log.info { "Claim created, xRequestId=$xRequestId, claimId=${claim.id}" }
ResponseEntity.ok(claim)
}
@ -92,7 +90,7 @@ class ClaimManagementController(
log.info { "Process 'revokeClaimByID' get started, xRequestId=$xRequestId, claimId=$claimId" }
partyManagementService.checkStatus(xRequestId)
deadlineChecker.checkDeadline(xRequestDeadline, xRequestId)
claimManagementService.revokeClaimById(keycloakService.partyId, claimId, claimRevision, reason)
claimManagementService.revokeClaimById(partyId, claimId, claimRevision, reason)
log.info { "Successful revoke claim, xRequestId=$xRequestId, claimId=$claimId" }
ResponseEntity<Void>(HttpStatus.OK)
@ -112,7 +110,7 @@ class ClaimManagementController(
log.info { "Process 'requestReviewClaimByID' get started, xRequestId=$xRequestId, claimId=$claimId" }
partyManagementService.checkStatus(xRequestId)
deadlineChecker.checkDeadline(xRequestDeadline, xRequestId)
claimManagementService.requestClaimReviewById(keycloakService.partyId, claimId, claimRevision)
claimManagementService.requestClaimReviewById(partyId, claimId, claimRevision)
log.info { "Successful request claim review, xRequestId=$xRequestId, claimId=$claimId" }
ResponseEntity<Void>(HttpStatus.OK)
@ -164,7 +162,7 @@ class ClaimManagementController(
log.info { "Process 'updateClaimByID' get started, requestId=$xRequestId, claimId=$claimId" }
partyManagementService.checkStatus(xRequestId)
deadlineChecker.checkDeadline(xRequestDeadline, xRequestId)
claimManagementService.updateClaimById(keycloakService.partyId, claimId, claimRevision, changeset!!)
claimManagementService.updateClaimById(partyId, claimId, claimRevision, changeset!!)
log.info { "Successful update claim, xRequestId=$xRequestId, claimId=$claimId" }
ResponseEntity<Void>(HttpStatus.OK)

View File

@ -3,10 +3,7 @@ package com.rbkmoney.claimmanagementapi.service
import com.rbkmoney.claimmanagementapi.exception.client.ForbiddenException
import com.rbkmoney.claimmanagementapi.exception.server.DarkApi5xxException
import com.rbkmoney.claimmanagementapi.security.KeycloakService
import dev.vality.damsel.payment_processing.InternalUser
import dev.vality.damsel.payment_processing.PartyManagementSrv
import dev.vality.damsel.payment_processing.UserInfo
import dev.vality.damsel.payment_processing.UserType
import mu.KotlinLogging
import org.springframework.stereotype.Service
@ -39,15 +36,11 @@ class PartyManagementService(
private fun getPartyStatus(xRequestId: String?, partyId: String) =
try {
partyManagementClient.getStatus(userInfo, partyId)
partyManagementClient.getStatus(partyId)
} catch (ex: Exception) {
throw DarkApi5xxException(
"Some Exception while requesting api='party-management', method='getStatus', xRequestId=$xRequestId",
ex
)
}
companion object {
private val userInfo = UserInfo("dark-api", UserType.internal_user(InternalUser()))
}
}

View File

@ -46,17 +46,17 @@ class PartyManagementServiceTest {
partyStatus.setBlocking(Blocking.unblocked(Unblocked()))
reset(partyManagementClient)
whenever(
partyManagementClient.getStatus(any(), any())
partyManagementClient.getStatus(any())
).thenReturn(partyStatus)
partyManagementService.checkStatus()
partyStatus.setBlocking(Blocking.blocked(Blocked()))
whenever(
partyManagementClient.getStatus(any(), any())
partyManagementClient.getStatus(any())
).thenReturn(partyStatus)
Assertions.assertThrows(ForbiddenException::class.java) { partyManagementService.checkStatus() }
reset(partyManagementClient)
whenever(
partyManagementClient.getStatus(any(), any())
partyManagementClient.getStatus(any())
).thenThrow(
TException::class.java
)