diff --git a/.github/actions/e2e/env-setup/action.yml b/.github/actions/e2e/env-setup/action.yml
index dabaa752c3e..863ad27e75b 100644
--- a/.github/actions/e2e/env-setup/action.yml
+++ b/.github/actions/e2e/env-setup/action.yml
@@ -10,12 +10,8 @@ runs:
run: echo -e "machine github.com\n login $E2E_GH_TOKEN" > ~/.netrc
# PHP setup
- - name: PHP Setup
- uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- tools: composer
- coverage: none
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
# Composer setup
- name: Setup Composer
diff --git a/.github/actions/setup-php/action.yml b/.github/actions/setup-php/action.yml
new file mode 100644
index 00000000000..44e797aeb6d
--- /dev/null
+++ b/.github/actions/setup-php/action.yml
@@ -0,0 +1,19 @@
+name: "Set up PHP"
+description: "Extracts the required PHP version from plugin file and uses it to build PHP."
+
+runs:
+ using: composite
+ steps:
+ - name: "Get minimum PHP version"
+ shell: bash
+ id: get_min_php_version
+ run: |
+ MIN_PHP_VERSION=$(sed -n 's/.*PHP: //p' woocommerce-payments.php)
+ echo "MIN_PHP_VERSION=$MIN_PHP_VERSION" >> $GITHUB_OUTPUT
+
+ - name: "Setup PHP"
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ steps.get_min_php_version.outputs.MIN_PHP_VERSION }}
+ tools: composer
+ coverage: none
diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml
index 28741b60920..890fe95963f 100644
--- a/.github/actions/setup-repo/action.yml
+++ b/.github/actions/setup-repo/action.yml
@@ -1,29 +1,20 @@
name: "Setup WooCommerce Payments repository"
description: "Handles the installation, building, and caching of the projects within the repository."
-inputs:
- php-version:
- description: "The version of PHP that the action should set up."
- default: "7.4"
-
runs:
using: composite
steps:
- name: "Setup Node"
uses: actions/setup-node@v3
with:
- node-version-file: '.nvmrc'
- cache: 'npm'
+ node-version-file: ".nvmrc"
+ cache: "npm"
- name: "Enable composer dependencies caching"
uses: actions/cache@v3
with:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
-
- - name: "Setup PHP"
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ inputs.php-version }}
- tools: composer
- coverage: none
+
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
diff --git a/.github/workflows/build-zip-and-run-smoke-tests.yml b/.github/workflows/build-zip-and-run-smoke-tests.yml
index 94599b3b88e..7afaf05a833 100644
--- a/.github/workflows/build-zip-and-run-smoke-tests.yml
+++ b/.github/workflows/build-zip-and-run-smoke-tests.yml
@@ -24,7 +24,7 @@ on:
jobs:
build-zip:
name: "Build the zip file"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml
index 55f7391fb90..c44b2b0191e 100644
--- a/.github/workflows/check-changelog.yml
+++ b/.github/workflows/check-changelog.yml
@@ -11,7 +11,7 @@ concurrency:
jobs:
check-changelog:
name: Check changelog
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v3
@@ -22,11 +22,8 @@ jobs:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- - uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- tools: composer
- coverage: none
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
# Install composer packages.
- run: composer self-update && composer install --no-progress
# Fetch the target branch before running the check.
diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml
index 4dd1d7c6512..12439ae65b1 100644
--- a/.github/workflows/compatibility.yml
+++ b/.github/workflows/compatibility.yml
@@ -15,7 +15,7 @@ concurrency:
jobs:
generate-wc-compat-matrix:
name: "Generate the matrix for woocommerce compatibility dynamically"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
@@ -29,7 +29,7 @@ jobs:
woocommerce-compatibility:
name: "WC compatibility"
needs: generate-wc-compat-matrix
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
WP_VERSION: ${{ matrix.wordpress }}
WC_VERSION: ${{ matrix.woocommerce }}
@@ -57,7 +57,7 @@ jobs:
generate-wc-compat-beta-matrix:
name: "Generate the matrix for compatibility-woocommerce-beta dynamically"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
@@ -71,7 +71,7 @@ jobs:
compatibility-woocommerce-beta:
name: Environment - WC beta
needs: generate-wc-compat-beta-matrix
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.generate-wc-compat-beta-matrix.outputs.matrix) }}
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index ddc2db674bc..b1401136de9 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -10,7 +10,7 @@ concurrency:
jobs:
woocommerce-coverage:
name: Code coverage
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
diff --git a/.github/workflows/create-pre-release.yml b/.github/workflows/create-pre-release.yml
index 80ab331c563..65c20427376 100644
--- a/.github/workflows/create-pre-release.yml
+++ b/.github/workflows/create-pre-release.yml
@@ -16,7 +16,7 @@ defaults:
jobs:
create-release:
name: "Create the pre-release"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ inputs.releaseVersion }}
diff --git a/.github/workflows/e2e-pull-request.yml b/.github/workflows/e2e-pull-request.yml
index c8363faa490..ab0cd702a86 100644
--- a/.github/workflows/e2e-pull-request.yml
+++ b/.github/workflows/e2e-pull-request.yml
@@ -42,7 +42,7 @@ concurrency:
jobs:
wcpay-e2e-tests:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
fail-fast: false
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 11cc17bafab..9c85a291ab1 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -30,7 +30,7 @@ env:
jobs:
generate-matrix:
name: "Generate the matrix for subscriptions-tests dynamically"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
@@ -42,7 +42,7 @@ jobs:
# Run WCPay & subscriptions tests against specific WC versions
wcpay-subscriptions-tests:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
needs: generate-matrix
strategy:
fail-fast: false
@@ -70,7 +70,7 @@ jobs:
# Run tests against WC Checkout blocks & WC latest
# [TODO] Unskip blocks tests after investigating constant failures.
# blocks-tests:
- # runs-on: ubuntu-20.04
+ # runs-on: ubuntu-latest
# name: WC - latest | blocks - shopper
# env:
@@ -93,7 +93,7 @@ jobs:
# Run tests against WP Nightly & WC latest
wp-nightly-tests:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
fail-fast: false
diff --git a/.github/workflows/i18n-weekly-release.yml b/.github/workflows/i18n-weekly-release.yml
index 197213dec1c..11dd8a89705 100644
--- a/.github/workflows/i18n-weekly-release.yml
+++ b/.github/workflows/i18n-weekly-release.yml
@@ -6,7 +6,7 @@ on:
jobs:
i18n-release:
name: Release
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
# clone the repository
@@ -27,12 +27,8 @@ jobs:
path: ~/.npm/
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
# setup PHP, but without debug extensions for reasonable performance
- - uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- tools: composer
- coverage: none
-
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
- name: Build release
run: |
npm ci
diff --git a/.github/workflows/js-lint-test.yml b/.github/workflows/js-lint-test.yml
index 4824d78ca19..fdbea1d59b0 100644
--- a/.github/workflows/js-lint-test.yml
+++ b/.github/workflows/js-lint-test.yml
@@ -11,7 +11,7 @@ concurrency:
jobs:
lint:
name: JS linting
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v3
@@ -32,7 +32,7 @@ jobs:
test:
name: JS testing
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v3
diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml
index 8c0e7d73b37..abf8413b84c 100644
--- a/.github/workflows/php-compatibility.yml
+++ b/.github/workflows/php-compatibility.yml
@@ -11,12 +11,9 @@ jobs:
# Check for version-specific PHP compatibility
php-compatibility:
name: PHP Compatibility
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- tools: composer
- coverage: none
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
- run: bash bin/phpcs-compat.sh
diff --git a/.github/workflows/php-lint-test.yml b/.github/workflows/php-lint-test.yml
index 0399a22735c..4077352f4ce 100644
--- a/.github/workflows/php-lint-test.yml
+++ b/.github/workflows/php-lint-test.yml
@@ -17,7 +17,7 @@ concurrency:
jobs:
lint:
name: PHP linting
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
# clone the repository
- uses: actions/checkout@v3
@@ -27,17 +27,14 @@ jobs:
path: ~/.cache/composer/
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
# setup PHP, but without debug extensions for reasonable performance
- - uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
- tools: composer
- coverage: none
+ - name: "Set up PHP"
+ uses: ./.github/actions/setup-php
# install dependencies and run linter
- run: composer self-update && composer install --no-progress && ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep .php$) && ./vendor/bin/psalm
generate-test-matrix:
name: "Generate the matrix for php tests dynamically"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
steps:
@@ -50,7 +47,7 @@ jobs:
test:
name: PHP testing
needs: generate-test-matrix
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
diff --git a/.github/workflows/post-release-updates.yml b/.github/workflows/post-release-updates.yml
index f19be159407..141c53e0b16 100644
--- a/.github/workflows/post-release-updates.yml
+++ b/.github/workflows/post-release-updates.yml
@@ -11,7 +11,7 @@ defaults:
jobs:
get-last-released-version:
name: "Get the last released version"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
releaseVersion: ${{ steps.current-version.outputs.RELEASE_VERSION }}
@@ -31,7 +31,7 @@ jobs:
create-gh-release:
name: "Create a GH release"
needs: get-last-released-version
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ needs.get-last-released-version.outputs.releaseVersion }}
@@ -75,7 +75,7 @@ jobs:
merge-trunk-into-develop:
name: "Merge trunk back into develop"
needs: get-last-released-version
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ needs.get-last-released-version.outputs.releaseVersion }}
@@ -98,7 +98,7 @@ jobs:
trigger-translations:
name: "Trigger translations update for the release"
needs: [ get-last-released-version, create-gh-release ]
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- name: "Checkout repository (trunk)"
uses: actions/checkout@v3
@@ -114,7 +114,7 @@ jobs:
update-wiki:
name: "Update the wiki for the next release"
needs: get-last-released-version
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ needs.get-last-released-version.outputs.releaseVersion }}
diff --git a/.github/workflows/pr-build-live-branch.yml b/.github/workflows/pr-build-live-branch.yml
index 3ff165f2898..1fa9742f0ea 100644
--- a/.github/workflows/pr-build-live-branch.yml
+++ b/.github/workflows/pr-build-live-branch.yml
@@ -10,7 +10,7 @@ concurrency:
jobs:
build-and-inform-zip-file:
name: "Build and inform the zip file"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
diff --git a/.github/workflows/release-changelog.yml b/.github/workflows/release-changelog.yml
index c99db69b350..4c9c7a7a8b1 100644
--- a/.github/workflows/release-changelog.yml
+++ b/.github/workflows/release-changelog.yml
@@ -29,7 +29,7 @@ defaults:
jobs:
process-changelog:
name: "Process the changelog"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
CHANGELOG_ACTION: ${{ inputs.action-type }}
RELEASE_VERSION: ${{ inputs.release-version }}
diff --git a/.github/workflows/release-code-freeze.yml b/.github/workflows/release-code-freeze.yml
index 84760b24ebc..7b81c24d138 100644
--- a/.github/workflows/release-code-freeze.yml
+++ b/.github/workflows/release-code-freeze.yml
@@ -19,7 +19,7 @@ defaults:
jobs:
check-code-freeze:
name: "Check that today is the day of the code freeze"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
freeze: ${{ steps.check-freeze.outputs.FREEZE }}
nextReleaseVersion: ${{ steps.next-version.outputs.NEXT_RELEASE_VERSION }}
@@ -81,7 +81,7 @@ jobs:
name: "Send notification to Slack"
needs: [check-code-freeze, create-release-pr]
if: ${{ ! ( inputs.skipSlackPing && needs.create-release-pr.outputs.release-pr-id ) }}
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ needs.check-code-freeze.outputs.nextReleaseVersion }}
RELEASE_DATE: ${{ needs.check-code-freeze.outputs.nextReleaseDate }}
diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml
index f14a49df77b..0433e03eb51 100644
--- a/.github/workflows/release-pr.yml
+++ b/.github/workflows/release-pr.yml
@@ -53,7 +53,7 @@ defaults:
jobs:
prepare-release:
name: "Prepare a stable release"
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
outputs:
branch: ${{ steps.create_branch.outputs.branch-name }}
release-pr-id: ${{ steps.create-pr-to-trunk.outputs.RELEASE_PR_ID }}
diff --git a/README.md b/README.md
index 54b8403c470..416c6b6a728 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ We currently support the following variables:
## Test account setup
-For setting up a test account follow [these instructions](https://woocommerce.com/document/woocommerce-payments/testing-and-troubleshooting/dev-mode/).
+For setting up a test account follow [these instructions](https://woocommerce.com/document/woopayments/testing-and-troubleshooting/dev-mode/).
You will need a externally accessible URL to set up the plugin. You can use ngrok for this.
diff --git a/bin/cli.sh b/bin/cli.sh
new file mode 100755
index 00000000000..86d167477da
--- /dev/null
+++ b/bin/cli.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+first_arg=${1}
+if [ "${first_arg}" = "--as-root" ]; then
+ user=0
+ command=${@:2}
+else
+ user=www-data
+ command=${@:1}
+fi
+
+command=${command:-bash}
+
+docker-compose exec -u ${user} wordpress ${command}
diff --git a/changelog.txt b/changelog.txt
index 13f4ed780c8..e440ee01f4f 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,71 @@
*** WooPayments Changelog ***
+= 6.5.0 - 2023-09-21 =
+* Add - Add a new task prompt to set up APMs after onboarding. Fixed an issue where a notice would show up in some unintended circumstances on the APM setup.
+* Add - Add an option on the Settings screen to enable merchants to migrate their Stripe Billing subscriptions to on-site billing.
+* Add - Added additional meta data to payment requests
+* Add - Add onboarding task incentive badge.
+* Add - Add payment request class for loading, sanitizing, and escaping data (reengineering payment process)
+* Add - Add the express button on the pay for order page
+* Add - add WooPay checkout appearance documentation link
+* Add - Fall back to site logo when a custom WooPay logo has not been defined
+* Add - Introduce a new setting that enables store to opt into Subscription off-site billing via Stripe Billing.
+* Add - Load payment methods through the request class (re-engineering payment process).
+* Add - Record the source (Woo Subscriptions or WCPay Subscriptions) when a Stripe Billing subscription is created.
+* Add - Record the subscriptions environment context in transaction meta when Stripe Billing payments are handled.
+* Add - Redirect back to the pay-for-order page when it is pay-for-order order
+* Add - Support kanji and kana statement descriptors for Japanese merchants
+* Add - Warn about dev mode enabled on new onboarding flow choice
+* Fix - Allow request classes to be extended more than once.
+* Fix - Avoid empty fields in new onboarding flow
+* Fix - Corrected an issue causing incorrect responses at the cancel authorization API endpoint.
+* Fix - Disable automatic currency switching and switcher widgets on pay_for_order page.
+* Fix - Ensure the shipping phone number field is copied to subscriptions and their orders when copying address meta.
+* Fix - Ensure the Stripe Billing subscription is cancelled when the subscription is changed from WooPayments to another payment method.
+* Fix - express checkout links UI consistency & area increase
+* Fix - fix: save platform checkout info on blocks
+* Fix - fix checkout appearance width
+* Fix - Fix Currency Switcher Block flag rendering on Windows platform.
+* Fix - Fix deprecation warnings on blocks checkout.
+* Fix - Fix double indicators showing under Payments tab
+* Fix - Fixes the currency formatting for AED and SAR currencies.
+* Fix - Fix init WooPay and empty cart error
+* Fix - Fix Multi-currency exchange rate date format when using custom date or time settings.
+* Fix - Fix Multicurrency widget error on post/page edit screen
+* Fix - Fix single currency manual rate save producing error when no changes are made
+* Fix - Fix the way request params are loaded between parent and child classes.
+* Fix - Fix WooPay Session Handler in Store API requests.
+* Fix - Improve escaping around attributes.
+* Fix - Increase admin enqueue scripts priority to avoid compatibility issues with WooCommerce Beta Tester plugin.
+* Fix - Modify title in task to continue with onboarding
+* Fix - Prevent WooPay-related implementation to modify non-WooPay-specific webhooks by changing their data.
+* Fix - Refactor Woo Subscriptions compatibility to fix currency being able to be updated during renewals, resubscribes, or switches.
+* Fix - Update inbox note logic to prevent prompt to set up payment methods from showing on not fully onboarded account.
+* Update - Add notice for legacy UPE users about deferred UPE upcoming, and adjust wording for non-UPE users
+* Update - Disable refund button on order edit page when there is active or lost dispute.
+* Update - Enhanced Analytics SQL, added unit test for has_multi_currency_orders(). Improved code quality and test coverage.
+* Update - Improved `get_all_customer_currencies` method to retrieve existing order currencies faster.
+* Update - Improve the transaction details redirect user-experience by using client-side routing.
+* Update - Temporarily disable saving SEPA
+* Update - Update Multi-currency documentation links.
+* Update - Update outdated public documentation links on WooCommerce.com
+* Update - Update Tooltip component on ConvertedAmount.
+* Update - When HPOS is disabled, fetch subscriptions by customer_id using the user's subscription cache to improve performance.
+* Dev - Adding factor flags to control when to enter the new payment process.
+* Dev - Adding issuer evidence to dispute details. Hidden behind a feature flag
+* Dev - Comment: Update GH workflows to use PHP version from plugin file.
+* Dev - Comment: Update occurence of all ubuntu versions to ubuntu-latest
+* Dev - Deprecated the 'woocommerce_subscriptions_not_found_label' filter.
+* Dev - Fix payment context and subscription payment metadata stored on subscription recurring transactions.
+* Dev - Fix Tracks conditions
+* Dev - Migrate DetailsLink component to TypeScript to improve code quality
+* Dev - Migrate link-item.js to typescript
+* Dev - Migrate woopay-item to typescript
+* Dev - Remove reference to old experiment.
+* Dev - Update Base_Constant to return the singleton object for same static calls.
+* Dev - Updated subscriptions-core to 6.2.0
+* Dev - Update the name of the A/B experiment on new onboarding.
+
= 6.4.2 - 2023-09-14 =
* Fix - Fix an error in the checkout when Afterpay is selected as payment method.
diff --git a/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js b/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js
index 38a94dcc476..b619ae96044 100644
--- a/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js
+++ b/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js
@@ -258,35 +258,37 @@ const AddPaymentMethodsTask = () => {
components: {
learnMoreLink: (
// eslint-disable-next-line max-len
-
Test mode: use the test VISA card 4242424242424242
with any expiry date and CVC, or any test card numbers listed{ ' ' }
-
+
here
.
@@ -87,7 +84,7 @@ const WCPayFields = ( {
api,
stripe,
elements,
- onCheckoutAfterProcessingWithSuccess,
+ onCheckoutSuccess,
emitResponse,
shouldSavePayment
);
diff --git a/client/checkout/blocks/hooks.js b/client/checkout/blocks/hooks.js
index fd52b16c93b..34a7a6f504d 100644
--- a/client/checkout/blocks/hooks.js
+++ b/client/checkout/blocks/hooks.js
@@ -16,21 +16,20 @@ export const usePaymentCompleteHandler = (
api,
stripe,
elements,
- onCheckoutAfterProcessingWithSuccess,
+ onCheckoutSuccess,
emitResponse,
shouldSavePayment
) => {
// Once the server has completed payment processing, confirm the intent of necessary.
useEffect(
() =>
- onCheckoutAfterProcessingWithSuccess(
- ( { processingResponse: { paymentDetails } } ) =>
- confirmCardPayment(
- api,
- paymentDetails,
- emitResponse,
- shouldSavePayment
- )
+ onCheckoutSuccess( ( { processingResponse: { paymentDetails } } ) =>
+ confirmCardPayment(
+ api,
+ paymentDetails,
+ emitResponse,
+ shouldSavePayment
+ )
),
// not sure if we need to disable this, but kept it as-is to ensure nothing breaks. Please consider passing all the deps.
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/client/checkout/blocks/saved-token-handler.js b/client/checkout/blocks/saved-token-handler.js
index a2e2b0ea339..2ec311c8d5e 100644
--- a/client/checkout/blocks/saved-token-handler.js
+++ b/client/checkout/blocks/saved-token-handler.js
@@ -7,7 +7,7 @@ export const SavedTokenHandler = ( {
api,
stripe,
elements,
- eventRegistration: { onCheckoutAfterProcessingWithSuccess },
+ eventRegistration: { onCheckoutSuccess },
emitResponse,
} ) => {
// Once the server has completed payment processing, confirm the intent of necessary.
@@ -15,7 +15,7 @@ export const SavedTokenHandler = ( {
api,
stripe,
elements,
- onCheckoutAfterProcessingWithSuccess,
+ onCheckoutSuccess,
emitResponse,
false // No need to save a payment that has already been saved.
);
diff --git a/client/checkout/blocks/upe-deferred-intent-creation/payment-processor.js b/client/checkout/blocks/upe-deferred-intent-creation/payment-processor.js
index 1d0a8d9f564..989773e8400 100644
--- a/client/checkout/blocks/upe-deferred-intent-creation/payment-processor.js
+++ b/client/checkout/blocks/upe-deferred-intent-creation/payment-processor.js
@@ -59,7 +59,7 @@ const PaymentProcessor = ( {
api,
activePaymentMethod,
testingInstructions,
- eventRegistration: { onPaymentSetup, onCheckoutAfterProcessingWithSuccess },
+ eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
paymentMethodId,
upeMethods,
@@ -228,7 +228,7 @@ const PaymentProcessor = ( {
api,
stripe,
elements,
- onCheckoutAfterProcessingWithSuccess,
+ onCheckoutSuccess,
emitResponse,
shouldSavePayment
);
diff --git a/client/checkout/blocks/upe-fields.js b/client/checkout/blocks/upe-fields.js
index f8f0b5680c0..9f1ea7d67ee 100644
--- a/client/checkout/blocks/upe-fields.js
+++ b/client/checkout/blocks/upe-fields.js
@@ -41,10 +41,7 @@ const WCPayUPEFields = ( {
activePaymentMethod,
billing: { billingData },
shippingData,
- eventRegistration: {
- onPaymentProcessing,
- onCheckoutAfterProcessingWithSuccess,
- },
+ eventRegistration: { onPaymentProcessing, onCheckoutSuccess },
emitResponse,
paymentIntentId,
paymentIntentSecret,
@@ -206,7 +203,7 @@ const WCPayUPEFields = ( {
// Once the server has completed payment processing, confirm the intent if necessary.
useEffect(
() =>
- onCheckoutAfterProcessingWithSuccess(
+ onCheckoutSuccess(
( { orderId, processingResponse: { paymentDetails } } ) => {
async function updateIntent() {
if ( api.handleDuplicatePayments( paymentDetails ) ) {
diff --git a/client/checkout/blocks/upe-split-fields.js b/client/checkout/blocks/upe-split-fields.js
index 91d0500f3da..07b9f720da1 100644
--- a/client/checkout/blocks/upe-split-fields.js
+++ b/client/checkout/blocks/upe-split-fields.js
@@ -45,10 +45,7 @@ const WCPayUPEFields = ( {
testingInstructions,
billing: { billingData },
shippingData,
- eventRegistration: {
- onPaymentProcessing,
- onCheckoutAfterProcessingWithSuccess,
- },
+ eventRegistration: { onPaymentProcessing, onCheckoutSuccess },
emitResponse,
paymentMethodId,
upeMethods,
@@ -204,7 +201,7 @@ const WCPayUPEFields = ( {
// Once the server has completed payment processing, confirm the intent if necessary.
useEffect(
() =>
- onCheckoutAfterProcessingWithSuccess(
+ onCheckoutSuccess(
( { orderId, processingResponse: { paymentDetails } } ) => {
async function updateIntent() {
if ( api.handleDuplicatePayments( paymentDetails ) ) {
diff --git a/client/checkout/woopay/email-input-iframe.js b/client/checkout/woopay/email-input-iframe.js
index 6c17b14fc3e..a30e7cc26ce 100644
--- a/client/checkout/woopay/email-input-iframe.js
+++ b/client/checkout/woopay/email-input-iframe.js
@@ -6,7 +6,11 @@ import { getConfig } from 'wcpay/utils/checkout';
import wcpayTracks from 'tracks';
import request from '../utils/request';
import { buildAjaxURL } from '../../payment-request/utils';
-import { getTargetElement, validateEmail } from './utils';
+import {
+ getTargetElement,
+ validateEmail,
+ appendRedirectionParams,
+} from './utils';
export const handleWooPayEmailInput = async (
field,
@@ -186,6 +190,9 @@ export const handleWooPayEmailInput = async (
buildAjaxURL( getConfig( 'wcAjaxUrl' ), 'get_woopay_session' ),
{
_ajax_nonce: getConfig( 'woopaySessionNonce' ),
+ order_id: getConfig( 'order_id' ),
+ key: getConfig( 'key' ),
+ billing_email: getConfig( 'billing_email' ),
}
).then( ( response ) => {
if ( response?.data?.session ) {
@@ -534,7 +541,9 @@ export const handleWooPayEmailInput = async (
true
);
if ( e.data.redirectUrl ) {
- window.location = e.data.redirectUrl;
+ window.location = appendRedirectionParams(
+ e.data.redirectUrl
+ );
}
break;
case 'redirect_to_platform_checkout':
diff --git a/client/checkout/woopay/express-button/express-checkout-iframe.js b/client/checkout/woopay/express-button/express-checkout-iframe.js
index 7ac6bfcb275..b021e9eab15 100644
--- a/client/checkout/woopay/express-button/express-checkout-iframe.js
+++ b/client/checkout/woopay/express-button/express-checkout-iframe.js
@@ -5,7 +5,11 @@ import { __ } from '@wordpress/i18n';
import { getConfig } from 'utils/checkout';
import request from 'wcpay/checkout/utils/request';
import { buildAjaxURL } from 'wcpay/payment-request/utils';
-import { getTargetElement, validateEmail } from '../utils';
+import {
+ getTargetElement,
+ validateEmail,
+ appendRedirectionParams,
+} from '../utils';
import wcpayTracks from 'tracks';
export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
@@ -92,6 +96,9 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
buildAjaxURL( getConfig( 'wcAjaxUrl' ), 'get_woopay_session' ),
{
_ajax_nonce: getConfig( 'woopaySessionNonce' ),
+ order_id: getConfig( 'order_id' ),
+ key: getConfig( 'key' ),
+ billing_email: getConfig( 'billing_email' ),
}
).then( ( response ) => {
if ( response?.data?.session ) {
@@ -250,7 +257,9 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
true
);
if ( e.data.redirectUrl ) {
- window.location = e.data.redirectUrl;
+ window.location = appendRedirectionParams(
+ e.data.redirectUrl
+ );
}
break;
case 'redirect_to_platform_checkout':
@@ -269,7 +278,9 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
return;
}
if ( response.result === 'success' ) {
- window.location = response.url;
+ window.location = appendRedirectionParams(
+ response.url
+ );
} else {
showErrorMessage();
closeIframe( false );
diff --git a/client/checkout/woopay/utils.js b/client/checkout/woopay/utils.js
index 48b25423d0b..a7b9a3a6152 100644
--- a/client/checkout/woopay/utils.js
+++ b/client/checkout/woopay/utils.js
@@ -39,3 +39,22 @@ export const validateEmail = ( value ) => {
/* eslint-enable */
return pattern.test( value );
};
+
+export const appendRedirectionParams = ( woopayUrl ) => {
+ const isPayForOrder = window.wcpayConfig.pay_for_order;
+ const orderId = window.wcpayConfig.order_id;
+ const key = window.wcpayConfig.key;
+ const billingEmail = window.wcpayConfig.billing_email;
+
+ if ( ! isPayForOrder || ! orderId || ! key ) {
+ return woopayUrl;
+ }
+
+ const url = new URL( woopayUrl );
+ url.searchParams.append( 'pay_for_order', isPayForOrder );
+ url.searchParams.append( 'order_id', orderId );
+ url.searchParams.append( 'key', key );
+ url.searchParams.append( 'billing_email', billingEmail );
+
+ return url.href;
+};
diff --git a/client/components/account-balances/strings.ts b/client/components/account-balances/strings.ts
index 547f23da8c7..76e7c2f9721 100644
--- a/client/components/account-balances/strings.ts
+++ b/client/components/account-balances/strings.ts
@@ -26,7 +26,7 @@ export const fundLabelStrings = {
export const documentationUrls = {
depositSchedule:
- 'https://woocommerce.com/document/woocommerce-payments/deposits/deposit-schedule',
+ 'https://woocommerce.com/document/woopayments/deposits/deposit-schedule/',
negativeBalance:
- 'https://woocommerce.com/document/woocommerce-payments/fees-and-debits/account-showing-negative-balance',
+ 'https://woocommerce.com/document/woopayments/fees-and-debits/account-showing-negative-balance/',
};
diff --git a/client/components/account-balances/test/index.test.tsx b/client/components/account-balances/test/index.test.tsx
index 6018d85b1f2..586b5dc2027 100644
--- a/client/components/account-balances/test/index.test.tsx
+++ b/client/components/account-balances/test/index.test.tsx
@@ -339,7 +339,7 @@ describe( 'AccountBalances', () => {
} );
expect( within( tooltip ).getByRole( 'link' ) ).toHaveAttribute(
'href',
- 'https://woocommerce.com/document/woocommerce-payments/deposits/deposit-schedule'
+ 'https://woocommerce.com/document/woopayments/deposits/deposit-schedule/'
);
} );
@@ -358,7 +358,7 @@ describe( 'AccountBalances', () => {
} );
expect( within( tooltip ).getByRole( 'link' ) ).toHaveAttribute(
'href',
- 'https://woocommerce.com/document/woocommerce-payments/fees-and-debits/account-showing-negative-balance'
+ 'https://woocommerce.com/document/woopayments/fees-and-debits/account-showing-negative-balance/'
);
} );
@@ -377,7 +377,7 @@ describe( 'AccountBalances', () => {
} );
expect( within( tooltip ).getByRole( 'link' ) ).toHaveAttribute(
'href',
- 'https://woocommerce.com/document/woocommerce-payments/fees-and-debits/account-showing-negative-balance'
+ 'https://woocommerce.com/document/woopayments/fees-and-debits/account-showing-negative-balance/'
);
} );
@@ -399,7 +399,7 @@ describe( 'AccountBalances', () => {
} );
expect( within( tooltip ).getByRole( 'link' ) ).toHaveAttribute(
'href',
- 'https://woocommerce.com/document/woocommerce-payments/deposits/deposit-schedule'
+ 'https://woocommerce.com/document/woopayments/deposits/deposit-schedule/'
);
} );
diff --git a/client/components/banner-notice/index.tsx b/client/components/banner-notice/index.tsx
index 6c687e10cff..dcba0e665fb 100644
--- a/client/components/banner-notice/index.tsx
+++ b/client/components/banner-notice/index.tsx
@@ -1,111 +1,197 @@
+/**
+ * Based on the @wordpress/components `Notice` component.
+ * Adjusted to meet WooCommerce Admin Design Library.
+ */
+
/**
* External dependencies
*/
-import * as React from 'react';
-import { Flex, FlexItem, Icon, Notice, Button } from '@wordpress/components';
+import React from 'react';
+
+import { __ } from '@wordpress/i18n';
+import { useEffect, renderToString } from '@wordpress/element';
+import { speak } from '@wordpress/a11y';
import classNames from 'classnames';
+import { Icon, Button } from '@wordpress/components';
+import { check, info } from '@wordpress/icons';
+import NoticeOutlineIcon from 'gridicons/dist/notice-outline';
+import CloseIcon from 'gridicons/dist/cross-small';
/**
* Internal dependencies.
*/
-import './styles.scss';
+import './style.scss';
+
+const statusIconMap = {
+ success: check,
+ error: NoticeOutlineIcon,
+ warning: NoticeOutlineIcon,
+ info: info,
+};
+
+type Status = keyof typeof statusIconMap;
/**
- * Props for the BannerNotice component.
- *
- * @typedef {Object} BannerNoticeProps
- * @property {Icon.IconType