Skip to content

Commit

Permalink
Merge branch 'develop' into tweak/using-blocks-api-to-process-cart-re…
Browse files Browse the repository at this point in the history
…quests
  • Loading branch information
wjrosa authored Jan 29, 2025
2 parents 2af80a8 + 799a6ba commit 2f5f10d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Fix - Fetch the payment intent status on order edit page only for unpaid orders if manual capture is enabled.
* Fix - Error when changing subscription payment method to a 3D Secure card while using a custom checkout endpoint.
* Fix - Fixes the webhook order retrieval by intent charges by adding an array check.
* Add - Add total tax amount to metadata.
* Update - Update the translation for payment requests settings section notice.

= 9.1.1 - 2025-01-10 =
* Fix - Fixes the webhook order retrieval by intent charges. The processed event is an object, not an array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import interpolateComponents from 'interpolate-components';
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from '@stripe/stripe-js';
import styled from '@emotion/styled';
import PaymentRequestButtonPreview from './payment-request-button-preview';
import ExpressCheckoutPreviewComponent from './express-checkout-button-preview';
import {
Expand Down Expand Up @@ -166,20 +167,39 @@ const PaymentRequestsSettingsSection = () => {
}
};

const checkoutPageUrl = `${ ADMIN_URL }post.php?post=${
getSetting( 'storePages' )?.checkout?.id
}&action=edit`;
const StyledLink = styled.a`
&:focus,
&:visited {
box-shadow: none;
}
`;

return (
<Card className="express-checkout-settings">
<CardBody>
<Notice status="warning" isDismissible={ false }>
{ __(
'Some appearance settings may be overridden by the express payment section of the'
) }{ ' ' }
<a href={ checkoutPageUrl }>
{ __( 'Cart & Checkout blocks.' ) }
</a>
{ interpolateComponents( {
mixedString: __(
'Some appearance settings may be overridden by the express payment section of the ' +
'{{checkoutPageLink}}Cart & Checkout blocks{{/checkoutPageLink}}.',
'woocommerce-gateway-stripe'
),
components: {
checkoutPageLink: (
<StyledLink
href={ `${ ADMIN_URL }post.php?post=${
getSetting( 'storePages' )?.checkout?.id
}&action=edit` }
target="_blank"
rel="noreferrer"
onClick={ ( ev ) => {
// Stop propagation is necessary so it doesn't trigger the tooltip click event.
ev.stopPropagation();
} }
/>
),
},
} ) }
</Notice>
<h4>
{ __(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,7 @@ public function get_metadata_from_order( $order ) {
'order_key' => $order->get_order_key(),
'payment_type' => $payment_type,
'signature' => $this->get_order_signature( $order ),
'tax_amount' => WC_Stripe_Helper::get_stripe_amount( $order->get_total_tax(), strtolower( $order->get_currency() ) ),
];

return apply_filters( 'wc_stripe_intent_metadata', $metadata, $order );
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
* Fix - Fetch the payment intent status on order edit page only for unpaid orders if manual capture is enabled.
* Fix - Error when changing subscription payment method to a 3D Secure card while using a custom checkout endpoint.
* Fix - Fixes the webhook order retrieval by intent charges by adding an array check.
* Add - Add total tax amount to metadata.
* Update - Update the translation for payment requests settings section notice.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
2 changes: 2 additions & 0 deletions tests/phpunit/test-class-wc-stripe-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ private function get_order_details( $order ) {
$order_id = $order->get_id();
$order_number = $order->get_order_number();
$order_key = $order->get_order_key();
$total_tax = $order->get_total_tax();
$amount = WC_Stripe_Helper::get_stripe_amount( $total, $currency );
$description = "Test Blog - Order $order_number";
$metadata = [
Expand All @@ -223,6 +224,7 @@ private function get_order_details( $order ) {
'order_key' => $order_key,
'payment_type' => 'single',
'signature' => sprintf( '%d:%s', $order->get_id(), md5( implode( '-', [ absint( $order->get_id() ), $order->get_order_key(), $order->get_customer_id(), $amount ] ) ) ),
'tax_amount' => WC_Stripe_Helper::get_stripe_amount( $total_tax, strtolower( $currency ) ),
];
return [ $amount, $description, $metadata ];
}
Expand Down

0 comments on commit 2f5f10d

Please sign in to comment.