Skip to content

Commit

Permalink
Merge branch 'develop' into fix/allow-ideal-tokens-saving-when-sepa-i…
Browse files Browse the repository at this point in the history
…s-disabled
  • Loading branch information
wjrosa committed Dec 23, 2024
2 parents db6e796 + a1147b5 commit 43095f4
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 25 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

= 9.1.0 - xxxx-xx-xx =
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.
* Fix - Don't update canceled order status to on-hold when a dispute is opened.
* Fix - Correctly sets the dispute opened note when a dispute does not require any further action.
Expand Down
16 changes: 10 additions & 6 deletions client/blocks/credit-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ const StripeLabel = ( props ) => {
};

const cardIcons = getStripeCreditCardIcons();
const supports = {
// Use `false` as fallback values in case server provided configuration is missing.
showSavedCards: getBlocksConfiguration()?.showSavedCards ?? false,
showSaveOption: getBlocksConfiguration()?.showSaveOption ?? false,
features: getBlocksConfiguration()?.supports ?? [],
};
if ( getBlocksConfiguration().isAdmin ?? false ) {
supports.style = getBlocksConfiguration()?.style ?? [];
}
const stripeCcPaymentMethod = {
name: PAYMENT_METHOD_NAME,
label: <StripeLabel />,
Expand All @@ -53,12 +62,7 @@ const stripeCcPaymentMethod = {
'Stripe Credit Card payment method',
'woocommerce-gateway-stripe'
),
supports: {
// Use `false` as fallback values in case server provided configuration is missing.
showSavedCards: getBlocksConfiguration()?.showSavedCards ?? false,
showSaveOption: getBlocksConfiguration()?.showSaveOption ?? false,
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
};

export default stripeCcPaymentMethod;
19 changes: 10 additions & 9 deletions client/blocks/express-checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import { PAYMENT_METHOD_LINK } from 'wcstripe/stripe-utils/constants';

const stripePromise = loadStripe();

const supports = {
features: getBlocksConfiguration()?.supports ?? [],
};
if ( getBlocksConfiguration().isAdmin ?? false ) {
supports.style = getBlocksConfiguration()?.style ?? [];
}

const expressCheckoutElementsGooglePay = ( api ) => ( {
name: PAYMENT_METHOD_EXPRESS_CHECKOUT_ELEMENT + '_googlePay',
title: 'WooCommerce Stripe - Google Pay',
Expand Down Expand Up @@ -41,9 +48,7 @@ const expressCheckoutElementsGooglePay = ( api ) => ( {
},
paymentMethodId: PAYMENT_METHOD_EXPRESS_CHECKOUT_ELEMENT,
gatewayId: 'stripe',
supports: {
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
} );

const expressCheckoutElementsApplePay = ( api ) => ( {
Expand Down Expand Up @@ -73,9 +78,7 @@ const expressCheckoutElementsApplePay = ( api ) => ( {
},
paymentMethodId: PAYMENT_METHOD_EXPRESS_CHECKOUT_ELEMENT,
gatewayId: 'stripe',
supports: {
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
} );

const expressCheckoutElementsStripeLink = ( api ) => ( {
Expand Down Expand Up @@ -108,9 +111,7 @@ const expressCheckoutElementsStripeLink = ( api ) => ( {
} );
},
paymentMethodId: PAYMENT_METHOD_EXPRESS_CHECKOUT_ELEMENT,
supports: {
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
} );

export {
Expand Down
11 changes: 8 additions & 3 deletions client/blocks/payment-request/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ const ApplePayPreview = () => <img src={ applePayImage } alt="" />;

const componentStripePromise = loadStripe();

const supports = {
features: getBlocksConfiguration()?.supports ?? [],
};
if ( getBlocksConfiguration().isAdmin ?? false ) {
supports.style = getBlocksConfiguration()?.style ?? [];
}

const paymentRequestPaymentMethod = {
name: PAYMENT_METHOD_NAME,
title: 'Stripe',
Expand Down Expand Up @@ -63,9 +70,7 @@ const paymentRequestPaymentMethod = {
} );
},
paymentMethodId: 'stripe',
supports: {
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
};

export default paymentRequestPaymentMethod;
17 changes: 10 additions & 7 deletions client/blocks/upe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Object.entries( paymentMethodsConfig )
}

const Icon = Icons[ iconName ];
const supports = {
// Use `false` as fallback values in case server provided configuration is missing.
showSavedCards: getBlocksConfiguration()?.showSavedCards ?? false,
showSaveOption: upeConfig.showSaveOption ?? false,
features: getBlocksConfiguration()?.supports ?? [],
};
if ( getBlocksConfiguration().isAdmin ?? false ) {
supports.style = getBlocksConfiguration()?.style ?? [];
}

registerPaymentMethod( {
name: upeMethods[ upeName ],
Expand Down Expand Up @@ -95,13 +104,7 @@ Object.entries( paymentMethodsConfig )
</>
),
ariaLabel: 'Stripe',
supports: {
// Use `false` as fallback values in case server provided configuration is missing.
showSavedCards:
getBlocksConfiguration()?.showSavedCards ?? false,
showSaveOption: upeConfig.showSaveOption ?? false,
features: getBlocksConfiguration()?.supports ?? [],
},
supports,
} );
} );

Expand Down
14 changes: 14 additions & 0 deletions includes/class-wc-stripe-blocks-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function get_payment_method_data() {
'button' => [
'customLabel' => $this->payment_request_configuration->get_button_label(),
],
'style' => $this->get_style(),
]
);
}
Expand Down Expand Up @@ -250,6 +251,19 @@ private function should_show_payment_request_button() {
return $this->payment_request_configuration->should_show_payment_request_button();
}

/**
* Returns an array of style properties supported by the payment method.
* This method is used only when rendering the payment method in the editor.
*
* @return array Array of style properties.
*/
private function get_style() {
return [
'height',
'borderRadius',
];
}

/**
* Returns true if the ECE should be shown on the current page, false otherwise.
*
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o

= 9.1.0 - xxxx-xx-xx =
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.
* Fix - Don't update canceled order status to on-hold when a dispute is opened.
* Fix - Correctly sets the dispute opened note when a dispute does not require any further action.
Expand Down

0 comments on commit 43095f4

Please sign in to comment.