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

Subscription emails for customer should not link to order page if customer has no user account #2624

Conversation

kristinalim
Copy link
Member

What? Why?

Closes #2534

Updates subscription-related emails for customers, removing link to order page for customers who do not have a user account. Adds custom text for placement emails for this scenario.

What should we test?

For below, make sure that the OFN instance is already configured for Stripe integration.

The following should also be set up for the shop:

  1. Subscriptions are enabled (Shop Preferences > Subscriptions)
  2. Stripe payment method (Shop Preferences > Payment Methods)

There are three types of subscription emails affected by this PR:

  1. Placement of order
  2. Confirmation of order
  3. Failure to automatically charge payment

And three scenarios that should be tested:

  1. Customer has no associated user account
  2. Customer has user account, and shop is configured to allow customer to edit placed orders
  3. Customer has user account, but shop is configured to restrict customer from editing placed orders

Scenario 1: Customer has no associated user account

  1. Create a new ongoing order cycle (OC).
  2. Create the customer. Make sure there is no user account for this email yet.
  3. Create a subscription that starts before current time. Select Cheque payment method.
  4. Wait approximately 5 minutes. Find the order placement email, and check that it does not contain a link to the order. "This order was automatically created for you. This order was automatically created for you. You can make changes until orders close on Fri Aug 31 @ 11:00PM by contacting Amazing Shop via shop@example.com."
  5. To simulate the OC closing, ⚠️ set its close time to a couple of minutes before current time.
  6. Wait approximately 5 minutes. Find the order confirmation email, and check that it does not contain a link to the order. "This order was automatically placed for you, and it has now been finalised. If you have any questions you can contact Amazing Shop via shop@example.com."

(AFAIK, there is no way for a customer with no user account to receive the SO failed payment for the subscription. I will ask and will update this when I get info.)

Scenario 2: Customer has user account, and shop is configured to allow customer to edit placed orders

(Change enterprise setting: Shop Preferences > Change Orders > "Customers can change / cancel orders while OC is open")

  1. ⚠️ Open the OC again by updating its close date.
  2. Create the customer.
  3. As customer: Sign up with the customer email.
  4. As customer: Save credit card details that would charge successfully, and give the shop permission to charge you.
  5. Create a subscription that starts before current time. Select Stripe payment method.
  6. Wait approximately 5 minutes. Find the order placement email, and check that it contains a link to "make changes" to the order. "This order was automatically created for you. You can make changes until orders close on Fri Aug 31 @ 11:00PM. If you have any questions you can contact Amazing Shop via shop@example.com."
  7. To simulate the OC closing, ⚠️ set its close time to a couple of minutes before current time.
  8. Wait approximately 5 minutes. Find the order confirmation email, and check that it contains a link to "view details" of the order. "This order was automatically placed for you, and it has now been finalised. You can view details of this order at any time. If you have any questions you can contact Amazing Shop via shop@example.com."
  9. ⚠️ Open the OC again by updating its close date.
  10. As customer: Change the saved credit card details to a one that would fail when attempting to charge.
  11. Create a subscription that starts before current time. Select Stripe payment method.
  12. Wait approximately 5 minutes. Find the order placement email, and check that it contains a link to "view details" of the order. "The payment for your subscription with Amazing Shop failed because of a problem with your credit card. Amazing Shop has been notified of this failed payment. You can view details of this order at any time. If you have any questions you can contact Amazing Shop via shop@example.com."

Scenario 3: Customer has user account, but shop is configured to restrict customer from editing placed orders

(Change enterprise setting: Shop Preferences > Change Orders > "Placed orders cannot be changed / cancelled")

  1. ⚠️ Open the OC again by updating its close date.
  2. Create a subscription that starts before current time. Select Stripe payment method.
  3. Wait approximately 5 minutes. Find the Order placement email, and check that it contains a link to "view details" of the order. "This order was automatically created for you. You can view details of this order at any time. If you have any questions you can contact Amazing Shop via shop@example.com."

Release notes

  • Remove link to Order page from Subscription emails for Customers that do not have associated User.

Changelog Category: Fixed

@kristinalim kristinalim added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label Aug 31, 2018
@kristinalim kristinalim self-assigned this Aug 31, 2018
app/helpers/shop_mail_helper.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

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

awesome!

spec/mailers/subscription_mailer_spec.rb Outdated Show resolved Hide resolved
@luisramos0
Copy link
Contributor

@kristinalim I think you can decide what to do with the two tiny details raised above and move to test ready afterwards.

@kristinalim kristinalim force-pushed the fix-no_order_link_in_subscription_emails_unless_user branch from f91f1d4 to 029679f Compare September 1, 2018 08:16
@kristinalim
Copy link
Member Author

I made the change, and also squashed a local change I hadn't pushed (oops! 😟) which corrects %distributor} in the language file to %{distributor}. I also rebased this upon master.

Checks all good. Moving this to Test Ready now.

@luisramos0
Copy link
Contributor

I rechecked, all looks good.
Just the method doc comment :-)

Using a helper for this, but this can be changed to look up a
translation key.
The order link should not be provided if the order does not have an
associated user account.
@kristinalim kristinalim force-pushed the fix-no_order_link_in_subscription_emails_unless_user branch from 029679f to f844236 Compare September 1, 2018 15:47
@kristinalim
Copy link
Member Author

@luisramos0 Eep. 😁 I updated the method doc comment already. #2624 (comment)

@mkllnk
Copy link
Member

mkllnk commented Sep 3, 2018

Staged on https://staging1.openfood.com.au/.

@mkllnk mkllnk added the pr-staged-au staging.openfoodnetwork.org.au label Sep 3, 2018
@sstead
Copy link

sstead commented Sep 3, 2018

Testing notes

All three scenarios were behaving correctly.

https://docs.google.com/document/d/13HFUszOoEyvNqdBlefMZ5K0haXj28iMiKJaLPkxXPF4/edit#

@mkllnk mkllnk merged commit 1b26440 into openfoodfoundation:master Sep 3, 2018
@mkllnk mkllnk removed the pr-staged-au staging.openfoodnetwork.org.au label Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subs] Remove link to 'make changes' to order from confirmation email if customer is guest
5 participants