Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLR - do not clear session for incomplete orders #3335

Draft
wants to merge 1 commit into
base: feat/slr-support
Choose a base branch
from

Conversation

lucatume
Copy link
Contributor

@lucatume lucatume commented Oct 24, 2024

This updates the logic used to confirm attendee reservations and clear
the current seat selection session to make sure the session will not be
cleared when the order is not complete (e.g. a pending one).

If the session is incorrectly cleared, then the frontend timer will not
find the session information and will expire sending the user a time-out
message and a redirection dialog. This will happen if the user cannot
complete the payment correctly after a failure (that would generate
attendees and a pending order) in the grace time.

Avoiding the session clear in those instances of failed payment will
allow the user to try and complete the payment beyond the grace period,
provided they still have time to do it.

TODO:

  • Change timer grace time (maybe?)
  • On timeout, along with the session the pending attendees should be removed
  • Automated tests

This updates the logic used to confirm attendee reservations and clear
the current seat selection session to make sure the session will not be
cleared when the order is not complete (e.g. a pending one).

If the session is incorrectly cleared, then the frontend timer will not
find the session information and will expire sending the user a time-out
message and a redirection dialog. This will happen if the user cannot
complete the payment correctly after a failure (that would generate
attendees and a pending order) in the grace time.

Avoiding the session clear in those instances of failed payment will
allow the user to try and complete the payment beyond the grace period,
provided they still have time to do it.
@lucatume lucatume self-assigned this Oct 24, 2024
* @return bool Whether the reservations were confirmed or not.
*/
public function confirm_all_reservations(): bool {
public function confirm_all_reservations(bool $delete_token_session = true): bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen
Expected 1 spaces after opening parenthesis; 0 found

* @return bool Whether the reservations were confirmed or not.
*/
public function confirm_all_reservations(): bool {
public function confirm_all_reservations(bool $delete_token_session = true): bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose
Expected 1 spaces before closing parenthesis; 0 found

@@ -14,6 +14,7 @@
use TEC\Common\StellarWP\Assets\Asset;
use TEC\Common\StellarWP\DB\DB;
use TEC\Tickets\Admin\Attendees\Page as Attendee_Page;
use TEC\Tickets\Commerce\Order;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
Type TEC\Tickets\Commerce\Order is not used in this file.

* @return void
*/
public function confirm_all_reservations(): void {
$this->session->confirm_all_reservations();
public function confirm_all_reservations($attendees, $ticket, $order, $new_status): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen
Expected 1 spaces after opening parenthesis; 0 found

* @return void
*/
public function confirm_all_reservations(): void {
$this->session->confirm_all_reservations();
public function confirm_all_reservations($attendees, $ticket, $order, $new_status): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose
Expected 1 spaces before closing parenthesis; 0 found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants