diff --git a/adyenocc/src/com/adyen/commerce/controllers/PlaceOrderController.java b/adyenocc/src/com/adyen/commerce/controllers/PlaceOrderController.java index 53cc0c6e..da66f708 100644 --- a/adyenocc/src/com/adyen/commerce/controllers/PlaceOrderController.java +++ b/adyenocc/src/com/adyen/commerce/controllers/PlaceOrderController.java @@ -7,6 +7,7 @@ import com.adyen.commerce.response.PlaceOrderResponse; import com.adyen.model.checkout.PaymentDetailsRequest; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; import de.hybris.platform.acceleratorfacades.flow.CheckoutFlowFacade; import de.hybris.platform.acceleratorservices.urlresolver.SiteBaseUrlResolutionService; import de.hybris.platform.commercefacades.order.CartFacade; @@ -53,10 +54,11 @@ public class PlaceOrderController extends PlaceOrderControllerBase { @Operation(operationId = "placeOrder", summary = "Handle place order request", description = "Places order based on request data") @ApiBaseSiteIdUserIdAndCartIdParam - public ResponseEntity onPlaceOrder(@RequestBody PlaceOrderRequest placeOrderRequest, HttpServletRequest request) throws Exception { + public ResponseEntity onPlaceOrder(@RequestBody String placeOrderStringRequest, HttpServletRequest request) throws Exception { + PlaceOrderRequest placeOrderRequest = objectMapper.readValue(placeOrderStringRequest, PlaceOrderRequest.class); PlaceOrderResponse placeOrderResponse = super.placeOrder(placeOrderRequest, request); - - return ResponseEntity.ok(placeOrderResponse); + String response = objectMapper.writeValueAsString(placeOrderResponse); + return ResponseEntity.ok(response); } @Secured({"ROLE_CUSTOMERGROUP", "ROLE_CLIENT", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) diff --git a/adyenwebcommons/src/com/adyen/commerce/controllerbase/PlaceOrderControllerBase.java b/adyenwebcommons/src/com/adyen/commerce/controllerbase/PlaceOrderControllerBase.java index 7ffadd52..8b3350c3 100644 --- a/adyenwebcommons/src/com/adyen/commerce/controllerbase/PlaceOrderControllerBase.java +++ b/adyenwebcommons/src/com/adyen/commerce/controllerbase/PlaceOrderControllerBase.java @@ -9,6 +9,7 @@ import com.adyen.model.checkout.PaymentResponse; import com.adyen.service.exception.ApiException; import com.adyen.v6.exceptions.AdyenNonAuthorizedPaymentException; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import de.hybris.platform.acceleratorfacades.flow.CheckoutFlowFacade; import de.hybris.platform.acceleratorservices.urlresolver.SiteBaseUrlResolutionService; @@ -38,6 +39,10 @@ public abstract class PlaceOrderControllerBase { private static final String GET_TYPE = "getType"; + public PlaceOrderControllerBase() { + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + } + public PlaceOrderResponse placeOrder(PlaceOrderRequest placeOrderRequest, HttpServletRequest request) { String adyenPaymentMethodType = extractPaymentMethodType(placeOrderRequest);