Skip to content

Commit ab76dbe

Browse files
author
Woo
committed
Updates to 1.9.1
1 parent 967e01a commit ab76dbe

File tree

700 files changed

+845
-752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

700 files changed

+845
-752
lines changed

changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
*** Xero Integration ***
22

3+
2024-11-04 - version 1.9.1
4+
* Fix - Prevent fatal errors in the Xero connection process and enhance error handling.
5+
* Dev - Bump WordPress "tested up to" version 6.7.
6+
* Dev - Bump WordPress minimum supported version to 6.5.
7+
38
2024-10-14 - version 1.9.0
49
* Fix - Use a separate country list for the report tax type when creating a tax rate in Xero.
510
* Dev - Update secret key encryption to use the Sodium library for token encryption.

includes/class-wc-xr-settings.php

Lines changed: 68 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -482,22 +482,10 @@ public function oauth_redirect() {
482482

483483
// If we don't have an authorization code then get one.
484484
if ( ! isset( $_GET['code'] ) ) {
485-
?>
486-
<div class="wrap woocommerce">
487-
<div class="icon32 icon32-woocommerce-settings" id="icon-woocommerce"><br/></div>
488-
<h2><?php esc_html_e( 'Xero OAuth', 'woocommerce-xero' ); ?></h2>
489-
Something went wrong - token not received!
490-
</div>
491-
<?php
485+
$this->print_xero_connection_status( array( 'errorMessage' => esc_html__( 'Something went wrong - token not received!', 'woocommerce-xero' ) ) );
492486
// Check given state against previously stored one to mitigate CSRF attack.
493487
} elseif ( empty( $_GET['state'] ) || ( $_GET['state'] !== $state_transient ) ) {
494-
?>
495-
<div class="wrap woocommerce">
496-
<div class="icon32 icon32-woocommerce-settings" id="icon-woocommerce"><br/></div>
497-
<h2><?php esc_html_e( 'Xero OAuth', 'woocommerce-xero' ); ?></h2>
498-
Something went wrong - previous state is different. CSRF prevention.
499-
</div>
500-
<?php
488+
$this->print_xero_connection_status( array( 'errorMessage' => esc_html__( 'Something went wrong - previous state is different. CSRF prevention.', 'woocommerce-xero' ) ) );
501489
} else {
502490
try {
503491
$authorization_code = sanitize_text_field( $_GET['code'] );
@@ -510,9 +498,11 @@ public function oauth_redirect() {
510498
if ( $wc_xr_data_encryption->are_custom_xero_auth_keys_set() ) {
511499
update_option( 'wc_xero_auth_key_updated', true );
512500
}
513-
} catch ( \League\OAuth2\Client\Provider\Exception\IdentityProviderException $e ) {
501+
} catch ( Automattic\WooCommerce\Xero\Vendor\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e ) {
514502
if ( 'invalid_grant' === $e->getResponseBody()['error'] ) {
515503
$this->print_xero_connection_status( array( 'errorMessage' => 'invalid_grant' ) );
504+
} elseif ( 'invalid_client' === $e->getResponseBody()['error'] ) {
505+
$this->print_xero_connection_status( array( 'errorMessage' => 'invalid_client' ) );
516506
} else {
517507
?>
518508
<div class="wrap woocommerce">
@@ -526,7 +516,11 @@ public function oauth_redirect() {
526516
}
527517
}
528518
// Go back link.
529-
echo '</br><a href="' . esc_url( admin_url( 'admin.php?page=woocommerce_xero' ) ) . '">Go back to Xero settings page.</a>';
519+
?>
520+
<div class="wc-xero-status">
521+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=woocommerce_xero' ) ); ?>"><?php esc_html_e( 'Go back to Xero settings page.', 'woocommerce-xero' ); ?></a>
522+
</div>
523+
<?php
530524
}
531525

532526
/**
@@ -712,28 +706,69 @@ public function input_select( $args ) {
712706
/**
713707
* Helper function to print connection status.
714708
*
715-
* @param object $status
709+
* @param array $status Connection status.
716710
*/
717711
public function print_xero_connection_status( $status ) {
718-
echo '<div class="wc-xero-oauth-redirect-page">WooCommerce Xero authorization redirect page.</div>';
719-
echo '<div class="wc-xero-status">';
720-
echo '<img class="wc-xero-logo" src= ' . esc_attr( WC_XERO_ABSURL ) . 'assets/xero_logo_blue.png>';
721-
echo '</br><span><b>Connection status:</b>';
722-
if ( array_key_exists( 'correctRequest', $status ) ) {
723-
echo '<span class="wc-xero-oauth-connection-ok"><b> [OK]</b></span></span>';
724-
echo '<div>You are connected to <b>' . esc_html( $status['connectedCompany'] ) . '</b> organisation.</div>';
725-
} else {
726-
if ( $status['errorMessage'] === 'invalid_grant' ) {
727-
echo '<span class="wc-xero-oauth-connection-error"><b> [ERROR]</b></span></span>';
728-
echo '<div>Cannot request the access token, please connect your application again!</div>';
729-
echo '<div>For more information check the documentation page : <a href="https://docs.woocommerce.com/document/xero/#section-3">WooCommerce and Xero setup</a></div>';
730-
} elseif ( $status['errorMessage'] === 'no_connection' ) {
731-
echo '<div>Application not authorized with Xero! Pleas click Sign in with Xero button.</div>';
712+
?>
713+
<div class="wc-xero-oauth-redirect-page"><?php esc_html_e( 'WooCommerce Xero authorization redirect page.', 'woocommerce-xero' ); ?></div>
714+
<div class="wc-xero-status">
715+
<img class="wc-xero-logo" src="<?php echo esc_url( WC_XERO_ABSURL . 'assets/xero_logo_blue.png' ); ?>" >
716+
</br><span><b><?php esc_html_e( 'Connection status:', 'woocommerce-xero' ); ?></b>
717+
<?php
718+
if ( array_key_exists( 'correctRequest', $status ) ) {
719+
?>
720+
<span class="wc-xero-oauth-connection-ok"><b> <?php esc_html_e( '[OK]', 'woocommerce-xero' ); ?></b></span></span>
721+
<div>
722+
<?php
723+
echo wp_kses(
724+
sprintf(
725+
// translators: %s: company name.
726+
__( 'You are connected to %s organisation.', 'woocommerce-xero' ),
727+
'<strong>' . esc_html( $status['connectedCompany'] ) . '</strong>'
728+
),
729+
array( 'strong' => array() )
730+
);
731+
?>
732+
</div>
733+
<?php
734+
} elseif ( 'invalid_grant' === $status['errorMessage'] ) {
735+
?>
736+
<span class="wc-xero-oauth-connection-error"><b> <?php esc_html_e( '[ERROR]', 'woocommerce-xero' ); ?></b></span></span>
737+
<div><?php esc_html_e( 'Cannot request the access token, please connect your application again!', 'woocommerce-xero' ); ?></div>
738+
<div>
739+
<?php
740+
echo wp_kses(
741+
__( 'For more information check the documentation page: <a href="https://woocommerce.com/document/xero/#setup-and-configuration">WooCommerce and Xero setup</a>', 'woocommerce-xero' ),
742+
array( 'a' => array( 'href' => array() ) )
743+
);
744+
?>
745+
</div>
746+
<?php
747+
} elseif ( 'invalid_client' === $status['errorMessage'] ) {
748+
?>
749+
<span class="wc-xero-oauth-connection-error"><b> <?php esc_html_e( '[ERROR]', 'woocommerce-xero' ); ?></b></span></span>
750+
<div><?php esc_html_e( 'Authentication failed: It appears the client credentials are incorrect. Please verify them and try again.', 'woocommerce-xero' ); ?></div>
751+
<div>
752+
<?php
753+
echo wp_kses(
754+
__( 'For more information check the documentation page: <a href="https://woocommerce.com/document/xero/#setup-and-configuration">WooCommerce and Xero setup</a>', 'woocommerce-xero' ),
755+
array( 'a' => array( 'href' => array() ) )
756+
);
757+
?>
758+
</div>
759+
<?php
760+
} elseif ( 'no_connection' === $status['errorMessage'] ) {
761+
?>
762+
<div>
763+
<?php esc_html_e( 'Application not authorized with Xero! Please click Sign in with Xero button.', 'woocommerce-xero' ); ?>
764+
</div>
765+
<?php
732766
} else {
733767
echo esc_html( $status['errorMessage'] ) . '</span>';
734768
}
735-
}
736-
echo '</div">';
769+
?>
770+
</div>
771+
<?php
737772
}
738773

739774
/**

languages/woocommerce-xero.pot

Lines changed: 73 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# This file is distributed under the same license as the WooCommerce Xero Integration package.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: WooCommerce Xero Integration 1.9.0\n"
5+
"Project-Id-Version: WooCommerce Xero Integration 1.9.1\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-xero\n"
7-
"POT-Creation-Date: 2024-10-14 14:39:56+00:00\n"
7+
"POT-Creation-Date: 2024-11-04 13:26:36+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
@@ -418,52 +418,63 @@ msgid "Xero Settings"
418418
msgstr ""
419419

420420
#: includes/class-wc-xr-settings.php:457 includes/class-wc-xr-settings.php:458
421-
#: includes/class-wc-xr-settings.php:488 includes/class-wc-xr-settings.php:497
422-
#: includes/class-wc-xr-settings.php:520
421+
#: includes/class-wc-xr-settings.php:510
423422
msgid "Xero OAuth"
424423
msgstr ""
425424

426-
#: includes/class-wc-xr-settings.php:540
425+
#: includes/class-wc-xr-settings.php:485
426+
msgid "Something went wrong - token not received!"
427+
msgstr ""
428+
429+
#: includes/class-wc-xr-settings.php:488
430+
msgid "Something went wrong - previous state is different. CSRF prevention."
431+
msgstr ""
432+
433+
#: includes/class-wc-xr-settings.php:521
434+
msgid "Go back to Xero settings page."
435+
msgstr ""
436+
437+
#: includes/class-wc-xr-settings.php:534
427438
msgid "Xero for WooCommerce"
428439
msgstr ""
429440

430-
#: includes/class-wc-xr-settings.php:544
441+
#: includes/class-wc-xr-settings.php:538
431442
msgid "Your settings have been saved."
432443
msgstr ""
433444

434-
#: includes/class-wc-xr-settings.php:557
445+
#: includes/class-wc-xr-settings.php:551
435446
msgid "Missing required fields"
436447
msgstr ""
437448

438-
#: includes/class-wc-xr-settings.php:563
449+
#: includes/class-wc-xr-settings.php:557
439450
msgid "There was an error saving your settings."
440451
msgstr ""
441452

442-
#: includes/class-wc-xr-settings.php:580
453+
#: includes/class-wc-xr-settings.php:574
443454
msgid ""
444455
"Settings for your Xero account including security keys and default account "
445456
"numbers."
446457
msgstr ""
447458

448-
#: includes/class-wc-xr-settings.php:583
459+
#: includes/class-wc-xr-settings.php:577
449460
#. translators: %1$s: opening anchor tag; %2$s: closing anchor tag
450461
msgid "Please ensure you're following all %1$srequirements%2$s prior to setup."
451462
msgstr ""
452463

453-
#: includes/class-wc-xr-settings.php:586
464+
#: includes/class-wc-xr-settings.php:580
454465
#. translators: %1$s: opening strong tag; %2$s: closing strong tag
455466
msgid "%1$sAll%2$s text fields are required for the integration to work properly."
456467
msgstr ""
457468

458-
#: includes/class-wc-xr-settings.php:624
469+
#: includes/class-wc-xr-settings.php:618
459470
msgid "Disconnect from Xero"
460471
msgstr ""
461472

462-
#: includes/class-wc-xr-settings.php:632
473+
#: includes/class-wc-xr-settings.php:626
463474
msgid "Sign in with Xero"
464475
msgstr ""
465476

466-
#: includes/class-wc-xr-settings.php:637
477+
#: includes/class-wc-xr-settings.php:631
467478
#. translators: %1$s: line break tag; %2$s: opening anchor tag; %3$s: closing
468479
#. anchor tag;
469480
msgid ""
@@ -472,33 +483,75 @@ msgid ""
472483
"%2$srequirements%3$s prior to setup."
473484
msgstr ""
474485

475-
#: includes/class-wc-xr-settings.php:673
486+
#: includes/class-wc-xr-settings.php:667
476487
msgid ""
477488
"Please use the following url as your redirect url when creating a Xero "
478489
"application:"
479490
msgstr ""
480491

481-
#: includes/class-wc-xr-settings.php:787
492+
#: includes/class-wc-xr-settings.php:713
493+
msgid "WooCommerce Xero authorization redirect page."
494+
msgstr ""
495+
496+
#: includes/class-wc-xr-settings.php:716
497+
msgid "Connection status:"
498+
msgstr ""
499+
500+
#: includes/class-wc-xr-settings.php:720
501+
msgid "[OK]"
502+
msgstr ""
503+
504+
#: includes/class-wc-xr-settings.php:726
505+
#. translators: %s: company name.
506+
msgid "You are connected to %s organisation."
507+
msgstr ""
508+
509+
#: includes/class-wc-xr-settings.php:736 includes/class-wc-xr-settings.php:749
510+
msgid "[ERROR]"
511+
msgstr ""
512+
513+
#: includes/class-wc-xr-settings.php:737
514+
msgid "Cannot request the access token, please connect your application again!"
515+
msgstr ""
516+
517+
#: includes/class-wc-xr-settings.php:741 includes/class-wc-xr-settings.php:754
518+
msgid ""
519+
"For more information check the documentation page: <a "
520+
"href=\"https://woocommerce.com/document/xero/#setup-and-configuration\""
521+
">WooCommerce and Xero setup</a>"
522+
msgstr ""
523+
524+
#: includes/class-wc-xr-settings.php:750
525+
msgid ""
526+
"Authentication failed: It appears the client credentials are incorrect. "
527+
"Please verify them and try again."
528+
msgstr ""
529+
530+
#: includes/class-wc-xr-settings.php:763
531+
msgid "Application not authorized with Xero! Please click Sign in with Xero button."
532+
msgstr ""
533+
534+
#: includes/class-wc-xr-settings.php:822
482535
msgid "Xero authentication using keys is deprecated and no longer works."
483536
msgstr ""
484537

485-
#: includes/class-wc-xr-settings.php:788
538+
#: includes/class-wc-xr-settings.php:823
486539
msgid ""
487540
"Please use new flow and the button available in Xero settings to authorize "
488541
"your application."
489542
msgstr ""
490543

491-
#: includes/class-wc-xr-settings.php:790
544+
#: includes/class-wc-xr-settings.php:825
492545
msgid "Go to Xero settings page"
493546
msgstr ""
494547

495-
#: includes/class-wc-xr-settings.php:807
548+
#: includes/class-wc-xr-settings.php:842
496549
msgid ""
497550
"Unable to fetch the Branding Theme details. Please ensure your Xero "
498551
"connection is properly authenticated."
499552
msgstr ""
500553

501-
#: includes/class-wc-xr-settings.php:827
554+
#: includes/class-wc-xr-settings.php:862
502555
msgid ""
503556
"Xero account was disconnected because authentication keys were changed. "
504557
"Please connect again."

lib/packages/firebase/php-jwt/src/BeforeValidException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/CachedKeySet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/ExpiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWK.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88
namespace Automattic\WooCommerce\Xero\Vendor\Firebase\JWT;

lib/packages/firebase/php-jwt/src/Key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 14-October-2024 using Strauss.
5+
* Modified by woocommerce on 04-November-2024 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

0 commit comments

Comments
 (0)