From 3cb907321fb96d8a79d1ac6698a57b007cef9a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20=C5=A0trobl?= Date: Thu, 21 Nov 2024 17:46:22 +0800 Subject: [PATCH] Fix #1141: Use operation claim endpoint instead of operation detail (#1142) --- docs/PowerAuth-Enrollment-Server-1.10.0.md | 4 ++++ .../impl/service/MobileTokenService.java | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/PowerAuth-Enrollment-Server-1.10.0.md b/docs/PowerAuth-Enrollment-Server-1.10.0.md index f1beb3f9..07b33d76 100644 --- a/docs/PowerAuth-Enrollment-Server-1.10.0.md +++ b/docs/PowerAuth-Enrollment-Server-1.10.0.md @@ -19,3 +19,7 @@ The allowed values of the `environment` parameter are: - `production` - production APNs host is used for sending push messages For platforms other than APNs the parameter is not used, `null` value is allowed. + +## Internal Changes + +Operation claim now uses the new `POST /rest/v3/operation/claim` for claiming operations instead of `POST /rest/v3/operation/detail` to separate operation claim action from obtaining operation detail. diff --git a/enrollment-server/src/main/java/com/wultra/app/enrollmentserver/impl/service/MobileTokenService.java b/enrollment-server/src/main/java/com/wultra/app/enrollmentserver/impl/service/MobileTokenService.java index 742b4de4..4899cf75 100644 --- a/enrollment-server/src/main/java/com/wultra/app/enrollmentserver/impl/service/MobileTokenService.java +++ b/enrollment-server/src/main/java/com/wultra/app/enrollmentserver/impl/service/MobileTokenService.java @@ -28,6 +28,7 @@ import com.wultra.security.powerauth.client.model.enumeration.SignatureType; import com.wultra.security.powerauth.client.model.enumeration.UserActionResult; import com.wultra.security.powerauth.client.model.error.PowerAuthClientException; +import com.wultra.security.powerauth.client.model.request.OperationClaimRequest; import com.wultra.security.powerauth.client.model.request.OperationDetailRequest; import com.wultra.security.powerauth.client.model.request.OperationFailApprovalRequest; import com.wultra.security.powerauth.client.model.request.OperationListForUserRequest; @@ -334,11 +335,11 @@ private OperationDetailResponse fetchOperationDetailInternal(@NotNull String ope * @throws MobileTokenException When the operation is in incorrect state. */ private OperationDetailResponse claimOperationInternal(@NotNull String operationId, @NotNull String userId) throws PowerAuthClientException, MobileTokenException { - final OperationDetailRequest operationDetailRequest = new OperationDetailRequest(); - operationDetailRequest.setOperationId(operationId); - operationDetailRequest.setUserId(userId); - final OperationDetailResponse operationDetail = powerAuthClient.operationDetail( - operationDetailRequest, + final OperationClaimRequest operationClaimRequest = new OperationClaimRequest(); + operationClaimRequest.setOperationId(operationId); + operationClaimRequest.setUserId(userId); + final OperationDetailResponse operationDetail = powerAuthClient.operationClaim( + operationClaimRequest, httpCustomizationService.getQueryParams(), httpCustomizationService.getHttpHeaders() );