Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD-325 Apple pay doesn't work #458

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import com.adyen.service.exception.ApiException;
import com.adyen.v6.dto.CheckoutConfigDTO;
import com.adyen.v6.facades.AdyenCheckoutFacade;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import de.hybris.platform.commerceservices.request.mapping.annotation.ApiVersion;
import de.hybris.platform.webservicescommons.swagger.ApiBaseSiteIdUserIdAndCartIdParam;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -24,6 +27,13 @@
@Tag(name = "Adyen")
public class PaymentMethodsController
{
protected static ObjectMapper objectMapper;

static {
objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
}

@Autowired
private AdyenCheckoutFacade adyenCheckoutFacade;

Expand All @@ -32,7 +42,8 @@ public class PaymentMethodsController
@Operation(operationId = "getCheckoutConfiguration", summary = "Get checkout configuration", description =
"Returns configuration for Adyen dropin component")
@ApiBaseSiteIdUserIdAndCartIdParam
public ResponseEntity<CheckoutConfigDTO> getCheckoutConfiguration() throws ApiException {
return ResponseEntity.ok().body(adyenCheckoutFacade.getReactCheckoutConfig());
public ResponseEntity<String> getCheckoutConfiguration() throws ApiException, JsonProcessingException {
String response = objectMapper.writeValueAsString(adyenCheckoutFacade.getReactCheckoutConfig());
return ResponseEntity.ok().body(response);
}
}