impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
345 stars 191 forks source link

fix: ensure that PDF download template tag link doesn't redirect to an archive page on site #3941

Closed mehul0810 closed 5 years ago

mehul0810 commented 5 years ago

@samsmith89 commented on Wed Dec 19 2018

Bug Report

User Story

As a site admin, I want to have the {pdf_receipt} template tag link download the PDF receipt so that my donors can quickly obtain it.

Current Behavior

When the {pdf_receipt} link is selected the donor is redirected back to an archive page on the website and the PDF Receipt never downloads.

The current workaround is to send the donors to the Donation History Receipt page to download their PDF Receipt.

Expected Behavior

I expect the {pdf_receipt} link that is sent in emails to immediately start downloading the PDF Receipt.

Bug Type

Steps to Reproduce

  1. Place the {pdf_receipt} in an email template
  2. Submit a donation and intercept the receipt email
  3. Click on the generated PDF download link and see that you're redirected back to the site

Visuals

screen shot 2018-12-18 at 3 59 58 pm

Related

https://secure.helpscout.net/conversation/734598669/31324 https://secure.helpscout.net/conversation/737104653/31549 https://secure.helpscout.net/conversation/716102479/29748

Acceptance Criteria

Environment

Operating System
  • Platform: Mac OS X
Browser
  • Name: Chrome
WordPress System Info ### WordPress Environment ### Home URL: https://give.gsamsmith.com Site URL: https://give.gsamsmith.com WP Version: 5.0.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%year%/%monthnum%/%day%/%postname%/ Show on Front: posts Table Prefix Length: 4b8_ Table Prefix Length: 4 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, in-progress, failed, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed, refunded, revoked, cancelled, abandoned, processing, preapproval, recurring, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: give.gsamsmith.com TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache PHP Version: 7.0.33 PHP Post Max Size: 64 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 PHP Max Upload Size: 64 MB cURL Version: 7.62.0, OpenSSL/1.0.2q SUHOSIN Installed: – MySQL Version: 5.6.41 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.3.1 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Daily Email Report✔Weekly Email Report✔Monthly Email Report❌Renewal Receipt Email❌Renewal Receipt Email❌Subscription Cancelled Email❌Subscription Cancelled Email❌Subscription Completed Email✔Subscription Reminder Email✔Subscriptions Email Access Upgraded From: 2.2.4 Test Mode: Enabled Currency Code: USD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: https://give.gsamsmith.com/donation-confirmation/ Failure Page: https://give.gsamsmith.com/donation-failed/ Donation History Page: https://give.gsamsmith.com/donation-history/ Give Forms Slug: /donations/ Enabled Payment Gateways: Stripe - Credit Card, Test Donation, Mollie Gateway, Authorize.net, Stripe + Plaid Default Payment Gateway: Stripe - Credit Card PayPal IPN Verification: Disabled PayPal IPN Notifications: IPN received for #559 ( 52438396UD795131G ) on 12/15/2018 at 11:58. Status N/A Donor Email Access: Enabled ### Active Give Add-ons ### Give - Authorize.net Gateway: ✔ Licensed – by WordImpress – 1.4.3 Give - Currency Switcher: ❌ Unlicensed – by GiveWP – 1.3.1 Give - Donation Upsells for WooCommerce: ❌ Unlicensed – by GiveWP – 1.1.0 Give - Email Reports: ❌ Unlicensed – by WordImpress – 1.1.2 Give - Fee Recovery: ❌ Unlicensed – by GiveWP – 1.7.2 Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.1 Give - Gift Aid: ❌ Unlicensed – by GiveWP – 1.2.0 Give - GoCardless Gateway: ✔ Licensed – by WordImpress – 1.2.1 Give - Google Analytics Donation Tracking: ❌ Unlicensed – by GiveWP – 1.2.1 Give - iATS Payment Solutions: ❌ Unlicensed – by GiveWP – 1.0.4 Give - MailChimp: ❌ Unlicensed – by GiveWP – 1.4.3 Give - Mollie Gateway: ❌ Unlicensed – by WordImpress – 1.1.2 Give - PayFast Payment Gateway: ❌ Unlicensed – by WordImpress – 1.0.2 Give - PayPal Pro Gateway: ❌ Unlicensed – by GiveWP – 1.2.1 Give - PayUmoney: ❌ Unlicensed – by GiveWP – 1.0.3 Give - PDF Receipts: ❌ Unlicensed – by GiveWP – 2.3.2 Give - Per Form Gateways: ❌ Unlicensed – by WordImpress – 1.0.1 Give - Recurring Donations: ❌ Unlicensed – by GiveWP – 1.8.3 Give - Stripe Gateway: ❌ Unlicensed – by GiveWP – 2.1.2 Give - Tributes: ❌ Unlicensed – by GiveWP – 1.5.2 Give - Zapier: ✔ Licensed – by WordImpress – 1.2.1 ### Other Active Plugins ### All-in-One WP Migration: by ServMask – 6.81 Email Cop: by Ashfame – 0.1.1 Give - AmeriCloud Payments: by AmeriCloud Solutions, Inc. – 1.3.1 Give - Sofort Payment Gateway: by WordImpress, CoachBirgit – 1.0 Query Monitor: by John Blackbourn & contributors – 3.2.2 Transients Manager: by Pippin Williamson – 1.7.5 WooCommerce: by Automattic – 3.5.2 WordPress Importer: by wordpressdotorg – 0.6.4 WP Rollback: by Impress.org – 1.6 ### Inactive Plugins ### Akismet Anti-Spam: by Automattic – 4.1 Contact Form 7: by Takayuki Miyoshi – 5.1 Debug Bar: by wordpressdotorg – 1.0 Give - 2Checkout Gateway: by WordImpress – 1.1.2 Give - AWeber: by WordImpress – 1.0.3 Give - Braintree Gateway: by WordImpress – 1.2.2 Give - CCAvenue Gateway: by WordImpress – 1.0.2 Give - Constant Contact: by WordImpress – 1.2.1 Give - ConvertKit: by WordImpress – 1.0.2 Give - CSV Toolbox: by WordImpress – 1.0 Give - Dwolla Gateway: by WordImpress – 1.1.2 Give - Manual Donations: by GiveWP – 1.4.2 Give - Paymill Gateway: by WordImpress – 1.0.2 Give - Paytm Gateway: by WordImpress – 1.0 Give - Razorpay: by WordImpress – 1.2.0 Gutenberg: by Gutenberg Team – 4.7.0 Head and Footer Scripts Inserter: by Space X-Chimp – 4.33 Invisible reCaptcha: by Mihai Chelaru – 1.2.1 My Custom Functions: by Space X-Chimp – 4.31 ### Active MU Plugins ### Endurance PHP Edge: by Mike Hansen – 0.2 SSO: by Garth Mortensen, Mike Hansen – 0.3 ### Theme ### Name: Twenty Seventeen Version: 1.7 Author URL: https://wordpress.org/ Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

@nishitlangaliya commented on Tue Dec 25 2018

@samsmith89 , @kevinwhoffman , I have gone through the steps to reproduce the issue but I am unable to reproduce case. I have prepared video of my findings. @samsmith89 please review it and let me know if I am missing anything.

https://www.useloom.com/share/71eb47aebcf04efca2fee22a861b5ca3

Thanks


@mehul0810 commented on Fri Dec 28 2018

@kevinwhoffman I'm unable to reproduce this issue. So, I had a call with @samsmith89 yesterday and he was able to reproduce it on random scenarios (that too not the exact issue which is mentioned). So, I've asked to get a site clone so that I can try to reproduce it on local with the actual site. I doubt that there is some sort of manipulation in PDF receipt URL on customer site as the PDF receipt URL provided by the customer in HS ticket is not the same as we get the PDF receipt URL in our instance. Hence, moving this issue to Blocked until I receive the site dump.


@samsmith89 commented on Fri Jan 04 2019

@mehul0810 the customer got back to me today. Here is the link to the site download: https://drive.google.com/file/d/18vgFw3dRAKbaYltpNLgZYhhZykV4JDSm/view?usp=sharing I DM'd you the creds


@mehul0810 commented on Mon Jan 07 2019

@kevinwhoffman @samsmith89 I've tried all the possible scenarios with the site dump you provided. But, I'm unable to reproduce the issue.

I've tried it with the plugin "Post SMTP" which sends email on the site dump and also tried after deactivating it.


@kevinwhoffman commented on Wed Jan 09 2019

@samsmith89 @Benunc Hey guys we are on dev team call and wondering if you can give us an update on a common thread among the various reports of issues with PDF receipts.

Look for the possibility of outdated Give core and/or PDF Receipts, since changes to PDF receipt privacy in a recent release may have an impact.


@Benunc commented on Thu Jan 10 2019

I spent some significant time looking into this today, and with an exact clone of the site locally I am not able to reproduce. Yet on the live site, it redirects.

Live Site System Info ### WordPress Environment ### Home URL: https://chasdeikaduri.org Site URL: https://chasdeikaduri.org WP Version: 5.0.2 WP Multisite: – WP Memory Limit: 1 GB WP Debug Mode: – WP Cron: ✔ Language: en Permalink Structure: /%postname%/ Show on Front: page Page on Front: Home (#8) Page for Posts: Unset Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: chasdeikaduri.org TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache PHP Version: 7.1.18 PHP Post Max Size: 50 MB PHP Time Limit: 400 PHP Max Input Vars: 10000 PHP Max Upload Size: 50 MB cURL Version: 7.54.0, OpenSSL/1.0.2k SUHOSIN Installed: – MySQL Version: 5.6.39 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.3.1 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Renewal Receipt Email❌Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Cancelled Email❌Subscription Completed Email❌Subscription Reminder Email✔Subscriptions Email Access Upgraded From: 1.8.7.1 Test Mode: Disabled Currency Code: CAD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: https://chasdeikaduri.org/donation-confirmation/ Failure Page: https://chasdeikaduri.org/transaction-failed/ Donation History Page: https://chasdeikaduri.org/donor-area/ Give Forms Slug: /donations/ Enabled Payment Gateways: Stripe - Credit Card, PayPal Standard, Offline Donation Default Payment Gateway: Stripe - Credit Card PayPal IPN Verification: Enabled PayPal IPN Notifications: IPN received for #3179 ( 0K995214UC6276213 ) on 12/28/2018 at 08:54. Status VERIFIED Donor Email Access: Enabled ### Active Give Add-ons ### Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.1 Give - Google Analytics Donation Tracking: ✔ Licensed – by WordImpress – 1.1.2 Give - MailChimp: ❌ Unlicensed – by GiveWP – 1.4.3 Give - Manual Donations: ❌ Unlicensed – by GiveWP – 1.4.2 Give - PayPal Pro Gateway: ❌ Unlicensed – by GiveWP – 1.2.1 Give - PDF Receipts: ❌ Unlicensed – by GiveWP – 2.3.2 Give - Recurring Donations: ❌ Unlicensed – by GiveWP – 1.8.3 Give - Stripe Gateway: ❌ Unlicensed – by GiveWP – 2.1.2 Give - Tributes: ❌ Unlicensed – by GiveWP – 1.5.2 Give - Zapier: ✔ Licensed – by WordImpress – 1.2.1 ### Other Active Plugins ### Akismet Anti-Spam: by Automattic – 4.1 CF7 Google Sheet Connector: by WesternDeal – 2.7 Contact Form 7: by Takayuki Miyoshi – 5.1.1 Custom Facebook Feed Pro Personal: by Smash Balloon – 3.6.1 Duplicator: by Snap Creek – 1.3.0 Google XML Sitemaps: by Arne Brachhold – 4.1.0 Hide Admin Bar: by Shelby DeNike – 0.3.9.5 Logos Showcase (shared on www.null24.ir): by Carlos Moreira – 1.4.9 Modular Custom CSS: by Nick Halsey – 2.1 OneSignal Push Notifications: by OneSignal – 1.16.9 Postman SMTP: by Jason Hendriks – 1.7.2 Really Simple SSL: by Rogier Lankhorst, Mark Wolters – 3.1.3 Slider Revolution: by ThemePunch – 5.4.7.4 WPBakery Page Builder: by Michael M - WPBakery.com – 5.6 ### Inactive Plugins ### Custom Facebook Feed Pro - Masonry Columns: by Smash Balloon – 1.1.2 Essential Grid: by ThemePunch – 2.2.4.2 LayerSlider WP: by Kreatura Media – 6.7.6 Popup Builder: by Sygnoos – 3.1.4 SSL Insecure Content Fixer: by WebAware – 2.7.2 Top Bar: by WP Darko – 2.0 ### Theme ### Name: Highend Version: 3.5.0.1 Author URL: https://hb-themes.com Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
Local clone System Info ### WordPress Environment ### Home URL: http://chasedi.local Site URL: http://chasedi.local WP Version: 5.0.2 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en Permalink Structure: /%postname%/ Show on Front: page Page on Front: Home (#8) Page for Posts: Unset Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: chasedi.local TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache/2.4.10 (Debian) PHP Version: 7.1.4 PHP Post Max Size: 1,000 MB PHP Time Limit: 400 PHP Max Input Vars: 3000 PHP Max Upload Size: 1,000 MB cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40. SUHOSIN Installed: – MySQL Version: 5.6.34 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.3.1 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Renewal Receipt Email❌Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Cancelled Email❌Subscription Completed Email❌Subscription Reminder Email✔Subscriptions Email Access Upgraded From: 2.3.0 Test Mode: Disabled Currency Code: CAD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: http://chasedi.local/donation-confirmation/ Failure Page: http://chasedi.local/transaction-failed/ Donation History Page: http://chasedi.local/donor-area/ Give Forms Slug: /donations/ Enabled Payment Gateways: Stripe - Credit Card, PayPal Standard, Offline Donation Default Payment Gateway: Stripe - Credit Card PayPal IPN Verification: Enabled PayPal IPN Notifications: IPN received for #3179 ( 0K995214UC6276213 ) on 12/28/2018 at 08:54. Status VERIFIED Donor Email Access: Enabled ### Active Give Add-ons ### Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.1 Give - Google Analytics Donation Tracking: ✔ Licensed – by WordImpress – 1.1.2 Give - MailChimp: ❌ Unlicensed – by GiveWP – 1.4.3 Give - Manual Donations: ❌ Unlicensed – by GiveWP – 1.4.2 Give - PayPal Pro Gateway: ❌ Unlicensed – by GiveWP – 1.2.1 Give - PDF Receipts: ❌ Unlicensed – by GiveWP – 2.3.2 Give - Recurring Donations: ❌ Unlicensed – by GiveWP – 1.8.3 Give - Stripe Gateway: ❌ Unlicensed – by GiveWP – 2.1.2 Give - Tributes: ❌ Unlicensed – by GiveWP – 1.5.2 Give - Zapier: ✔ Licensed – by WordImpress – 1.2.1 ### Other Active Plugins ### Postman SMTP: by Jason Hendriks – 1.7.2 ### Inactive Plugins ### Akismet Anti-Spam: by Automattic – 4.1 CF7 Google Sheet Connector: by WesternDeal – 2.6 Contact Form 7: by Takayuki Miyoshi – 5.1.1 Custom Facebook Feed Pro - Masonry Columns: by Smash Balloon – 1.1.2 Custom Facebook Feed Pro Personal: by Smash Balloon – 3.6.1 Duplicator: by Snap Creek – 1.3.0 Essential Grid: by ThemePunch – 2.2.4.2 Google XML Sitemaps: by Arne Brachhold – 4.1.0 Hide Admin Bar: by Shelby DeNike – 0.3.9.5 LayerSlider WP: by Kreatura Media – 6.7.6 Logos Showcase (shared on www.null24.ir): by Carlos Moreira – 1.4.9 Modular Custom CSS: by Nick Halsey – 2.1 OneSignal Push Notifications: by OneSignal – 1.16.9 Popup Builder: by Sygnoos – 3.1.3 Really Simple SSL: by Rogier Lankhorst, Mark Wolters – 3.1.3 Slider Revolution: by ThemePunch – 5.4.7.4 SSL Insecure Content Fixer: by WebAware – 2.7.2 Top Bar: by WP Darko – 2.0 WPBakery Page Builder: by Michael M - WPBakery.com – 5.6 ### Theme ### Name: Highend Version: 3.5.0.1 Author URL: https://hb-themes.com Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

Malfunctioning link:

https://chasdeikaduri.org/donor-area/?give-action=generate_pdf_receipt&donation_id=4588&_give_hash=e24a724ee1

Functioning link: (on my local machine): ​

https://chasedi.local/donor-area/?give-action=generate_pdf_receipt&donation_id=4594&_give_hash=2122426f49

I tried with the Postman SMTP plugin active, and without (using mailhog on my machine) and the local link works no matter what to generate a PDF.


@kevinwhoffman commented on Thu Jan 10 2019

@Benunc Can you clarify if the redirect behavior only happens for PDF links from within emails, or does it also happen when a PDF link is clicked from Donation History or from within WP admin?


@Benunc commented on Thu Jan 10 2019

Ah, that may be the differentiator. If my browser is logged into the site in question, those links work to download a PDF.

If I am not logged in they do not work.

So to replicate, log out of the site and then follow the link from the email.


@kevinwhoffman commented on Thu Jan 10 2019

I mentioned on the team call that this may be a side effect of the privacy protection added for PDF receipts. If an incorrect redirect is happening only when logged out, then that may confirm the issue is related to donor validation that was added to improve privacy.

@mehul0810 When you get to this issue, I'd recommend reviewing the recent PRs related to privacy protection such as https://github.com/impress-org/give-pdf-receipts/pull/194 to see if if the behavior @Benunc is describing might be related.

mehul0810 commented 5 years ago

@kevinwhoffman After doing the investigation on this issue based on the details provided, I've noticed that when no session exists, then the donation receipt page link as well as donation receipt download link on donation history page stops working and instead shows email access page.

Hence, creating a PR for this.