diff --git a/lib/code_corps/conn_utils.ex b/lib/code_corps/conn_utils.ex new file mode 100644 index 000000000..cefe98da9 --- /dev/null +++ b/lib/code_corps/conn_utils.ex @@ -0,0 +1,9 @@ +defmodule CodeCorps.ConnUtils do + def extract_ip(%Plug.Conn{} = conn) do + conn.remote_ip |> Tuple.to_list |> Enum.join(".") + end + + def extract_user_agent(%Plug.Conn{} = conn) do + conn |> Plug.Conn.get_req_header("user-agent") |> List.first + end +end diff --git a/lib/code_corps/stripe_service/adapters/stripe_connect_account.ex b/lib/code_corps/stripe_service/adapters/stripe_connect_account.ex index 62aa68476..2a5b8c2ce 100644 --- a/lib/code_corps/stripe_service/adapters/stripe_connect_account.ex +++ b/lib/code_corps/stripe_service/adapters/stripe_connect_account.ex @@ -51,6 +51,9 @@ defmodule CodeCorps.StripeService.Adapters.StripeConnectAccountAdapter do {:support_email, [:support_email]}, {:support_phone, [:support_phone]}, {:support_url, [:support_url]}, + {:tos_acceptance_date, [:tos_acceptance, :date]}, + {:tos_acceptance_ip, [:tos_acceptance, :ip]}, + {:tos_acceptance_user_agent, [:tos_acceptance, :user_agent]}, {:transfers_enabled, [:transfers_enabled]}, {:verification_disabled_reason, [:verification, :disabled_reason]}, {:verification_due_by, [:verification, :due_by]}, diff --git a/lib/code_corps/stripe_service/stripe_connect_account.ex b/lib/code_corps/stripe_service/stripe_connect_account.ex index f8ab952a2..a72ad807f 100644 --- a/lib/code_corps/stripe_service/stripe_connect_account.ex +++ b/lib/code_corps/stripe_service/stripe_connect_account.ex @@ -4,8 +4,9 @@ defmodule CodeCorps.StripeService.StripeConnectAccountService do @api Application.get_env(:code_corps, :stripe) - def create(%{"country" => country_code, "organization_id" => _} = attributes) do - with {:ok, %Stripe.Account{} = account} <- @api.Account.create(%{country: country_code, managed: true}), + def create(attributes) do + with {:ok, from_params} <- StripeConnectAccountAdapter.from_params(attributes), + {:ok, %Stripe.Account{} = account} <- @api.Account.create(from_params), {:ok, params} <- StripeConnectAccountAdapter.to_params(account, attributes) do %StripeConnectAccount{} diff --git a/lib/code_corps/stripe_testing/account.ex b/lib/code_corps/stripe_testing/account.ex index 2a3cb24aa..b142f7358 100644 --- a/lib/code_corps/stripe_testing/account.ex +++ b/lib/code_corps/stripe_testing/account.ex @@ -1,6 +1,6 @@ defmodule CodeCorps.StripeTesting.Account do - def create(_map) do - {:ok, create_stripe_record(%{})} + def create(attributes) do + {:ok, create_stripe_record(attributes)} end def retrieve(id) do @@ -8,19 +8,18 @@ defmodule CodeCorps.StripeTesting.Account do end def update(id, attributes) do - attributes = + {:ok, create_stripe_record(attributes |> Map.merge(%{id: id}))} + end + + defp create_stripe_record(attributes) do + transformed_attributes = attributes |> CodeCorps.MapUtils.keys_to_string - |> Map.merge(%{"id" => id}) + |> Map.merge(account_fixture) + |> add_nestings - {:ok, create_stripe_record(attributes)} - end - defp create_stripe_record(attributes) do - with attributes <- account_fixture |> Map.merge(attributes) |> add_nestings - do - Stripe.Account |> Stripe.Converter.stripe_map_to_struct(attributes) - end + Stripe.Account |> Stripe.Converter.stripe_map_to_struct(transformed_attributes) end defp account_fixture do diff --git a/lib/code_corps/stripe_testing/customer.ex b/lib/code_corps/stripe_testing/customer.ex index 23941bbc8..acaa21869 100644 --- a/lib/code_corps/stripe_testing/customer.ex +++ b/lib/code_corps/stripe_testing/customer.ex @@ -12,12 +12,10 @@ defmodule CodeCorps.StripeTesting.Customer do end defp do_create(_) do - {:ok, created} = DateTime.from_unix(1479472835) - %Stripe.Customer{ id: "cus_9aMOFmqy1esIRE", account_balance: 0, - created: created, + created: 1479472835, currency: "usd", default_source: nil, delinquent: false, @@ -29,12 +27,10 @@ defmodule CodeCorps.StripeTesting.Customer do end defp do_update(id, map) do - {:ok, created} = DateTime.from_unix(1479472835) - %Stripe.Customer{ id: id, account_balance: 0, - created: created, + created: 1479472835, currency: "usd", default_source: nil, delinquent: false, diff --git a/lib/code_corps/stripe_testing/event.ex b/lib/code_corps/stripe_testing/event.ex index c3374176e..0ec67d9b6 100644 --- a/lib/code_corps/stripe_testing/event.ex +++ b/lib/code_corps/stripe_testing/event.ex @@ -7,11 +7,10 @@ defmodule CodeCorps.StripeTesting.Event do end defp do_retrieve(_) do - {:ok, created} = DateTime.from_unix(1479472835) %Stripe.Event{ api_version: "2016-07-06", - created: created, + created: 1479472835, id: "evt_123", livemode: false, object: "event", @@ -22,11 +21,9 @@ defmodule CodeCorps.StripeTesting.Event do end defp do_retrieve_connect(_) do - {:ok, created} = DateTime.from_unix(1479472835) - %Stripe.Event{ api_version: "2016-07-06", - created: created, + created: 1479472835, id: "evt_123", livemode: false, object: "event", diff --git a/lib/code_corps/stripe_testing/plan.ex b/lib/code_corps/stripe_testing/plan.ex index 4ff7cc612..1bcac5357 100644 --- a/lib/code_corps/stripe_testing/plan.ex +++ b/lib/code_corps/stripe_testing/plan.ex @@ -4,12 +4,10 @@ defmodule CodeCorps.StripeTesting.Plan do end defp do_create(_) do - {:ok, created} = DateTime.from_unix(1479472835) - %Stripe.Plan{ id: "plan_9aMOFmqy1esIRE", amount: 5000, - created: created, + created: 1479472835, currency: "usd", interval: "month", interval_count: 1, diff --git a/lib/code_corps/stripe_testing/subscription.ex b/lib/code_corps/stripe_testing/subscription.ex index 564956dfd..74d63332b 100644 --- a/lib/code_corps/stripe_testing/subscription.ex +++ b/lib/code_corps/stripe_testing/subscription.ex @@ -8,17 +8,15 @@ defmodule CodeCorps.StripeTesting.Subscription do end defp do_create(%{quantity: quantity}) do - {:ok, date} = DateTime.from_unix(1479472835) - {:ok, plan} = CodeCorps.StripeTesting.Plan.create(%{}, []) %Stripe.Subscription{ application_fee_percent: 5.0, cancel_at_period_end: false, canceled_at: nil, - created: date, - current_period_end: date, - current_period_start: date, + created: 1479472835, + current_period_end: 1479472835, + current_period_start: 1479472835, customer: "cus_123", ended_at: nil, id: "sub_123", @@ -27,7 +25,7 @@ defmodule CodeCorps.StripeTesting.Subscription do plan: plan, quantity: quantity, source: nil, - start: date, + start: 1479472835, status: "active", tax_percent: nil, trial_end: nil, @@ -36,17 +34,15 @@ defmodule CodeCorps.StripeTesting.Subscription do end defp do_retrieve(_) do - {:ok, date} = DateTime.from_unix(1479472835) - {:ok, plan} = CodeCorps.StripeTesting.Plan.create(%{}, []) %Stripe.Subscription{ application_fee_percent: 5.0, cancel_at_period_end: false, canceled_at: nil, - created: date, - current_period_end: date, - current_period_start: date, + created: 1479472835, + current_period_end: 1479472835, + current_period_start: 1479472835, customer: "cus_123", ended_at: nil, id: "sub_123", @@ -55,7 +51,7 @@ defmodule CodeCorps.StripeTesting.Subscription do plan: plan, quantity: 1000, source: nil, - start: date, + start: 1479472835, status: "canceled", tax_percent: nil, trial_end: nil, diff --git a/mix.lock b/mix.lock index a4edd3614..7bd7d90b3 100644 --- a/mix.lock +++ b/mix.lock @@ -56,7 +56,7 @@ "segment": {:hex, :segment, "0.1.1", "47bf9191590e7a533c105d1e21518e0d6da47c91e8d98ebb649c624db5dfc359", [:mix], [{:httpoison, "~> 0.8", [hex: :httpoison, optional: false]}, {:poison, "~> 1.3 or ~> 2.0", [hex: :poison, optional: false]}]}, "sentry": {:hex, :sentry, "2.1.0", "51e7ca261b519294ac73b30763893c4a7ad2005205514aefa5bf37ccb83e44ea", [:mix], [{:hackney, "~> 1.6.1", [hex: :hackney, optional: false]}, {:plug, "~> 1.0", [hex: :plug, optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}, {:uuid, "~> 1.0", [hex: :uuid, optional: false]}]}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:make, :rebar], []}, - "stripity_stripe": {:git, "https://github.com/code-corps/stripity_stripe.git", "88698ce6582574d5c7070db3551099c2439248c9", [branch: "add-update-changesets"]}, + "stripity_stripe": {:git, "https://github.com/code-corps/stripity_stripe.git", "bffefa3195d4fc75dafece4094d697506dc72c07", [branch: "2.0"]}, "sweet_xml": {:hex, :sweet_xml, "0.6.3", "814265792baeb163421811c546581c522dfdcb9d1767b1e59959c52906414e80", [:mix], []}, "timber": {:hex, :timber, "0.4.7", "df3fcd79bcb4eb4b53874d906ef5f3a212937b4bc7b7c5b244745202cc389443", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: true]}, {:phoenix, "~> 1.2", [hex: :phoenix, optional: true]}, {:plug, "~> 1.2", [hex: :plug, optional: true]}, {:poison, "~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]}, "timex": {:hex, :timex, "3.1.5", "413d6d8d6f0162a5d47080cb8ca520d790184ac43e097c95191c7563bf25b428", [:mix], [{:combine, "~> 0.7", [hex: :combine, optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, optional: false]}]}, diff --git a/priv/repo/migrations/20170102130055_add_tos_acceptance_fields_to_stripe_connect_accounts.exs b/priv/repo/migrations/20170102130055_add_tos_acceptance_fields_to_stripe_connect_accounts.exs new file mode 100644 index 000000000..54d012960 --- /dev/null +++ b/priv/repo/migrations/20170102130055_add_tos_acceptance_fields_to_stripe_connect_accounts.exs @@ -0,0 +1,11 @@ +defmodule CodeCorps.Repo.Migrations.AddTosAcceptanceFieldsToStripeConnectAccounts do + use Ecto.Migration + + def change do + alter table(:stripe_connect_accounts) do + add :tos_acceptance_date, :datetime + add :tos_acceptance_ip, :string + add :tos_acceptance_user_agent, :string + end + end +end diff --git a/priv/repo/migrations/20170102181053_convert_stripe_time_stamps_to_integers.exs b/priv/repo/migrations/20170102181053_convert_stripe_time_stamps_to_integers.exs new file mode 100644 index 000000000..960ee00c3 --- /dev/null +++ b/priv/repo/migrations/20170102181053_convert_stripe_time_stamps_to_integers.exs @@ -0,0 +1,87 @@ +defmodule CodeCorps.Repo.Migrations.ConvertStripeTimeStampsToIntegers do + use Ecto.Migration + + def up do + alter table(:stripe_connect_accounts) do + remove :tos_acceptance_date + remove :verification_due_by + + add :tos_acceptance_date, :integer + add :verification_due_by, :integer + end + + alter table(:stripe_platform_customers) do + remove :created + add :created, :integer + end + + alter table(:stripe_connect_plans) do + remove :created + add :created, :integer + end + + alter table(:stripe_connect_subscriptions) do + remove :cancelled_at + remove :created + remove :current_period_end + remove :current_period_start + remove :ended_at + remove :start + + add :cancelled_at, :integer + add :created, :integer + add :current_period_end, :integer + add :current_period_start, :integer + add :ended_at, :integer + add :start, :integer + end + + alter table(:stripe_file_upload) do + remove :created + + add :created, :integer + end + end + + def down do + alter table(:stripe_connect_accounts) do + remove :tos_acceptance_date + remove :verification_due_by + + add :tos_acceptance_date, :datetime + add :verification_due_by, :datetime + end + + alter table(:stripe_platform_customers) do + remove :created + add :created, :datetime + end + + alter table(:stripe_connect_plans) do + remove :created + add :created, :datetime + end + + alter table(:stripe_connect_subscriptions) do + remove :cancelled_at + remove :created + remove :current_period_end + remove :current_period_start + remove :ended_at + remove :start + + add :cancelled_at, :datetime + add :created, :datetime + add :current_period_end, :datetime + add :current_period_start, :datetime + add :ended_at, :datetime + add :start, :datetime + end + + alter table(:stripe_file_upload) do + remove :created + + add :created, :datetime + end + end +end diff --git a/test/controllers/stripe_connect_account_controller_test.exs b/test/controllers/stripe_connect_account_controller_test.exs index 1c6dcf168..eb759741d 100644 --- a/test/controllers/stripe_connect_account_controller_test.exs +++ b/test/controllers/stripe_connect_account_controller_test.exs @@ -34,11 +34,22 @@ defmodule CodeCorps.StripeConnectAccountControllerTest do test "creates and renders resource when user is authenticated and authorized", %{conn: conn, current_user: current_user} do organization = insert(:organization) insert(:organization_membership, member: current_user, organization: organization, role: "owner") - attrs = %{organization: organization, country: "US"} - assert conn |> request_create(attrs) |> json_response(201) + + attrs = %{organization: organization, country: "US", tos_acceptance_date: 123456} + + response = conn |> put_req_header("user-agent", "Test agent") |> request_create(attrs) + assert response |> json_response(201) user_id = current_user.id assert_received {:track, ^user_id, "Created Stripe Connect Account", %{}} + + account = StripeConnectAccount |> Repo.one + + assert account.tos_acceptance_date + request_ip = CodeCorps.ConnUtils.extract_ip(response) + assert account.tos_acceptance_ip == request_ip + request_user_agent = CodeCorps.ConnUtils.extract_user_agent(response) + assert account.tos_acceptance_user_agent == request_user_agent end test "does not create resource and renders 401 when unauthenticated", %{conn: conn} do diff --git a/test/lib/code_corps/conn_utils_test.exs b/test/lib/code_corps/conn_utils_test.exs new file mode 100644 index 000000000..92718395b --- /dev/null +++ b/test/lib/code_corps/conn_utils_test.exs @@ -0,0 +1,21 @@ +defmodule CodeCorps.ConnUtilsTest do + use CodeCorps.ConnCase + + alias CodeCorps.ConnUtils + + defp conn_with_ip(ip) do + %Plug.Conn{remote_ip: ip} + end + + describe "extract_ip/1" do + test "extracts IP address from the request properly" do + assert conn_with_ip({151, 236, 219, 228}) |> ConnUtils.extract_ip == "151.236.219.228" + end + end + + describe "extract_user_agent/1" do + test "extracts User Agent from the request properly", %{conn: conn} do + assert conn |> put_req_header("user-agent", "Some agent") |> ConnUtils.extract_user_agent == "Some agent" + end + end +end diff --git a/test/lib/code_corps/stripe_service/adapters/stripe_connect_account_test.exs b/test/lib/code_corps/stripe_service/adapters/stripe_connect_account_test.exs index 3f944dad2..2b20c1ade 100644 --- a/test/lib/code_corps/stripe_service/adapters/stripe_connect_account_test.exs +++ b/test/lib/code_corps/stripe_service/adapters/stripe_connect_account_test.exs @@ -62,6 +62,11 @@ defmodule CodeCorps.StripeService.Adapters.StripeConnectAccountTestAdapter do support_email: nil, support_phone: "1234567890", timezone: "US/Pacific", + tos_acceptance: %{ + date: 123456, + ip: "127.0.0.1", + user_agent: "Chrome" + }, transfers_enabled: false, verification: %{ disabled_reason: "fields_needed", @@ -141,6 +146,10 @@ defmodule CodeCorps.StripeService.Adapters.StripeConnectAccountTestAdapter do "transfers_enabled" => false, + "tos_acceptance_date" => 123456, + "tos_acceptance_ip" => "127.0.0.1", + "tos_acceptance_user_agent" => "Chrome", + "verification_disabled_reason" => "fields_needed", "verification_due_by" => nil, "verification_fields_needed" => [ diff --git a/test/lib/code_corps/stripe_service/stripe_connect_account_service_test.exs b/test/lib/code_corps/stripe_service/stripe_connect_account_service_test.exs index a95fc61bb..cd644fde9 100644 --- a/test/lib/code_corps/stripe_service/stripe_connect_account_service_test.exs +++ b/test/lib/code_corps/stripe_service/stripe_connect_account_service_test.exs @@ -10,7 +10,11 @@ defmodule CodeCorps.StripeService.StripeConnectAccountServiceTest do test "creates a StripeConnectAccount" do organization = insert(:organization) - attributes = %{"country" => "US", "organization_id" => organization.id} + attributes = %{ + "country" => "US", + "organization_id" => organization.id, + "tos_acceptance_date" => 123456 + } {:ok, %StripeConnectAccount{} = connect_account} = StripeConnectAccountService.create(attributes) @@ -18,6 +22,7 @@ defmodule CodeCorps.StripeService.StripeConnectAccountServiceTest do assert connect_account.country == "US" assert connect_account.organization_id == organization.id assert connect_account.managed == true + assert connect_account.tos_acceptance_date == 123456 end end diff --git a/test/models/stripe_connect_account_test.exs b/test/models/stripe_connect_account_test.exs index f99c71547..a13370960 100644 --- a/test/models/stripe_connect_account_test.exs +++ b/test/models/stripe_connect_account_test.exs @@ -4,7 +4,8 @@ defmodule CodeCorps.StripeConnectAccountTest do alias CodeCorps.StripeConnectAccount @valid_attrs %{ - id_from_stripe: "abc123" + id_from_stripe: "abc123", + tos_acceptance_date: 1234567 } @invalid_attrs %{} @@ -22,8 +23,9 @@ defmodule CodeCorps.StripeConnectAccountTest do changeset = StripeConnectAccount.create_changeset(%StripeConnectAccount{}, @invalid_attrs) refute changeset.valid? - assert_error_message(changeset, :id_from_stripe, "can't be blank") - assert_error_message(changeset, :organization_id, "can't be blank") + assert_validation_triggered(changeset, :id_from_stripe, :required) + assert_validation_triggered(changeset, :organization_id, :required) + assert_validation_triggered(changeset, :tos_acceptance_date, :required) end test "ensures associations link to records that exist" do diff --git a/test/support/factories.ex b/test/support/factories.ex index e845febb1..617568c88 100644 --- a/test/support/factories.ex +++ b/test/support/factories.ex @@ -168,7 +168,7 @@ defmodule CodeCorps.Factories do def stripe_platform_customer_factory do %CodeCorps.StripePlatformCustomer{ - created: Timex.now, + created: Timex.now |> Timex.to_unix, email: sequence(:email, &"email_#{&1}@mail.com"), id_from_stripe: sequence(:id_from_stripe, &"stripe_id_#{&1}"), user: build(:user) diff --git a/test/support/json_api_helpers.ex b/test/support/json_api_helpers.ex index e9ac982dc..0f28dc1ed 100644 --- a/test/support/json_api_helpers.ex +++ b/test/support/json_api_helpers.ex @@ -27,6 +27,7 @@ defmodule CodeCorps.JsonAPIHelpers do end end + defp is_attribute({_key, %DateTime{} = _val}), do: true defp is_attribute({_key, val}) when is_map(val), do: false defp is_attribute(_), do: true diff --git a/web/controllers/stripe_connect_account_controller.ex b/web/controllers/stripe_connect_account_controller.ex index 813d66ec1..0ac44523f 100644 --- a/web/controllers/stripe_connect_account_controller.ex +++ b/web/controllers/stripe_connect_account_controller.ex @@ -2,6 +2,7 @@ defmodule CodeCorps.StripeConnectAccountController do use CodeCorps.Web, :controller use JaResource + alias CodeCorps.ConnUtils alias CodeCorps.StripeConnectAccount alias CodeCorps.StripeService.StripeConnectAccountService @@ -11,6 +12,9 @@ defmodule CodeCorps.StripeConnectAccountController do def handle_create(conn, attributes) do attributes + |> Map.put("tos_acceptance_ip", conn |> ConnUtils.extract_ip) + |> Map.put("tos_acceptance_user_agent", conn |> ConnUtils.extract_user_agent) + |> Map.put("managed", true) |> StripeConnectAccountService.create |> handle_create_result(conn) end diff --git a/web/models/stripe_connect_account.ex b/web/models/stripe_connect_account.ex index bc9f2ebdf..26d633b40 100644 --- a/web/models/stripe_connect_account.ex +++ b/web/models/stripe_connect_account.ex @@ -47,6 +47,7 @@ defmodule CodeCorps.StripeConnectAccount do field :legal_entity_ssn_last_4, :string, virtual: true field :legal_entity_ssn_last_4_provided, :boolean, default: false field :legal_entity_type, :string + field :legal_entity_verification_details, :string field :legal_entity_verification_details_code, :string field :legal_entity_verification_document, :string @@ -60,10 +61,13 @@ defmodule CodeCorps.StripeConnectAccount do field :support_phone, :string field :support_url, :string + field :tos_acceptance_date, :integer + field :tos_acceptance_ip, :string + field :tos_acceptance_user_agent, :string field :transfers_enabled, :boolean field :verification_disabled_reason, :string - field :verification_due_by, Ecto.DateTime + field :verification_due_by, :integer field :verification_fields_needed, {:array, :string}, default: [] belongs_to :organization, CodeCorps.Organization @@ -119,6 +123,9 @@ defmodule CodeCorps.StripeConnectAccount do :support_email, :support_phone, :support_url, + :tos_acceptance_date, + :tos_acceptance_ip, + :tos_acceptance_user_agent, :transfers_enabled, :verification_disabled_reason, :verification_due_by, @@ -127,10 +134,12 @@ defmodule CodeCorps.StripeConnectAccount do def create_changeset(struct, params \\ %{}) do valid_params = Enum.concat(@insert_params, @stripe_params) - struct + changeset = struct |> cast(params, valid_params) - |> validate_required([:id_from_stripe, :organization_id]) + |> validate_required([:id_from_stripe, :organization_id, :tos_acceptance_date]) |> assoc_constraint(:organization) + + changeset end def webhook_update_changeset(struct, params \\ %{}) do diff --git a/web/models/stripe_connect_plan.ex b/web/models/stripe_connect_plan.ex index 2503b1701..a35f9fa8c 100644 --- a/web/models/stripe_connect_plan.ex +++ b/web/models/stripe_connect_plan.ex @@ -13,7 +13,7 @@ defmodule CodeCorps.StripeConnectPlan do schema "stripe_connect_plans" do field :amount, :integer - field :created, Ecto.DateTime + field :created, :integer field :id_from_stripe, :string, null: false field :name, :string diff --git a/web/models/stripe_connect_subscription.ex b/web/models/stripe_connect_subscription.ex index 9e25ad8a7..42bf1ded0 100644 --- a/web/models/stripe_connect_subscription.ex +++ b/web/models/stripe_connect_subscription.ex @@ -29,16 +29,16 @@ defmodule CodeCorps.StripeConnectSubscription do schema "stripe_connect_subscriptions" do field :application_fee_percent, :decimal - field :cancelled_at, Ecto.DateTime - field :created, Ecto.DateTime - field :current_period_end, Ecto.DateTime - field :current_period_start, Ecto.DateTime + field :cancelled_at, :integer + field :created, :integer + field :current_period_end, :integer + field :current_period_start, :integer field :customer_id_from_stripe, :string - field :ended_at, Ecto.DateTime + field :ended_at, :integer field :id_from_stripe, :string, null: false field :plan_id_from_stripe, :string, null: false field :quantity, :integer - field :start, Ecto.DateTime + field :start, :integer field :status, :string belongs_to :stripe_connect_plan, CodeCorps.StripeConnectPlan diff --git a/web/models/stripe_file_upload.ex b/web/models/stripe_file_upload.ex index 293bc714b..73ae87ed7 100644 --- a/web/models/stripe_file_upload.ex +++ b/web/models/stripe_file_upload.ex @@ -2,7 +2,7 @@ defmodule CodeCorps.StripeFileUpload do use CodeCorps.Web, :model schema "stripe_file_uploads" do - field :created, Timex.Ecto.DateTime + field :created, :integer field :id_from_stripe, :string, null: false field :purpose, :string field :size, :integer diff --git a/web/models/stripe_platform_customer.ex b/web/models/stripe_platform_customer.ex index 50252670e..02ebd8914 100644 --- a/web/models/stripe_platform_customer.ex +++ b/web/models/stripe_platform_customer.ex @@ -2,7 +2,7 @@ defmodule CodeCorps.StripePlatformCustomer do use CodeCorps.Web, :model schema "stripe_platform_customers" do - field :created, Timex.Ecto.DateTime + field :created, :integer field :currency, :string field :delinquent, :boolean field :email, :string