-
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 #473 from Adyen/feature/AD-335_1
Feature/ad 335 1
- Loading branch information
Showing
9 changed files
with
338 additions
and
21 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
24 changes: 23 additions & 1 deletion
24
...b/src/com/adyen/v6/controllers/cms/AdyenAccProductExpressCheckoutComponentController.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 |
---|---|---|
@@ -1,19 +1,41 @@ | ||
package com.adyen.v6.controllers.cms; | ||
|
||
import com.adyen.service.exception.ApiException; | ||
import com.adyen.v6.facades.AdyenCheckoutFacade; | ||
import com.adyen.v6.model.contents.components.AdyenAccExpressCheckoutProductPageComponentModel; | ||
import de.hybris.platform.acceleratorservices.data.RequestContextData; | ||
import de.hybris.platform.addonsupport.controllers.cms.AbstractCMSAddOnComponentController; | ||
import de.hybris.platform.commercefacades.product.ProductFacade; | ||
import de.hybris.platform.commercefacades.product.ProductOption; | ||
import de.hybris.platform.commercefacades.product.data.ProductData; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import java.util.Arrays; | ||
|
||
@Controller(AdyenAccExpressCheckoutProductPageComponentModel._TYPECODE + "Controller") | ||
@RequestMapping(value = "/view/" + AdyenAccExpressCheckoutProductPageComponentModel._TYPECODE + "Controller") | ||
public class AdyenAccProductExpressCheckoutComponentController extends AbstractCMSAddOnComponentController<AdyenAccExpressCheckoutProductPageComponentModel> { | ||
|
||
@Autowired | ||
private AdyenCheckoutFacade adyenCheckoutFacade; | ||
|
||
@Autowired | ||
private ProductFacade productFacade; | ||
|
||
@Override | ||
protected void fillModel(final HttpServletRequest request, final Model model, final AdyenAccExpressCheckoutProductPageComponentModel component) { | ||
model.addAttribute("test", "testValue"); | ||
try { | ||
RequestContextData requestContextData = getRequestContextData(request); | ||
requestContextData.getProduct(); | ||
final ProductData productData = productFacade.getProductForCodeAndOptions(requestContextData.getProduct().getCode(), Arrays.asList(ProductOption.BASIC, ProductOption.PRICE)); | ||
|
||
adyenCheckoutFacade.initializeApplePayExpressPDPData(model, productData); | ||
} catch (ApiException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...ckoutaddon/acceleratoraddon/web/webroot/WEB-INF/tags/responsive/expressCheckoutConfig.tag
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,48 @@ | ||
<%@ taglib prefix="adyen" tagdir="/WEB-INF/tags/addons/adyenv6b2ccheckoutaddon/responsive" %> | ||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> | ||
<%@ attribute name="pageType" required="true" type="java.lang.String"%> | ||
|
||
|
||
<adyen:adyenLibrary | ||
dfUrl="${dfUrl}" | ||
showDefaultCss="${true}" | ||
/> | ||
|
||
<script type="text/javascript"> | ||
var config = { | ||
amount: { | ||
value: '${amount.value}', | ||
currency: '${amount.currency}' | ||
}, | ||
amountDecimal: '${amountDecimal}', | ||
merchantAccount: '${merchantAccount}', | ||
label: ['visible-xs', 'hidden-xs'], | ||
applePayMerchantIdentifier: '${applePayMerchantIdentifier}', | ||
applePayMerchantName: '${applePayMerchantName}', | ||
pageType: '${pageType}', | ||
productCode: '${product.code}' | ||
} | ||
var checkoutConfig = { | ||
shopperLocale: '${shopperLocale}', | ||
environment: '${environmentMode}', | ||
clientKey: '${clientKey}', | ||
session: { | ||
id: '${sessionData.id}', | ||
sessionData: '${sessionData.sessionData}' | ||
}, | ||
countryCode: 'US' | ||
} | ||
window.onload = function() { | ||
AdyenExpressCheckoutHybris.initExpressCheckout(config, checkoutConfig); | ||
} | ||
</script> | ||
|
||
<form:form id="handleComponentResultForm" | ||
class="create_update_payment_form" | ||
action="${handleComponentResult}" | ||
method="post"> | ||
<input type="hidden" id="resultData" name="resultData"/> | ||
<input type="hidden" id="isResultError" name="isResultError" value="false"/> | ||
</form:form> |
16 changes: 10 additions & 6 deletions
16
...don/web/webroot/WEB-INF/views/responsive/cms/adyenaccexpresscheckoutcartpagecomponent.jsp
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
<%@ page trimDirectiveWhitespaces="true" %> | ||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | ||
<%@ taglib prefix="adyen" tagdir="/WEB-INF/tags/addons/adyenv6b2ccheckoutaddon/responsive" %> | ||
|
||
<div class="row"> | ||
<div class="col-sm-8 col-md-6 pull-right"> | ||
Cart Page Express Checkout component | ||
<br> | ||
${test} | ||
<adyen:expressCheckoutConfig pageType="cart"/> | ||
|
||
<div class="cart__actions border"> | ||
<div class="row"> | ||
<div class="col-sm-4 col-md-3 pull-right"> | ||
<div class="adyen-google-pay-button"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
10 changes: 5 additions & 5 deletions
10
.../web/webroot/WEB-INF/views/responsive/cms/adyenaccexpresscheckoutproductpagecomponent.jsp
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<%@ page trimDirectiveWhitespaces="true" %> | ||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | ||
<%@ taglib prefix="adyen" tagdir="/WEB-INF/tags/addons/adyenv6b2ccheckoutaddon/responsive" %> | ||
|
||
<div> | ||
Product Page Express Checkout component | ||
<br> | ||
${test} | ||
</div> | ||
<adyen:expressCheckoutConfig pageType="PDP"/> | ||
|
||
<div class="adyen-google-pay-button"> | ||
</div> |
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
Oops, something went wrong.