Skip to content

Commit

Permalink
Merge branch 'develop' into dev/7886-add-country-codes-enum
Browse files Browse the repository at this point in the history
  • Loading branch information
zmaglica authored Jan 9, 2024
2 parents 71264d5 + 7b71828 commit b2a392e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
3 changes: 3 additions & 0 deletions changelog/dev-refactor-order-dispute-refundable-util
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Significance: patch
Type: dev
Comment: Not user-facing: refactors the refund eligibility logic for disputed orders
4 changes: 4 additions & 0 deletions changelog/fix-2395-rerender-woopay-button-on-cart-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Re-render WooPay button when cart updates, when checkout updates.
4 changes: 4 additions & 0 deletions changelog/fix-woopay-tablet-breakpoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Update WooPay tablet breakpoint.
2 changes: 1 addition & 1 deletion client/checkout/woopay/email-input-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const handleWooPayEmailInput = async (
}

// If the window width is less than the breakpoint, reset the styles and return.
if ( fullScreenModalBreakpoint >= window.innerWidth ) {
if ( fullScreenModalBreakpoint > window.innerWidth ) {
iframe.style.left = '0';
iframe.style.right = '';
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const expressCheckoutIframe = async ( api, context, emailSelector ) => {
}

// If the window width is less than the breakpoint, set iframe to full window
if ( fullScreenModalBreakpoint >= window.innerWidth ) {
if ( fullScreenModalBreakpoint > window.innerWidth ) {
iframe.style.left = '0';
iframe.style.right = '';
iframe.style.top = '0';
Expand Down
11 changes: 6 additions & 5 deletions client/checkout/woopay/express-button/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global jQuery */
/**
* External dependencies
*/
Expand Down Expand Up @@ -57,17 +58,17 @@ const renderWooPayExpressCheckoutButtonWithCallbacks = () => {
renderWooPayExpressCheckoutButton( listenForCartChanges );
};

document.addEventListener( 'DOMContentLoaded', () => {
jQuery( ( $ ) => {
listenForCartChanges = {
start: () => {
document.body.addEventListener(
'updated_cart_totals',
$( document.body ).on(
'updated_cart_totals updated_checkout',
renderWooPayExpressCheckoutButtonWithCallbacks
);
},
stop: () => {
document.body.removeEventListener(
'updated_cart_totals',
$( document.body ).off(
'updated_cart_totals updated_checkout',
renderWooPayExpressCheckoutButtonWithCallbacks
);
},
Expand Down
10 changes: 3 additions & 7 deletions client/components/disputed-order-notice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getDetailsURL } from 'wcpay/components/details-link';
import {
isAwaitingResponse,
isInquiry,
isRefundable,
isUnderReview,
} from 'wcpay/disputes/utils';
import { useCharge } from 'wcpay/data';
Expand All @@ -30,10 +31,7 @@ const DisputedOrderNoticeHandler = ( { chargeId, onDisableOrderRefund } ) => {
if ( ! charge?.dispute ) {
return;
}
// Refunds are only allowed if the dispute is an inquiry or if it's won.
const isRefundable =
isInquiry( dispute ) || [ 'won' ].includes( dispute.status );
if ( ! isRefundable ) {
if ( ! isRefundable( dispute.status ) ) {
onDisableOrderRefund( dispute.status );
}
}, [ charge, onDisableOrderRefund ] );
Expand All @@ -42,8 +40,6 @@ const DisputedOrderNoticeHandler = ( { chargeId, onDisableOrderRefund } ) => {
if ( ! charge?.dispute ) {
return null;
}
const isRefundable =
isInquiry( dispute ) || [ 'won' ].includes( dispute.status );

// Special case the dispute "under review" notice which is much simpler.
// (And return early.)
Expand All @@ -66,7 +62,7 @@ const DisputedOrderNoticeHandler = ( { chargeId, onDisableOrderRefund } ) => {
// This may be dead code. Leaving in for now as this is consistent with
// the logic before this PR.
// https://github.com/Automattic/woocommerce-payments/pull/7557
if ( dispute.status === 'lost' && ! isRefundable ) {
if ( dispute.status === 'lost' ) {
return (
<DisputeOrderLockedNotice
message={ __(
Expand Down

0 comments on commit b2a392e

Please sign in to comment.