Skip to content

Commit 5451cb5

Browse files
committed
Merge remote-tracking branch 'origin/release/8.7.0' into trunk
2 parents 21f8822 + cd54ee8 commit 5451cb5

File tree

109 files changed

+1924
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1924
-828
lines changed

.github/workflows/compatibility.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
woocommerce: [ 'beta' ]
1313
wordpress: [ 'latest' ]
14-
php: [ '7.4', '8.0' ]
14+
php: [ '7.4', '8.0', '8.1' ]
1515

1616

1717
name: Beta (PHP=${{ matrix.php }}, WP=${{ matrix.wordpress }}, WC=${{ matrix.woocommerce }})

.github/workflows/e2e-tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ concurrency:
1010
jobs:
1111
test:
1212
runs-on: ubuntu-latest
13-
name: "WP=latest, WC=latest, PHP=7.4"
13+
strategy:
14+
fail-fast: false
15+
max-parallel: 10
16+
matrix:
17+
checkout: [ 'Default', 'Legacy' ]
18+
19+
name: ${{ matrix.checkout }} WP=latest, WC=latest, PHP=7.4
1420
steps:
1521
- name: Checkout repo
1622
uses: actions/checkout@v4
@@ -74,18 +80,18 @@ jobs:
7480
STRIPE_SECRET_KEY: ${{ secrets.E2E_STRIPE_SECRET_KEY }}
7581
run: npm run test:e2e-setup
7682

77-
- name: Run E2E tests
83+
- name: Run ${{ matrix.checkout }} E2E tests
7884
shell: bash
7985
env:
8086
STRIPE_PUB_KEY: ${{ secrets.E2E_STRIPE_PUBLISHABLE_KEY }}
8187
STRIPE_SECRET_KEY: ${{ secrets.E2E_STRIPE_SECRET_KEY }}
82-
run: npm run test:e2e
88+
run: npm run test:e2e${{ matrix.checkout == 'Legacy' && '-legacy' || '' }}
8389

84-
- name: Upload E2E test results
90+
- name: Upload ${{ matrix.checkout }} E2E test results
8591
if: ${{ failure() }}
8692
uses: actions/upload-artifact@v4
8793
with:
88-
name: WP_latest-WC_latest-results
94+
name: ${{ matrix.checkout }}-WP_latest-WC_latest-results
8995
path: tests/e2e/test-results
9096
if-no-files-found: ignore
9197
retention-days: 14

.github/workflows/generate-zip.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Generate ZIP file
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
generate-zip-file:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup node version
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version-file: '.nvmrc'
18+
19+
- name: Generate ZIP file
20+
run: npm run build && rm -rf ./woocommerce-gateway-stripe && unzip woocommerce-gateway-stripe.zip -d ./woocommerce-gateway-stripe
21+
22+
- name: Use the Upload Artifact GitHub Action
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: woocommerce-gateway-stripe
26+
path: woocommerce-gateway-stripe/

.github/workflows/issue-gardening.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Issue Gardening'
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
issue-gardening:
9+
name: ${{ matrix.name }}
10+
runs-on: ubuntu-latest
11+
if: ${{ github.repository == 'woocommerce/woocommerce-gateway-stripe' }}
12+
strategy:
13+
matrix:
14+
include:
15+
16+
- name: 'Issues that require more info'
17+
message: 'Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward.'
18+
days-before-stale: 15
19+
days-before-close: -1
20+
only-labels: 'status: needs more info'
21+
remove-stale-when-updated: true
22+
stale-issue-label: 'status: stale'
23+
24+
- name: 'Issues without activity for 5 months'
25+
message: "Hi,\nThis issue has gone 150 days (5 months) without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest version, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.\nThanks for helping out."
26+
days-before-stale: 150
27+
days-before-close: -1
28+
only-labels: ''
29+
remove-stale-when-updated: true
30+
stale-issue-label: 'status: needs confirmation'
31+
32+
- name: 'Issues without activity for 6 months'
33+
message: 'This issue has gone 180 days (6 months) without any activity.'
34+
days-before-stale: 30
35+
days-before-close: -1
36+
only-labels: 'status: needs confirmation'
37+
remove-stale-when-updated: true
38+
stale-issue-label: 'status: stale'
39+
40+
steps:
41+
- name: Update issues
42+
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
stale-issue-message: ${{ matrix.message }}
46+
days-before-stale: ${{ matrix.days-before-stale }}
47+
days-before-close: ${{ matrix.days-before-close }}
48+
only-labels: ${{ matrix.only-labels }}
49+
remove-stale-when-updated: ${{ matrix.remove-stale-when-updated }}
50+
stale-issue-label: ${{ matrix.stale-issue-label }}

.github/workflows/qit.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: QIT Tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test:
7+
description: 'Test to run'
8+
required: true
9+
default: 'default'
10+
type: choice
11+
options:
12+
- default
13+
- activation
14+
- api
15+
- e2e
16+
- phpstan
17+
- phpcompat
18+
- security
19+
- malware
20+
pull_request:
21+
types: [opened, synchronize, reopened, labeled]
22+
branches:
23+
- trunk
24+
- develop
25+
26+
permissions:
27+
contents: read
28+
pull-requests: write
29+
30+
jobs:
31+
build:
32+
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpcompat test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') || contains(github.event.pull_request.labels.*.name, 'needs: qit malware test') }}"
33+
uses: woocommerce/woocommerce-gateway-stripe/.github/workflows/generate-zip.yml@fix-qit-security
34+
35+
test:
36+
if: "${{ ( inputs.test != '' && inputs.test != 'none' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') || contains(github.event.pull_request.labels.*.name, 'needs: qit phpcompat test') || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') || contains(github.event.pull_request.labels.*.name, 'needs: qit malware test') }}"
37+
needs: build
38+
name: run
39+
runs-on: ubuntu-latest
40+
41+
env:
42+
NO_COLOR: 1
43+
QIT_DISABLE_ONBOARDING: yes
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Download build
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: ${{ github.event.repository.name }}
53+
54+
- name: Build plugin zip
55+
run: zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
56+
57+
- name: Set PHP version
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: 7.4
61+
tools: composer:v2
62+
coverage: none
63+
64+
- name: Install QIT via composer
65+
run: composer require woocommerce/qit-cli
66+
67+
- name: Add partner
68+
run: ./vendor/bin/qit partner:add --user='${{ secrets.PARTNER_USER }}' --application_password='${{ secrets.PARTNER_SECRET }}'
69+
70+
- name: Run activation test
71+
if: "${{ ( inputs.tests == 'default' || inputs.tests == 'activation' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit activation test') }}"
72+
id: run-activation-test
73+
run: ./vendor/bin/qit run:activation ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > activation-result.txt
74+
75+
- uses: marocchino/sticky-pull-request-comment@v2
76+
if: ${{ failure() && steps.run-activation-test.conclusion == 'failure' }}
77+
with:
78+
header: QIT activation result
79+
recreate: true
80+
path: activation-result.txt
81+
82+
- name: Run API test
83+
if: "${{ ( ( inputs.tests == 'default' || inputs.tests == 'api' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit api test') ) && ( success() || failure() ) }}"
84+
id: run-api-test
85+
run: ./vendor/bin/qit run:woo-api ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > api-result.txt
86+
87+
- uses: marocchino/sticky-pull-request-comment@v2
88+
if: ${{ failure() && steps.run-api-test.conclusion == 'failure' }}
89+
with:
90+
header: QIT API result
91+
recreate: true
92+
path: api-result.txt
93+
94+
- name: Run E2E test
95+
if: "${{ ( ( inputs.tests == 'default' || inputs.tests == 'e2e' ) || contains(github.event.pull_request.labels.*.name, 'needs: qit default tests') || contains(github.event.pull_request.labels.*.name, 'needs: qit e2e test') ) && ( success() || failure() ) }}"
96+
id: run-e2e-test
97+
run: ./vendor/bin/qit run:woo-e2e ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > e2e-result.txt
98+
99+
- uses: marocchino/sticky-pull-request-comment@v2
100+
if: ${{ failure() && steps.run-e2e-test.conclusion == 'failure' }}
101+
with:
102+
header: QIT E2E result
103+
recreate: true
104+
path: e2e-result.txt
105+
106+
- name: Run PHPStan test
107+
if: "${{ inputs.tests == 'phpstan' || contains(github.event.pull_request.labels.*.name, 'needs: qit phpstan test') && ( success() || failure() ) }}"
108+
id: run-phpstan-test
109+
run: ./vendor/bin/qit run:phpstan ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > phpstan-result.txt
110+
111+
- uses: marocchino/sticky-pull-request-comment@v2
112+
if: ${{ failure() && steps.run-phpstan-test.conclusion == 'failure' }}
113+
with:
114+
header: QIT PHPStan result
115+
recreate: true
116+
path: phpstan-result.txt
117+
118+
- name: Run PHPCompat test
119+
if: "${{ inputs.tests == 'phpcompat' || contains(github.event.pull_request.labels.*.name, 'needs: qit phpcompat test') && ( success() || failure() ) }}"
120+
id: run-phpcompat-test
121+
run: ./vendor/bin/qit run:phpcompatibility ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > phpcompat-result.txt
122+
123+
- uses: marocchino/sticky-pull-request-comment@v2
124+
if: ${{ failure() && steps.run-phpcompat-test.conclusion == 'failure' }}
125+
with:
126+
header: QIT PHPCompat result
127+
recreate: true
128+
path: phpcompat-result.txt
129+
130+
- name: Run security test
131+
if: "${{ inputs.tests == 'security' || contains(github.event.pull_request.labels.*.name, 'needs: qit security test') && ( success() || failure() ) }}"
132+
id: run-security-test
133+
run: ./vendor/bin/qit run:security ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > security-result.txt
134+
135+
- uses: marocchino/sticky-pull-request-comment@v2
136+
if: ${{ failure() && steps.run-security-test.conclusion == 'failure' }}
137+
with:
138+
header: QIT security result
139+
recreate: true
140+
path: security-result.txt
141+
142+
- name: Run malware test
143+
if: "${{ inputs.tests == 'malware' || contains(github.event.pull_request.labels.*.name, 'needs: qit malware test') && ( success() || failure() ) }}"
144+
id: run-malware-test
145+
run: ./vendor/bin/qit run:malware ${{ github.event.repository.name }} --zip=${{ github.event.repository.name }}.zip --wait > malware-result.txt
146+
147+
- uses: marocchino/sticky-pull-request-comment@v2
148+
if: ${{ failure() && steps.run-malware-test.conclusion == 'failure' }}
149+
with:
150+
header: QIT malware result
151+
recreate: true
152+
path: malware-result.txt

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ docker/bin/jt
3838
docker/data
3939
docker/wordpress
4040
docker/logs
41+
42+
# PHPUnit cache files
43+
.phpunit.cache/
44+
.phpunit.result.cache

changelog.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
*** Changelog ***
22

3+
= 8.7.0 - 2024-09-16 =
4+
* Add - Introduces a new promotional surface to encourage merchants with the legacy checkout experience and APMs enabled to use the new checkout experience.
5+
* Fix - Prevent duplicate failed-order emails from being sent.
6+
* Fix - Support custom name and description for Afterpay.
7+
* Fix - Link APM charge IDs in Order Details page to their Stripe dashboard payments page.
8+
* Fix - Fix Indian subscription processing by forcing the recreation of mandates during switches (upgrading/downgrading).
9+
* Fix - Add back support for Stripe Link autofill for shortcode checkout.
10+
* Fix - Fix undefined method error caused by settings refactor when connecting Stripe account.
11+
* Fix - Fix multiple compatibility issues and deprecation warnings when running the extension on PHP 8.1.
12+
* Fix - Re-connect promotional surface blinking after disappearing for merchants that have already connected their Stripe account.
13+
* Fix - Fix possible fatal errors when Stripe settings format is invalid during account connection.
14+
* Fix - Clear webhook state after reconfiguring webhooks to remove outdated error and success statuses.
15+
* Fix - Prevent payment methods from being detached from Stripe customers on non-production sites when a WP user is deleted with the new checkout experience enabled.
16+
* Add - Log incoming webhook events and their request body.
17+
* Add - Show UPE payment methods in saved order on block checkout page.
18+
* Add - Display UI elements for connection type and expired keys status for Stripe accounts linked via the WooCommerce Stripe App.
19+
* Tweak - Delete the notice about the missing customization options on the updated checkout experience.
20+
* Fix - Prevent fatal error when canceling uncaptured orders by ensuring refunds array is expanded in Stripe API response.
21+
* Fix - Fix error in saving settings when express payment methods are disabled.
22+
* Fix - Catch error when getting intent from order.
23+
* Fix - Handle undefined array key when no matching customer account is found when guest customers checkout.
24+
* Tweak - Update capabilities to payment methods mapping.
25+
* Fix - Address QIT Security test errors.
26+
* Fix - Address QIT PHPStan test errors.
27+
* Update - Specify the JS Stripe API version as 2024-06-20.
28+
* Tweak - Use order ID from 'get_order_number' in stripe intent metadata.
29+
* Fix - Ensure payment tokens are detached from Stripe when a user is deleted, regardless of if the admin user has a Stripe account.
30+
* Fix - Address Klarna availability based on correct presentment currency rules.
31+
* Fix - Use correct ISO country code of United Kingdom in supported country and currency list of AliPay and WeChat.
32+
* Fix - Prevent duplicate order notes and emails being sent when purchasing subscription products with no initial payment.
33+
* Add - Display an admin notice on the WooCommerce > Subscriptions screen for tracking the progress of SEPA subscriptions migrations after the legacy checkout is disabled.
34+
* Add - Introduce a new tool on the WooCommerce > Status > Tools screen to restart the legacy SEPA subscriptions update.
35+
* Fix - Remove the Stripe OAuth Keys when uninstalling the plugin.
36+
* Fix - Resolve an error for checkout block where 'wc_stripe_upe_params' is undefined due to the script registering the variable not being loaded yet.
37+
338
= 8.6.1 - 2024-08-09 =
439
* Tweak - Improves the wording of the invalid Stripe keys errors, instructing merchants to click the "Configure connection" button instead of manually setting the keys.
540
* Add - Includes a new promotional surface to encourage merchants to re-connect their Stripe account using the new flow.

client/api/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ export default class WCStripeAPI {
7878
}
7979

8080
createStripe( key, locale, betas = [] ) {
81-
const options = { locale };
81+
const options = {
82+
locale,
83+
apiVersion: this.options.apiVersion,
84+
};
8285

8386
if ( betas.length ) {
8487
options.betas = betas;

client/blocks/payment-request/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getSetting } from '@woocommerce/settings';
2+
import { __ } from '@wordpress/i18n';
23
import { PAYMENT_METHOD_NAME } from './constants';
34
import { PaymentRequestExpress } from './payment-request-express';
45
import { applePayImage } from './apple-pay-preview';
@@ -14,6 +15,12 @@ const componentStripePromise = loadStripe();
1415

1516
const paymentRequestPaymentMethod = {
1617
name: PAYMENT_METHOD_NAME,
18+
title: 'Stripe',
19+
description: __(
20+
'This will show users the ApplePay, GooglePay, or Stripe Link button depending on their browser and logged in status.',
21+
'woocommerce-gateway-stripe'
22+
),
23+
gatewayId: 'stripe',
1724
content: <PaymentRequestExpress stripe={ componentStripePromise } />,
1825
edit: <ApplePayPreview />,
1926
canMakePayment: ( cartData ) => {

client/blocks/payment-request/payment-request-express.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const PaymentRequestExpressComponent = ( {
4444
onClick,
4545
onClose,
4646
setExpressPaymentError,
47+
buttonAttributes,
4748
} ) => {
4849
const stripe = useStripe();
4950
const { needsShipping } = shippingData;
@@ -71,20 +72,24 @@ const PaymentRequestExpressComponent = ( {
7172

7273
// locale is not a valid value for the paymentRequestButton style.
7374
// Make sure `theme` defaults to 'dark' if it's not found in the server provided configuration.
74-
const {
75+
let {
7576
type = 'default',
7677
theme = 'dark',
7778
height = '48',
7879
} = getBlocksConfiguration()?.button;
7980

81+
// If we are on the checkout block, we receive button attributes which overwrite the extension specific settings
82+
if ( typeof buttonAttributes !== 'undefined' ) {
83+
height = buttonAttributes.height || height;
84+
}
85+
8086
const paymentRequestButtonStyle = {
8187
paymentRequestButton: {
8288
type,
8389
theme,
8490
height: `${ height }px`,
8591
},
8692
};
87-
8893
const isBranded = getBlocksConfiguration()?.button?.is_branded;
8994
const brandedType = getBlocksConfiguration()?.button?.branded_type;
9095
const isCustom = getBlocksConfiguration()?.button?.is_custom;

0 commit comments

Comments
 (0)