Skip to content

Commit c99eb51

Browse files
committed
Merge remote-tracking branch 'origin/release/6.1.0' into trunk
2 parents 82742b2 + 9dca4e7 commit c99eb51

File tree

47 files changed

+6013
-6464
lines changed

Some content is hidden

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

47 files changed

+6013
-6464
lines changed

.vscode/launch.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
"name": "Listen for Xdebug (remote/docker)",
99
"type": "php",
1010
"request": "launch",
11+
"hostname": "0.0.0.0",
1112
"port": 9000,
1213
"pathMappings": {
1314
"/var/www/html/": "${workspaceFolder}/docker/wordpress",
1415
"/var/www/html/wp-content/plugins/woocommerce-gateway-stripe/": "${workspaceFolder}"
15-
}
16+
},
17+
"preLaunchTask": "enable:xdebug",
18+
"postDebugTask": "disable:xdebug"
1619
},
1720
{
1821
"name": "Listen for Xdebug (local)",

assets/js/stripe-payment-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jQuery( function( $ ) {
33
'use strict';
44

55
var stripe = Stripe( wc_stripe_payment_request_params.stripe.key, {
6-
locale: typeof wc_stripe_params !== 'undefined' ? wc_stripe_params.stripe_locale : 'auto',
6+
locale: wc_stripe_payment_request_params.stripe.locale
77
} ),
88
paymentRequestType;
99

changelog.txt

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

3+
= 6.1.0 - 2022-01-26 =
4+
* Tweak - Use the newly exposed LoadableMask component provided by WooCommerce Blocks to trigger the loading state for Payment Request Buttons.
5+
* Fix - Response type for account summary API.
6+
* Fix - Invalid response in account summary API when missing account data.
7+
* Add - Live and test mode information in account summary API.
8+
* Add - Add filter call when updating an existent intent (wc_stripe_update_existing_intent_request).
9+
* Add - Add ability to test Stripe account keys' validity.
10+
* Fix - Fixed full bank statement field description.
11+
* Fix - Notification messages are placed on top of the account keys modal.
12+
* Fix - Express checkout with 3DS card on product page when new checkout experience is enabled.
13+
* Fix - Remove duplicate call to `payment_scripts`.
14+
* Fix - Send bank statement descriptors to payment intents.
15+
316
= 6.0.0 - 2022-01-05 =
417
* Fix - Fixed capitalization for payment method names: iDEAL, giropay, and Sofort.
518
* Add - Text to explain how to enable webhooks when manually entering your API keys in the new Stripe settings.

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

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { __ } from '@wordpress/i18n';
12
import {
23
Elements,
34
PaymentRequestButtonElement,
@@ -38,6 +39,7 @@ import { getBlocksConfiguration } from 'wcstripe/blocks/utils';
3839
*/
3940
const PaymentRequestExpressComponent = ( {
4041
billing,
42+
components,
4143
shippingData,
4244
onClick,
4345
onClose,
@@ -91,49 +93,41 @@ const PaymentRequestExpressComponent = ( {
9193
return null;
9294
}
9395

96+
const { LoadingMask } = components;
97+
9498
if ( isCustom ) {
9599
return (
96-
<div
97-
className={
98-
isUpdatingPaymentRequest
99-
? 'wc-block-components-loading-mask'
100-
: ''
101-
}
100+
<LoadingMask
101+
isLoading={ isUpdatingPaymentRequest }
102+
screenReaderLabel={ __(
103+
'Loading payment request…',
104+
'woocommerce-gateway-stripe'
105+
) }
102106
>
103107
<CustomButton
104-
className={
105-
isUpdatingPaymentRequest
106-
? 'wc-block-components-loading-mask__children'
107-
: ''
108-
}
109108
onButtonClicked={ ( evt ) => {
110109
onPaymentRequestButtonClick( evt, paymentRequest );
111110
} }
112111
/>
113-
</div>
112+
</LoadingMask>
114113
);
115114
}
116115

117116
if ( isBranded && shouldUseGooglePayBrand() ) {
118117
return (
119-
<div
120-
className={
121-
isUpdatingPaymentRequest
122-
? 'wc-block-components-loading-mask'
123-
: ''
124-
}
118+
<LoadingMask
119+
isLoading={ isUpdatingPaymentRequest }
120+
screenReaderLabel={ __(
121+
'Loading payment request…',
122+
'woocommerce-gateway-stripe'
123+
) }
125124
>
126125
<GooglePayButton
127-
className={
128-
isUpdatingPaymentRequest
129-
? 'wc-block-components-loading-mask__children'
130-
: ''
131-
}
132126
onButtonClicked={ ( evt ) => {
133127
onPaymentRequestButtonClick( evt, paymentRequest );
134128
} }
135129
/>
136-
</div>
130+
</LoadingMask>
137131
);
138132
}
139133

@@ -146,30 +140,21 @@ const PaymentRequestExpressComponent = ( {
146140
}
147141

148142
return (
149-
// The classNames here manually trigger the loading state for the PRB. Hopefully we'll
150-
// see an API introduced to WooCommerce Blocks that will let us control this without
151-
// relying on a CSS class.
152-
// - @reykjalin
153-
<div
154-
className={
155-
isUpdatingPaymentRequest
156-
? 'wc-block-components-loading-mask'
157-
: ''
158-
}
143+
<LoadingMask
144+
isLoading={ isUpdatingPaymentRequest }
145+
screenReaderLabel={ __(
146+
'Loading payment request…',
147+
'woocommerce-gateway-stripe'
148+
) }
159149
>
160150
<PaymentRequestButtonElement
161-
className={
162-
isUpdatingPaymentRequest
163-
? 'wc-block-components-loading-mask__children'
164-
: ''
165-
}
166151
onClick={ onPaymentRequestButtonClick }
167152
options={ {
168153
style: paymentRequestButtonStyle,
169154
paymentRequest,
170155
} }
171156
/>
172-
</div>
157+
</LoadingMask>
173158
);
174159
};
175160

client/components/tooltip/tooltip-base.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ const useHideDelay = (
8181
onHideCallbackRef.current();
8282
};
8383

84-
document.addEventListener( 'click', handleDocumentClick );
84+
const { ownerDocument } = triggerRef.current;
85+
86+
ownerDocument.addEventListener( 'click', handleDocumentClick );
8587
rootElement.addEventListener(
8688
'wcstripe-tooltip-open',
8789
handleHideElement
8890
);
8991

9092
return () => {
91-
document.removeEventListener( 'click', handleDocumentClick );
93+
ownerDocument.removeEventListener( 'click', handleDocumentClick );
9294
rootElement.removeEventListener(
9395
'wcstripe-tooltip-open',
9496
handleHideElement
@@ -185,14 +187,22 @@ const TooltipBase = ( {
185187

186188
const debouncedCalculation = debounce( calculateTooltipPosition, 150 );
187189

188-
window.addEventListener( 'resize', debouncedCalculation );
189-
document.addEventListener( 'scroll', debouncedCalculation );
190+
const { ownerDocument } = wrapperRef.current;
191+
192+
ownerDocument.defaultView.addEventListener(
193+
'resize',
194+
debouncedCalculation
195+
);
196+
ownerDocument.addEventListener( 'scroll', debouncedCalculation );
190197

191198
return () => {
192-
window.removeEventListener( 'resize', debouncedCalculation );
193-
document.removeEventListener( 'scroll', debouncedCalculation );
199+
ownerDocument.defaultView.removeEventListener(
200+
'resize',
201+
debouncedCalculation
202+
);
203+
ownerDocument.removeEventListener( 'scroll', debouncedCalculation );
194204
};
195-
}, [ isTooltipVisible, maxWidth ] );
205+
}, [ isTooltipVisible, maxWidth, wrapperRef ] );
196206

197207
return (
198208
<>

client/data/account-keys/__tests__/actions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe( 'Account keys actions tests', () => {
4141
const yielded = [ ...saveAccountKeys( accountKeysMock ) ];
4242

4343
expect( apiFetch ).toHaveBeenCalledWith( {
44-
method: 'post',
44+
method: 'POST',
4545
path: '/wc/v3/wc_stripe/account_keys',
4646
data: accountKeysMock,
4747
} );

client/data/account-keys/__tests__/hooks.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ describe( 'Account keys hooks tests', () => {
3232

3333
selectors = {
3434
getAccountKeys: jest.fn( () => ( { foo: 'bar' } ) ),
35+
getIsTestingAccountKeys: jest.fn(),
36+
getIsValidAccountKeys: jest.fn(),
3537
hasFinishedResolution: jest.fn(),
3638
isResolving: jest.fn(),
3739
isSavingAccountKeys: jest.fn(),

client/data/account-keys/__tests__/reducer.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ describe( 'Account keys reducer tests', () => {
77

88
expect( defaultState ).toEqual( {
99
isSaving: false,
10+
isTesting: false,
11+
isValid: null,
1012
data: {},
1113
savingError: null,
1214
} );

client/data/account-keys/action-types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ export default {
22
SET_ACCOUNT_KEYS: 'SET_ACCOUNT_KEYS',
33
SET_ACCOUNT_KEYS_VALUES: 'SET_ACCOUNT_KEYS_VALUES',
44
SET_IS_SAVING_ACCOUNT_KEYS: 'SET_IS_SAVING_ACCOUNT_KEYS',
5+
SET_IS_TESTING_ACCOUNT_KEYS: 'SET_IS_TESTING_ACCOUNT_KEYS',
6+
SET_IS_VALID_KEYS: 'SET_IS_VALID_KEYS',
57
};

client/data/account-keys/actions.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ export function updateIsSavingAccountKeys( isSaving, error ) {
2727
};
2828
}
2929

30+
export function updateIsTestingAccountKeys( isTesting ) {
31+
return {
32+
type: ACTION_TYPES.SET_IS_TESTING_ACCOUNT_KEYS,
33+
isTesting,
34+
};
35+
}
36+
37+
export function updateIsValidAccountKeys( isValid ) {
38+
return {
39+
type: ACTION_TYPES.SET_IS_VALID_KEYS,
40+
isValid,
41+
};
42+
}
43+
3044
export function* saveAccountKeys( accountKeys ) {
3145
const isDisconnecting =
3246
! accountKeys.publishable_key && ! accountKeys.test_publishable_key;
@@ -37,7 +51,7 @@ export function* saveAccountKeys( accountKeys ) {
3751

3852
const accountData = yield apiFetch( {
3953
path: `${ NAMESPACE }/account_keys`,
40-
method: 'post',
54+
method: 'POST',
4155
data: accountKeys,
4256
} );
4357

0 commit comments

Comments
 (0)