Skip to content

Commit

Permalink
Add more sponsor products
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabi755 committed Apr 24, 2024
1 parent 7aa8a03 commit 0f1522d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ CHANGELOG

## Upcoming version ##

## 1.1.2 (2024-04-24) ##

- 🛠 Add more sponsor products

## 1.1.1 (2024-04-20) ##

- 🐞 Clean constrains & indexes after table migrations
Expand Down
2 changes: 1 addition & 1 deletion apps/sponsor/lib/sponsor/purchases/purchase.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Tankste.Sponsor.Purchases.Purchase do
struct
|> cast(params, [:device_id, :product, :provider, :type])
|> validate_required([:device_id, :product, :provider, :type])
|> validate_inclusion(:product, ~w(sponsor_single_1 sponsor_single_2 sponsor_single_10 sponsor_subscription_monthly_1 sponsor_subscription_monthly_2 sponsor_subscription_yearly_12))
|> validate_inclusion(:product, ~w(sponsor_single_1 sponsor_single_2 sponsor_single_5 sponsor_single_10 sponsor_single_20 sponsor_single_50 sponsor_subscription_monthly_1 sponsor_subscription_monthly_2 sponsor_subscription_yearly_12))
|> validate_inclusion(:provider, ~w(apple_store play_store))
|> validate_inclusion(:type, ~w(single subscription))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ defmodule Tankste.SponsorWeb.PurchaseController do

defp product_from_apple_id("app.tankste.sponsor.product.1"), do: "sponsor_single_1"
defp product_from_apple_id("app.tankste.sponsor.product.2"), do: "sponsor_single_2"
defp product_from_apple_id("app.tankste.sponsor.product.5"), do: "sponsor_single_5"
defp product_from_apple_id("app.tankste.sponsor.product.10"), do: "sponsor_single_10"
defp product_from_apple_id("app.tankste.sponsor.product.20"), do: "sponsor_single_20"
defp product_from_apple_id("app.tankste.sponsor.product.50"), do: "sponsor_single_50"
defp product_from_apple_id("app.tankste.sponsor.sub.monthly.1"), do: "sponsor_subscription_monthly_1"
defp product_from_apple_id("app.tankste.sponsor.sub.monthly.2"), do: "sponsor_subscription_monthly_2"
defp product_from_apple_id("app.tankste.sponsor.sub.yearly.12"), do: "sponsor_subscription_yearly_12"
Expand Down Expand Up @@ -143,15 +146,21 @@ defmodule Tankste.SponsorWeb.PurchaseController do

defp product_from_google_id("app.tankste.sponsor.product.1"), do: "sponsor_single_1"
defp product_from_google_id("app.tankste.sponsor.product.2"), do: "sponsor_single_2"
defp product_from_google_id("app.tankste.sponsor.product.5"), do: "sponsor_single_5"
defp product_from_google_id("app.tankste.sponsor.product.10"), do: "sponsor_single_10"
defp product_from_google_id("app.tankste.sponsor.product.20"), do: "sponsor_single_20"
defp product_from_google_id("app.tankste.sponsor.product.50"), do: "sponsor_single_50"
defp product_from_google_id("app.tankste.sponsor.sub.monthly.1"), do: "sponsor_subscription_monthly_1"
defp product_from_google_id("app.tankste.sponsor.sub.monthly.2"), do: "sponsor_subscription_monthly_2"
defp product_from_google_id("app.tankste.sponsor.sub.yearly.12"), do: "sponsor_subscription_yearly_12"
defp product_from_google_id(_), do: nil

defp value_from_product("sponsor_single_1"), do: 1
defp value_from_product("sponsor_single_2"), do: 2
defp value_from_product("sponsor_single_5"), do: 5
defp value_from_product("sponsor_single_10"), do: 10
defp value_from_product("sponsor_single_20"), do: 20
defp value_from_product("sponsor_single_50"), do: 50
defp value_from_product("sponsor_subscription_monthly_1"), do: 1
defp value_from_product("sponsor_subscription_monthly_2"), do: 2
defp value_from_product("sponsor_subscription_yearly_12"), do: 12
Expand All @@ -162,7 +171,10 @@ defmodule Tankste.SponsorWeb.PurchaseController do
defp type_from_product("sponsor_subscription_yearly_12"), do: "subscription"
defp type_from_product("sponsor_single_1"), do: "single"
defp type_from_product("sponsor_single_2"), do: "single"
defp type_from_product("sponsor_single_5"), do: "single"
defp type_from_product("sponsor_single_10"), do: "single"
defp type_from_product("sponsor_single_20"), do: "single"
defp type_from_product("sponsor_single_50"), do: "single"
defp type_from_product(_), do: nil

defp expiration_days_from_product("sponsor_subscription_monthly_1"), do: 30
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
1.1.2

0 comments on commit 0f1522d

Please sign in to comment.