Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GooglePay live account test mode notice #10429

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

feat: add compatibility notice for GooglePlay with live mode accounts.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import WizardTaskContext from '../../wizard/task/context';
import SetupComplete from '../setup-complete-task';
import WizardContext from '../../wizard/wrapper/context';
import { useEnabledPaymentMethodIds } from '../../../data';
import WCPaySettingsContext from 'wcpay/settings/wcpay-settings-context';

jest.mock( '@wordpress/data', () => ( {
useDispatch: jest.fn().mockReturnValue( { updateOptions: jest.fn() } ),
Expand All @@ -18,16 +19,24 @@ jest.mock( '../../../data', () => ( {
useEnabledPaymentMethodIds: jest.fn(),
} ) );

const renderWithSettingsProvider = ( ui ) =>
render(
<WCPaySettingsContext.Provider value={ global.wcpaySettings }>
{ ui }
</WCPaySettingsContext.Provider>
);

describe( 'SetupComplete', () => {
beforeEach( () => {
useEnabledPaymentMethodIds.mockReturnValue( [
[ 'card', 'bancontact', 'eps', 'ideal', 'p24', 'sepa_debit' ],
() => null,
] );
global.wcpaySettings = { featureFlags: { multiCurrency: true } };
} );

it( 'renders setup complete messaging when context value is undefined', () => {
render(
renderWithSettingsProvider(
<WizardContext.Provider value={ { completedTasks: {} } }>
<WizardTaskContext.Provider value={ { isActive: true } }>
<SetupComplete />
Expand All @@ -41,9 +50,11 @@ describe( 'SetupComplete', () => {
} );

it( 'renders setup complete messaging when context value is `true`', () => {
render(
renderWithSettingsProvider(
<WizardContext.Provider
value={ { completedTasks: { 'add-payment-methods': true } } }
value={ {
completedTasks: { 'add-payment-methods': true },
} }
>
<WizardTaskContext.Provider value={ { isActive: true } }>
<SetupComplete />
Expand All @@ -57,7 +68,7 @@ describe( 'SetupComplete', () => {
} );

it( 'renders setup complete messaging when context value says that methods have not changed', () => {
render(
renderWithSettingsProvider(
<WizardContext.Provider
value={ {
completedTasks: {
Expand Down Expand Up @@ -90,7 +101,7 @@ describe( 'SetupComplete', () => {
[ 'card', 'ideal' ],
() => null,
] );
render(
renderWithSettingsProvider(
<WizardContext.Provider
value={ {
completedTasks: {
Expand Down Expand Up @@ -123,7 +134,7 @@ describe( 'SetupComplete', () => {
[ 'card', 'ideal' ],
() => null,
] );
render(
renderWithSettingsProvider(
<WizardContext.Provider
value={ {
completedTasks: {
Expand Down Expand Up @@ -156,7 +167,7 @@ describe( 'SetupComplete', () => {
[ 'card', ...additionalMethods ],
() => null,
] );
render(
renderWithSettingsProvider(
<WizardContext.Provider
value={ {
completedTasks: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/deposits-overview/deposit-notices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export const DepositFailureNotice: React.FC< {
/**
* The link to update the account details.
*/
updateAccountLink: string;
updateAccountLink?: string;
} > = ( { updateAccountLink } ) => {
const accountLinkWithSource = updateAccountLink
? addQueryArgs( updateAccountLink, {
Expand Down
13 changes: 9 additions & 4 deletions client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ declare global {
connectUrl: string;
overviewUrl: string;
isSubscriptionsActive: boolean;
featureFlags: {
featureFlags: Partial< {
customSearch: boolean;
woopay: boolean;
woopayExpressCheckout: boolean;
isAuthAndCaptureEnabled: boolean;
paymentTimeline: boolean;
isDisputeIssuerEvidenceEnabled: boolean;
isPaymentOverviewWidgetEnabled?: boolean;
};
multiCurrency?: boolean;
} >;
accountFees: Record< string, any >;
fraudServices: unknown[];
testMode: boolean;
testModeOnboarding: boolean;
Expand All @@ -26,9 +30,10 @@ declare global {
isJetpackIdcActive: boolean;
isAccountConnected: boolean;
isAccountValid: boolean;
accountStatus: {
accountStatus: Partial< {
email?: string;
created: string;
isLive?: boolean;
error?: boolean;
status?: string;
country?: string;
Expand Down Expand Up @@ -69,7 +74,7 @@ declare global {
declineOnAVSFailure: boolean;
declineOnCVCFailure: boolean;
};
};
} >;
accountLoans: {
has_active_loan: boolean;
has_past_loans: boolean;
Expand Down
2 changes: 1 addition & 1 deletion client/overview/task-list/tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const getTasks = ( {
getUpdateBusinessDetailsTask(
errorMessages,
status ?? '',
accountLink,
accountLink ?? '',
Number( currentDeadline ) ?? null,
pastDue ?? false,
detailsSubmitted ?? true
Expand Down
4 changes: 2 additions & 2 deletions client/overview/task-list/tasks/po-task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const getVerifyBankAccountTask = (): any => {
progressiveOnboarding: {
isEnabled: poEnabled,
isComplete: poComplete,
tpv,
tpv = 0,
firstTransactionDate: firstPaymentDate,
},
} = {},
created: createdDate,
} = wcpaySettings.accountStatus;

Expand Down
Loading
Loading