Skip to content
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

build(deps): Bump stripity_stripe from 2.17.3 to 3.0.0 #59

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions example.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ defmodule AppWeb.CheckoutSessionController do
automatic_tax: %{enabled: true}
}

{:ok, session} = Stripe.Session.create(params)
{:ok, session} = Stripe.Checkout.Session.create(params)

conn
|> put_status(303)
Expand All @@ -572,7 +572,7 @@ end

Let's analyze the code.

We are using `Stripe.session.create/1`
We are using `Stripe.Checkout.Session.create/1`
to create a [`Session`](https://stripe.com/docs/api/checkout/sessions)
in Stripe.
We need to pass a few required parameters.
Expand Down Expand Up @@ -666,7 +666,7 @@ and add the following piece of code:

```elixir
def success(conn, %{"session_id" => session_id}) do
case Stripe.Session.retrieve(session_id) do
case Stripe.Checkout.Session.retrieve(session_id) do
{:ok, _session} ->
render(conn, :success, layout: false)

Expand All @@ -685,7 +685,7 @@ and add the following piece of code:

def cancel(conn, %{"session_id" => session_id}) do

case Stripe.Session.retrieve(session_id) do
case Stripe.Checkout.Session.retrieve(session_id) do
{:ok, _session} ->
render(conn, :cancel, layout: false)

Expand Down Expand Up @@ -721,7 +721,7 @@ we check if the `session_id` is valid
by retrieving it from `Stripe`.

```elixir
Stripe.Session.retrieve(session_id)
Stripe.Checkout.Session.retrieve(session_id)
```

If it is successful, we render a page confirming the payment.
Expand Down Expand Up @@ -997,7 +997,7 @@ Change the handler, so it looks like the following:
```elixir
def success(conn, %{"session_id" => session_id}) do

case Stripe.Session.retrieve(session_id) do
case Stripe.Checkout.Session.retrieve(session_id) do
{:ok, session} ->

person_id = conn.assigns.person.id
Expand Down
2 changes: 1 addition & 1 deletion lib/app_web/controllers/checkout_session_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule AppWeb.CheckoutSessionController do
automatic_tax: %{enabled: true}
}

{:ok, session} = Stripe.Session.create(params)
{:ok, session} = Stripe.Checkout.Session.create(params)

conn
|> put_status(303)
Expand Down
4 changes: 2 additions & 2 deletions lib/app_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule AppWeb.PageController do
end

def success(conn, %{"session_id" => session_id}) do
case Stripe.Session.retrieve(session_id) do
case Stripe.Checkout.Session.retrieve(session_id) do
{:ok, session} ->
person_id = conn.assigns.person.id

Expand All @@ -32,7 +32,7 @@ defmodule AppWeb.PageController do
end

def cancel(conn, %{"session_id" => session_id}) do
case Stripe.Session.retrieve(session_id) do
case Stripe.Checkout.Session.retrieve(session_id) do
{:ok, _session} ->
render(conn, :cancel, layout: false)

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ defmodule App.MixProject do
{:auth_plug, "~> 1.5.1"},

# Stripe integration
{:stripity_stripe, "~> 2.17"},
{:stripity_stripe, "~> 3.0"},

# Storage
{:pockets, "~> 1.4.0"},
Expand Down
8 changes: 4 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%{
"auth_plug": {:hex, :auth_plug, "1.5.2", "3e330cd9c231a29dc9e0524ac4bf81444168dc3ab09bfe789048d88a06e4908a", [:mix], [{:envar, "~> 1.1.0", [hex: :envar, repo: "hexpm", optional: false]}, {:httpoison, "~> 1.8.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:joken, "~> 2.5", [hex: :joken, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:useful, "~> 1.10.0", [hex: :useful, repo: "hexpm", optional: false]}], "hexpm", "326bedcedce560de37d3606bb85f7124b8e29c7ad892d4d8fe04a3ba14d18b06"},
"castore": {:hex, :castore, "1.0.4", "ff4d0fb2e6411c0479b1d965a814ea6d00e51eb2f58697446e9c41a97d940b28", [:mix], [], "hexpm", "9418c1b8144e11656f0be99943db4caf04612e3eaecefb5dae9a2a87565584f8"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
"cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"},
Expand All @@ -13,7 +13,7 @@
"finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"},
"floki": {:hex, :floki, "0.34.2", "5fad07ef153b3b8ec110b6b155ec3780c4b2c4906297d0b4be1a7162d04a7e02", [:mix], [], "hexpm", "26b9d50f0f01796bc6be611ca815c5e0de034d2128e39cc9702eee6b66a4d1c8"},
"gettext": {:hex, :gettext, "0.23.0", "8065a6eb5a6c94ef3909b23178ffc064cd43a51d977b6c80babc8bb0c5ebfd6f", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "09ca27284fe5a82449eb252f2877e551a46b1c9c7d10d72d087211f0bfed9638"},
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~>2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
"heroicons": {:hex, :heroicons, "0.5.3", "ee8ae8335303df3b18f2cc07f46e1cb6e761ba4cf2c901623fbe9a28c0bc51dd", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:phoenix_live_view, ">= 0.18.2", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "a210037e8a09ac17e2a0a0779d729e89c821c944434c3baa7edfc1f5b32f3502"},
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
"httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"},
Expand All @@ -29,7 +29,7 @@
"mock": {:hex, :mock, "0.3.7", "75b3bbf1466d7e486ea2052a73c6e062c6256fb429d6797999ab02fa32f29e03", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "4da49a4609e41fd99b7836945c26f373623ea968cfb6282742bcb94440cf7e5c"},
"nimble_options": {:hex, :nimble_options, "1.0.1", "b448018287b22584e91b5fd9c6c0ad717cb4bcdaa457957c8d57770f56625c43", [:mix], [], "hexpm", "078b2927cd9f84555be6386d56e849b0c555025ecccf7afee00ab6a9e6f63837"},
"nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"},
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
"parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"},
"phoenix": {:hex, :phoenix, "1.7.8", "80cf70507f892843f5b265a89b74327141c71cc0071898fca0d150015d67ffd6", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "7549e3a2f121a232dfbd88ef8dcaeccd671fb09e5fd53ec241a178f248b2c629"},
"phoenix_html": {:hex, :phoenix_html, "3.3.2", "d6ce982c6d8247d2fc0defe625255c721fb8d5f1942c5ac051f6177bffa5973f", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "44adaf8e667c1c20fb9d284b6b0fa8dc7946ce29e81ce621860aa7e96de9a11d"},
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.7.2", "97cc4ff2dba1ebe504db72cb45098cb8e91f11160528b980bd282cc45c73b29c", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18.3", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "0e5fdf063c7a3b620c566a30fcf68b7ee02e5e46fe48ee46a6ec3ba382dc05b7"},
Expand All @@ -43,7 +43,7 @@
"pockets": {:hex, :pockets, "1.4.0", "ef2b4c0479d43721be5019a76f00baed3f5536014d49d216ae11ec720171ab48", [:mix], [], "hexpm", "f777f30f05191dda681ea1eebcc36e92a6790e991d53a0c101a54c6011d0fd90"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
"stripity_stripe": {:hex, :stripity_stripe, "2.17.3", "2c03a8a42aad26f0f1b751332f846bf624081cec0f2fdaceefe96e61238bd58f", [:mix], [{:hackney, "~> 1.18", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}, {:uri_query, "~> 0.1.2", [hex: :uri_query, repo: "hexpm", optional: false]}], "hexpm", "85e3d2729a7668b39cadb4dc51c67ae83c7300eda6d6f62dd06e5b04f1471080"},
"stripity_stripe": {:hex, :stripity_stripe, "3.0.0", "9561b43273e1ab1bf8c5dc4c5aa9f9583157c339c5caf9535181295a64584d96", [:mix], [{:hackney, "~> 1.18", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}, {:uri_query, "~> 0.1.2", [hex: :uri_query, repo: "hexpm", optional: false]}], "hexpm", "b36a241ebe54c23a4a7ba09ff1f236791a4318dc697de6b6f442a9d6dc5feb0a"},
"tailwind": {:hex, :tailwind, "0.2.1", "83d8eadbe71a8e8f67861fe7f8d51658ecfb258387123afe4d9dc194eddc36b0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "e8a13f6107c95f73e58ed1b4221744e1eb5a093cd1da244432067e19c8c9a277"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule AppWeb.CheckoutSessionControllerTest do
conn = setup_conn_with_user(conn)
url_to_be_redirected_to = "www.session_url.com"

with_mock Stripe.Session,
with_mock Stripe.Checkout.Session,
create: fn _params -> {:ok, %{url: url_to_be_redirected_to}} end do
conn = post(conn, ~p"/purchase/checkout-session", %{})

Expand Down
10 changes: 6 additions & 4 deletions test/app_web/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule AppWeb.PageControllerTest do
test "get success with loggedin user with session_id", %{conn: conn} do
conn = setup_conn_with_user(conn)

with_mock Stripe.Session,
with_mock Stripe.Checkout.Session,
retrieve: fn _session_id -> {:ok, %{customer: 1}} end do
conn = get(conn, ~p"/purchase/success?session_id=123")

Expand All @@ -33,7 +33,8 @@ defmodule AppWeb.PageControllerTest do
%{conn: conn} do
conn = setup_conn_with_user(conn)

with_mock Stripe.Session, retrieve: fn _session_id -> {:error, nil} end do
with_mock Stripe.Checkout.Session,
retrieve: fn _session_id -> {:error, nil} end do
conn = get(conn, ~p"/purchase/success?session_id=123")
assert redirected_to(conn, 303) == ~p"/"
end
Expand All @@ -48,7 +49,7 @@ defmodule AppWeb.PageControllerTest do
test "get cancel with loggedin user with session_id", %{conn: conn} do
conn = setup_conn_with_user(conn)

with_mock Stripe.Session,
with_mock Stripe.Checkout.Session,
retrieve: fn _session_id -> {:ok, %{customer: 1}} end do
conn = get(conn, ~p"/purchase/cancel?session_id=123")

Expand All @@ -60,7 +61,8 @@ defmodule AppWeb.PageControllerTest do
%{conn: conn} do
conn = setup_conn_with_user(conn)

with_mock Stripe.Session, retrieve: fn _session_id -> {:error, nil} end do
with_mock Stripe.Checkout.Session,
retrieve: fn _session_id -> {:error, nil} end do
conn = get(conn, ~p"/purchase/cancel?session_id=123")
assert redirected_to(conn, 303) == ~p"/"
end
Expand Down
Loading