Skip to content

Commit

Permalink
Merge release/6.4.1 into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
shendy-a8c committed Sep 6, 2023
2 parents 09fe431 + b56cfcf commit 4f75334
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 60 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ on:
pull_request

env:
WC_MIN_SUPPORTED_VERSION: '7.8.0'
WP_MIN_SUPPORTED_VERSION: '6.1'
WC_MIN_SUPPORTED_VERSION: '7.6.0'
WP_MIN_SUPPORTED_VERSION: '6.0'
PHP_MIN_SUPPORTED_VERSION: '7.3'
GUTENBERG_VERSION_FOR_WP_MIN: '15.7.0'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -24,7 +23,7 @@ jobs:
id: generate_matrix
run: |
WC_VERSIONS=$( echo "[\"$WC_MIN_SUPPORTED_VERSION\", \"latest\", \"beta\"]" )
MATRIX_INCLUDE=$( echo "[{\"woocommerce\":\"$WC_MIN_SUPPORTED_VERSION\",\"wordpress\":\"$WP_MIN_SUPPORTED_VERSION\",\"gutenberg\":\"$GUTENBERG_VERSION_FOR_WP_MIN\",\"php\":\"$PHP_MIN_SUPPORTED_VERSION\"}]" )
MATRIX_INCLUDE=$( echo "[{\"woocommerce\":\"$WC_MIN_SUPPORTED_VERSION\",\"wordpress\":\"$WP_MIN_SUPPORTED_VERSION\",\"gutenberg\":\"13.6.0\",\"php\":\"$PHP_MIN_SUPPORTED_VERSION\"}]" )
echo "matrix={\"woocommerce\":$WC_VERSIONS,\"wordpress\":[\"latest\"],\"gutenberg\":[\"latest\"],\"php\":[\"7.4\"], \"include\":$MATRIX_INCLUDE}" >> $GITHUB_OUTPUT
woocommerce-compatibility:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
E2E_SLACK_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
E2E_USE_LOCAL_SERVER: false
E2E_RESULT_FILEPATH: 'tests/e2e/results.json'
WC_MIN_SUPPORTED_VERSION: '7.8.0'
WC_MIN_SUPPORTED_VERSION: '7.6.0'
NODE_ENV: 'test'
FORCE_E2E_DEPS_SETUP: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

env:
WP_VERSION: latest
WC_MIN_SUPPORTED_VERSION: '7.8.0'
WC_MIN_SUPPORTED_VERSION: '7.6.0'
GUTENBERG_VERSION: latest
PHP_MIN_SUPPORTED_VERSION: '7.3'

Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
*** WooPayments Changelog ***

= 6.4.1 - 2023-09-06 =
* Fix - checkout processing when fields are hidden via customizer
* Fix - Potential fatal error when viewing WooCommerce home because we try to check if store has been fully onboarded but account service is not yet initialized.
* Fix - Resolved an issue with WCPay Subscription orders being set to failed during payment processing when Woo Subscriptions plugin is active.
* Fix - Use the gateway from the Checkout class in case the main registered gateway isn't initialized for some reason.
* Dev - Revert - Bump minimum required version of WooCommerce to 8.0.0 and WP to 6.1
* Dev - Setting the minimum required version of WooCommerce back to 7.8.0 and WP to 6.0

= 6.4.0 - 2023-08-31 =
* Add - Added the Transactions reporting endpoint
* Add - Adjust WooPay "custom message" to be reused for T&C and privacy policy
Expand Down
4 changes: 0 additions & 4 deletions changelog/fix-7109-fatal-on-wc-home-task

This file was deleted.

4 changes: 0 additions & 4 deletions changelog/issue-7123

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,25 @@ function createStripePaymentMethod(
name: document.querySelector( '#billing_first_name' )
? (
document.querySelector( '#billing_first_name' )
.value +
?.value +
' ' +
document.querySelector( '#billing_last_name' ).value
document.querySelector( '#billing_last_name' )
?.value
).trim()
: undefined,
email: document.querySelector( '#billing_email' ).value,
phone: document.querySelector( '#billing_phone' ).value,
email: document.querySelector( '#billing_email' )?.value,
phone: document.querySelector( '#billing_phone' )?.value,
address: {
city: document.querySelector( '#billing_city' ).value,
country: document.querySelector( '#billing_country' ).value,
line1: document.querySelector( '#billing_address_1' ).value,
line2: document.querySelector( '#billing_address_2' ).value,
city: document.querySelector( '#billing_city' )?.value,
country: document.querySelector( '#billing_country' )
?.value,
line1: document.querySelector( '#billing_address_1' )
?.value,
line2: document.querySelector( '#billing_address_2' )
?.value,
postal_code: document.querySelector( '#billing_postcode' )
.value,
state: document.querySelector( '#billing_state' ).value,
?.value,
state: document.querySelector( '#billing_state' )?.value,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,12 @@ describe( 'Payment processing', () => {

const mockJqueryForm = {
submit: jest.fn(),
addClass: jest.fn( () => {
return {
block: jest.fn(),
};
} ),
removeClass: jest.fn(),
unblock: jest.fn(),
addClass: jest.fn( () => ( {
block: jest.fn(),
} ) ),
removeClass: jest.fn( () => ( {
unblock: jest.fn(),
} ) ),
attr: jest.fn().mockReturnValue( 'checkout' ),
};

Expand Down Expand Up @@ -377,13 +376,46 @@ describe( 'Payment processing', () => {

const checkoutForm = {
submit: jest.fn(),
addClass: jest.fn( () => {
return {
block: jest.fn(),
};
} ),
removeClass: jest.fn(),
unblock: jest.fn(),
addClass: jest.fn( () => ( {
block: jest.fn(),
} ) ),
removeClass: jest.fn( () => ( {
unblock: jest.fn(),
} ) ),
attr: jest.fn().mockReturnValue( 'checkout' ),
};

await processPayment( apiMock, checkoutForm, 'card' );

expect( mockCreatePaymentMethod ).toHaveBeenCalledWith( {
elements: expect.any( Object ),
params: {
billing_details: expect.any( Object ),
},
} );
} );

test( 'Payment processing does not create error when some fields are hidden via customizer', async () => {
setupBillingDetailsFields();
// pretending that the customizer removed the billing phone field
document.body.removeChild( document.getElementById( 'billing_phone' ) );
getFingerprint.mockImplementation( () => {
return 'fingerprint';
} );

const mockDomElement = document.createElement( 'div' );
mockDomElement.dataset.paymentMethodType = 'card';

await mountStripePaymentElement( apiMock, mockDomElement );

const checkoutForm = {
submit: jest.fn(),
addClass: jest.fn( () => ( {
block: jest.fn(),
} ) ),
removeClass: jest.fn( () => ( {
unblock: jest.fn(),
} ) ),
attr: jest.fn().mockReturnValue( 'checkout' ),
};

Expand All @@ -410,13 +442,12 @@ describe( 'Payment processing', () => {

const addPaymentMethodForm = {
submit: jest.fn(),
addClass: jest.fn( () => {
return {
block: jest.fn(),
};
} ),
removeClass: jest.fn(),
unblock: jest.fn(),
addClass: jest.fn( () => ( {
block: jest.fn(),
} ) ),
removeClass: jest.fn( () => ( {
unblock: jest.fn(),
} ) ),
attr: jest.fn().mockReturnValue( 'add_payment_method' ),
};

Expand Down
5 changes: 4 additions & 1 deletion includes/class-wc-payments-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public function get_payment_fields_js_config() {
// Needed to init the hooks.
WC_Checkout::instance();

// The registered card gateway is more reliable than $this->gateway, but if it isn't available for any reason, fall back to the gateway provided to this checkout class.
$gateway = WC_Payments::get_registered_card_gateway() ?? $this->gateway;

$js_config = [
'publishableKey' => $this->account->get_publishable_key( WC_Payments::mode()->is_test() ),
'testMode' => WC_Payments::mode()->is_test(),
Expand All @@ -176,7 +179,7 @@ public function get_payment_fields_js_config() {
'genericErrorMessage' => __( 'There was a problem processing the payment. Please check your email inbox and refresh the page to try again.', 'woocommerce-payments' ),
'fraudServices' => $this->account->get_fraud_services_config(),
'features' => $this->gateway->supports,
'forceNetworkSavedCards' => WC_Payments::is_network_saved_cards_enabled() || WC_Payments::get_registered_card_gateway()->should_use_stripe_platform_on_checkout_page(),
'forceNetworkSavedCards' => WC_Payments::is_network_saved_cards_enabled() || $gateway->should_use_stripe_platform_on_checkout_page(),
'locale' => WC_Payments_Utils::convert_to_stripe_locale( get_locale() ),
'isPreview' => is_preview(),
'isUPEEnabled' => WC_Payments_Features::is_upe_enabled(),
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": "6.4.0",
"version": "6.4.1",
"main": "webpack.config.js",
"author": "Automattic",
"license": "GPL-3.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion phpcs-compat.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<exclude-pattern>tests/</exclude-pattern>

<!-- Configs -->
<config name="minimum_supported_wp_version" value="6.1" />
<config name="minimum_supported_wp_version" value="6.0" />
<config name="testVersion" value="7.3-" />

<rule ref="PHPCompatibility">
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<exclude-pattern>./lib/*</exclude-pattern>

<!-- Configs -->
<config name="minimum_supported_wp_version" value="6.1" />
<config name="minimum_supported_wp_version" value="6.0" />
<config name="testVersion" value="7.3-" />

<!-- Rules -->
Expand Down
18 changes: 13 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== WooPayments - Fully Integrated Solution Built and Supported by Woo ===
Contributors: woocommerce, automattic
Tags: payment gateway, payment, apple pay, credit card, google pay, woocommerce payments
Requires at least: 6.1
Tested up to: 6.3
Requires at least: 6.0
Tested up to: 6.2
Requires PHP: 7.3
Stable tag: 6.4.0
Stable tag: 6.4.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -38,8 +38,8 @@ Our global support team is available to answer questions you may have about WooP

= Requirements =

* WordPress 6.1 or newer.
* WooCommerce 7.8 or newer.
* WordPress 6.0 or newer.
* WooCommerce 7.6 or newer.
* PHP 7.3 or newer is recommended.

= Try it now =
Expand Down Expand Up @@ -94,6 +94,14 @@ Please note that our support for the checkout block is still experimental and th

== Changelog ==

= 6.4.1 - 2023-09-06 =
* Fix - checkout processing when fields are hidden via customizer
* Fix - Potential fatal error when viewing WooCommerce home because we try to check if store has been fully onboarded but account service is not yet initialized.
* Fix - Resolved an issue with WCPay Subscription orders being set to failed during payment processing when Woo Subscriptions plugin is active.
* Fix - Use the gateway from the Checkout class in case the main registered gateway isn't initialized for some reason.
* Dev - Revert - Bump minimum required version of WooCommerce to 8.0.0 and WP to 6.1
* Dev - Setting the minimum required version of WooCommerce back to 7.8.0 and WP to 6.0

= 6.4.0 - 2023-08-31 =
* Add - Added the Transactions reporting endpoint
* Add - Adjust WooPay "custom message" to be reused for T&C and privacy policy
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/test-class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,27 @@ public function test_force_network_saved_cards_is_returned_as_true_if_should_use
WC_Payments::set_registered_card_gateway( $registered_card_gateway );
}

public function test_registered_gateway_replaced_by_gateway_if_not_initialized() {
// Set the registered gateway to null to simulate the case where the gateway is not initialized and thus should be replaced by $mock_wcpay_gateway.
WC_Payments::set_registered_card_gateway( null );

$mock_wcpay_gateway = $this->get_partial_mock_for_gateway( [ 'should_use_stripe_platform_on_checkout_page' ] );

$mock_wcpay_gateway
->expects( $this->once() )
->method( 'should_use_stripe_platform_on_checkout_page' )
->willReturn( true );

$payments_checkout = new WC_Payments_Checkout(
$mock_wcpay_gateway,
$this->woopay_utilities,
$this->mock_wcpay_account,
$this->mock_customer_service
);

$this->assertTrue( $payments_checkout->get_payment_fields_js_config()['forceNetworkSavedCards'] );
}

public function test_force_network_saved_cards_is_returned_as_false_if_should_not_use_stripe_platform() {
$mock_wcpay_gateway = $this->get_partial_mock_for_gateway( [ 'should_use_stripe_platform_on_checkout_page' ] );

Expand Down
8 changes: 4 additions & 4 deletions woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
* Woo: 5278104:bf3cf30871604e15eec560c962593c1f
* Text Domain: woocommerce-payments
* Domain Path: /languages
* WC requires at least: 7.8
* WC tested up to: 8.0.0
* Requires at least: 6.1
* WC requires at least: 7.6
* WC tested up to: 7.8.0
* Requires at least: 6.0
* Requires PHP: 7.3
* Version: 6.4.0
* Version: 6.4.1
*
* @package WooCommerce\Payments
*/
Expand Down

0 comments on commit 4f75334

Please sign in to comment.