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

fix: unable to process donation when email access token expires #3886

Closed
1 of 5 tasks
mehul0810 opened this issue Dec 4, 2018 · 4 comments
Closed
1 of 5 tasks

fix: unable to process donation when email access token expires #3886

mehul0810 opened this issue Dec 4, 2018 · 4 comments
Assignees

Comments

@mehul0810
Copy link
Contributor

mehul0810 commented Dec 4, 2018

Bug Report

User Story

As a user, I want to process the donations properly so that donors receive a consistent UX.

Currently, I'm unable to process a successful donation when a cookie generated via email access link is expired and we are using the same browser to process a donation. Then, the error notice for access token expired which should be shown on the email access page is restricting the donation to process successfully. Hence, this is a rare scenario. Check the error message in the screenshot below. Also, check the possible solution section and let me know your thoughts

Current Behavior

I'm unable to process donations using Stripe CC

Expected Behavior

We should be able to process donation without any errors.

Bug Type

  • This bug describes functionality that once worked as expected in version 2.3.0.
  • This bug describes functionality that never worked as expected.
  • I am not sure whether this functionality ever worked as expected.

Steps to Reproduce

  1. Install & Activate Give 2.3.1 & Stripe 2.1.2
  2. Try processing donation using Stripe CC, it will be successful
  3. Now, open donation history page in incognito
  4. Provide an email address for which you've processed a donation earlier and then submit details to receive email access link in the email.
  5. Click on the link received in an email which will set a cookie give_nl
  6. Now, wait for around 15-20 mins in the idle state for the cookie to expire.
  7. Open a donation form in the same incognito browser after 20 mins and try donating using Stripe or any other gateway.
  8. You'll receive an error related to access token as shown in the screenshot. and then again submitting the donation form after the error will process the donation properly. The error occurs for the first time on every refresh of the donation form when the email access token is expired.

Possible Solution

We're already redirecting to the email access page asking for email which on submission creates a new cookie. Now, when the cookie is expired. I suggest removing the access token expired notice and unset the existing cookie which is expired to avoid this rare scenario from happening on the donation form page.

Visuals

image

Related

Acceptance Criteria

  • Processing donation with Stripe should not have any errors
  • Testing
@mehul0810 mehul0810 self-assigned this Dec 4, 2018
@mehul0810
Copy link
Contributor Author

mehul0810 commented Dec 4, 2018

@kevinwhoffman @DevinWalker As per the quick look on the issue, this is a rare scenario when a donor has email access token expired and then tried to donate. We are looking into it. However, no customer has reported such issue till date.

@mehul0810 mehul0810 changed the title fix: unable to process donation with 2.3.1 fix: unable to process donation when email access token expires Dec 4, 2018
@mehul0810
Copy link
Contributor Author

Slack Call Summary

Participants: @mehul0810 @kevinwhoffman
Topic: Discussion about the issue
Results: We have discussed the possible solutions to fix the issue and finalized to go with the one @ravinderk suggested to restrict the access token notice to be displayed only on donation history and confirmation page only. Implementing this will be a quick fix and the issue will get resolved as well.

mehul0810 added a commit that referenced this issue Dec 5, 2018
fix: unable to process donation when email access token expires #3886
@spartakb
Copy link

Hi all. Thanks in advance for any help.

I'm trying to develop a custom plugin, and I'm seeing this issue appear when email access token expires. In further tracing what is gets submitted at the following line:

! isset( $_POST['_wpnonce'] )

I get the following data via var_dump($_REQUEST);:
{ ["action"]=> string(34) "give_donation_form_reset_all_nonce" ["give_form_id"]=> string(1) "8" }

For full details, within my plugin:

  1. I'm calling preventDefault on the form submission:
document.addEventListener( 'DOMContentLoaded', function( e ) {

    console.log("merchantid: ", jQuery( this ).find( 'input[name="give-form-merchantid"]' ).val());

	jQuery( 'body' ).on( 'submit', '.give-form', function( event ) {

        const $form = jQuery( this );
		const $idPrefix = $form.find( 'input[name="give-form-id-prefix"]' ).val();
        const $merchantId  = $form.find( 'input[name="give-form-merchantid"]' ).val();

		if ( 'payengine' === $form.find( 'input.give-gateway' ).val() ) {
			tokenRequest(this, $merchantId);
			event.preventDefault();
            
		}

        
	} );

});
  1. Once I obtain the token for payment, I retrigger the for submit like this:
var successCallback = function(formElement, data) {

    console.log("successCallback: ", data.token);
    const $form = jQuery( formElement );
    $form.find( 'input[name="give-form-payengine-cardtoken"]' ).val(data.token);
    formElement.submit();
    return

};

@JoshuaHungDinh
Copy link
Contributor

Hi all. Thanks in advance for any help.

I'm trying to develop a custom plugin, and I'm seeing this issue appear when email access token expires. In further tracing what is gets submitted at the following line:

! isset( $_POST['_wpnonce'] )

I get the following data via var_dump($_REQUEST);: { ["action"]=> string(34) "give_donation_form_reset_all_nonce" ["give_form_id"]=> string(1) "8" }

For full details, within my plugin:

  1. I'm calling preventDefault on the form submission:
document.addEventListener( 'DOMContentLoaded', function( e ) {

    console.log("merchantid: ", jQuery( this ).find( 'input[name="give-form-merchantid"]' ).val());

	jQuery( 'body' ).on( 'submit', '.give-form', function( event ) {

        const $form = jQuery( this );
		const $idPrefix = $form.find( 'input[name="give-form-id-prefix"]' ).val();
        const $merchantId  = $form.find( 'input[name="give-form-merchantid"]' ).val();

		if ( 'payengine' === $form.find( 'input.give-gateway' ).val() ) {
			tokenRequest(this, $merchantId);
			event.preventDefault();
            
		}

        
	} );

});
  1. Once I obtain the token for payment, I retrigger the for submit like this:
var successCallback = function(formElement, data) {

    console.log("successCallback: ", data.token);
    const $form = jQuery( formElement );
    $form.find( 'input[name="give-form-payengine-cardtoken"]' ).val(data.token);
    formElement.submit();
    return

};

Hello @spartakb, I understand you are having an issue with email access tokens expiring. Given that the current issue is marked as Closed, we ask that you create a new GH Discussion for this conversation. This will allow us to better manage/record what is going on and also bring more attention into a solution. Feel free to reference the current issue in the discussion if you feel it may be related.

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

No branches or pull requests

3 participants