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

feat(auth-server): Modify transactional emails to accomodate PayPal payments #7653

Merged
merged 4 commits into from Mar 2, 2021

Conversation

lesleyjanenorton
Copy link
Contributor

Because

  • We need to modify some transactional emails when the user's method of paying is through PayPal

This pull request

  • Updates extractInvoiceDetailsForEmail() and relevant email handlers so that payment_provider is available to the email templates.
  • Adds new email partial (paymentProvider.html) which handles what text we show based on the payment_provider
  • Adds new handlebar helper {{#ifEquals something someOtherThing}} so that we can conditionally show bits of UI based on whether payment_provider === "stripe" or payment_provider === "paypal"
  • Updates tests
  • Corrects language in subscriptionPaymentFailed: Changes "3 days" to "24 hours". Maybe we should say "1 day" instead? I don't know. How do we ensure string changes bubble up to l10n?

Issue that this pull request solves

Closes: #7264 #7101

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Proposed language change to reactivation email
Screen Shot 2021-02-25 at 7 53 59 PM




Proposed language change in subscriptionPaymentFailed.
Needs UX: Should we say "1 day" instead of "24 hours" ?
Screen Shot 2021-02-25 at 8 00 36 PM

subscriptionFirstInvoice when payment_method === "paypal"
Screen Shot 2021-02-25 at 8 11 34 PM

subscriptionSubsequentInvoice when payment_method === "paypal"
Screen Shot 2021-02-25 at 8 09 12 PM

Other information (Optional)

How do we get updated strings to l10n? These emails are localized but the plumbing is an area of great mystery to me.

@lesleyjanenorton lesleyjanenorton marked this pull request as ready for review March 1, 2021 16:19
: 'stripe';
}
return 'not_chosen';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this function doesn't really need to be in a class.

return options.fn(this);
}
return options.inverse(this);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consistency suggestion: using the pattern from orHelper above we can write

function isEqualHelper() {
  return reduceOp(arguments, (a, b) => a === b);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find an instance of orHelper actually being used? I did try to follow that pattern initially but it results in this:
Screen Shot 2021-03-01 at 7 51 02 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦 Sorry about that. In that case, please delete that orHelper dead code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok so - I was mistaken! This helper is actually used here. I had been looking for {{#or}} but the usage was just a bit different. I've updated ifEqualHelper to match.

@chenba
Copy link
Contributor

chenba commented Mar 1, 2021

@lesleyjanenorton I tried this locally and didn't get any emails when I paid with PayPal. It did work when I paid with Stripe. Is it working for you?

I don't think it's directly related to this PR; I'm confused as to why I'm not even getting the welcome email though.

@lesleyjanenorton
Copy link
Contributor Author

@chenba Emails triggered by PayPal checkouts should be working now

@@ -76,8 +76,8 @@ export class StripeWebhookHandler extends StripeHandler {
await this.handleInvoiceOpenEvent(request, event);
}
break;
case 'invoice.payment_succeeded':
await this.handleInvoicePaymentSucceededEvent(request, event);
case 'invoice.paid':
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Member

@bbangert bbangert left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@chenba chenba left a comment

Choose a reason for hiding this comment

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

WFM

@lesleyjanenorton lesleyjanenorton merged commit 6692a2d into main Mar 2, 2021
@lesleyjanenorton lesleyjanenorton deleted the feat/issue-2898 branch March 2, 2021 19:46
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.

Use PayPal billing information in Subscription Management emails
3 participants