diff --git a/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/WEB-INF/tags/responsive/expressCheckoutConfig.tag b/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/WEB-INF/tags/responsive/expressCheckoutConfig.tag
index 77c19013..3cd70d18 100644
--- a/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/WEB-INF/tags/responsive/expressCheckoutConfig.tag
+++ b/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/WEB-INF/tags/responsive/expressCheckoutConfig.tag
@@ -32,7 +32,12 @@
id: '${sessionData.id}',
sessionData: '${sessionData.sessionData}'
},
- countryCode: 'US'
+ countryCode: 'US',
+ googlePayExpressEnabledOnCart: ${expressPaymentConfig.googlePayExpressEnabledOnCart},
+ applePayExpressEnabledOnCart: ${expressPaymentConfig.applePayExpressEnabledOnCart},
+ googlePayExpressEnabledOnProduct: ${expressPaymentConfig.googlePayExpressEnabledOnProduct},
+ applePayExpressEnabledOnProduct: ${expressPaymentConfig.applePayExpressEnabledOnProduct},
+
}
window.onload = function() {
diff --git a/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen_express_checkout.js b/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen_express_checkout.js
index ef74c703..7b12f423 100644
--- a/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen_express_checkout.js
+++ b/adyenv6b2ccheckoutaddon/acceleratoraddon/web/webroot/_ui/responsive/common/js/adyen_express_checkout.js
@@ -33,8 +33,12 @@ var AdyenExpressCheckoutHybris = (function () {
initExpressCheckout: async function (params, config) {
var checkoutPromise = this.initiateCheckout(config);
checkoutPromise.then((checkout) => {
- this.initiateGooglePayExpress(checkout, params)
- this.initiateApplePayExpress(checkout, params)
+ if(params.pageType === 'cart' && config.googlePayExpressEnabledOnCart || params.pageType === 'PDP' && config.googlePayExpressEnabledOnProduct) {
+ this.initiateGooglePayExpress(checkout, params)
+ }
+ if(params.pageType=== 'cart' && config.applePayExpressEnabledOnCart || params.pageType === 'PDP' && config.applePayExpressEnabledOnProduct) {
+ this.initiateApplePayExpress(checkout, params)
+ }
});
},
initiateApplePayExpress: async function (checkout, params) {
diff --git a/adyenv6backoffice/resources/adyenv6backoffice-backoffice-config.xml b/adyenv6backoffice/resources/adyenv6backoffice-backoffice-config.xml
index de9acccf..a614c056 100644
--- a/adyenv6backoffice/resources/adyenv6backoffice-backoffice-config.xml
+++ b/adyenv6backoffice/resources/adyenv6backoffice-backoffice-config.xml
@@ -57,6 +57,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/adyenv6core/resources/adyenv6core-items.xml b/adyenv6core/resources/adyenv6core-items.xml
index 34a3837a..251c15c7 100644
--- a/adyenv6core/resources/adyenv6core-items.xml
+++ b/adyenv6core/resources/adyenv6core-items.xml
@@ -345,6 +345,56 @@
Boolean.FALSE
+
+ Configuration for express payment methods
+
+
+
+
+
+
+
+
+
+ Enable Google Pay Express on Cart Page
+
+ Boolean.FALSE
+
+
+ Enable Apple Pay Express on Cart Page
+
+ Boolean.FALSE
+
+
+ Enable PayPal Express on Cart Page
+
+ Boolean.FALSE
+
+
+ Enable Amazon Pay Express on Cart Page
+
+ Boolean.FALSE
+
+
+ Enable Google Pay Express on Product Page
+
+ Boolean.FALSE
+
+
+ Enable Apple Pay Express on Product Page
+
+ Boolean.FALSE
+
+
+ Enable PayPal Express on Product Page
+
+ Boolean.FALSE
+
+
+ Enable Amazon Pay Express on Product Page
+
+ Boolean.FALSE
+
diff --git a/adyenv6core/resources/localization/adyenv6core-locales_en.properties b/adyenv6core/resources/localization/adyenv6core-locales_en.properties
index 08a087d1..106c4322 100644
--- a/adyenv6core/resources/localization/adyenv6core-locales_en.properties
+++ b/adyenv6core/resources/localization/adyenv6core-locales_en.properties
@@ -65,6 +65,27 @@ type.basestore.adyenMerchantConfig.description=List of merchants that can be use
type.basestore.l2L3ESDEnabled.name=L2/L3 Enhanced Data Support
type.BaseStore.l2L3ESDEnabled.description=Enable or disable L2/L3 EDS for US MasterCard and Visa transactions (only for US merchants)
+
+type.ExpressPaymentConfig.name=Express Payment Config
+type.ExpressPaymentConfig.description=Configuration for Express Payment
+type.ExpressPaymentConfig.googlePayExpressEnabledOnCart.name=Google Pay Express Enabled On Cart
+type.ExpressPaymentConfig.googlePayExpressEnabledOnCart.description=Enable Google Pay Express on Cart
+type.ExpressPaymentConfig.googlePayExpressEnabledOnProduct.name=Google Pay Express Enabled On Product
+type.ExpressPaymentConfig.googlePayExpressEnabledOnProduct.description=Enable Google Pay Express on Product
+type.ExpressPaymentConfig.applePayExpressEnabledOnCart.name=Apple Pay Express Enabled On Cart
+type.ExpressPaymentConfig.applePayExpressEnabledOnCart.description=Enable Apple Pay Express on Cart
+type.ExpressPaymentConfig.applePayExpressEnabledOnProduct.name=Apple Pay Express Enabled On Product
+type.ExpressPaymentConfig.applePayExpressEnabledOnProduct.description=Enable Apple Pay Express on Product
+type.ExpressPaymentConfig.paypalExpressEnabledOnCart.name=PayPal Express Enabled On Cart
+type.ExpressPaymentConfig.paypalExpressEnabledOnCart.description=Enable PayPal Express on Cart
+type.ExpressPaymentConfig.paypalExpressEnabledOnProduct.name=PayPal Express Enabled On Product
+type.ExpressPaymentConfig.paypalExpressEnabledOnProduct.description=Enable PayPal Express on Product
+type.ExpressPaymentConfig.amazonPayExpressEnabledOnCart.name=Amazon Pay Express Enabled On Cart
+type.ExpressPaymentConfig.amazonPayExpressEnabledOnCart.description=Enable Amazon Pay Express on Cart
+type.ExpressPaymentConfig.amazonPayExpressEnabledOnProduct.name=Amazon Pay Express Enabled On Product
+type.ExpressPaymentConfig.amazonPayExpressEnabledOnProduct.description=Enable Amazon Pay Express on Product
+
+
type.paymentinfo.adyenPaymentMethod.name=Payment Method
type.paymentinfo.adyenIssuerId.name=Issuer ID
type.paymentinfo.adyenAvsResult.name=AVS Result
diff --git a/adyenv6core/src/com/adyen/v6/constants/Adyenv6coreConstants.java b/adyenv6core/src/com/adyen/v6/constants/Adyenv6coreConstants.java
index dcc5c4b0..7decf60a 100644
--- a/adyenv6core/src/com/adyen/v6/constants/Adyenv6coreConstants.java
+++ b/adyenv6core/src/com/adyen/v6/constants/Adyenv6coreConstants.java
@@ -87,6 +87,8 @@ public final class Adyenv6coreConstants extends GeneratedAdyenv6coreConstants {
public static final String CLEARPAY = "clearpay";
public static final String SHOPPER_LOCALE = "shopperLocale";
+ public static final String EXPRESS_PAYMENT_CONFIG = "expressPaymentConfig";
+
private Adyenv6coreConstants() {
//empty to avoid instantiating this constant class
}
diff --git a/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTO.java b/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTO.java
index 4b66a78f..19c26194 100644
--- a/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTO.java
+++ b/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTO.java
@@ -41,6 +41,18 @@ public class CheckoutConfigDTO {
private boolean cardHolderNameRequired;
private boolean sepaDirectDebit;
private BigDecimal amountDecimal;
+ private ExpressPaymentConfigDto expressPaymentConfig;
+
+ // Getters and setters for the new field
+ public ExpressPaymentConfigDto getExpressPaymentConfig() {
+ return expressPaymentConfig;
+ }
+
+ public void setExpressPaymentConfig(ExpressPaymentConfigDto expressPaymentConfigDto) {
+ this.expressPaymentConfig = expressPaymentConfigDto;
+ }
+
+
public List getAlternativePaymentMethods() {
diff --git a/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTOBuilder.java b/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTOBuilder.java
index ea8b9c92..b49302c1 100644
--- a/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTOBuilder.java
+++ b/adyenv6core/src/com/adyen/v6/dto/CheckoutConfigDTOBuilder.java
@@ -155,6 +155,11 @@ public CheckoutConfigDTOBuilder setAmountDecimal(BigDecimal amountDecimal) {
return this;
}
+ public CheckoutConfigDTOBuilder setExpressPaymentConfig(ExpressPaymentConfigDto expressPaymentConfigDto) {
+ checkoutConfigDTO.setExpressPaymentConfig(expressPaymentConfigDto);
+ return this;
+ }
+
public CheckoutConfigDTO build() {
return checkoutConfigDTO;
}
diff --git a/adyenv6core/src/com/adyen/v6/dto/ExpressPaymentConfigDto.java b/adyenv6core/src/com/adyen/v6/dto/ExpressPaymentConfigDto.java
new file mode 100644
index 00000000..a4a936a1
--- /dev/null
+++ b/adyenv6core/src/com/adyen/v6/dto/ExpressPaymentConfigDto.java
@@ -0,0 +1,77 @@
+package com.adyen.v6.dto;
+
+public class ExpressPaymentConfigDto {
+ private boolean googlePayExpressEnabledOnCart;
+ private boolean applePayExpressEnabledOnCart;
+ private boolean paypalExpressEnabledOnCart;
+ private boolean amazonPayExpressEnabledOnCart;
+ private boolean googlePayExpressEnabledOnProduct;
+ private boolean applePayExpressEnabledOnProduct;
+ private boolean paypalExpressEnabledOnProduct;
+ private boolean amazonPayExpressEnabledOnProduct;
+
+
+ public boolean isGooglePayExpressEnabledOnCart() {
+ return googlePayExpressEnabledOnCart;
+ }
+
+ public void setGooglePayExpressEnabledOnCart(boolean googlePayExpressEnabledOnCart) {
+ this.googlePayExpressEnabledOnCart = googlePayExpressEnabledOnCart;
+ }
+
+ public boolean isApplePayExpressEnabledOnCart() {
+ return applePayExpressEnabledOnCart;
+ }
+
+ public void setApplePayExpressEnabledOnCart(boolean applePayExpressEnabledOnCart) {
+ this.applePayExpressEnabledOnCart = applePayExpressEnabledOnCart;
+ }
+
+ public boolean isPaypalExpressEnabledOnCart() {
+ return paypalExpressEnabledOnCart;
+ }
+
+ public void setPaypalExpressEnabledOnCart(boolean paypalExpressEnabledOnCart) {
+ this.paypalExpressEnabledOnCart = paypalExpressEnabledOnCart;
+ }
+
+ public boolean isAmazonPayExpressEnabledOnCart() {
+ return amazonPayExpressEnabledOnCart;
+ }
+
+ public void setAmazonPayExpressEnabledOnCart(boolean amazonPayExpressEnabledOnCart) {
+ this.amazonPayExpressEnabledOnCart = amazonPayExpressEnabledOnCart;
+ }
+
+ public boolean isGooglePayExpressEnabledOnProduct() {
+ return googlePayExpressEnabledOnProduct;
+ }
+
+ public void setGooglePayExpressEnabledOnProduct(boolean googlePayExpressEnabledOnProduct) {
+ this.googlePayExpressEnabledOnProduct = googlePayExpressEnabledOnProduct;
+ }
+
+ public boolean isApplePayExpressEnabledOnProduct() {
+ return applePayExpressEnabledOnProduct;
+ }
+
+ public void setApplePayExpressEnabledOnProduct(boolean applePayExpressEnabledOnProduct) {
+ this.applePayExpressEnabledOnProduct = applePayExpressEnabledOnProduct;
+ }
+
+ public boolean isPaypalExpressEnabledOnProduct() {
+ return paypalExpressEnabledOnProduct;
+ }
+
+ public void setPaypalExpressEnabledOnProduct(boolean paypalExpressEnabledOnProduct) {
+ this.paypalExpressEnabledOnProduct = paypalExpressEnabledOnProduct;
+ }
+
+ public boolean isAmazonPayExpressEnabledOnProduct() {
+ return amazonPayExpressEnabledOnProduct;
+ }
+
+ public void setAmazonPayExpressEnabledOnProduct(boolean amazonPayExpressEnabledOnProduct) {
+ this.amazonPayExpressEnabledOnProduct = amazonPayExpressEnabledOnProduct;
+ }
+}
\ No newline at end of file
diff --git a/adyenv6core/src/com/adyen/v6/facades/impl/DefaultAdyenCheckoutFacade.java b/adyenv6core/src/com/adyen/v6/facades/impl/DefaultAdyenCheckoutFacade.java
index a051ff15..61d4c754 100644
--- a/adyenv6core/src/com/adyen/v6/facades/impl/DefaultAdyenCheckoutFacade.java
+++ b/adyenv6core/src/com/adyen/v6/facades/impl/DefaultAdyenCheckoutFacade.java
@@ -43,6 +43,7 @@
import com.adyen.v6.converters.PosPaymentResponseConverter;
import com.adyen.v6.dto.CheckoutConfigDTO;
import com.adyen.v6.dto.CheckoutConfigDTOBuilder;
+import com.adyen.v6.dto.ExpressPaymentConfigDto;
import com.adyen.v6.enums.AdyenCardTypeEnum;
import com.adyen.v6.enums.AdyenRegions;
import com.adyen.v6.enums.RecurringContractMode;
@@ -54,6 +55,7 @@
import com.adyen.v6.forms.AddressForm;
import com.adyen.v6.forms.AdyenPaymentForm;
import com.adyen.v6.forms.validation.AdyenPaymentFormValidator;
+import com.adyen.v6.model.ExpressPaymentConfigModel;
import com.adyen.v6.model.RequestInfo;
import com.adyen.v6.repository.OrderRepository;
import com.adyen.v6.service.AdyenBusinessProcessService;
@@ -156,6 +158,7 @@ public class DefaultAdyenCheckoutFacade implements AdyenCheckoutFacade {
private static final String US = "US";
private static final String RECURRING_RECURRING_DETAIL_REFERENCE = "recurring.recurringDetailReference";
private static final String EXCLUDED_PAYMENT_METHODS_CONFIG = "adyen.payment-methods.excluded";
+ public static final String EXPRESS_PAYMENT_CONFIG = "expressPaymentConfig";
private BaseStoreService baseStoreService;
private SessionService sessionService;
@@ -687,6 +690,7 @@ public void initializeCheckoutData(Model model) throws ApiException {
model.addAttribute(MODEL_COUNTRY_CODE, checkoutConfigDTO.getCountryCode());
model.addAttribute(MODEL_CARD_HOLDER_NAME_REQUIRED, checkoutConfigDTO.isCardHolderNameRequired());
model.addAttribute(PAYMENT_METHOD_SEPA_DIRECTDEBIT, checkoutConfigDTO.isSepaDirectDebit());
+
}
public CheckoutConfigDTO getReactCheckoutConfig() throws ApiException {
@@ -760,7 +764,7 @@ public CheckoutConfigDTO getReactCheckoutConfig() throws ApiException {
CheckoutConfigDTOBuilder checkoutConfigDTOBuilder = new CheckoutConfigDTOBuilder();
- return checkoutConfigDTOBuilder
+ checkoutConfigDTOBuilder
.setPaymentMethods(paymentMethods)
.setConnectedTerminalList(connectedTerminalList)
.setStoredPaymentMethodList(storedPaymentMethodList)
@@ -782,8 +786,29 @@ public CheckoutConfigDTO getReactCheckoutConfig() throws ApiException {
.setImmediateCapture(isImmediateCapture())
.setCountryCode(cartData != null && cartData.getDeliveryAddress() != null && cartData.getDeliveryAddress().getCountry() != null ? cartData.getDeliveryAddress().getCountry().getIsocode() : "")
.setCardHolderNameRequired(getHolderNameRequired())
- .setAmountDecimal(cartData.getTotalPriceWithTax().getValue())
- .build();
+ .setAmountDecimal(cartData.getTotalPriceWithTax().getValue());
+
+ ExpressPaymentConfigModel expressPaymentConfigModel = baseStore.getExpressPaymentConfig();
+ if (expressPaymentConfigModel != null) {
+ ExpressPaymentConfigDto expressPaymentConfigDto = getExpressPaymentConfigDto(expressPaymentConfigModel);
+
+ checkoutConfigDTOBuilder.setExpressPaymentConfig(expressPaymentConfigDto);
+ }
+
+ return checkoutConfigDTOBuilder.build();
+ }
+
+ private static ExpressPaymentConfigDto getExpressPaymentConfigDto(ExpressPaymentConfigModel expressPaymentConfigModel) {
+ ExpressPaymentConfigDto expressPaymentConfigDto = new ExpressPaymentConfigDto();
+ expressPaymentConfigDto.setGooglePayExpressEnabledOnCart(expressPaymentConfigModel.getGooglePayExpressEnabledOnCart());
+ expressPaymentConfigDto.setApplePayExpressEnabledOnCart(expressPaymentConfigModel.getApplePayExpressEnabledOnCart());
+ expressPaymentConfigDto.setPaypalExpressEnabledOnCart(expressPaymentConfigModel.getPaypalExpressEnabledOnCart());
+ expressPaymentConfigDto.setAmazonPayExpressEnabledOnCart(expressPaymentConfigModel.getAmazonPayExpressEnabledOnCart());
+ expressPaymentConfigDto.setGooglePayExpressEnabledOnProduct(expressPaymentConfigModel.getGooglePayExpressEnabledOnProduct());
+ expressPaymentConfigDto.setApplePayExpressEnabledOnProduct(expressPaymentConfigModel.getApplePayExpressEnabledOnProduct());
+ expressPaymentConfigDto.setPaypalExpressEnabledOnProduct(expressPaymentConfigModel.getPaypalExpressEnabledOnProduct());
+ expressPaymentConfigDto.setAmazonPayExpressEnabledOnProduct(expressPaymentConfigModel.getAmazonPayExpressEnabledOnProduct());
+ return expressPaymentConfigDto;
}
protected List getExcludedPaymentMethodsFromConfiguration() {
@@ -880,7 +905,7 @@ public CheckoutConfigDTO getCheckoutConfig() throws ApiException {
CheckoutConfigDTOBuilder checkoutConfigDTOBuilder = new CheckoutConfigDTOBuilder();
- return checkoutConfigDTOBuilder.setAlternativePaymentMethods(alternativePaymentMethods)
+ checkoutConfigDTOBuilder.setAlternativePaymentMethods(alternativePaymentMethods)
.setConnectedTerminalList(connectedTerminalList)
.setStoredPaymentMethodList(storedPaymentMethodList)
.setIssuerLists(issuerLists)
@@ -905,8 +930,16 @@ public CheckoutConfigDTO getCheckoutConfig() throws ApiException {
.setCountryCode(cartData.getDeliveryAddress().getCountry().getIsocode())
.setCardHolderNameRequired(getHolderNameRequired())
.setSepaDirectDebit(sepaDirectDebit)
- .setAmountDecimal(cartData.getTotalPriceWithTax().getValue())
- .build();
+ .setAmountDecimal(cartData.getTotalPriceWithTax().getValue());
+
+ ExpressPaymentConfigModel expressPaymentConfigModel = baseStore.getExpressPaymentConfig();
+ if (expressPaymentConfigModel != null) {
+ ExpressPaymentConfigDto expressPaymentConfigDto = getExpressPaymentConfigDto(expressPaymentConfigModel);
+
+ checkoutConfigDTOBuilder.setExpressPaymentConfig(expressPaymentConfigDto);
+ }
+
+ return checkoutConfigDTOBuilder.build();
}
@Deprecated
@@ -1104,6 +1137,9 @@ protected void initializeApplePayExpressDataInternal(BigDecimal amountValue, Str
model.addAttribute(MODEL_AMOUNT_DECIMAL, amountValue);
model.addAttribute(MODEL_DF_URL, getAdyenPaymentService().getDeviceFingerprintUrl());
model.addAttribute(MODEL_CHECKOUT_SHOPPER_HOST, getCheckoutShopperHost());
+ if(baseStore.getExpressPaymentConfig()!=null) {
+ model.addAttribute(EXPRESS_PAYMENT_CONFIG, getExpressPaymentConfigDto(baseStore.getExpressPaymentConfig()));
+ }
}
protected BigDecimal getExpressDeliveryModeValue(final String currencyIso) {
diff --git a/adyenv6core/src/com/adyen/v6/jalo/ExpressPaymentConfig.java b/adyenv6core/src/com/adyen/v6/jalo/ExpressPaymentConfig.java
new file mode 100644
index 00000000..66cc849d
--- /dev/null
+++ b/adyenv6core/src/com/adyen/v6/jalo/ExpressPaymentConfig.java
@@ -0,0 +1,25 @@
+package com.adyen.v6.jalo;
+
+import de.hybris.platform.jalo.Item;
+import de.hybris.platform.jalo.JaloBusinessException;
+import de.hybris.platform.jalo.SessionContext;
+import de.hybris.platform.jalo.type.ComposedType;
+import org.apache.log4j.Logger;
+
+public class ExpressPaymentConfig extends GeneratedExpressPaymentConfig
+{
+ @SuppressWarnings("unused")
+ private static final Logger LOG = Logger.getLogger( ExpressPaymentConfig.class.getName() );
+
+ @Override
+ protected Item createItem(final SessionContext ctx, final ComposedType type, final ItemAttributeMap allAttributes) throws JaloBusinessException
+ {
+ // business code placed here will be executed before the item is created
+ // then create the item
+ final Item item = super.createItem( ctx, type, allAttributes );
+ // business code placed here will be executed after the item was created
+ // and return the item
+ return item;
+ }
+
+}