-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AD-244 Develop OCC Endpoint for Retrieving Adyen Payment Methods
- Loading branch information
Showing
9 changed files
with
66 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
adyenocc/src/com/adyen/commerce/controllers/AdyenoccController.java
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
adyenocc/src/com/adyen/commerce/controllers/PaymentMethodsController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. | ||
*/ | ||
package com.adyen.commerce.controllers; | ||
|
||
import com.adyen.commerce.constants.AdyenoccConstants; | ||
import com.adyen.service.exception.ApiException; | ||
import com.adyen.v6.dto.CheckoutConfigDTO; | ||
import com.adyen.v6.facades.AdyenCheckoutFacade; | ||
import de.hybris.platform.commerceservices.request.mapping.annotation.ApiVersion; | ||
import de.hybris.platform.webservicescommons.swagger.ApiBaseSiteIdUserIdAndCartIdParam; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
@Controller | ||
@RequestMapping(value = AdyenoccConstants.ADYEN_USER_CART_PREFIX) | ||
@ApiVersion("v2") | ||
@Tag(name = "Adyen") | ||
public class PaymentMethodsController | ||
{ | ||
@Autowired | ||
private AdyenCheckoutFacade adyenCheckoutFacade; | ||
|
||
@GetMapping(value = "/checkout-configuration") | ||
@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()); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
adyenocc/src/com/adyen/commerce/exception/AdyenOCCControllerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.adyen.commerce.exception; | ||
|
||
public class AdyenOCCControllerException extends RuntimeException { | ||
} |
15 changes: 15 additions & 0 deletions
15
adyenocc/src/com/adyen/commerce/exceptionhandler/AdyenOCCControllerExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.adyen.commerce.exceptionhandler; | ||
|
||
import com.adyen.commerce.exception.AdyenOCCControllerException; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
@ControllerAdvice | ||
public class AdyenOCCControllerExceptionHandler { | ||
|
||
@ExceptionHandler(value = AdyenOCCControllerException.class) | ||
public ResponseEntity<Void> handleAdyenControllerException(AdyenOCCControllerException exception) { | ||
return ResponseEntity.badRequest().build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters