-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #416 from Adyen/feature/AD-251
Feature/ad 251
- Loading branch information
Showing
19 changed files
with
523 additions
and
38 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...atoraddon/web/src/com/adyen/commerce/controllers/api/AdyenRedirectResponseController.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,62 @@ | ||
package com.adyen.commerce.controllers.api; | ||
|
||
import com.adyen.commerce.controllerbase.RedirectControllerBase; | ||
import com.adyen.model.checkout.PaymentDetailsRequest; | ||
import com.adyen.v6.facades.AdyenCheckoutFacade; | ||
import de.hybris.platform.acceleratorstorefrontcommons.annotations.RequireHardLogIn; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import javax.annotation.Resource; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.util.Base64; | ||
|
||
import static com.adyen.commerce.constants.AdyencheckoutaddonapiWebConstants.*; | ||
import static de.hybris.platform.acceleratorstorefrontcommons.controllers.AbstractController.REDIRECT_PREFIX; | ||
|
||
@Controller | ||
@RequestMapping(value = ADYEN_CHECKOUT_API_PREFIX) | ||
public class AdyenRedirectResponseController extends RedirectControllerBase { | ||
private static final String SELECT_PAYMENT_METHOD_URL = ADYEN_CHECKOUT_PAGE_PREFIX + ADYEN_CHECKOUT_SELECT_PAYMENT; | ||
private static final String ORDER_CONFIRMATION_URL = ADYEN_CHECKOUT_PAGE_PREFIX + ADYEN_CHECKOUT_ORDER_CONFIRMATION; | ||
|
||
@Resource(name = "adyenCheckoutFacade") | ||
private AdyenCheckoutFacade adyenCheckoutFacade; | ||
|
||
@GetMapping(value = AUTHORISE_3D_SECURE_PAYMENT_URL) | ||
@RequireHardLogIn | ||
public String authoriseRedirectGetPayment(final HttpServletRequest request) { | ||
return super.authoriseRedirectGetPayment(request); | ||
} | ||
|
||
|
||
@PostMapping(value = AUTHORISE_3D_SECURE_PAYMENT_URL) | ||
@RequireHardLogIn | ||
public String authoriseRedirectPostPayment(@RequestBody PaymentDetailsRequest detailsRequest) { | ||
return super.authoriseRedirectPostPayment(detailsRequest); | ||
} | ||
|
||
@Override | ||
public String getErrorRedirectUrl(String errorMessage) { | ||
return REDIRECT_PREFIX + SELECT_PAYMENT_METHOD_URL + "/error/" + Base64.getUrlEncoder().encodeToString(errorMessage.getBytes()); | ||
} | ||
|
||
@Override | ||
public String getOrderConfirmationUrl(String orderCode) { | ||
return REDIRECT_PREFIX + ORDER_CONFIRMATION_URL + '/' + orderCode; | ||
} | ||
|
||
@Override | ||
public String getCartUrl() { | ||
return REDIRECT_PREFIX + CART_PREFIX; | ||
} | ||
|
||
@Override | ||
public AdyenCheckoutFacade getAdyenCheckoutFacade() { | ||
return adyenCheckoutFacade; | ||
} | ||
|
||
} |
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
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
84 changes: 84 additions & 0 deletions
84
adyenocc/src/com/adyen/commerce/controllers/RedirectController.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,84 @@ | ||
/* | ||
* 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.commerce.controllerbase.RedirectControllerBase; | ||
import com.adyen.model.checkout.PaymentDetailsRequest; | ||
import com.adyen.v6.facades.AdyenCheckoutFacade; | ||
import de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService; | ||
import de.hybris.platform.commerceservices.request.mapping.annotation.ApiVersion; | ||
import de.hybris.platform.servicelayer.config.ConfigurationService; | ||
import de.hybris.platform.site.BaseSiteService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.annotation.Resource; | ||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import static com.adyen.commerce.constants.AdyenwebcommonsConstants.REDIRECT_PREFIX; | ||
|
||
@Controller | ||
@RequestMapping(value = AdyenoccConstants.ADYEN_PREFIX) | ||
@ApiVersion("v2") | ||
@Tag(name = "Adyen") | ||
public class RedirectController extends RedirectControllerBase { | ||
private static final String REDIRECT_URL = "/redirect"; | ||
|
||
@Resource(name = "adyenCheckoutFacade") | ||
private AdyenCheckoutFacade adyenCheckoutFacade; | ||
|
||
@Resource(name = "configurationService") | ||
private ConfigurationService configurationService; | ||
|
||
@Resource(name = "commerceCommonI18NService") | ||
private CommerceCommonI18NService commerceCommonI18NService; | ||
|
||
@Resource(name = "baseSiteService") | ||
private BaseSiteService baseSiteService; | ||
|
||
@GetMapping(value = REDIRECT_URL) | ||
@Operation(operationId = "adyenRedirect", summary = "Handle redirect payment method", description = | ||
"Handles return after payment method redirect flow returns") | ||
public String authorizeRedirectPaymentGet(final HttpServletRequest request) { | ||
return super.authoriseRedirectGetPayment(request); | ||
} | ||
|
||
@PostMapping(value = REDIRECT_URL) | ||
@Operation(operationId = "adyenRedirect", summary = "Handle redirect payment method", description = | ||
"Handles return after payment method redirect flow returns") | ||
public String authorizeRedirectPaymentPost(@Parameter(description = "Payment details data", required = true) @RequestBody PaymentDetailsRequest detailsRequest) { | ||
return super.authoriseRedirectPostPayment(detailsRequest); | ||
} | ||
|
||
@Override | ||
public String getErrorRedirectUrl(String errorMessage) { | ||
//TODO: will be implemented | ||
return "error url"; | ||
} | ||
|
||
@Override | ||
public String getOrderConfirmationUrl(String orderCode) { | ||
//TODO: will be implemented | ||
return "order confirmation"; | ||
} | ||
|
||
@Override | ||
public String getCartUrl() { | ||
String currency = commerceCommonI18NService.getCurrentCurrency().getIsocode(); | ||
String language = commerceCommonI18NService.getCurrentLanguage().getIsocode(); | ||
String baseSiteUid = baseSiteService.getCurrentBaseSite().getUid(); | ||
|
||
String baseUrl = configurationService.getConfiguration().getString("adyen.spartacus.baseurl"); | ||
return REDIRECT_PREFIX + baseUrl + "/" + baseSiteUid + "/" + language + "/" + currency + "/cart"; | ||
} | ||
|
||
@Override | ||
public AdyenCheckoutFacade getAdyenCheckoutFacade() { | ||
return adyenCheckoutFacade; | ||
} | ||
} |
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,99 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!-- | ||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. | ||
--><!-- | ||
All hybris buildcallbacks.xml macrodefinitions: | ||
Build/Documentation | ||
before/after ant macro "clean" | ||
<macrodef name="adyenwebcommons_before_clean"/> | ||
<macrodef name="adyenwebcommons_after_clean"/> | ||
before/after ant macro "build" | ||
<macrodef name="adyenwebcommons_before_build"/> | ||
<macrodef name="adyenwebcommons_after_build"/> | ||
before/after ant macro "compile_core" - the core module of the extension | ||
<macrodef name="adyenwebcommons_before_compile_core"> | ||
<macrodef name="adyenwebcommons_after_compile_core"> | ||
before/after ant macro "compile_web" - the web module of the extension | ||
<macrodef name="adyenwebcommons_before_compile_web" /> | ||
<macrodef name="adyenwebcommons_after_compile_web" /> | ||
before/after ant macro "compile_hmc" - the hmc module of the extension | ||
<macrodef name="adyenwebcommons_before_compile_hmc" /> | ||
<macrodef name="adyenwebcommons_after_compile_hmc" /> | ||
Preparing extension | ||
will be called in the beginning of the ant call and only once (also when using multiple | ||
ant targets e.g. ant build yunittest) | ||
<macrodef name="adyenwebcommons_only_once_prepare"/> | ||
Creating ear module/production | ||
before/after ant macro "ear" | ||
<macrodef name="adyenwebcommons_before_ear"/> | ||
<macrodef name="adyenwebcommons_after_ear"/> | ||
before/after ant macro "production" - for hybris server only | ||
<macrodef name="adyenwebcommons_before_production" /> | ||
<macrodef name="adyenwebcommons_after_production" /> | ||
JUnit Test | ||
before/after ant macro "yunitinit" | ||
<macrodef name="adyenwebcommons_before_yunitinit" /> | ||
<macrodef name="adyenwebcommons_after_yunitinit" /> | ||
before/after ant macro "yunit" | ||
<macrodef name="adyenwebcommons_before_yunit" /> | ||
<macrodef name="adyenwebcommons_after_yunit" /> | ||
Distribution package | ||
before/after ant macro "dist" - internal target; only for use when platform is available in source code | ||
<macrodef name="adyenwebcommons_after_dist"/> | ||
<macrodef name="adyenwebcommons_before_dist"/> | ||
before/after ant macro "dist_copy" - internal target; only for use when platform is available in source code | ||
<macrodef name="adyenwebcommons_before_dist_copy"/> | ||
<macrodef name="adyenwebcommons_after_dist_copy"/> | ||
With these filters you can override the default extension filters defined in platform/resources/ant/dist/filtersets.xml | ||
<patternset id="extension.adyenwebcommons.binary.filter"> | ||
<patternset refid="extension.filter" /> | ||
<exclude name="**/*-source.jar" /> | ||
</patternset> | ||
<patternset id="extension.adyenwebcommons.source.filter"> | ||
<exclude name="**/bin/**" /> | ||
</patternset> | ||
With this filter you can decide what should be excluded from development zip. | ||
<patternset id="extension.adyenwebcommons.devzip.filter"> | ||
Include all files from extension.source.filter. | ||
<patternset refid="extension.source.filter" /> | ||
Exclude unwanted files. | ||
<exclude name="lib/exclude-me.jar" /> | ||
</patternset> | ||
--><project name="adyenwebcommons_buildcallbacks"> | ||
|
||
<!-- | ||
Called whenever 'ant ear' is used. this callback can be used to modify the content of the ear file | ||
${ear.path}: path to ear | ||
--> | ||
|
||
<macrodef name="adyenwebcommons_before_ear"> | ||
|
||
<sequential> | ||
|
||
<!-- you can do anything before the EAR file is being packed --> | ||
|
||
</sequential> | ||
|
||
</macrodef> | ||
|
||
</project> |
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,34 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!-- | ||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. | ||
--><extensioninfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extensioninfo.xsd"> | ||
|
||
|
||
<extension abstractclassprefix="Generated" classprefix="Adyenwebcommons" jaloLogicFree="true" managername="AdyenwebcommonsManager" managersuperclass="de.hybris.platform.jalo.extension.Extension" name="adyenwebcommons" usemaven="false"> | ||
|
||
|
||
|
||
<!-- for more information on maven managed libraries please consult https://wiki.hybris.com/x/Nq8sDQ --> | ||
|
||
|
||
|
||
<!-- you should add all required extensions to this list, except platform extensions which are automatically required --> | ||
|
||
|
||
|
||
<!-- <requires-extension name="cms"/> --> | ||
|
||
<requires-extension name="adyenv6core"/> | ||
|
||
|
||
|
||
<coremodule generated="true" manager="com.adyen.commerce.jalo.AdyenwebcommonsManager" packageroot="com.adyen.commerce"/> | ||
|
||
|
||
|
||
|
||
</extension> | ||
|
||
|
||
|
||
</extensioninfo> |
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 @@ | ||
<!-- | ||
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>de.hybris.platform</groupId> | ||
<artifactId>adyenwebcommons</artifactId> | ||
<version>2211.3</version> | ||
|
||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
</dependencies> | ||
</project> |
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,9 @@ | ||
# ----------------------------------------------------------------------- | ||
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. | ||
# ----------------------------------------------------------------------- | ||
|
||
# adyenwebcommons.key=value | ||
|
||
# Specifies the location of the spring context file putted automatically to the global platform application context. | ||
adyenwebcommons.application-context=adyenwebcommons-spring.xml | ||
|
Oops, something went wrong.