Skip to content

Commit e272cd0

Browse files
committed
feat: GooglePlay live account test node notice
1 parent 7199fbb commit e272cd0

File tree

22 files changed

+366
-225
lines changed

22 files changed

+366
-225
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: update
3+
4+
feat: add compatibility notice for GooglePlay with live mode accounts.

client/additional-methods-setup/upe-preview-methods-selector/test/setup-complete-task.test.js

Lines changed: 97 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import WizardTaskContext from '../../wizard/task/context';
1010
import SetupComplete from '../setup-complete-task';
1111
import WizardContext from '../../wizard/wrapper/context';
1212
import { useEnabledPaymentMethodIds } from '../../../data';
13+
import WCPaySettingsContext from 'wcpay/settings/wcpay-settings-context';
1314

1415
jest.mock( '@wordpress/data', () => ( {
1516
useDispatch: jest.fn().mockReturnValue( { updateOptions: jest.fn() } ),
@@ -18,6 +19,14 @@ jest.mock( '../../../data', () => ( {
1819
useEnabledPaymentMethodIds: jest.fn(),
1920
} ) );
2021

22+
const SettingsContextProvider = ( { children } ) => (
23+
<WCPaySettingsContext.Provider
24+
value={ { featureFlags: { multiCurrency: true } } }
25+
>
26+
{ children }
27+
</WCPaySettingsContext.Provider>
28+
);
29+
2130
describe( 'SetupComplete', () => {
2231
beforeEach( () => {
2332
useEnabledPaymentMethodIds.mockReturnValue( [
@@ -28,11 +37,13 @@ describe( 'SetupComplete', () => {
2837

2938
it( 'renders setup complete messaging when context value is undefined', () => {
3039
render(
31-
<WizardContext.Provider value={ { completedTasks: {} } }>
32-
<WizardTaskContext.Provider value={ { isActive: true } }>
33-
<SetupComplete />
34-
</WizardTaskContext.Provider>
35-
</WizardContext.Provider>
40+
<SettingsContextProvider>
41+
<WizardContext.Provider value={ { completedTasks: {} } }>
42+
<WizardTaskContext.Provider value={ { isActive: true } }>
43+
<SetupComplete />
44+
</WizardTaskContext.Provider>
45+
</WizardContext.Provider>
46+
</SettingsContextProvider>
3647
);
3748

3849
expect(
@@ -42,13 +53,17 @@ describe( 'SetupComplete', () => {
4253

4354
it( 'renders setup complete messaging when context value is `true`', () => {
4455
render(
45-
<WizardContext.Provider
46-
value={ { completedTasks: { 'add-payment-methods': true } } }
47-
>
48-
<WizardTaskContext.Provider value={ { isActive: true } }>
49-
<SetupComplete />
50-
</WizardTaskContext.Provider>
51-
</WizardContext.Provider>
56+
<SettingsContextProvider>
57+
<WizardContext.Provider
58+
value={ {
59+
completedTasks: { 'add-payment-methods': true },
60+
} }
61+
>
62+
<WizardTaskContext.Provider value={ { isActive: true } }>
63+
<SetupComplete />
64+
</WizardTaskContext.Provider>
65+
</WizardContext.Provider>
66+
</SettingsContextProvider>
5267
);
5368

5469
expect( screen.getByText( /Setup complete/ ) ).toHaveTextContent(
@@ -58,26 +73,28 @@ describe( 'SetupComplete', () => {
5873

5974
it( 'renders setup complete messaging when context value says that methods have not changed', () => {
6075
render(
61-
<WizardContext.Provider
62-
value={ {
63-
completedTasks: {
64-
'add-payment-methods': {
65-
initialMethods: [
66-
'card',
67-
'bancontact',
68-
'eps',
69-
'ideal',
70-
'p24',
71-
'sepa_debit',
72-
],
76+
<SettingsContextProvider>
77+
<WizardContext.Provider
78+
value={ {
79+
completedTasks: {
80+
'add-payment-methods': {
81+
initialMethods: [
82+
'card',
83+
'bancontact',
84+
'eps',
85+
'ideal',
86+
'p24',
87+
'sepa_debit',
88+
],
89+
},
7390
},
74-
},
75-
} }
76-
>
77-
<WizardTaskContext.Provider value={ { isActive: true } }>
78-
<SetupComplete />
79-
</WizardTaskContext.Provider>
80-
</WizardContext.Provider>
91+
} }
92+
>
93+
<WizardTaskContext.Provider value={ { isActive: true } }>
94+
<SetupComplete />
95+
</WizardTaskContext.Provider>
96+
</WizardContext.Provider>
97+
</SettingsContextProvider>
8198
);
8299

83100
expect( screen.getByText( /Setup complete/ ) ).toHaveTextContent(
@@ -91,26 +108,28 @@ describe( 'SetupComplete', () => {
91108
() => null,
92109
] );
93110
render(
94-
<WizardContext.Provider
95-
value={ {
96-
completedTasks: {
97-
'add-payment-methods': {
98-
initialMethods: [
99-
'card',
100-
'bancontact',
101-
'eps',
102-
'ideal',
103-
'p24',
104-
'sepa_debit',
105-
],
111+
<SettingsContextProvider>
112+
<WizardContext.Provider
113+
value={ {
114+
completedTasks: {
115+
'add-payment-methods': {
116+
initialMethods: [
117+
'card',
118+
'bancontact',
119+
'eps',
120+
'ideal',
121+
'p24',
122+
'sepa_debit',
123+
],
124+
},
106125
},
107-
},
108-
} }
109-
>
110-
<WizardTaskContext.Provider value={ { isActive: true } }>
111-
<SetupComplete />
112-
</WizardTaskContext.Provider>
113-
</WizardContext.Provider>
126+
} }
127+
>
128+
<WizardTaskContext.Provider value={ { isActive: true } }>
129+
<SetupComplete />
130+
</WizardTaskContext.Provider>
131+
</WizardContext.Provider>
132+
</SettingsContextProvider>
114133
);
115134

116135
expect( screen.getByText( /Setup complete/ ) ).toHaveTextContent(
@@ -124,19 +143,21 @@ describe( 'SetupComplete', () => {
124143
() => null,
125144
] );
126145
render(
127-
<WizardContext.Provider
128-
value={ {
129-
completedTasks: {
130-
'add-payment-methods': {
131-
initialMethods: [ 'card' ],
146+
<SettingsContextProvider>
147+
<WizardContext.Provider
148+
value={ {
149+
completedTasks: {
150+
'add-payment-methods': {
151+
initialMethods: [ 'card' ],
152+
},
132153
},
133-
},
134-
} }
135-
>
136-
<WizardTaskContext.Provider value={ { isActive: true } }>
137-
<SetupComplete />
138-
</WizardTaskContext.Provider>
139-
</WizardContext.Provider>
154+
} }
155+
>
156+
<WizardTaskContext.Provider value={ { isActive: true } }>
157+
<SetupComplete />
158+
</WizardTaskContext.Provider>
159+
</WizardContext.Provider>
160+
</SettingsContextProvider>
140161
);
141162

142163
expect( screen.getByText( /Setup complete/ ) ).toHaveTextContent(
@@ -157,19 +178,21 @@ describe( 'SetupComplete', () => {
157178
() => null,
158179
] );
159180
render(
160-
<WizardContext.Provider
161-
value={ {
162-
completedTasks: {
163-
'add-payment-methods': {
164-
initialMethods: [ 'card' ],
181+
<SettingsContextProvider>
182+
<WizardContext.Provider
183+
value={ {
184+
completedTasks: {
185+
'add-payment-methods': {
186+
initialMethods: [ 'card' ],
187+
},
165188
},
166-
},
167-
} }
168-
>
169-
<WizardTaskContext.Provider value={ { isActive: true } }>
170-
<SetupComplete />
171-
</WizardTaskContext.Provider>
172-
</WizardContext.Provider>
189+
} }
190+
>
191+
<WizardTaskContext.Provider value={ { isActive: true } }>
192+
<SetupComplete />
193+
</WizardTaskContext.Provider>
194+
</WizardContext.Provider>
195+
</SettingsContextProvider>
173196
);
174197

175198
expect( screen.getByText( /Setup complete/ ) ).toHaveTextContent(

client/components/deposits-overview/deposit-notices.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const DepositFailureNotice: React.FC< {
205205
/**
206206
* The link to update the account details.
207207
*/
208-
updateAccountLink: string;
208+
updateAccountLink?: string;
209209
} > = ( { updateAccountLink } ) => {
210210
const accountLinkWithSource = updateAccountLink
211211
? addQueryArgs( updateAccountLink, {

client/components/deposits-overview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const DepositsOverview: React.FC = () => {
161161
{ hasErroredExternalAccount && (
162162
<DepositFailureNotice
163163
updateAccountLink={
164-
wcpaySettings.accountStatus.accountLink
164+
wcpaySettings.accountStatus?.accountLink
165165
}
166166
/>
167167
) }

client/components/payment-methods-checkboxes/payment-method-checkbox.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const PaymentMethodCheckbox: React.FC< PaymentMethodCheckboxProps > = ( {
7777
} ) => {
7878
const {
7979
accountFees,
80-
}: { accountFees: Record< string, FeeStructure > } = useContext(
80+
}: { accountFees?: Record< string, FeeStructure > } = useContext(
8181
WCPaySettingsContext
8282
);
8383

@@ -192,10 +192,10 @@ const PaymentMethodCheckbox: React.FC< PaymentMethodCheckboxProps > = ( {
192192
</PaymentMethodDisabledTooltip>
193193
) }
194194
</div>
195-
<div className={ 'payment-method-checkbox__pills-right' }>
195+
<div className="payment-method-checkbox__pills-right">
196196
<HoverTooltip
197197
content={ formatMethodFeesTooltip(
198-
accountFees[ name ]
198+
accountFees?.[ name ]
199199
) }
200200
maxWidth={ '300px' }
201201
>
@@ -210,7 +210,7 @@ const PaymentMethodCheckbox: React.FC< PaymentMethodCheckboxProps > = ( {
210210
>
211211
<span>
212212
{ formatMethodFeesDescription(
213-
accountFees[ name ]
213+
accountFees?.[ name ]
214214
) }
215215
</span>
216216
</Pill>

client/globals.d.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ declare global {
1111
connectUrl: string;
1212
overviewUrl: string;
1313
isSubscriptionsActive: boolean;
14-
featureFlags: {
14+
featureFlags: Partial< {
1515
customSearch: boolean;
16+
woopay: boolean;
17+
woopayExpressCheckout: boolean;
1618
isAuthAndCaptureEnabled: boolean;
1719
paymentTimeline: boolean;
1820
isDisputeIssuerEvidenceEnabled: boolean;
1921
isPaymentOverviewWidgetEnabled?: boolean;
20-
};
22+
multiCurrency?: boolean;
23+
} >;
24+
accountFees: Record< string, any >;
2125
fraudServices: unknown[];
2226
testMode: boolean;
2327
testModeOnboarding: boolean;
@@ -26,9 +30,10 @@ declare global {
2630
isJetpackIdcActive: boolean;
2731
isAccountConnected: boolean;
2832
isAccountValid: boolean;
29-
accountStatus: {
33+
accountStatus: Partial< {
3034
email?: string;
3135
created: string;
36+
isLive?: boolean;
3237
error?: boolean;
3338
status?: string;
3439
country?: string;
@@ -69,7 +74,7 @@ declare global {
6974
declineOnAVSFailure: boolean;
7075
declineOnCVCFailure: boolean;
7176
};
72-
};
77+
} >;
7378
accountLoans: {
7479
has_active_loan: boolean;
7580
has_past_loans: boolean;

client/overview/task-list/tasks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const getTasks = ( {
103103
getUpdateBusinessDetailsTask(
104104
errorMessages,
105105
status ?? '',
106-
accountLink,
106+
accountLink ?? '',
107107
Number( currentDeadline ) ?? null,
108108
pastDue ?? false,
109109
detailsSubmitted ?? true

client/overview/task-list/tasks/po-task.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export const getVerifyBankAccountTask = (): any => {
2121
progressiveOnboarding: {
2222
isEnabled: poEnabled,
2323
isComplete: poComplete,
24-
tpv,
24+
tpv = 0,
2525
firstTransactionDate: firstPaymentDate,
26-
},
26+
} = {},
2727
created: createdDate,
2828
} = wcpaySettings.accountStatus;
2929

0 commit comments

Comments
 (0)