diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 00000000..f4949b24 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,44 @@ +name: Release + +on: +# Manual run from Github UI (e.g. for when a merged PR labels have changed) + workflow_dispatch: + inputs: + pre-release: + required: false + type: boolean + default: false + description: "This release will be labeled as non-production ready" + # Publish the current version now, useful if the automated run failed + github-release: + required: false + type: boolean + default: false + description: "Publish Github release for the current version" + # Monitor pull request events + + pull_request: + types: + - closed + branches: + - main + +jobs: + release: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prepare the next main release + uses: Adyen/release-automation-action@v1.3.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + develop-branch: main + version-files: composer.json + release-title: Adyen Magento 2 Express Checkout Module + pre-release: ${{ inputs.pre-release || false }} +# For a manual Github release + github-release: ${{ inputs.github-release || false }} + separator: .pre.beta \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..50aea0e7 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/composer.json b/composer.json index d91728bf..5742ea27 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "adyen/adyen-magento2-expresscheckout", "description": "Official Adyen Magento2 plugin to add express payment method shortcuts.", "type": "magento2-module", - "version": "2.1.0", + "version": "2.2.0", "license": "MIT", "repositories": [ { diff --git a/etc/module.xml b/etc/module.xml index b5ae5670..c11fe601 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -11,7 +11,7 @@ */ --> - + diff --git a/view/frontend/web/js/applepay/button.js b/view/frontend/web/js/applepay/button.js index 5d562ebc..c37b3cde 100644 --- a/view/frontend/web/js/applepay/button.js +++ b/view/frontend/web/js/applepay/button.js @@ -30,6 +30,7 @@ define([ 'Adyen_ExpressCheckout/js/model/countries', 'Adyen_ExpressCheckout/js/model/totals', 'Adyen_ExpressCheckout/js/model/currency', + 'Adyen_ExpressCheckout/js/helpers/getCurrentPage', 'Adyen_ExpressCheckout/js/model/virtualQuote' ], function ( @@ -64,6 +65,7 @@ define([ countriesModel, totalsModel, currencyModel, + getCurrentPage, virtualQuoteModel ) { 'use strict'; @@ -148,6 +150,7 @@ define([ initialiseApplePayComponent: async function (applePaymentMethod, element) { const config = configModel().getConfig(); const adyenData = window.adyenData; + let currentPage = getCurrentPage(this.isProductView, element); const adyenCheckoutComponent = await new AdyenCheckout({ locale: config.locale, @@ -169,6 +172,8 @@ define([ risk: { enabled: false }, + isExpress: true, + expressPage: currentPage, clientKey: AdyenConfiguration.getClientKey() }); const applePayConfiguration = this.getApplePayConfiguration(applePaymentMethod, element); diff --git a/view/frontend/web/js/googlepay/button.js b/view/frontend/web/js/googlepay/button.js index 6fdbdb18..b9c102af 100644 --- a/view/frontend/web/js/googlepay/button.js +++ b/view/frontend/web/js/googlepay/button.js @@ -38,7 +38,8 @@ define([ 'Adyen_ExpressCheckout/js/model/countries', 'Adyen_ExpressCheckout/js/model/totals', 'Adyen_ExpressCheckout/js/model/currency', - 'Adyen_ExpressCheckout/js/model/virtualQuote' + 'Adyen_ExpressCheckout/js/model/virtualQuote', + 'Adyen_ExpressCheckout/js/helpers/getCurrentPage' ], function ( $, @@ -80,7 +81,8 @@ define([ countriesModel, totalsModel, currencyModel, - virtualQuoteModel + virtualQuoteModel, + getCurrentPage ) { 'use strict'; @@ -177,6 +179,7 @@ define([ initialiseGooglePayComponent: async function (googlePaymentMethod, element) { const config = configModel().getConfig(); const adyenData = window.adyenData; + let currentPage = getCurrentPage(this.isProductView, element); this.checkoutComponent = await new AdyenCheckout({ locale: config.locale, @@ -198,6 +201,8 @@ define([ }, paymentMethodsResponse: getPaymentMethod('googlepay', this.isProductView), onAdditionalDetails: this.handleOnAdditionalDetails.bind(this), + isExpress: true, + expressPage: currentPage, risk: { enabled: false } diff --git a/view/frontend/web/js/helpers/getCurrentPage.js b/view/frontend/web/js/helpers/getCurrentPage.js new file mode 100644 index 00000000..e86a7289 --- /dev/null +++ b/view/frontend/web/js/helpers/getCurrentPage.js @@ -0,0 +1,19 @@ +define(['jquery',], function ($) { + 'use strict'; + + return function (isProductView, element) { + let currentPage = ''; + + if (isProductView) { + currentPage = 'pdp'; + } else if ($(element).closest('.minicart-wrapper').length > 0) { + currentPage = 'minicart'; + } else if ($('.cart-container').length > 0) { + currentPage = 'cart'; + } else if ($('body').hasClass('checkout-index-index')) { + currentPage = 'checkout'; + } + + return currentPage; + }; +}); diff --git a/view/frontend/web/js/paypal_express/button.js b/view/frontend/web/js/paypal_express/button.js index b3663833..41c9d13f 100755 --- a/view/frontend/web/js/paypal_express/button.js +++ b/view/frontend/web/js/paypal_express/button.js @@ -42,7 +42,8 @@ define([ 'jquery', 'Adyen_ExpressCheckout/js/model/virtualQuote', 'Adyen_ExpressCheckout/js/model/maskedId', - 'Adyen_ExpressCheckout/js/helpers/manageQuoteIdOnPageRefresh' + 'Adyen_ExpressCheckout/js/helpers/manageQuoteIdOnPageRefresh', + 'Adyen_ExpressCheckout/js/helpers/getCurrentPage' ], function ( Component, $t, @@ -87,7 +88,8 @@ define([ $, virtualQuoteModel, maskedIdModel, - manageQuoteIdOnPageRefresh + manageQuoteIdOnPageRefresh, + getCurrentPage ) { 'use strict'; @@ -200,6 +202,8 @@ define([ // Configuration setup const config = configModel().getConfig(); const adyenData = window.adyenData; + let currentPage = getCurrentPage(this.isProductView, element); + const adyenCheckoutComponent = await new AdyenCheckout({ locale: config.locale, originKey: config.originkey, @@ -222,6 +226,7 @@ define([ enabled: false }, isExpress: true, + expressPage: currentPage, clientKey: AdyenConfiguration.getClientKey() }); @@ -444,7 +449,7 @@ define([ fullScreenLoader.startLoader(); request.orderId = this.orderId; - adyenPaymentService.paymentDetails(request,this.orderId,false,this.quoteId). + adyenPaymentService.paymentDetails(request,this.orderId,this.quoteId). done(function(responseJSON) { fullScreenLoader.stopLoader(); self.handleAdyenResult(responseJSON, self.orderId);