Skip to content

Commit

Permalink
AD-337 Add PayPal Express Button with Frontend Logic and API Calls to…
Browse files Browse the repository at this point in the history
… CMS Components on PDP and Cart Pages
  • Loading branch information
pjaneta committed Jan 28, 2025
1 parent 447c176 commit e5d9fc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<div class="adyen-apple-pay-button">
</div>
</div>
</div>
<div class="col-sm-4 col-md-3 pull-right">
<div class="adyen-paypal-button">
<div class="col-sm-4 col-md-3 pull-right">
<div class="adyen-paypal-button">
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ protected ExpressCheckoutConfigDTO initializeExpressCheckoutDataInternal(BigDeci

Map<String, String> payPalConfig = getPayPalConfigFromPaymentMethods(paymentMethodsResponse.getPaymentMethods());
if (!CollectionUtils.isEmpty(payPalConfig)) {
expressCheckoutConfigDTOBuilder.setPayPalIntent(payPalConfig.get("intent"))
expressCheckoutConfigDTOBuilder.setPayPalIntent(payPalConfig.get("intent"));
} else {
LOGGER.warn("Empty PayPal config");
}
Expand All @@ -1145,21 +1145,24 @@ protected ExpressCheckoutConfigDTO initializeExpressCheckoutDataInternal(BigDeci
return expressCheckoutConfigDTOBuilder.build();
}

protected void populateExpressCheckoutConfigModel(final Model model, final ExpressCheckoutConfigDTO expressCheckoutConfigDTO){
if(StringUtils.isNotEmpty(expressCheckoutConfigDTO.getApplePayMerchantId())){
protected void populateExpressCheckoutConfigModel(final Model model, final ExpressCheckoutConfigDTO expressCheckoutConfigDTO) {
if (StringUtils.isNotEmpty(expressCheckoutConfigDTO.getApplePayMerchantId())) {
model.addAttribute(MODEL_APPLEPAY_MERCHANT_IDENTIFIER, expressCheckoutConfigDTO.getApplePayMerchantId());
}
if(StringUtils.isNotEmpty(expressCheckoutConfigDTO.getApplePayMerchantName())){
if (StringUtils.isNotEmpty(expressCheckoutConfigDTO.getApplePayMerchantName())) {
model.addAttribute(MODEL_APPLEPAY_MERCHANT_NAME, expressCheckoutConfigDTO.getApplePayMerchantName());
}
if(expressCheckoutConfigDTO.getExpressPaymentConfig() != null){
if (expressCheckoutConfigDTO.getExpressPaymentConfig() != null) {
model.addAttribute(EXPRESS_PAYMENT_CONFIG, expressCheckoutConfigDTO.getExpressPaymentConfig());
}
if (expressCheckoutConfigDTO.getPayPalIntent() != null) {
model.addAttribute(MODEL_PAYPAL_INTENT, expressCheckoutConfigDTO.getPayPalIntent());
}

model.addAttribute(SHOPPER_LOCALE, expressCheckoutConfigDTO.getShopperLocale());
model.addAttribute(MODEL_ENVIRONMENT_MODE, expressCheckoutConfigDTO.getEnvironmentMode());
model.addAttribute(MODEL_CLIENT_KEY, expressCheckoutConfigDTO.getClientKey());
model.addAttribute(MODEL_MERCHANT_ACCOUNT,expressCheckoutConfigDTO.getMerchantAccount());
model.addAttribute(MODEL_MERCHANT_ACCOUNT, expressCheckoutConfigDTO.getMerchantAccount());
model.addAttribute(MODEL_AMOUNT, expressCheckoutConfigDTO.getAmount());
model.addAttribute(MODEL_AMOUNT_DECIMAL, expressCheckoutConfigDTO.getAmountDecimal());
model.addAttribute(MODEL_DF_URL, expressCheckoutConfigDTO.getDfUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import de.hybris.platform.order.CartService;
import de.hybris.platform.order.DeliveryModeService;
import de.hybris.platform.order.InvalidCartException;
import de.hybris.platform.order.exceptions.CalculationException;
import de.hybris.platform.product.ProductService;
import de.hybris.platform.servicelayer.dto.converter.Converter;
import de.hybris.platform.servicelayer.i18n.CommonI18NService;
Expand Down

0 comments on commit e5d9fc5

Please sign in to comment.