-
Notifications
You must be signed in to change notification settings - Fork 84
Add stripe external account model and tests #576
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
Merged
joshsmith
merged 1 commit into
develop
from
571-stripe-external-account-model-and-tests
Dec 14, 2016
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
priv/repo/migrations/20161214005935_create_stripe_external_account.exs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| defmodule CodeCorps.Repo.Migrations.CreateStripeExternalAccount do | ||
| use Ecto.Migration | ||
|
|
||
| def change do | ||
| create table(:stripe_external_accounts) do | ||
| add :id_from_stripe, :string, null: false | ||
| add :account_id_from_stripe, :string, null: false | ||
| add :account_holder_name, :string | ||
| add :account_holder_type, :string | ||
| add :bank_name, :string | ||
| add :country, :string | ||
| add :currency, :string | ||
| add :default_for_currency, :string | ||
| add :fingerprint, :string | ||
| add :last4, :string | ||
| add :routing_number, :string | ||
| add :status, :string | ||
|
|
||
| timestamps() | ||
| end | ||
|
|
||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| defmodule CodeCorps.StripeExternalAccountTest do | ||
| use CodeCorps.ModelCase | ||
|
|
||
| alias CodeCorps.StripeExternalAccount | ||
|
|
||
| @valid_attrs %{account_id_from_stripe: "some content", id_from_stripe: "some content"} | ||
| @invalid_attrs %{} | ||
|
|
||
| test "changeset with valid attributes" do | ||
| changeset = StripeExternalAccount.changeset(%StripeExternalAccount{}, @valid_attrs) | ||
| assert changeset.valid? | ||
| end | ||
|
|
||
| test "changeset with invalid attributes" do | ||
| changeset = StripeExternalAccount.changeset(%StripeExternalAccount{}, @invalid_attrs) | ||
| refute changeset.valid? | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| defmodule CodeCorps.StripeExternalAccount do | ||
| use CodeCorps.Web, :model | ||
|
|
||
| schema "stripe_external_accounts" do | ||
| field :id_from_stripe, :string, null: false | ||
| field :account_id_from_stripe, :string, null: false | ||
| field :account_holder_name, :string | ||
| field :account_holder_type, :string | ||
| field :bank_name, :string | ||
| field :country, :string | ||
| field :currency, :string | ||
| field :default_for_currency, :string | ||
| field :fingerprint, :string | ||
| field :last4, :string | ||
| field :routing_number, :string | ||
| field :status, :string | ||
|
|
||
| timestamps() | ||
| end | ||
|
|
||
| @doc """ | ||
| Builds a changeset based on the `struct` and `params`. | ||
| """ | ||
| def changeset(struct, params \\ %{}) do | ||
| struct | ||
| |> cast(params, [:id_from_stripe, :account_id_from_stripe, :account_holder_name, :account_holder_type, :bank_name, :country, :currency, :default_for_currency, :fingerprint, :last4, :routing_number, :status]) | ||
| |> validate_required([:id_from_stripe, :account_id_from_stripe]) | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the comment below, can probably use less attrs here for it to be valid.