Skip to content

Commit

Permalink
Merge branch 'develop' into fix/woopay-theming-border-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
malithsen authored Oct 17, 2024
2 parents cff7707 + b6fc858 commit dd52494
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .github/actions/e2e/env-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ runs:
echo "::group::Setup E2E test environment"
npm run test:e2e-setup
echo "::endgroup::"
# Disable restrictions that prevent chromium from running properly. See: https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor User Namespace Restrictions
shell: bash
run: |
echo "::group::Disable AppArmor User Namespace Restrictions"
sudo sysctl --ignore --write kernel.apparmor_restrict_unprivileged_userns=0
echo "::endgroup::"
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** WooPayments Changelog ***

= 8.3.1 - 2024-10-16 =
* Fix - Auto-enabled WooPay for new accounts.
* Fix - Load Stripe with merchant account's key when checking payment method availability.

= 8.3.0 - 2024-10-03 =
* Add - Add compatibility with the buttonAttributes API from Woo Blocks
* Add - Add rate limiter to compatibility data updates
Expand Down
4 changes: 4 additions & 0 deletions changelog/dev-use-official-docker-hub-phpmyadmin-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Use official `phpmyadmin` Docker Hub container image
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Prevented detaching payment methods from live Stripe accounts when working in non-production environments.
4 changes: 4 additions & 0 deletions changelog/fix-9518-apple-pay-button-on-blocks-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Load Stripe with merchant account's key when checking payment method availability.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const checkPaymentMethodIsAvailable = memoize(

root.render(
<Elements
stripe={ api.loadStripe() }
stripe={ api.loadStripe( true ) }
options={ {
mode: 'payment',
paymentMethodCreation: 'manual',
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
- ./docker/data:/var/lib/mysql
phpMyAdmin:
container_name: woocommerce_payments_phpmyadmin
image: phpmyadmin/phpmyadmin:latest
image: phpmyadmin:latest
ports:
- "8083:80"
env_file:
Expand Down
34 changes: 25 additions & 9 deletions includes/class-wc-payments-token-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,34 @@ private function is_payment_method_enabled( $payment_method ) {
* Delete token from Stripe.
*
* @param string $token_id Token ID.
* @param WC_Payment_Token $token Token object.
* @param WC_Payment_Token $token Token object.
*
* @throws Exception
*/
public function woocommerce_payment_token_deleted( $token_id, $token ) {

if ( in_array( $token->get_gateway_id(), self::REUSABLE_GATEWAYS_BY_PAYMENT_METHOD, true ) ) {
try {
$this->payments_api_client->detach_payment_method( $token->get_token() );
// Clear cached payment methods.
$this->customer_service->clear_cached_payment_methods_for_user( $token->get_user_id() );
} catch ( Exception $e ) {
Logger::log( 'Error detaching payment method:' . $e->getMessage() );
}
// If it's not reusable payment method, we don't need to perform any additional checks.
if ( ! in_array( $token->get_gateway_id(), self::REUSABLE_GATEWAYS_BY_PAYMENT_METHOD, true ) ) {
return;
}
// First check if it's live mode.
// Second check if it's admin.
// Third check if it's not production environment.
// When all conditions are met, we don't want to delete the payment method from Stripe.
// This is to avoid detaching the payment method from the live stripe account on non production environments.
if (
WC_Payments::mode()->is_live() &&
is_admin() &&
'production' !== wp_get_environment_type()
) {
return;
}
try {
$this->payments_api_client->detach_payment_method( $token->get_token() );
// Clear cached payment methods.
$this->customer_service->clear_cached_payment_methods_for_user( $token->get_user_id() );
} catch ( Exception $e ) {
Logger::log( 'Error detaching payment method:' . $e->getMessage() );
}
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woocommerce-payments",
"version": "8.3.0",
"version": "8.3.1",
"main": "webpack.config.js",
"author": "Automattic",
"license": "GPL-3.0-or-later",
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.3
Stable tag: 8.3.0
Stable tag: 8.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -94,6 +94,11 @@ Please note that our support for the checkout block is still experimental and th

== Changelog ==

= 8.3.1 - 2024-10-16 =
* Fix - Auto-enabled WooPay for new accounts.
* Fix - Load Stripe with merchant account's key when checking payment method availability.


= 8.3.0 - 2024-10-03 =
* Add - Add compatibility with the buttonAttributes API from Woo Blocks
* Add - Add rate limiter to compatibility data updates
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* WC tested up to: 9.3.3
* Requires at least: 6.0
* Requires PHP: 7.3
* Version: 8.3.0
* Version: 8.3.1
* Requires Plugins: woocommerce
*
* @package WooCommerce\Payments
Expand Down

0 comments on commit dd52494

Please sign in to comment.