Skip to content

Commit d5133f6

Browse files
committed
Merge branch 'main' of github.com:pay-rails/pay
2 parents e16f531 + 40805da commit d5133f6

File tree

7 files changed

+70
-6
lines changed

7 files changed

+70
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Extra confirmation is needed to process your payment
2+
3+
Your <%= Pay.application_name %> subscription requires confirmation to process your payment to continue access.
4+
5+
Confirm your payment: <%= pay.payment_url(params[:payment_intent_id]) %>
6+
7+
If you have any questions, please hit reply and let us know.
8+
9+
— The <%= Pay.application_name %> Team
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Your payment was declined
2+
3+
We were unable to charge your payment method for your <%= Pay.application_name %> subscription. Please update your billing information.
4+
5+
Update billing information: <%= root_url %>
6+
7+
Let us know if you have any questions.
8+
9+
— The <%= Pay.application_name %> Team
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
We have processed your <%= Pay.application_name %> refund.
2+
Please allow up to 7 business days for your refund to appear in your account
3+
4+
Questions? Please reply to this email.
5+
6+
------------------------------------
7+
RECEIPT - REFUND
8+
9+
<%= Pay.application_name %>
10+
Amount: <%= params[:pay_charge].amount_refunded_with_currency %>
11+
12+
Refunded to: <%= params[:pay_charge].charged_to %>
13+
Transaction ID: <%= params[:pay_charge].id %>
14+
Date: <%= l params[:pay_charge].created_at %>
15+
<% if params[:pay_charge].customer.owner.try(:extra_billing_info?) %>
16+
<%= params[:pay_charge].customer.owner.extra_billing_info %>
17+
<% end %>
18+
19+
<%= Pay.business_name %>
20+
<%= Pay.business_address %>
21+
------------------------------------
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Your upcoming <%= Pay.application_name %> subscription renewal
2+
3+
This is a friendly reminder that your <%= Pay.application_name %> subscription will renew automatically on <%= l params[:date].to_date, format: :long %>.
4+
5+
You may manage your subscription via your account: <%= root_url %>
6+
If you have any questions, please hit reply and let us know.
7+
8+
— The <%= Pay.application_name %> Team
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Your <%= Pay.application_name %> trial has ended
2+
3+
This is just a friendly reminder that your <%= Pay.application_name %> trial has ended.
4+
5+
You may manage your subscription via your account: <%= root_url %>
6+
If you have any questions, please hit reply and let us know.
7+
8+
— The <%= Pay.application_name %> Team
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Your <%= Pay.application_name %> trial is ending soon
2+
3+
This is just a friendly reminder that your <%= Pay.application_name %> trial will be ending soon.
4+
5+
You may manage your subscription via your account: <%= root_url %>
6+
If you have any questions, please hit reply and let us know.
7+
8+
— The <%= Pay.application_name %> Team

test/mailers/pay/user_mailer_test.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,17 @@ class UserMailerTest < ActionMailer::TestCase
6464
email = Pay::UserMailer.with(pay_customer: @pay_customer, pay_subscription: Pay::Subscription.new, date: time).subscription_renewing
6565

6666
assert_equal [@user.email], email.to
67-
assert_equal I18n.t("pay.user_mailer.subscription_renewing.subject", application: Pay.application_name), email.subject
68-
assert_includes email.body.decoded, I18n.l(time.to_date, format: :long)
67+
assert_equal I18n.t("pay.user_mailer.subscription_renewing.subject", application: Pay.application_name),
68+
email.subject
69+
assert_includes email.html_part.decoded, I18n.l(time.to_date, format: :long)
6970
end
7071

7172
test "payment_action_required" do
7273
email = Pay::UserMailer.with(pay_customer: @pay_customer, payment_intent_id: "x", pay_subscription: Pay::Subscription.new).payment_action_required
7374

7475
assert_equal [@user.email], email.to
7576
assert_equal I18n.t("pay.user_mailer.payment_action_required.subject", application: Pay.application_name), email.subject
76-
assert_includes email.body.decoded, Pay::Engine.instance.routes.url_helpers.payment_path("x")
77+
assert_includes email.html_part.decoded, Pay::Engine.instance.routes.url_helpers.payment_path("x")
7778
end
7879

7980
test "receipt with no extra billing info column" do
@@ -99,22 +100,22 @@ class UserMailerTest < ActionMailer::TestCase
99100

100101
assert_equal [@user.email], email.to
101102
assert_equal I18n.t("pay.user_mailer.subscription_trial_will_end.subject", application: Pay.application_name), email.subject
102-
assert_includes email.body.decoded, "trial is ending soon"
103+
assert_includes email.html_part.decoded, "trial is ending soon"
103104
end
104105

105106
test "subscription_trial_ended" do
106107
email = Pay::UserMailer.with(pay_customer: @pay_customer).subscription_trial_ended
107108

108109
assert_equal [@user.email], email.to
109110
assert_equal I18n.t("pay.user_mailer.subscription_trial_ended.subject", application: Pay.application_name), email.subject
110-
assert_includes email.body.decoded, "trial has ended"
111+
assert_includes email.html_part.decoded, "trial has ended"
111112
end
112113

113114
test "subscription payment failed" do
114115
email = Pay::UserMailer.with(pay_customer: @pay_customer).payment_failed
115116

116117
assert_equal [@user.email], email.to
117118
assert_equal I18n.t("pay.user_mailer.payment_failed.subject", application: Pay.application_name), email.subject
118-
assert_includes email.body.decoded, "payment was declined"
119+
assert_includes email.html_part.decoded, "payment was declined"
119120
end
120121
end

0 commit comments

Comments
 (0)