Skip to content

Commit 0b1c8db

Browse files
committed
Send receipt email on charge succeeded event handling
1 parent a9e7d78 commit 0b1c8db

File tree

26 files changed

+923
-128
lines changed

26 files changed

+923
-128
lines changed

config/dev.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ config :code_corps, CodeCorps.Endpoint,
1212
code_reloader: true,
1313
check_origin: false
1414

15+
config :code_corps, site_url: "http://localhost:4200"
16+
1517
# Watch static and templates for browser reloading.
1618
config :code_corps, CodeCorps.Endpoint,
1719
live_reload: [
@@ -56,3 +58,6 @@ config :sentry,
5658

5759
config :code_corps, CodeCorps.Mailer,
5860
adapter: Bamboo.LocalAdapter
61+
62+
config :code_corps,
63+
postmark_receipt_template: "123"

config/prod.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ config :code_corps, CodeCorps.Endpoint,
1818
force_ssl: [rewrite_on: [:x_forwarded_proto]],
1919
secret_key_base: System.get_env("SECRET_KEY_BASE")
2020

21+
config :code_corps, site_url: "https://www.codecorps.org"
22+
2123
# Configure your database
2224
config :code_corps, CodeCorps.Repo,
2325
adapter: Ecto.Adapters.Postgres,
@@ -58,6 +60,9 @@ config :code_corps, CodeCorps.Mailer,
5860
adapter: Bamboo.PostmarkAdapter,
5961
api_key: System.get_env("POSTMARK_API_KEY")
6062

63+
config :code_corps,
64+
postmark_receipt_template: "1255222"
65+
6166
# ## SSL Support
6267
#
6368
# To get SSL working, you will need to add the `https` key

config/remote-development.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ config :code_corps, CodeCorps.Endpoint,
1616
url: [scheme: "http", host: "api.pbqrpbecf-qri.org", port: 80],
1717
secret_key_base: System.get_env("SECRET_KEY_BASE")
1818

19+
config :code_corps, site_url: "http://www.pbqrpbecf-qri.org"
20+
1921
# Configure your database
2022
config :code_corps, CodeCorps.Repo,
2123
adapter: Ecto.Adapters.Postgres,
@@ -40,6 +42,9 @@ config :code_corps, :stripe_env, :remote_dev
4042
config :code_corps, CodeCorps.Mailer,
4143
adapter: Bamboo.LocalAdapter
4244

45+
config :code_corps,
46+
postmark_receipt_template: "123"
47+
4348
# ## SSL Support
4449
#
4550
# To get SSL working, you will need to add the `https` key

config/staging.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ config :code_corps, CodeCorps.Endpoint,
1717
url: [scheme: "http", host: "api.pbqrpbecf.org", port: 80],
1818
secret_key_base: System.get_env("SECRET_KEY_BASE")
1919

20+
config :code_corps, site_url: "http://www.pbqrpbecf.org"
21+
2022
# Configure your database
2123
config :code_corps, CodeCorps.Repo,
2224
adapter: Ecto.Adapters.Postgres,
@@ -56,6 +58,9 @@ config :code_corps, CodeCorps.Mailer,
5658
adapter: Bamboo.PostmarkAdapter,
5759
api_key: System.get_env("POSTMARK_API_KEY")
5860

61+
config :code_corps,
62+
postmark_receipt_template: "1252361"
63+
5964
# ## SSL Support
6065
#
6166
# To get SSL working, you will need to add the `https` key

config/test.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ config :code_corps, CodeCorps.Repo,
1818
database: "code_corps_phoenix_test",
1919
pool: Ecto.Adapters.SQL.Sandbox
2020

21+
config :code_corps, site_url: "http://localhost:4200"
22+
2123
# speed up password hashing
2224
config :comeonin, :bcrypt_log_rounds, 4
2325
config :comeonin, :pbkdf2_rounds, 1
@@ -44,3 +46,6 @@ config :sentry,
4446

4547
config :code_corps, CodeCorps.Mailer,
4648
adapter: Bamboo.TestAdapter
49+
50+
config :code_corps,
51+
postmark_receipt_template: "123"

emails/receipt.html

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
<title>Your monthly donation on Code Corps</title>
7+
<!--
8+
Make sure you copy the styles from styles.css into the email template in Postmark before saving there.
9+
10+
<style type="text/css" rel="stylesheet" media="all">
11+
</style>
12+
-->
13+
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
14+
</head>
15+
<body>
16+
<span class="preheader">Your receipt for your monthly donation to {{project_title}}.</span>
17+
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0">
18+
<tr>
19+
<td align="center">
20+
<table class="email-content" width="100%" cellpadding="0" cellspacing="0">
21+
<tr>
22+
<td class="email-masthead" width="100%" cellpadding="0" cellspacing="0">
23+
<table class="email-masthead_inner" align="center" width="570" cellpadding="0" cellspacing="0">
24+
<tr>
25+
<td>
26+
<a href="https://www.codecorps.org">
27+
<img src="https://d3pgew4wbk2vb1.cloudfront.net/emails/images/logo-small@2x.png" class="email-masthead_logo" />
28+
</a>
29+
</td>
30+
</tr>
31+
</table>
32+
</td>
33+
</tr>
34+
<!-- Email Body -->
35+
<tr>
36+
<td class="email-body" width="100%" cellpadding="0" cellspacing="0">
37+
<table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0">
38+
<!-- Body content -->
39+
<tr>
40+
<td class="content-cell">
41+
<table class="donation" width="100%" cellpadding="0" cellspacing="0">
42+
<tr>
43+
<td>
44+
<p class="donation_image center">
45+
<img src="{{high_five_image_url}}" width="100" height="100" />
46+
</p>
47+
<p class="donation_text center">
48+
<strong>{{user_first_name}}</strong>, thanks for your monthly donation to <a href="{{project_url}}">{{project_title}}</a>.
49+
</p>
50+
<tr>
51+
<td class="donation_goal">
52+
<p class="donation_goal_header">
53+
Current Goal
54+
</p>
55+
<p class="donation_goal_footer">
56+
{{project_current_donation_goal_description}}
57+
</p>
58+
<td>
59+
</tr>
60+
</tr>
61+
</td>
62+
</table>
63+
<table class="purchase" width="100%" cellpadding="0" cellspacing="0">
64+
<tr>
65+
<td colspan="2">
66+
<table class="charge_content" width="100%" cellpadding="0" cellspacing="0">
67+
<tr>
68+
<th class="charge_heading">
69+
<p>Description</p>
70+
</th>
71+
<th class="charge_heading">
72+
<p class="align-right">Amount</p>
73+
</th>
74+
</tr>
75+
<tr>
76+
<td width="80%" class="charge_item">Monthly Donation to {{project_title}}</td>
77+
<td class="align-right" width="20%" class="charge_item">{{charge_amount}}</td>
78+
</tr>
79+
<tr>
80+
<td width="80%" class="charge_footer" valign="middle">
81+
<p class="charge_total charge_total--label">Total</p>
82+
</td>
83+
<td width="20%" class="charge_footer" valign="middle">
84+
<p class="charge_total">{{charge_amount}}</p>
85+
</td>
86+
</tr>
87+
</table>
88+
</td>
89+
</tr>
90+
</table>
91+
<table class="body-signature">
92+
<tr>
93+
<td>
94+
<p class="center small">
95+
Questions? Feedback?
96+
<br>Visit our <strong><a href="https://intercom.help/code-corps">Help Center</a></strong> or just reply to this email.</p>
97+
<p class="center">
98+
Thanks again!
99+
<br><strong>The Code Corps Team</strong>
100+
</p>
101+
</td>
102+
</tr>
103+
</table>
104+
<!-- Sub copy -->
105+
<table class="body-sub">
106+
<tr>
107+
<td>
108+
<p class="sub">The charge will appear as <strong>{{charge_statement_descriptor}}</strong> on your statement.</p>
109+
</td>
110+
</tr>
111+
</table>
112+
</td>
113+
</tr>
114+
</table>
115+
</td>
116+
</tr>
117+
<tr>
118+
<td>
119+
<table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0">
120+
<tr>
121+
<td class="content-cell" align="center">
122+
<p class="sub align-center">
123+
Code Corps PBC
124+
<br>4166 Wilson Ave #1
125+
<br>San Diego, CA 92104
126+
</p>
127+
</td>
128+
</tr>
129+
</table>
130+
</td>
131+
</tr>
132+
</table>
133+
</td>
134+
</tr>
135+
</table>
136+
</body>
137+
</html>

0 commit comments

Comments
 (0)