Skip to content

Commit

Permalink
Merge release/6.9.0 into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardo committed Dec 6, 2023
2 parents 4e2918f + 9bac0aa commit 3ea1e90
Show file tree
Hide file tree
Showing 192 changed files with 5,903 additions and 3,847 deletions.
49 changes: 49 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
*** WooPayments Changelog ***

= 6.9.0 - 2023-12-06 =
* Add - Added cleanup code after Payment Processing - RPP.
* Add - Adds new option to track dismissal of PO eligibility modal.
* Add - Display an error banner on the connect page when the WooCommerce country is not supported.
* Add - Filter to disable WooPay checkout auto-redirect and email input hooks.
* Add - Handle failed transaction rate limiter in RPP.
* Add - Handle fraud prevention service in InitialState (project RPP).
* Add - Handle mimium amount in InitialState (project RPP).
* Add - Introduce filters for channel, customer country, and risk level on the transactions list page.
* Add - Store the working mode of the gateway (RPP).
* Fix - Add AutomateWoo - Refer A Friend Add-On support on WooPay.
* Fix - Add date_between filter for Authorization Reporting API.
* Fix - Add invalid product id error check.
* Fix - Allow Gradual signup accounts to continue with the Gradual KYC after abandoning it.
* Fix - Allow requests with item IDs to be extended without exceptions.
* Fix - Check that the email is set in the post global.
* Fix - Display notice when clicking the WooPay button if variable product selection is incomplete.
* Fix - Do not show the WooPay button on the product page when WC Bookings require confirmation.
* Fix - Enable deferred intent creation when initialization process encounters cache unavailability.
* Fix - Ensure express payment methods (Google and Apple Pay) correctly reflect eligible shipping methods after closing and reattempting payment.
* Fix - Fixes a redirect to show the new onboarding when coming from WC Core.
* Fix - Fix saved card payments not working on block checkout while card testing prevention is active.
* Fix - Pass the pay-for-order params to the first-party auth flow.
* Fix - Prevent merchants to access onboarding again after starting it in new flow.
* Fix - Remove unsupported EUR currency from Afterpay payment method.
* Fix - Show Payments menu sub-items only for merchants that completed KYC.
* Fix - Support 'variation' product type when re-adding items to a cart.
* Fix - When rendering customer reference in transaction details, fallback to order data.
* Fix - When rendering customer reference on transaction details page, handle case with name being not provided in the order.
* Update - Change PRB default height for new installations.
* Update - Cleanup the deprecated payment gateway processing - part I.
* Update - Correct some links that now lead to better documentation.
* Update - Enable the new onboarding flow as default for all users.
* Update - Exclude estimated deposits from the deposits list screen.
* Update - Improvements to the dev mode and test mode indicators.
* Update - Remove estimated status option from the advanced filters on the deposits list screen.
* Update - Replace the deposit overview transactions list with a "transaction history is unavailable for instant deposits" message.
* Update - Update Payments Overview deposits UI to simplify how we communicate upcoming deposits.
* Update - Update to the new onboarding builder flow to not prefill country/address to US.
* Dev - Add client user-agent value to Tracks event props.
* Dev - Add E2E tests for Affirm and Afterpay checkouts.
* Dev - Add E2E tests for checking out with Giropay.
* Dev - Added customer details management within the re-engineered payment process.
* Dev - Adds WCPay options to Woo Core option allow list to avoid 403 responses from Options API when getting and updating options in non-prod env.
* Dev - Bump WC tested up to version to 8.3.1.
* Dev - Fix a bug in WooPay button update Tracks.
* Dev - Introduce filter `wcpay_payment_request_is_cart_supported`. Allow plugins to conditionally disable payment request buttons on cart and checkout pages containing products that do not support them.
* Dev - Upgrade the csv-export JS package to the latest version.

= 6.8.0 - 2023-11-16 =
* Add - Added mechanism to track and log changes to the payment context (reengineering payment process)
* Add - Add rejected payment method capability status
Expand Down
6 changes: 3 additions & 3 deletions client/capital/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { dateI18n } from '@wordpress/date';
* Internal dependencies.
*/
import Page from 'components/page';
import { TestModeNotice, topics } from 'components/test-mode-notice';
import { TestModeNotice } from 'components/test-mode-notice';
import ErrorBoundary from 'components/error-boundary';
import ActiveLoanSummary from 'components/active-loan-summary';
import { formatExplicitCurrency, isZeroDecimalCurrency } from 'utils/currency';
Expand All @@ -21,7 +21,6 @@ import ClickableCell from 'components/clickable-cell';
import Chip from 'components/chip';
import { useLoans } from 'wcpay/data';
import { getAdminUrl } from 'wcpay/utils';

import './style.scss';

const columns = [
Expand Down Expand Up @@ -205,7 +204,8 @@ const CapitalPage = (): JSX.Element => {

return (
<Page>
<TestModeNotice topic={ topics.loans } />
<TestModeNotice currentPage="loans" />

{ wcpaySettings.accountLoans.has_active_loan && (
<ErrorBoundary>
<ActiveLoanSummary />
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/blocks/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const WCPayFields = ( {
stripe,
elements,
billing: { billingData },
eventRegistration: { onPaymentProcessing, onCheckoutSuccess },
eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
shouldSavePayment,
} ) => {
Expand All @@ -49,7 +49,7 @@ const WCPayFields = ( {
// When it's time to process the payment, generate a Stripe payment method object.
useEffect(
() =>
onPaymentProcessing( () => {
onPaymentSetup( () => {
if ( PAYMENT_METHOD_NAME_CARD !== activePaymentMethod ) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion client/checkout/blocks/generate-payment-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PAYMENT_METHOD_NAME_CARD } from '../constants.js';
* @param {Object} billingData The billing data, which was collected from the checkout block.
* @param {string} fingerprint User fingerprint.
*
* @return {Object} The `onPaymentProcessing` response object, including a type and meta data/error message.
* @return {Object} The `onPaymentSetup` response object, including a type and meta data/error message.
*/
const generatePaymentMethod = async (
api,
Expand Down
1 change: 1 addition & 0 deletions client/checkout/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ registerPaymentMethod( {
if ( getConfig( 'isWooPayEnabled' ) ) {
if (
document.querySelector( '[data-block-name="woocommerce/checkout"]' ) &&
getConfig( 'isWooPayEmailInputEnabled' ) &&
! isPreviewing()
) {
handleWooPayEmailInput( '#email', api, true );
Expand Down
28 changes: 27 additions & 1 deletion client/checkout/blocks/saved-token-handler.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
/**
* Internal dependencies
*/
import { useEffect } from 'react';
import { usePaymentCompleteHandler } from './hooks';
import { useSelect } from '@wordpress/data';

export const SavedTokenHandler = ( {
api,
stripe,
elements,
eventRegistration: { onCheckoutSuccess },
eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
} ) => {
const paymentMethodData = useSelect( ( select ) => {
const store = select( 'wc/store/payment' );
return store.getPaymentMethodData();
} );

useEffect( () => {
return onPaymentSetup( () => {
const fraudPreventionToken = document
.querySelector( '#wcpay-fraud-prevention-token' )
?.getAttribute( 'value' );

return {
type: 'success',
meta: {
paymentMethodData: {
...paymentMethodData,
'wcpay-fraud-prevention-token':
fraudPreventionToken ?? '',
},
},
};
} );
}, [ onPaymentSetup, paymentMethodData ] );

// Once the server has completed payment processing, confirm the intent of necessary.
usePaymentCompleteHandler(
api,
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/blocks/upe-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const WCPayUPEFields = ( {
activePaymentMethod,
billing: { billingData },
shippingData,
eventRegistration: { onPaymentProcessing, onCheckoutSuccess },
eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
paymentIntentId,
paymentIntentSecret,
Expand Down Expand Up @@ -135,7 +135,7 @@ const WCPayUPEFields = ( {
// When it's time to process the payment, generate a Stripe payment method object.
useEffect(
() =>
onPaymentProcessing( () => {
onPaymentSetup( () => {
if ( PAYMENT_METHOD_NAME_CARD !== activePaymentMethod ) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/blocks/upe-split-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const WCPayUPEFields = ( {
testingInstructions,
billing: { billingData },
shippingData,
eventRegistration: { onPaymentProcessing, onCheckoutSuccess },
eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
paymentMethodId,
upeMethods,
Expand Down Expand Up @@ -133,7 +133,7 @@ const WCPayUPEFields = ( {
// When it's time to process the payment, generate a Stripe payment method object.
useEffect(
() =>
onPaymentProcessing( () => {
onPaymentSetup( () => {
if ( upeMethods[ paymentMethodId ] !== activePaymentMethod ) {
return;
}
Expand Down
6 changes: 5 additions & 1 deletion client/checkout/classic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,11 @@ jQuery( function ( $ ) {
}
} );

if ( getConfig( 'isWooPayEnabled' ) && ! isPreviewing() ) {
if (
getConfig( 'isWooPayEnabled' ) &&
getConfig( 'isWooPayEmailInputEnabled' ) &&
! isPreviewing()
) {
handleWooPayEmailInput( '#billing_email', api );
}
} );
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ jQuery( function ( $ ) {
return processPaymentIfNotUsingSavedMethod( $( 'form#order_review' ) );
} );

if ( getUPEConfig( 'isWooPayEnabled' ) && ! isPreviewing() ) {
if (
getUPEConfig( 'isWooPayEnabled' ) &&
getUPEConfig( 'isWooPayEmailInputEnabled' ) &&
! isPreviewing()
) {
handleWooPayEmailInput( '#billing_email', api );
}

Expand Down
7 changes: 3 additions & 4 deletions client/checkout/woopay/express-button/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global jQuery */
/**
* External dependencies
*/
Expand Down Expand Up @@ -58,16 +57,16 @@ const renderWooPayExpressCheckoutButtonWithCallbacks = () => {
renderWooPayExpressCheckoutButton( listenForCartChanges );
};

jQuery( ( $ ) => {
document.addEventListener( 'DOMContentLoaded', () => {
listenForCartChanges = {
start: () => {
$( document.body ).on(
document.body.addEventListener(
'updated_cart_totals',
renderWooPayExpressCheckoutButtonWithCallbacks
);
},
stop: () => {
$( document.body ).off(
document.body.removeEventListener(
'updated_cart_totals',
renderWooPayExpressCheckoutButtonWithCallbacks
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ jest.mock( '../use-express-checkout-product-handler', () => jest.fn() );
jest.spyOn( window, 'alert' ).mockImplementation( () => {} );

global.fetch = jest.fn( () => Promise.resolve( { json: () => ( {} ) } ) );
global.window.wc_add_to_cart_variation_params = {
i18n_make_a_selection_text: 'Mock text',
};

describe( 'WoopayExpressCheckoutButton', () => {
const buttonSettings = {
Expand All @@ -62,7 +59,6 @@ describe( 'WoopayExpressCheckoutButton', () => {
};
useExpressCheckoutProductHandler.mockImplementation( () => ( {
addToCart: mockAddToCart,
isAddToCartDisabled: false,
} ) );
} );

Expand Down Expand Up @@ -214,15 +210,21 @@ describe( 'WoopayExpressCheckoutButton', () => {
} );
} );

test( 'should shown an alert when clicking the button when add to cart button is disabled', () => {
test( 'should show an alert when clicking the button when add to cart button is disabled', () => {
getConfig.mockImplementation( ( v ) => {
return v === 'isWoopayFirstPartyAuthEnabled' ? false : 'foo';
} );
useExpressCheckoutProductHandler.mockImplementation( () => ( {
addToCart: mockAddToCart,
isAddToCartDisabled: true,
} ) );

// Add a disabled add to cart button to the DOM.
const addToCartButton = document.createElement( 'button' );
addToCartButton.classList.add( 'single_add_to_cart_button' );
addToCartButton.classList.add( 'disabled' );
addToCartButton.classList.add( 'wc-variation-selection-needed' );
document.body.appendChild( addToCartButton );

render(
<WoopayExpressCheckoutButton
isPreview={ false }
Expand All @@ -240,9 +242,10 @@ describe( 'WoopayExpressCheckoutButton', () => {
userEvent.click( expressButton );

expect( window.alert ).toBeCalledWith(
window.wc_add_to_cart_variation_params
.i18n_make_a_selection_text
'Please select your product options before proceeding.'
);

document.body.removeChild( addToCartButton );
} );

test( 'call `addToCart` and `expressCheckoutIframe` on express button click on product page', async () => {
Expand All @@ -252,7 +255,6 @@ describe( 'WoopayExpressCheckoutButton', () => {
useExpressCheckoutProductHandler.mockImplementation( () => ( {
addToCart: mockAddToCart,
getProductData: jest.fn().mockReturnValue( {} ),
isAddToCartDisabled: false,
} ) );
render(
<WoopayExpressCheckoutButton
Expand Down Expand Up @@ -288,7 +290,6 @@ describe( 'WoopayExpressCheckoutButton', () => {
useExpressCheckoutProductHandler.mockImplementation( () => ( {
addToCart: mockAddToCart,
getProductData: jest.fn().mockReturnValue( false ),
isAddToCartDisabled: false,
} ) );
render(
<WoopayExpressCheckoutButton
Expand Down
Loading

0 comments on commit 3ea1e90

Please sign in to comment.