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

Release branch for 7.7.0 #8882

Merged
merged 51 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0809d03
Updated requests classes documentation to link to correct README (#8767)
jessy-p May 6, 2024
1d5b91a
Pass merchant timezone to Reporting Payment Activity API (#8743)
jessy-p May 6, 2024
7f75c4d
Display Link as payment method on order received page with setup inte…
mdmoore May 6, 2024
b5d4710
Upgrade jetpack sync package version (#8763)
zmaglica May 6, 2024
206fc5e
Escape attributes added/edited in #8650 (#8787)
brettshumaker May 6, 2024
48abd2a
Fix/5223 payment activity adjustment (#8780)
jessy-p May 7, 2024
a7cfd9c
Reporting: Fix `View report` link on Disputes tile in Payment activit…
nagpai May 7, 2024
518a1fe
Fix charm pricing and rounding for non-decimal currencies (#8723)
reykjalin May 7, 2024
16b6147
Parameterize Xdebug remote host in Dockerfile. (#8789)
alopezari May 7, 2024
0635be2
Ensure payment method is stored on subscriptions paid with 3DS cards …
mdmoore May 7, 2024
ca7527b
Fix failing tests for adding/deleting payment methods on My Account p…
brettshumaker May 8, 2024
71c2f0b
Fix Payment block error while editing the blocks checkout page. (#8771)
brettshumaker May 8, 2024
d272e6a
Merge trunk v7.6.0 into develop
botwoo May 8, 2024
98a9863
Sending payment_method_update_data param to intent API (#8720)
gpressutto5 May 9, 2024
6e37e99
Prevent duplicate queries from PRB on checkout (#8803)
mdmoore May 9, 2024
4a78d37
Remove auto redirect to WooPay on page load (#8777)
asumaran May 10, 2024
6f110cb
Fix Shortcode Orders When Using WooPay Direct Checkout (#8802)
lovo-h May 10, 2024
1e74d6b
Add command to run QIT PHPStan tests (#8814)
timur27 May 14, 2024
038fd72
Update XPF currency formatting (#8722)
cesarcosta99 May 14, 2024
c0033b4
Re-removed deprecated depositsStatus key from account status (#8755)
shendy-a8c May 15, 2024
f78e96c
Add the WooPay Direct Checkout flow to the blocks mini cart widget (#…
ricardo May 16, 2024
9eab5e4
feat: error message on 1M+ amount (#8793)
frosso May 17, 2024
b0436e9
feat: tokenized cart PRBs on PDPs (#8644)
frosso May 17, 2024
3bcea2b
Fixed Afterpay for virtual products (#8826)
gpressutto5 May 17, 2024
5c07c30
feat: add Store API multi-currency support (#8816)
frosso May 17, 2024
e9a45eb
perf: unneeded WooPay scripts (#8829)
frosso May 17, 2024
6b42312
Update WooPay button colors to match new designs (#8827)
malithsen May 17, 2024
88d920d
Render ECE buttons (#8818)
rafaelzaleski May 20, 2024
f094322
Upgrade jetpack sync package version to v2.16.3 (#8836)
elazzabi May 20, 2024
1dc22c4
Add unit test for Get_Reporting_Payment_Activity. (#8785)
shendy-a8c May 20, 2024
65b9b3a
Update shopper Tracks/BumpStats tracking parameters (#8821)
malithsen May 20, 2024
28a60a4
WooPayment REST: conditional initialization. (#8805)
kalessil May 21, 2024
c05b2bb
Add local release package support for PHPStan (#8846)
timur27 May 21, 2024
bc4de6a
chore: remove unused UPE JS methods (#8843)
frosso May 21, 2024
7c91c5a
Move `usePaymentActivityData()` to `PaymentActivity` because filters …
shendy-a8c May 21, 2024
634c042
Remove public key encryption feature (#8847)
tpaksu May 21, 2024
3b71322
Update sandbox mode notice tooltip copy (#8848)
vladolaru May 21, 2024
9cffee4
Fix ECE error in the blocks checkout when PRBs are disabled. (#8854)
rafaelzaleski May 21, 2024
80f9999
Fix WooPay button in classic cart/product pages (#8861)
malithsen May 22, 2024
92a623e
Pass previous Exception with Exception (#8824)
hsingyuc May 22, 2024
100575d
fix: settings notices consistency (#8837)
frosso May 23, 2024
f23f2a9
fix: Store API tokenized cart nonce verification (#8840)
frosso May 23, 2024
fcf9c78
Fix the exclusion clause in ruleset.xml to only apply to a single rul…
marcinbot May 23, 2024
97a7fee
Fix Klarna E2E tests (#8858)
ricardo May 23, 2024
05b4cc1
Try adding WooCommerce share key to Stripe onboarding (#8851)
psealock May 24, 2024
cd0925d
Add spacing between Giropay and P24 icons and source identifier (#8876)
mdmoore May 24, 2024
7e80354
Bump WP tested up to 6.5 and WC tested up to 8.9.1 (#8877)
ricardo May 24, 2024
5afdfd1
Update version and add changelog entries for release 7.7.0
github-actions[bot] May 26, 2024
b82e190
Normalize changelog entries
ricardo May 27, 2024
f13a7b1
Fix "Pay for order" infinite loading (#8886)
ricardo May 29, 2024
b52d2f7
Amend changelog entries for release 7.7.0
botwoo May 29, 2024
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
30 changes: 30 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
*** WooPayments Changelog ***

= 7.7.0 - 2024-05-29 =
* Add - Add share key query param when sending data to Stripe KYC.
* Add - Add the WooPay Direct Checkout flow to the blocks mini cart widget.
* Add - feat: add multi-currency support to Store API.
* Add - feat: error message on 1M+ amount.
* Add - feat: tokenized cart PRBs on PDPs via feature flag.
* Add - Render ECE buttons behind a feature flag.
* Fix - Charm pricing and rounding options corrected for all currencies that aren't presented with decimal points.
* Fix - Fix "Pay for order" infinite loading when submitting form without payment details.
* Fix - fix: remove WooPay checkout pages scripts from non-checkout pages.
* Fix - fix: settings notices consistency.
* Fix - fix: Store API tokenized cart nonce verification.
* Fix - Fix a bug in Tracks where shopper events are not fired properly.
* Fix - Fix ECE error in the blocks checkout when PRBs are disabled.
* Fix - Fix Payment block render error while editing the block checkout page.
* Fix - Fix shortcode orders when using WooPay Direct Checkout.
* Fix - Improve visibility of WooPay button on light and outline button themes.
* Fix - Updating saved payment method billing address before processing the payment.
* Update - Do not auto-redirect to WooPay on page load.
* Update - Pass previous exception with exception.
* Update - Removed deprecated deposit_status key from account status.
* Update - Remove public key encryption setting from WooPayments settings.
* Update - Update XPF currency formatting.
* Dev - Add command to run QIT PHPStan tests.
* Dev - Add local release package support for PHPStan.
* Dev - Bump tested up to version for WP to 6.5 and WC to 8.9.1.
* Dev - Fix Klarna E2E tests.
* Dev - Guarantee REST intialization on REST request context (avoiding rest_preload_api_request context).
* Dev - Upgrade jetpack sync package version.

= 7.6.0 - 2024-05-08 =
* Add - Add additional data to Compatibility service
* Add - Add User Satisfaction Survey for Payments Overview Widget
Expand Down
102 changes: 5 additions & 97 deletions client/checkout/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
getPaymentRequestData,
getPaymentRequestAjaxURL,
buildAjaxURL,
} from '../../payment-request/utils';
import { decryptClientSecret } from '../utils/encryption';
} from 'utils/express-checkout';

/**
* Handles generic connections to the server and Stripe.
Expand Down Expand Up @@ -117,90 +116,6 @@ export default class WCPayAPI {
} );
}

/**
* Generates a Stripe payment method.
*
* @param {Object} elements A hash of all Stripe elements, used to enter card data.
* @param {Object} preparedCustomerData Default values for customer data, used on pages like Pay for Order.
* @return {Object} A request object, which will be prepared and then `.send()`.
*/
generatePaymentMethodRequest( elements, preparedCustomerData = {} ) {
const stripe = this.getStripe();

return new ( class {
constructor() {
this.args = {
...elements,
billing_details: {
address: {},
},
};
}

/**
* Prepares a value that's been loaded from inputs,
* uses a default value if none is present.
*
* @param {string} name The key of the value.
* @param {mixed} value The value to sanitize.
* @return {mixed} The sanitized value, `undefined` if not present.
*/
prepareValue( name, value ) {
// Fall back to the value in `preparedCustomerData`.
if ( typeof value === 'undefined' || value.length === 0 ) {
value = preparedCustomerData[ name ]; // `undefined` if not set.
}

if ( typeof value !== 'undefined' && value.length > 0 ) {
return value;
}
}

/**
* Updates a billing detail within the request.
*
* @param {string} name The name of the billing value.
* @param {string} value The actual value.
*/
setBillingDetail( name, value ) {
const preparedValue = this.prepareValue( name, value );
if ( typeof preparedValue !== 'undefined' ) {
this.args.billing_details[ name ] = preparedValue;
}
}

/**
* Updates an address detail within the request.
*
* @param {string} name The name of the address value.
* @param {string} value The actual value.
*/
setAddressDetail( name, value ) {
const preparedValue = this.prepareValue( name, value );
if ( typeof preparedValue !== 'undefined' ) {
this.args.billing_details.address[ name ] = preparedValue;
}
}

/**
* Sends the request to Stripe once everything is ready.
*
* @return {Object} The payment method object if successfully loaded.
*/
send() {
return stripe
.createPaymentMethod( this.args )
.then( ( paymentMethod ) => {
if ( paymentMethod.error ) {
throw paymentMethod.error;
}

return paymentMethod;
} );
}
} )();
}

/**
* Extracts the details about a payment intent from the redirect URL,
* and displays the intent confirmation modal (if needed).
Expand Down Expand Up @@ -253,7 +168,7 @@ export default class WCPayAPI {
// use the regular getStripe function.
if ( isSetupIntent ) {
return this.getStripe().handleNextAction( {
clientSecret: decryptClientSecret( clientSecret ),
clientSecret: clientSecret,
} );
}

Expand All @@ -264,18 +179,13 @@ export default class WCPayAPI {
publishableKey,
locale,
accountIdForIntentConfirmation
).confirmCardPayment(
decryptClientSecret(
clientSecret,
accountIdForIntentConfirmation
)
);
).confirmCardPayment( clientSecret );
}

// When not dealing with a setup intent or woopay we need to force an account
// specific request in Stripe.
return this.getStripe( true ).handleNextAction( {
clientSecret: decryptClientSecret( clientSecret ),
clientSecret: clientSecret,
} );
};

Expand Down Expand Up @@ -353,9 +263,7 @@ export default class WCPayAPI {
}

return this.getStripe()
.confirmCardSetup(
decryptClientSecret( response.data.client_secret )
)
.confirmCardSetup( response.data.client_secret )
.then( ( confirmedSetupIntent ) => {
const { setupIntent, error } = confirmedSetupIntent;
if ( error ) {
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/api/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/
import WCPayAPI from '..';
import request from 'wcpay/checkout/utils/request';
import { buildAjaxURL } from 'wcpay/payment-request/utils';
import { buildAjaxURL } from 'wcpay/utils/express-checkout';
import { getConfig } from 'wcpay/utils/checkout';

jest.mock( 'wcpay/checkout/utils/request', () =>
jest.fn( () => Promise.resolve( {} ).finally( () => {} ) )
);
jest.mock( 'wcpay/payment-request/utils', () => ( {
jest.mock( 'wcpay/utils/express-checkout', () => ( {
buildAjaxURL: jest.fn(),
} ) );
jest.mock( 'wcpay/utils/checkout', () => ( {
Expand Down
63 changes: 0 additions & 63 deletions client/checkout/blocks/generate-payment-method.js

This file was deleted.

2 changes: 2 additions & 0 deletions client/checkout/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import PaymentMethodLabel from './payment-method-label';
import request from '../utils/request';
import enqueueFraudScripts from 'fraud-scripts';
import paymentRequestPaymentMethod from '../../payment-request/blocks';
import expressCheckoutElementPaymentMethod from '../../express-checkout/blocks';
import {
PAYMENT_METHOD_NAME_CARD,
PAYMENT_METHOD_NAME_BANCONTACT,
Expand Down Expand Up @@ -154,6 +155,7 @@ if ( getUPEConfig( 'isWooPayEnabled' ) ) {
}

registerExpressPaymentMethod( paymentRequestPaymentMethod( api ) );
registerExpressPaymentMethod( expressCheckoutElementPaymentMethod( api ) );
window.addEventListener( 'load', () => {
enqueueFraudScripts( getUPEConfig( 'fraudServices' ) );
addCheckoutTracking();
Expand Down
27 changes: 25 additions & 2 deletions client/checkout/blocks/payment-elements.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* External dependencies
*/
import { useEffect, useState, RawHTML } from '@wordpress/element';
import { Elements } from '@stripe/react-stripe-js';
// eslint-disable-next-line import/no-unresolved
import { StoreNotice } from '@woocommerce/blocks-checkout';

/**
* Internal dependencies
*/
Expand All @@ -6,14 +14,16 @@ import { getAppearance, getFontRulesFromPage } from 'wcpay/checkout/upe-styles';
import { getUPEConfig } from 'wcpay/utils/checkout';
import { useFingerprint } from './hooks';
import { LoadableBlock } from 'wcpay/components/loadable';
import { Elements } from '@stripe/react-stripe-js';
import { useEffect, useState } from 'react';
import PaymentProcessor from './payment-processor';
import { getPaymentMethodTypes } from 'wcpay/checkout/utils/upe';

const PaymentElements = ( { api, ...props } ) => {
const stripe = api.getStripeForUPE( props.paymentMethodId );
const [ errorMessage, setErrorMessage ] = useState( null );
const [
paymentProcessorLoadErrorMessage,
setPaymentProcessorLoadErrorMessage,
] = useState( undefined );
const [ appearance, setAppearance ] = useState(
getUPEConfig( 'wcBlocksUPEAppearance' )
);
Expand Down Expand Up @@ -63,10 +73,23 @@ const PaymentElements = ( { api, ...props } ) => {
fonts: fontRules,
} }
>
{ paymentProcessorLoadErrorMessage?.error?.message && (
<div className="wc-block-components-notices">
<StoreNotice status="error" isDismissible={ false }>
<RawHTML>
{
paymentProcessorLoadErrorMessage.error
.message
}
</RawHTML>
</StoreNotice>
</div>
) }
<PaymentProcessor
api={ api }
errorMessage={ errorMessage }
fingerprint={ fingerprint }
onLoadError={ setPaymentProcessorLoadErrorMessage }
{ ...props }
/>
</Elements>
Expand Down
18 changes: 12 additions & 6 deletions client/checkout/blocks/payment-method-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,29 @@ export default ( {
const bnplMethods = [ 'affirm', 'afterpay_clearpay', 'klarna' ];

// Stripe expects the amount to be sent as the minor unit of 2 digits.
const amount = normalizeCurrencyToMinorUnit(
cartData.totals.total_price,
cartData.totals.currency_minor_unit
const amount = parseInt(
normalizeCurrencyToMinorUnit(
cartData.totals.total_price,
cartData.totals.currency_minor_unit
),
10
);

// Customer's country or base country of the store.
const currentCountry =
cartData.billingAddress.country ||
window.wcBlocksCheckoutData.storeCountry;
window.wcBlocksCheckoutData?.storeCountry ||
'US';

return (
<>
<span>
{ upeConfig.title }
{ bnplMethods.includes( upeName ) &&
( upeConfig.countries.length === 0 ||
upeConfig.countries.includes( currentCountry ) ) && (
upeConfig.countries.includes( currentCountry ) ) &&
amount > 0 &&
currentCountry && (
<>
<Elements
stripe={ api.getStripeForUPE( upeName ) }
Expand All @@ -44,7 +50,7 @@ export default ( {
>
<PaymentMethodMessagingElement
options={ {
amount: parseInt( amount, 10 ) || 0,
amount: amount || 0,
currency:
cartData.totals.currency_code ||
'USD',
Expand Down
Loading
Loading