Skip to content

Commit

Permalink
Merge release/8.1.0 into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessy committed Aug 21, 2024
2 parents 106db15 + 791df35 commit c6cd121
Show file tree
Hide file tree
Showing 234 changed files with 9,699 additions and 4,251 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
20.11
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WooCommerce Payments
# WooPayments

This is a feature plugin for accepting payments via a WooCommerce-branded payment gateway.

Expand Down Expand Up @@ -31,9 +31,9 @@ Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+

To fix this up, follow the link provided in the prompt and paste the token into the terminal window to continue.

### Extending WooCommerce Payments
### Extending WooPayments

If you are extending WooCommerce Payments, or building on top of it, please refer to the [core docs](includes/core/README.md) and directory (`includes/core`) for guides and recommended ways of doing it.
If you are extending WooPayments, or building on top of it, please refer to the [core docs](includes/core/README.md) and directory (`includes/core`) for guides and recommended ways of doing it.

## Setup

Expand Down
Binary file removed assets/images/bnpl_announcement_afterpay.png
Binary file not shown.
Binary file removed assets/images/bnpl_announcement_clearpay.png
Binary file not shown.
43 changes: 21 additions & 22 deletions bin/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ redirect_output() {
fi
}

# --user xfs forces the wordpress:cli container to use a user with the same ID as the main wordpress container. See:
# https://hub.docker.com/_/wordpress#running-as-an-arbitrary-user
cli()
{
INTERACTIVE=''
if [ -t 1 ] ; then
INTERACTIVE='-it'
fi
redirect_output docker run $INTERACTIVE --env-file default.env --rm --user xfs --volumes-from $WP_CONTAINER --network container:$WP_CONTAINER wordpress:cli "$@"

redirect_output docker exec $INTERACTIVE --env-file default.env --user www-data $WP_CONTAINER "$@"
}

set +e
# Wait for containers to be started up before the setup.
# The db being accessible means that the db container started and the WP has been downloaded and the plugin linked
# The db being accessible means that the db container started and the WP has been downloaded and the plugin linked
cli wp db check --path=/var/www/html --quiet > /dev/null
while [[ $? -ne 0 ]]; do
echo "Waiting until the service is ready..."
Expand All @@ -40,7 +39,7 @@ cli wp plugin is-active woocommerce-payments > /dev/null
if [[ $? -eq 0 ]]; then
set -e
echo
echo "WCPay is installed and active"
echo "WooPayments is installed and active"
echo "SUCCESS! You should now be able to access http://${SITE_URL}/wp-admin/"
echo "You can login by using the username and password both as 'admin'"
exit 0
Expand All @@ -52,9 +51,6 @@ echo
echo "Setting up environment..."
echo

echo "Pulling the WordPress CLI docker image..."
docker pull wordpress:cli > /dev/null

echo "Setting up WordPress..."
cli wp core install \
--path=/var/www/html \
Expand All @@ -72,19 +68,19 @@ echo "Updating the WordPress database..."
cli wp core update-db --quiet

echo "Configuring WordPress to work with ngrok (in order to allow creating a Jetpack-WPCOM connection)";
cli config set DOCKER_HOST "\$_SERVER['HTTP_X_ORIGINAL_HOST'] ?? \$_SERVER['HTTP_HOST'] ?? 'localhost'" --raw
cli config set DOCKER_REQUEST_URL "( ! empty( \$_SERVER['HTTPS'] ) ? 'https://' : 'http://' ) . DOCKER_HOST" --raw
cli config set WP_SITEURL DOCKER_REQUEST_URL --raw
cli config set WP_HOME DOCKER_REQUEST_URL --raw
cli wp config set DOCKER_HOST "\$_SERVER['HTTP_X_ORIGINAL_HOST'] ?? \$_SERVER['HTTP_HOST'] ?? 'localhost'" --raw
cli wp config set DOCKER_REQUEST_URL "( ! empty( \$_SERVER['HTTPS'] ) ? 'https://' : 'http://' ) . DOCKER_HOST" --raw
cli wp config set WP_SITEURL DOCKER_REQUEST_URL --raw
cli wp config set WP_HOME DOCKER_REQUEST_URL --raw

echo "Enabling WordPress debug flags"
cli config set WP_DEBUG true --raw
cli config set WP_DEBUG_DISPLAY true --raw
cli config set WP_DEBUG_LOG true --raw
cli config set SCRIPT_DEBUG true --raw
cli wp config set WP_DEBUG true --raw
cli wp config set WP_DEBUG_DISPLAY true --raw
cli wp config set WP_DEBUG_LOG true --raw
cli wp config set SCRIPT_DEBUG true --raw

echo "Enabling WordPress development environment (enforces Stripe testing mode)";
cli config set WP_ENVIRONMENT_TYPE development
cli wp config set WP_ENVIRONMENT_TYPE development

echo "Updating permalink structure"
cli wp rewrite structure '/%postname%/'
Expand Down Expand Up @@ -114,26 +110,29 @@ cli wp plugin install wordpress-importer --activate
echo "Importing some sample data..."
cli wp import wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip

echo "Activating the WooCommerce Payments plugin..."
echo "Activating the WooPayments plugin..."
cli wp plugin activate woocommerce-payments

echo "Setting up WooCommerce Payments..."
echo "Setting up WooPayments..."
if [[ "0" == "$(cli wp option list --search=woocommerce_woocommerce_payments_settings --format=count)" ]]; then
echo "Creating WooCommerce Payments settings"
echo "Creating WooPayments settings"
cli wp option add woocommerce_woocommerce_payments_settings --format=json '{"enabled":"yes"}'
else
echo "Updating WooCommerce Payments settings"
echo "Updating WooPayments settings"
cli wp option update woocommerce_woocommerce_payments_settings --format=json '{"enabled":"yes"}'
fi

echo "Installing and activating Disable WordPress Updates..."
cli wp plugin install disable-wordpress-updates --activate

echo "Installing dev tools plugin..."
set +e
git clone [email protected]:Automattic/woocommerce-payments-dev-tools.git docker/wordpress/wp-content/plugins/woocommerce-payments-dev-tools
if [[ $? -eq 0 ]]; then
cli wp plugin activate woocommerce-payments-dev-tools
else
echo
echo "WARN: Could not access the dev tools repository. Skipping the install."
echo "WARN: Could not clone the dev tools repository. Skipping the install."
fi;
set -e

Expand Down
33 changes: 33 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
*** WooPayments Changelog ***

= 8.1.0 - 2024-08-21 =
* Add - Add button rules to appearance
* Add - Add heading rules to appearance
* Add - Add link rules to appearance
* Add - Adds skeleton loading element for BNPL payment messaging element on product details page.
* Add - Add tokenized cart PRB support to cart and checkout blocks.
* Add - Add WooPay global theme support flag
* Add - Enhance Sandbox mode onboarding by skipping KYC and making it fully automated for all supported countries.
* Fix - Added better error message when mandate is invalid.
* Fix - Do not enqueue Cart scripts if WooPayments is not enabled
* Fix - fix: alignment of info icon w/ WooPay/Link settings
* Fix - fix: cart association on tokenized PRB orders via custom session handler
* Fix - fix: platform_global_theme_support_enabled undefined index
* Fix - fix: translatable strings around currencies list
* Fix - Fix GooglePay button missing in Safari.
* Fix - Fix onboarding redirect loop when starting from Woo Settings Payments.
* Fix - Fix spacing on Express Checkout buttons.
* Fix - Fix uncaught error on the block based Cart page when WooPayments is disabled.
* Fix - Fix WooPay checkboxes while signed in.
* Fix - If a payment method fails to be created in the frontend during checkout, forward the errors to the server so it can be recorded in an order.
* Fix - Migrate to Docker Compose V2 for test runner environment setup scripts
* Fix - Reverts changes related to Direct Checkout that broke the PayPal extension.
* Fix - Translate hardcoded strings on the Connect page
* Update - refactor: separate BNPL methods from settings list
* Update - Updated the integration between WooPayments Multi-Currency and Product Add-Ons.
* Update - Update outdated express checkout settings notification.
* Dev - Add e2e tests for critical flow: merchant account balance overview
* Dev - Bump WC tested up to version to 9.2.0
* Dev - Fix Klarna and Refund Failures E2E tests
* Dev - Match the Node version in nvm with the minimum version in package.json.
* Dev - Remove unnecessary console.warn statements added in #9121.
* Dev - Update bundle size checker workflow to support node v20

= 8.0.2 - 2024-08-07 =
* Fix - Add opt-in checks to prevent blocking customers using other payment methods.
* Fix - Fix error in Express Checkout Element use with coupons.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ import PaymentMethodCheckboxes from '../../components/payment-methods-checkboxes
import PaymentMethodCheckbox from '../../components/payment-methods-checkboxes/payment-method-checkbox';
import { LoadableBlock } from '../../components/loadable';
import LoadableSettingsSection from '../../settings/loadable-settings-section';
import CurrencyInformationForMethods, {
BuildMissingCurrenciesTooltipMessage,
} from '../../components/currency-information-for-methods';
import CurrencyInformationForMethods from './currency-information-for-methods';
import { getMissingCurrenciesTooltipMessage } from 'wcpay/multi-currency/missing-currencies-message';
import { upeCapabilityStatuses, upeMethods } from '../constants';
import paymentMethodsMap from '../../payment-methods-map';
import ConfirmPaymentMethodActivationModal from 'wcpay/payment-methods/activation-modal';
import ConfirmPaymentMethodActivationModal from 'wcpay/settings/payment-methods-list/activation-modal';
import './add-payment-methods-task.scss';
import PAYMENT_METHOD_IDS from 'wcpay/payment-methods/constants';
import PAYMENT_METHOD_IDS from 'wcpay/constants/payment-method';

const usePaymentMethodsCheckboxState = () => {
// For UPE, the card payment method is required and always active.
Expand Down Expand Up @@ -228,7 +227,7 @@ const AddPaymentMethodsTask = () => {
const currency = wcpaySettings.storeCurrency;
if ( currencies.indexOf( currency ) < 0 ) {
isSetupRequired = true;
setupTooltip = BuildMissingCurrenciesTooltipMessage(
setupTooltip = getMissingCurrenciesTooltipMessage(
label,
currencies
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* External dependencies
*/
import React, { useContext } from 'react';
import _ from 'lodash';
import { sprintf, __, _n } from '@wordpress/i18n';
import { uniq } from 'lodash';
import { sprintf, __ } from '@wordpress/i18n';
import interpolateComponents from '@automattic/interpolate-components';

/**
Expand All @@ -17,48 +17,7 @@ import {
import WCPaySettingsContext from '../../settings/wcpay-settings-context';
import InlineNotice from 'components/inline-notice';
import PaymentMethodsMap from '../../payment-methods-map';

const ListToCommaSeparatedSentencePartConverter = ( items ) => {
if ( items.length === 1 ) {
return items[ 0 ];
} else if ( items.length === 2 ) {
return items.join( ' ' + __( 'and', 'woocommerce-payments' ) + ' ' );
}
const lastItem = items.pop();
return (
items.join( ', ' ) +
__( ', and', 'woocommerce-payments' ) +
' ' +
lastItem
);
};

export const BuildMissingCurrenciesTooltipMessage = (
paymentMethodLabel,
missingCurrencies
) => {
return sprintf(
__(
'%s requires the %s %s. In order to enable ' +
'the payment method, you must add %s to your store.',
'woocommerce-payments'
),
paymentMethodLabel,
ListToCommaSeparatedSentencePartConverter( missingCurrencies ),
_n(
'currency',
'currencies',
missingCurrencies.length,
'woocommerce-payments'
),
_n(
'this currency',
'these currencies',
missingCurrencies.length,
'woocommerce-payments'
)
);
};
import { formatListOfItems } from 'wcpay/utils/format-list-of-items';

const CurrencyInformationForMethods = ( { selectedMethods } ) => {
const {
Expand Down Expand Up @@ -113,8 +72,8 @@ const CurrencyInformationForMethods = ( { selectedMethods } ) => {
} );
} );

missingCurrencyLabels = _.uniq( missingCurrencyLabels );
paymentMethodsWithMissingCurrencies = _.uniq(
missingCurrencyLabels = uniq( missingCurrencyLabels );
paymentMethodsWithMissingCurrencies = uniq(
paymentMethodsWithMissingCurrencies
);

Expand Down Expand Up @@ -167,12 +126,8 @@ const CurrencyInformationForMethods = ( { selectedMethods } ) => {
{ interpolateComponents( {
mixedString: sprintf(
stringFormat,
ListToCommaSeparatedSentencePartConverter(
paymentMethodsWithMissingCurrencies
),
ListToCommaSeparatedSentencePartConverter(
missingCurrencyLabels
)
formatListOfItems( paymentMethodsWithMissingCurrencies ),
formatListOfItems( missingCurrencyLabels )
),
components: {
strong: <strong />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import {
useCurrencies,
useEnabledCurrencies,
useAccountDomesticCurrency,
} from '../../../data';
import CurrencyInformationForMethods, {
BuildMissingCurrenciesTooltipMessage,
} from '..';
} from 'wcpay/data';
import CurrencyInformationForMethods from '../currency-information-for-methods';
import WCPaySettingsContext from '../../../settings/wcpay-settings-context';

jest.mock( '../../../data', () => ( {
jest.mock( 'wcpay/data', () => ( {
useCurrencies: jest.fn(),
useEnabledCurrencies: jest.fn(),
useAccountDomesticCurrency: jest.fn(),
Expand Down Expand Up @@ -238,27 +236,4 @@ describe( 'CurrencyInformationForMethods', () => {
} )
).toBeInTheDocument();
} );

it( 'returns correct string with the given LPM label and currency list', () => {
const output = BuildMissingCurrenciesTooltipMessage( 'x', [ 'EUR' ] );
expect( output ).toBe(
'x requires the EUR currency. In order to enable the payment method, you must add this currency to your store.'
);
const outputMultiple = BuildMissingCurrenciesTooltipMessage( 'x', [
'EUR',
'PLN',
] );
expect( outputMultiple ).toBe(
'x requires the EUR and PLN currencies. In order to enable the payment method, you must add these currencies to your store.'
);
const outputMany = BuildMissingCurrenciesTooltipMessage( 'x', [
'EUR',
'PLN',
'TRY',
] );
expect( outputMany ).toBe(
'x requires the EUR, PLN, and TRY currencies. ' +
'In order to enable the payment method, you must add these currencies to your store.'
);
} );
} );
Loading

0 comments on commit c6cd121

Please sign in to comment.