Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/paypalExpress' into feat…
Browse files Browse the repository at this point in the history
…ure/paypalExpress
  • Loading branch information
khushboo-singhvi committed Jul 24, 2024
2 parents 55c5886 + b7bbd86 commit 6614478
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 7 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_ExpressCheckout" setup_version="2.1.0">
<module name="Adyen_ExpressCheckout">
<sequence>
<module name="Adyen_Payment"/>
</sequence>
Expand Down
5 changes: 5 additions & 0 deletions view/frontend/web/js/applepay/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -64,6 +65,7 @@ define([
countriesModel,
totalsModel,
currencyModel,
getCurrentPage,
virtualQuoteModel
) {
'use strict';
Expand Down Expand Up @@ -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,
Expand All @@ -169,6 +172,8 @@ define([
risk: {
enabled: false
},
isExpress: true,
expressPage: currentPage,
clientKey: AdyenConfiguration.getClientKey()
});
const applePayConfiguration = this.getApplePayConfiguration(applePaymentMethod, element);
Expand Down
9 changes: 7 additions & 2 deletions view/frontend/web/js/googlepay/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
$,
Expand Down Expand Up @@ -80,7 +81,8 @@ define([
countriesModel,
totalsModel,
currencyModel,
virtualQuoteModel
virtualQuoteModel,
getCurrentPage
) {
'use strict';

Expand Down Expand Up @@ -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,
Expand All @@ -198,6 +201,8 @@ define([
},
paymentMethodsResponse: getPaymentMethod('googlepay', this.isProductView),
onAdditionalDetails: this.handleOnAdditionalDetails.bind(this),
isExpress: true,
expressPage: currentPage,
risk: {
enabled: false
}
Expand Down
19 changes: 19 additions & 0 deletions view/frontend/web/js/helpers/getCurrentPage.js
Original file line number Diff line number Diff line change
@@ -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;
};
});
11 changes: 8 additions & 3 deletions view/frontend/web/js/paypal_express/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -87,7 +88,8 @@ define([
$,
virtualQuoteModel,
maskedIdModel,
manageQuoteIdOnPageRefresh
manageQuoteIdOnPageRefresh,
getCurrentPage
) {
'use strict';

Expand Down Expand Up @@ -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,
Expand All @@ -222,6 +226,7 @@ define([
enabled: false
},
isExpress: true,
expressPage: currentPage,
clientKey: AdyenConfiguration.getClientKey()
});

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6614478

Please sign in to comment.