Skip to content

Commit 4a99a5b

Browse files
Merge branch 'develop' into 60-add-elasticsearch
* develop: (28 commits) Send receipt email on charge succeeded event handling Add Postmark adapter for Bamboo emails Fix migrations Add stripe charge model and event tracking Add user_id to events Separate IgnoredEventHandler behavior for connect and platform events. Tracking and testing for donation goal update and create Subscription create tests, with segment tracking assertions Added unique constraint to member/organization of organization membership Update deps and fix errors with Stripe event handling Update docs for postgres env vars Extend StripeConnectAccountService.update_from_stripe to also create associated external account record Remove Docker and update docs Add explicit ignoring of some event types during webhook processing Restructure WebhookProcessor to make testing easier Add error handling to token controller Add structure.sql Bridge gap with Mirage seeds Set order of the default task lists through TaskList.changeset/2 Store object ids with events ...
2 parents adf83f2 + b3032d2 commit 4a99a5b

116 files changed

Lines changed: 5568 additions & 1206 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export AWS_ACCESS_KEY_ID=
22
export AWS_SECRET_ACCESS_KEY=
33
export CLOUDFRONT_DOMAIN=
4+
export POSTMARK_API_KEY=
45
export S3_BUCKET=
56
export SEGMENT_WRITE_KEY=
67
export SENTRY_DSN=

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Thanks for thinking about helping! How would you like to help?
1414

1515
2. Read and work through [the installation guide](/docs/INSTALLING.md).
1616

17-
3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `docker-compose run test mix test`
17+
3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `MIX_ENV=test mix test`
1818

1919
Okay, you're ready to go!
2020

Dockerfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,35 @@ You can also always come :wave: hello [in our Slack](http://slack.codecorps.org)
2626

2727
We highlight everyone who's contributed to [the Code Corps team page](https://www.codecorps.org/team). If we've missed you for some reason, please [open an issue in the Ember app](https://github.com/code-corps/code-corps-ember/issues/new)!
2828

29-
**At the moment, our focus is integration with Stripe**, so if you want to help, that would be the most useful spot. Check our [Donations milestone](https://github.com/code-corps/code-corps-api/blob/develop/milestone/1) to see which parts we need help on. Of course, help with other areas is always welcome, so if that sort of thing isn't your cup of tea, feel free to pick anything else.
29+
## Where should I help?
3030

31-
## Installing with Docker
31+
We recommend checking the latest [milestones on GitHub](https://github.com/code-corps/code-corps-api/milestones) to get a sense for our current priorities.
3232

33-
To make your life easier, you can just clone this repository and use our Docker container. [Follow this guide to get started.](https://github.com/code-corps/code-corps-api/blob/develop/docs/INSTALLING.md)
33+
Of course, help with other areas is always welcome, so if the current milestones aren't your cup of tea, feel free to [browse the issues](https://github.com/code-corps/code-corps-api/issues).
34+
35+
And you can _always_ ask us for advice on where to start [in our Slack](http://slack.codecorps.org).
36+
37+
## Installing
38+
39+
[Follow this guide to get started.](https://github.com/code-corps/code-corps-api/blob/develop/docs/INSTALLING.md)
3440

3541
## Usage
3642

3743
Have everything installed and ready to work? Read [our usage guides](USAGE.md) to learn how to:
3844

39-
- [Run normal `mix` commands through Docker](USAGE.md#interacting-with-the-app)
45+
- [Run `mix` commands](USAGE.md#interacting-with-the-app)
4046
- [Stop and start the server](USAGE.md#stopping-and-starting-the-server)
4147
- [Run tests](USAGE.md#running-tests)
42-
- [Linting and Style Guidelines](USAGE.md#linting-code-with-credo)
43-
- [Rebuild Docker containers](USAGE.md#rebuilding-docker-containers)
48+
- [Linting and style guidelines](USAGE.md#linting-code-with-credo)
4449
- [Work with the Ember front-end](USAGE.md#serving-ember)
4550
- [Set up environment variables](USAGE.md#environment)
46-
- [Push changes to GitHub](USAGE.md#pushing-changes)
4751

4852
## Documentation
4953

5054
We have several types of docs:
5155

5256
- Project documentation (README, CONTRIBUTING, etc.)
53-
- [API documentation](http://docs.codecorpsapi.apiary.io/) written in [API Blueprint](https://apiblueprint.org/) format in [`blueprint/api.apib`](https://github.com/code-corps/code-corps-api/blob/develop/blueprint/api.apib) and published to the web when merging into `develop`
57+
- API documentation ([`master`](http://docs.codecorpsapi.apiary.io/) | [`develop`](http://docs.codecorpsapidevelop.apiary.io/) | [local](docs/API.md)) written in [API Blueprint](https://apiblueprint.org/) format in [`blueprint/api.apib`](https://github.com/code-corps/code-corps-api/blob/develop/blueprint/api.apib) and published to the web when merging into `develop` or `master`
5458
- [Inline documentation](https://code-corps.github.io/code-corps-api-github-pages) for the Elixir app generated by [`ex_doc`](https://github.com/elixir-lang/ex_doc) and published to GitHub pages when merging into `develop`
5559

5660
Want to improve the documentation? [Get started here.](https://github.com/code-corps/code-corps-api/blob/develop/.github/CONTRIBUTING.md#what-kind-of-documentation-are-you-writing)
@@ -68,4 +72,4 @@ We care about:
6872
- Welcoming and teaching new contributors :wave:
6973
- Writing small, clear, and achievable issues :dart:
7074

71-
We also track quantifiable metrics like inline documentation coverage, testing coverage, and so on. You can see some of these metrics in the icons at the top of this page.
75+
We also track quantifiable metrics like inline documentation coverage, testing coverage, and so on. You can see some of these metrics in the badges at the top of this page.

USAGE.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,32 @@
33
- [How do I interact with the app?](#interacting-with-the-app)
44
- [How do I stop and start the server?](#stopping-and-starting-the-server)
55
- [How do I run tests?](#running-tests)
6-
- [How do I rebuild Docker containers?](#rebuilding-docker-containers)
6+
- [How do I view the API docs?](#api-docs)
7+
- [How do I lint the code?](#linting-code-with-credo)
78
- [How do I serve the front-end?](#serving-ember)
89
- [Do I need special environment variables?](#environment)
9-
- [How do I push changes to GitHub?](#pushing-changes)
1010

1111
### Interacting with the app
1212

13-
You'll generally interact with the app using `docker-compose`. You can choose not to if you're contributing often enough to not need to worry about dependency management. But if you're short on time, Docker is probably the happier path to get up and running quickly.
13+
You'll generally interact with the app using `mix` tasks. You can [read the Phoenix documentation here](http://www.phoenixframework.org/docs/mix-tasks).
1414

15-
Here are conversions of your typical Elixir project commands:
15+
### Stopping and starting the server
1616

17-
- `iex -S mix phoenix.server``docker-compose run web iex -S mix phoenix.server`
18-
- `mix run priv/repo/seeds.exs``docker-compose run web mix run priv/repo/seeds/.exs`
19-
- `mix test``docker-compose run test mix test`
20-
- and so on...
17+
To start the server, run `mix phoenix.server`.
2118

22-
These follow the basic format of `my-command with arguments``docker-compose run TARGET_CONTAINER my-command with arguments`.
19+
To stop the server, hit `Ctrl+C` twice.
2320

24-
### Stopping and starting the server
21+
### Running tests
2522

26-
Need to stop the containers? Either `Ctrl+C` or in a separate prompt run `docker-compose stop`.
23+
To run the tests you run `MIX_ENV=test mix test`.
2724

28-
To start the services again you can run `docker-compose up`, or `docker-compose start` to start the containers in a detached state.
25+
### API docs
2926

30-
### Rebuilding Docker containers
27+
You can [view the API documentation locally](docs/API.md) with the Apiary CLI.
3128

32-
If you ever need to rebuild you can run `docker-compose up --build`. Unless you've destroyed your Docker container images, this should be faster than the first run.
29+
The production API's documentation (matching the latest `master` branch) can be found online at `http://docs.codecorpsapi.apiary.io/`.
3330

34-
### Running tests
35-
36-
To run the tests you can run `docker-compose run test mix test`.
31+
The staging API's documentation (matching the latest `develop` branch) can be found online at `http://docs.codecorpsapidevelop.apiary.io/`.
3732

3833
### Linting Code with Credo
3934

@@ -45,7 +40,7 @@ Credo's style guide is influenced by this more popular and exhaustive community
4540

4641
The Code Corps API is intended to work alongside a client written in Ember. For that purpose, the Elixir application exposes all of its API endpoints behind an `api.` subdomain.
4742

48-
For Ember to work with your now running API listening on `localhost:49235`, you simply need to run under `ember serve` at `localhost:4200` and everything should work under normal conditions.
43+
For Ember to work with your now running API listening on `localhost:4000`, you simply need to run under `ember serve` at `localhost:4200` and everything should work under normal conditions.
4944

5045
### Environment
5146

@@ -78,7 +73,3 @@ In your `.env` you should have a `STRIPE_SECRET_KEY` and `STRIPE_PLATFORM_CLIENT
7873

7974
- `STRIPE_SECRET_KEY` should be set to your "Test Secret Key" from the [API Keys section of your Stripe dashboard](https://dashboard.stripe.com/account/apikeys).
8075
- `STRIPE_PLATFORM_CLIENT_ID` should be set to "Development `client_id`" key from the [Connect section of your Stripe dashboard](https://dashboard.stripe.com/account/applications/settings).
81-
82-
### Pushing changes
83-
84-
You can use `git` as you normally would, either on your own host machine or in Docker's `web` container.

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: [
@@ -59,3 +61,6 @@ config :sentry,
5961

6062
config :code_corps, CodeCorps.Mailer,
6163
adapter: Bamboo.LocalAdapter
64+
65+
config :code_corps,
66+
postmark_receipt_template: "123"

config/prod.exs

Lines changed: 7 additions & 1 deletion
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,7 +60,11 @@ config :sentry,
5860

5961
# TODO: Replace with actual adapter
6062
config :code_corps, CodeCorps.Mailer,
61-
adapter: Bamboo.LocalAdapter
63+
adapter: Bamboo.PostmarkAdapter,
64+
api_key: System.get_env("POSTMARK_API_KEY")
65+
66+
config :code_corps,
67+
postmark_receipt_template: "1255222"
6268

6369
# ## SSL Support
6470
#

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: 7 additions & 1 deletion
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,
@@ -53,7 +55,11 @@ config :code_corps, :stripe, Stripe
5355
config :code_corps, :stripe_env, :staging
5456

5557
config :code_corps, CodeCorps.Mailer,
56-
adapter: Bamboo.LocalAdapter
58+
adapter: Bamboo.PostmarkAdapter,
59+
api_key: System.get_env("POSTMARK_API_KEY")
60+
61+
config :code_corps,
62+
postmark_receipt_template: "1252361"
5763

5864
# ## SSL Support
5965
#

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
@@ -47,3 +49,6 @@ config :sentry,
4749

4850
config :code_corps, CodeCorps.Mailer,
4951
adapter: Bamboo.TestAdapter
52+
53+
config :code_corps,
54+
postmark_receipt_template: "123"

0 commit comments

Comments
 (0)