Skip to content

Commit

Permalink
feat: adding the google pay express enable/disable option for cart,mi…
Browse files Browse the repository at this point in the history
…nicart and pdp
  • Loading branch information
zenit2001 committed Oct 15, 2024
1 parent 38adebf commit 0b254fe
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 11 deletions.
16 changes: 16 additions & 0 deletions metadata/site_import/meta/system-objecttype-extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,20 @@
<externally-managed-flag>false</externally-managed-flag>
<default-value>true</default-value>
</attribute-definition>
<attribute-definition attribute-id="GooglePayExpress_Enabled">
<display-name xml:lang="x-default">Enable Google Pay express checkout</display-name>
<type>boolean</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
<default-value>true</default-value>
</attribute-definition>
<attribute-definition attribute-id="GooglePayExpress_Pdp_Enabled">
<display-name xml:lang="x-default">Enable Google Pay express on product detail page</display-name>
<type>boolean</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
<default-value>true</default-value>
</attribute-definition>
<attribute-definition attribute-id="PayPalExpress_Enabled">
<display-name xml:lang="x-default">Enable PayPal express checkout</display-name>
<type>boolean</type>
Expand Down Expand Up @@ -714,6 +728,8 @@
<attribute attribute-id="AmazonPayExpress_Enabled"/>
<attribute attribute-id="PayPalExpress_Enabled"/>
<attribute attribute-id="PayPalExpress_ReviewPage_Enabled"/>
<attribute attribute-id="GooglePayExpress_Enabled"/>
<attribute attribute-id="GooglePayExpress_Pdp_Enabled"/>
</attribute-group>
</group-definitions>
</type-extension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,8 @@ function getGiftCardConfig() {
async: false,
success: (data) => {
giftcardBalance = data.balance;
document.querySelector(
'button[value="submit-payment"]',
).disabled = false;
document.querySelector('button[value="submit-payment"]').disabled =
false;
if (data.resultCode === constants.SUCCESS) {
const {
giftCardsInfoMessageContainer,
Expand All @@ -220,9 +219,8 @@ function getGiftCardConfig() {
initialPartialObject.totalDiscountedAmount;
});

document.querySelector(
'button[value="submit-payment"]',
).disabled = true;
document.querySelector('button[value="submit-payment"]').disabled =
true;
giftCardsInfoMessageContainer.innerHTML = '';
giftCardsInfoMessageContainer.classList.remove(
'gift-cards-info-message-container',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ function removeGiftCards() {
giftCardsInfoMessageContainer.classList.remove(
'gift-cards-info-message-container',
);
document.querySelector(
'button[value="submit-payment"]',
).disabled = false;
document.querySelector('button[value="submit-payment"]').disabled =
false;

if (res.resultCode === constants.RECEIVED) {
document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
<isif condition="${AdyenConfigs.areExpressPaymentsEnabled() && AdyenConfigs.isPayPalExpressEnabled()}">
<script src="${URLUtils.httpsStatic('/js/paypalExpress.js')}" type="text/javascript"></script>
</isif>
<isif condition="${AdyenConfigs.areExpressPaymentsEnabled() && AdyenConfigs.GooglePayExpress_Enabled()}">
<!-- To be commented in once we have the googlePayExpress.js file -->
<!-- <script src="${URLUtils.httpsStatic('/js/googlePayExpress.js')}" type="text/javascript"></script> -->
</isif>
</iselse>
</isif>
<input type="hidden" id="adyen-token" name="${pdict.csrf.tokenName}" value="${pdict.csrf.token}"/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const expressPaymentMethods = [
text: 'Show shopper order review page',
},
},
{
id: 'googlepay',
name: 'GooglePayExpress_Enabled',
text: 'Google Pay',
icon: window.googleIcon,
checked: window.isGooglePayExpressEnabled,
},
];

const expressPaymentMethodsOnPdp = [
Expand All @@ -35,6 +42,13 @@ const expressPaymentMethodsOnPdp = [
icon: window.applePayIcon,
checked: window.isApplePayExpressOnPdpEnabled,
},
{
id: 'googlepay',
name: 'GooglePayExpress_Pdp_Enabled',
text: 'Google Pay',
icon: window.googleIcon,
checked: window.isGooglePayExpressOnPdpEnabled,
},
];

document.addEventListener('DOMContentLoaded', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
window.applePayIcon = "${URLUtils.staticURL('icons/applepay.svg')}";
window.amazonPayIcon = "${URLUtils.staticURL('icons/amazonpay.svg')}";
window.paypalIcon = "${URLUtils.staticURL('icons/paypal.svg')}";
window.googleIcon = "${URLUtils.staticURL('icons/googlepay.svg')}";

window.isApplePayEnabled = ${AdyenConfigs.isApplePayExpressEnabled() || false};
window.isApplePayExpressOnPdpEnabled = ${AdyenConfigs.isApplePayExpressOnPdpEnabled() || false};
window.isAmazonPayEnabled = ${AdyenConfigs.isAmazonPayExpressEnabled() || false};
window.isPayPalExpressEnabled = ${AdyenConfigs.isPayPalExpressEnabled() || false};
window.isPayPalExpressReviewPageEnabled = ${AdyenConfigs.isPayPalExpressReviewPageEnabled() || false};
window.isGooglePayExpressEnabled = ${AdyenConfigs.isGooglePayExpressEnabled() || false};
window.isGooglePayExpressOnPdpEnabled = ${AdyenConfigs.isGooglePayExpressOnPdpEnabled() || false};
window.expressMethodsOrder = "${AdyenConfigs.getExpressPaymentsOrder()}";
</script>
<div id="epmSettings" class="card bg-white mt-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ const adyenConfigsObj = {
},

areExpressPaymentsEnabled() {
return this.isApplePayExpressEnabled() || this.isAmazonPayExpressEnabled() || this.isPayPalExpressEnabled();
return this.isApplePayExpressEnabled() || this.isAmazonPayExpressEnabled() || this.isPayPalExpressEnabled() || this.isGooglePayExpressOnPdpEnabled();
},

arePdpExpressPaymentsEnabled() {
return this.isApplePayExpressOnPdpEnabled();
return this.isApplePayExpressOnPdpEnabled() || this.isGooglePayExpressOnPdpEnabled();
},

isApplePayExpressEnabled() {
Expand All @@ -159,6 +159,14 @@ const adyenConfigsObj = {
return getCustomPreference('PayPalExpress_ReviewPage_Enabled');
},

isGooglePayExpressEnabled() {
return getCustomPreference('GooglePayExpress_Enabled');
},

isGooglePayExpressOnPdpEnabled() {
return getCustomPreference('GooglePayExpress_Pdp_Enabled');
},

getExpressPaymentsOrder() {
return getCustomPreference('ExpressPayments_order');
},
Expand Down

0 comments on commit 0b254fe

Please sign in to comment.