Skip to content

Commit

Permalink
Merge pull request #1128 from Adyen/release/24.3.0
Browse files Browse the repository at this point in the history
Release/24.3.0
  • Loading branch information
zenit2001 committed Jul 23, 2024
2 parents ce60315 + a1a08f6 commit ae4aad6
Show file tree
Hide file tree
Showing 146 changed files with 23,070 additions and 24,123 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/E2E_SFRA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
code-version-secret: 'SFCC_CODE_VERSION_SFRA7'
steps:
- name: Checkout SFRA code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: SalesforceCommerceCloud/storefront-reference-architecture
ref: ${{ matrix.sfra-version }}
Expand All @@ -39,7 +39,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: adyen-salesforce-commerce-cloud
- name: Install SFRA dependencies
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: adyen-salesforce-commerce-cloud
- name: install e2e test dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/SFCC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand All @@ -22,6 +22,6 @@ jobs:
npm install
npm run lint:fix
npm run lint
npm test
npm run test:coverage
env:
CI: true
4 changes: 2 additions & 2 deletions .github/workflows/cartridges-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add cartridges/**/*
git commit -m "chore: committing the built /cartridge folder"
git commit --no-verify -m "chore: committing the built /cartridge folder"
git fetch origin
git push origin HEAD:${{ github.head_ref }} --force-with-lease
- name: Commit .project files
Expand Down Expand Up @@ -91,6 +91,6 @@ jobs:
git add .
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git commit -m "chore: committing the project files"
git commit --no-verify -m "chore: committing the project files"
git fetch origin
git push origin HEAD:${{ github.head_ref }} --force-with-lease
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/metadata-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Metadata upload

on:
pull_request:
paths:
- 'metadata/**'
jobs:
upload-metadata:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
include:
- sfra-version: 'v5.3.0'
node-version: '16'
sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_SFRA5'
code-version-secret: 'SFCC_CODE_VERSION_SFRA5'
- sfra-version: 'v6.1.0'
node-version: '16'
sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_SFRA6'
code-version-secret: 'SFCC_CODE_VERSION_SFRA6'
- sfra-version: 'v7.0.0'
node-version: '18'
sfcc-hostname-secret: 'SFCC_STOREFRONT_URL_SFRA7'
code-version-secret: 'SFCC_CODE_VERSION_SFRA7'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: adyen-salesforce-commerce-cloud
- name: Install Salesforce CLI
run: |
npm install -g sfcc-ci
- name: Zip site_import
working-directory: adyen-salesforce-commerce-cloud/metadata
run: |
zip -r $GITHUB_WORKSPACE/site_import.zip site_import
- name: Upload the metadata to the sandbox
working-directory: adyen-salesforce-commerce-cloud/metadata
run: |
sfcc-ci client:auth '${{ secrets.SFCC_CLIENT_ID }}' '${{ secrets.SFCC_CLIENT_SECRET }}'
sfcc-ci instance:upload $GITHUB_WORKSPACE/site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}"
- name: Import the metadata to the sandbox
working-directory: adyen-salesforce-commerce-cloud/metadata
run: |
sfcc-ci instance:import site_import.zip -i "${{ secrets[matrix.sfcc-hostname-secret] }}" -s
2 changes: 1 addition & 1 deletion cartridges/app_adyen_SFRA/.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app_adyen_SFRA</name>
<comment>v24.2.1</comment>
<comment>v24.3.0</comment>
<projects></projects>
<buildSpec>
<buildCommand>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function getCardConfig() {
exposeExpiryDate: false,
onChange: function onChange(state) {
store.isValid = state.isValid;
var method = state.data.paymentMethod.storedPaymentMethodId ? "storedCard".concat(state.data.paymentMethod.storedPaymentMethodId) : constants.SCHEME;
var method = state.data.paymentMethod.storedPaymentMethodId ? "storedCard".concat(state.data.paymentMethod.storedPaymentMethodId) : store.selectedMethod;
store.updateSelectedPayment(method, 'isValid', store.isValid);
store.updateSelectedPayment(method, 'stateData', state.data);
},
Expand Down Expand Up @@ -267,12 +267,17 @@ function getGiftCardConfig() {
};
}
function handleOnChange(state) {
var type = state.data.paymentMethod.type;
var multipleTxVariantComponents = constants.MULTIPLE_TX_VARIANTS_COMPONENTS;
if (multipleTxVariantComponents.includes(store.selectedMethod)) {
type = store.selectedMethod;
}
store.isValid = state.isValid;
if (!store.componentsObj[store.selectedMethod]) {
store.componentsObj[store.selectedMethod] = {};
if (!store.componentsObj[type]) {
store.componentsObj[type] = {};
}
store.componentsObj[store.selectedMethod].isValid = store.isValid;
store.componentsObj[store.selectedMethod].stateData = state.data;
store.componentsObj[type].isValid = store.isValid;
store.componentsObj[type].stateData = state.data;
}
var actionHandler = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(action) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

181 changes: 101 additions & 80 deletions cartridges/app_adyen_SFRA/cartridge/client/default/js/applePayExpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,67 +20,6 @@ var _require3 = require('./constants'),
var checkout;
var shippingMethodsData;
var paymentMethodsResponse;
function initializeCheckout() {
return _initializeCheckout.apply(this, arguments);
}
function _initializeCheckout() {
_initializeCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
var _paymentMethodsRespon3;
var shippingMethods, applicationInfo;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return getPaymentMethods();
case 2:
paymentMethodsResponse = _context5.sent;
_context5.next = 5;
return fetch(window.shippingMethodsUrl);
case 5:
shippingMethods = _context5.sent;
_context5.next = 8;
return shippingMethods.json();
case 8:
shippingMethodsData = _context5.sent;
applicationInfo = (_paymentMethodsRespon3 = paymentMethodsResponse) === null || _paymentMethodsRespon3 === void 0 ? void 0 : _paymentMethodsRespon3.applicationInfo;
_context5.next = 12;
return AdyenCheckout({
environment: window.environment,
clientKey: window.clientKey,
locale: window.locale,
analytics: {
analyticsData: {
applicationInfo: applicationInfo
}
}
});
case 12:
checkout = _context5.sent;
case 13:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _initializeCheckout.apply(this, arguments);
}
function createApplePayButton(_x) {
return _createApplePayButton.apply(this, arguments);
}
function _createApplePayButton() {
_createApplePayButton = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(applePayButtonConfig) {
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
return _context6.abrupt("return", checkout.create(APPLE_PAY, applePayButtonConfig));
case 1:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return _createApplePayButton.apply(this, arguments);
}
function formatCustomerObject(customerData, billingData) {
return {
addressBook: {
Expand Down Expand Up @@ -166,6 +105,104 @@ function callPaymentFromComponent(data, resolveApplePay, rejectApplePay) {
rejectApplePay();
});
}
function selectShippingMethod(_ref) {
var shipmentUUID = _ref.shipmentUUID,
ID = _ref.ID;
var request = {
paymentMethodType: APPLE_PAY,
shipmentUUID: shipmentUUID,
methodID: ID
};
return fetch(window.selectShippingMethodUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify(request)
});
}
function getShippingMethod(shippingContact) {
var request = {
paymentMethodType: APPLE_PAY
};
if (shippingContact) {
request.address = {
city: shippingContact.locality,
country: shippingContact.country,
countryCode: shippingContact.countryCode,
stateCode: shippingContact.administrativeArea,
postalCode: shippingContact.postalCode
};
}
return fetch(window.shippingMethodsUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify(request)
});
}
function initializeCheckout() {
return _initializeCheckout.apply(this, arguments);
}
function _initializeCheckout() {
_initializeCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
var _paymentMethodsRespon3;
var shippingMethods, applicationInfo;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return getPaymentMethods();
case 2:
paymentMethodsResponse = _context5.sent;
_context5.next = 5;
return getShippingMethod();
case 5:
shippingMethods = _context5.sent;
_context5.next = 8;
return shippingMethods.json();
case 8:
shippingMethodsData = _context5.sent;
applicationInfo = (_paymentMethodsRespon3 = paymentMethodsResponse) === null || _paymentMethodsRespon3 === void 0 ? void 0 : _paymentMethodsRespon3.applicationInfo;
_context5.next = 12;
return AdyenCheckout({
environment: window.environment,
clientKey: window.clientKey,
locale: window.locale,
analytics: {
analyticsData: {
applicationInfo: applicationInfo
}
}
});
case 12:
checkout = _context5.sent;
case 13:
case "end":
return _context5.stop();
}
}, _callee5);
}));
return _initializeCheckout.apply(this, arguments);
}
function createApplePayButton(_x) {
return _createApplePayButton.apply(this, arguments);
}
function _createApplePayButton() {
_createApplePayButton = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(applePayButtonConfig) {
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) switch (_context6.prev = _context6.next) {
case 0:
return _context6.abrupt("return", checkout.create(APPLE_PAY, applePayButtonConfig));
case 1:
case "end":
return _context6.stop();
}
}, _callee6);
}));
return _createApplePayButton.apply(this, arguments);
}
initializeCheckout().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
var _paymentMethodsRespon, _paymentMethodsRespon2;
var applePayPaymentMethod, applePayConfig, applePayButtonConfig, cartContainer, applePayButton, isApplePayButtonAvailable, expressCheckoutNodesIndex;
Expand Down Expand Up @@ -265,12 +302,7 @@ initializeCheckout().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regener
return sm.ID === shippingMethod.identifier;
});
_context2.next = 4;
return fetch("".concat(window.calculateAmountUrl, "?").concat(new URLSearchParams({
shipmentUUID: matchingShippingMethod.shipmentUUID,
methodID: matchingShippingMethod.ID
})), {
method: 'POST'
});
return selectShippingMethod(matchingShippingMethod);
case 4:
calculationResponse = _context2.sent;
if (!calculationResponse.ok) {
Expand Down Expand Up @@ -316,13 +348,7 @@ initializeCheckout().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regener
case 0:
shippingContact = event.shippingContact;
_context3.next = 3;
return fetch("".concat(window.shippingMethodsUrl, "?").concat(new URLSearchParams({
city: shippingContact.locality,
country: shippingContact.country,
countryCode: shippingContact.countryCode,
stateCode: shippingContact.administrativeArea,
postalCode: shippingContact.postalCode
})));
return getShippingMethod(shippingContact);
case 3:
shippingMethods = _context3.sent;
if (!shippingMethods.ok) {
Expand All @@ -339,12 +365,7 @@ initializeCheckout().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regener
}
selectedShippingMethod = shippingMethodsData.shippingMethods[0];
_context3.next = 12;
return fetch("".concat(window.calculateAmountUrl, "?").concat(new URLSearchParams({
shipmentUUID: selectedShippingMethod.shipmentUUID,
methodID: selectedShippingMethod.ID
})), {
method: 'POST'
});
return selectShippingMethod(selectedShippingMethod);
case 12:
calculationResponse = _context3.sent;
if (!calculationResponse.ok) {
Expand Down
Loading

0 comments on commit ae4aad6

Please sign in to comment.