Commit Graph

79 Commits

Author SHA1 Message Date
evazion
d3267a5ffa user upgrades: fix button when upgrades are disabled. 2022-06-24 15:14:18 -05:00
evazion
ea92cbff4e user upgrades: update upgrade page text. 2022-06-02 14:40:42 -05:00
evazion
173e43b192 user upgrades: add upgrade code system.
Add a system for upgrading accounts using upgrade codes. Users purchase
an upgrade code off-site then redeem it on-site to upgrade their account
to Gold. Upgrade codes are randomly pre-generated and are one time use
only. Codes have enough randomness that guessing a code is infeasible.
2022-06-01 18:31:46 -05:00
evazion
8239a1b551 upgrades: fix Danbooru.config.user_upgrades_enabled? setting
* Fix it so that if upgrades are disabled, only the payment button is disabled instead of the whole page.
* Fix it so that disabling upgrades with DANBOORU_USER_UPGRADES_ENABLED="false" works.
2022-05-17 01:24:38 -05:00
evazion
1eb15da7c5 upgrades: add authorize.net integration.
Add integration for accepting payments with Authorize.net.

https://developer.authorize.net/hello_world.html
2022-05-15 01:47:45 -05:00
evazion
6de527f064 upgrades: show login and create account links for anon users. 2022-05-15 01:05:21 -05:00
evazion
4360573af0 upgrades: update text. 2022-05-10 12:20:11 -05:00
evazion
32d77d57ec upgrades: update upgrade page text. 2022-05-09 14:16:58 -05:00
evazion
067d094cc1 upgrades: add notice that upgrades are temporarily disabled. 2022-05-07 18:25:35 -05:00
evazion
449fd6c49c upgrades: factor out Stripe integration.
Factor out the Stripe code from the UserUpgrade class. Introduce a new
PaymentTransaction abstract class that represents a payment with some
payment processor, and a PaymentTransaction::Stripe class that
implements transactions with Stripe.

Note that we can't completely eliminate Stripe even though we no longer
accept payments with it because we still need to be able to look up old
payments in Stripe.
2022-05-06 22:52:33 -05:00
evazion
0d4c8baed8 upgrades: fix typos on upgrade page. 2022-05-05 20:36:20 -05:00
evazion
e03601896a upgrades: temporarily disable Gold account upgrades.
Disable upgrades while we migrate away from Stripe.
2022-05-05 17:20:52 -05:00
evazion
7232518f90 upgrades: update FAQs on account upgrade page. 2022-05-05 17:14:22 -05:00
evazion
0d4e2059d7 users: raise favgroup limit to 10 for Members, unlimited for Gold. 2022-04-24 21:43:42 -05:00
evazion
7d650a5dae users: raise saved search limit to 1000 for Gold. 2022-04-24 21:43:42 -05:00
evazion
1e4c0ffe78 users: disable upgrading to platinum.
Disable the ability to upgrade to Platinum. The Platinum level still
exists, but users can no longer upgrade to it. Sales of Platinum are
being disabled in preparation of increasing the tag limit for Gold
users.
2022-04-24 21:43:42 -05:00
evazion
7701fe2e17 Upgrade Ruby to 3.1.2.
Also fix a call to `Time.utc` that fails in Ruby 3.1.2 (can't pass a
string to Time.utc).
2022-04-21 21:43:06 -05:00
NamelessContributor
9ca47ad29e Fix minor typo on Account Upgrade page 2022-02-23 19:14:17 +01:00
evazion
b8356c97c1 Add Danbooru Winter Sale. 2021-12-28 14:41:37 -06:00
evazion
eda23c719a votes: fixup various minor issues.
* Add a gap between thumbnails on mobile.
* Adjust CSS for scores and vote buttons.
* Include "Private favorites" as an incentive on the user upgrade page.
* Fix vote buttons not being visible beneath thumbnails on mobile.
* Fix the "Show scores" link not preserving the current page number.
* Fix vote buttons being unintentionally enabled for all thumbnails by default.
* Fix banned and restricted users being able to favorite posts by
  tagging them with `fav:self`.
* Fix search engines being able to crawl /posts?view=score pages.
* Fix broken tests.
2021-11-20 02:40:18 -06:00
evazion
7fa23c5fbf users: give all users unlimited favorites.
Let all users have unlimited favorites. Formerly the limit was 10k
favorites for regular members, 20k for Gold, and unlimited for Platinum.

Limiting favorites doesn't make sense since upvotes are unlimited.
2021-10-07 06:27:09 -05:00
evazion
bb0540e1a1 Fix #4747: BUR layout partly broken on iOS.
Move the BUR help text from the <textarea> placeholder attribute to a
<details> tag that embeds the [[help:bur_notice]] wiki page.

Also update some CSS for the <details> tag that was meant to only apply
to the user upgrades page and didn't look good here.
2021-03-05 19:53:42 -06:00
evazion
bc9e2faa9e user upgrades: fix spacing on user upgrades page. 2021-02-22 02:38:37 -06:00
evazion
1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00
evazion
ae204df4ca css: factor out button css.
Factor out the buttons from the user upgrades page into a general
UI component.
2021-02-14 02:56:19 -06:00
evazion
014199ec2b user upgrades: handle the refunded status on show page. 2021-01-02 04:09:43 -06:00
evazion
0b2f9fafa8 users: refactor limit methods.
* Refactor various user limit methods to class methods from instance
  methods so they can be used outside the context of a single user.

* Remove the Danbooru.config.base_tag_query_limit option.
2021-01-01 19:24:37 -06:00
evazion
ecd29c1a66 user upgrades: allow using promo codes during checkout.
Allow promo codes to be used during checkout if a secret promo=true url
param is passed. Allows promo codes to be offered without having the
promo code option always appear even when there aren't any active promos.
2021-01-01 04:24:24 -06:00
evazion
1d15ce2bcd Remove Danbooru Winter Sale. 2021-01-01 04:16:38 -06:00
evazion
83d6cd5980 Update Winter Sale banner for last day. 2020-12-31 06:50:10 -06:00
evazion
d0bb4ed398 user upgrades: add bank payment methods for European countries.
Add the following bank redirect payment methods:

* https://stripe.com/docs/payments/bancontact
* https://stripe.com/docs/payments/eps
* https://stripe.com/docs/payments/giropay
* https://stripe.com/docs/payments/ideal
* https://stripe.com/docs/payments/p24

These methods are used in Austria, Belgium, Germany, the Netherlands,
and Poland.

These methods require payments to be denominated in EUR, which means we
have to set prices in both USD and EUR, and we have to automatically
detect which currency to use based on the user's country. We also have
to automatically detect which payment methods to offer based on the
user's country. We do this by using Cloudflare's CF-IPCountry header to
geolocate the user's country.

This also switches to using prices and products defined in Stripe
instead of generated on-the-fly when creating the checkout.
2020-12-31 06:50:10 -06:00
evazion
4b171bf97e user upgrades: add ability to refund upgrades. 2020-12-29 04:17:32 -06:00
evazion
87af02f689 user upgrades: add links to Stripe payment & receipt page.
Add links to the Stripe payment page and the Stripe receipt page on
completed user upgrades.

The Stripe payment link is a link to the payment details on the Stripe
dashboard and is only visible to the owner.
2020-12-29 00:19:52 -06:00
evazion
fd18291382 Add Danbooru Winter Sale. 2020-12-25 06:07:21 -06:00
evazion
e030a07816 user upgrades: add index action. 2020-12-25 01:21:54 -06:00
evazion
069231a33b user upgrades: update upgrade landing page.
* Add a frequently asked questions section.
* Add nicer looking upgrade buttons.
* Format the page nicer.
* Prevent users from attempting invalid upgrades on users that are
  already Platinum or above.
2020-12-25 00:47:08 -06:00
evazion
74ed2a8b96 user upgrades: add UserUpgrade model.
Add a model to store the status of user upgrades.

* Store the upgrade purchaser and the upgrade receiver (these are
  different for a gifted upgrade, the same for a self upgrade).
* Store the upgrade type: gold, platinum, or gold-to-platinum upgrades.
* Store the upgrade status:
** pending: User is still on the Stripe checkout page, no payment
   received yet.
** processing: User has completed checkout, but the checkout status in
   Stripe is still 'unpaid'.
** complete: We've received notification from Stripe that the payment
   has gone through and the user has been upgraded.
* Store the Stripe checkout ID, to cross-reference the upgrade record on
  Danbooru with the checkout record on Stripe.

This is the upgrade flow:

* When the user clicks the upgrade button on the upgrade page, we call
  POST /user_upgrades and create a pending UserUpgrade.
* We redirect the user to the checkout page on Stripe.
* When the user completes checkout on Stripe, Stripe sends us a webhook
  notification at POST /webhooks/receive.
* When we receive the webhook, we check the payment status, and if it's
  paid we mark the UserUpgrade as complete and upgrade the user.
* After Stripe sees that we have successfully processed the webhook,
  they redirect the user to the /user_upgrades/:id page, where we show
  the user their upgrade receipt.
2020-12-24 21:15:04 -06:00
evazion
7762489d7d user upgrades: upgrade to new Stripe checkout system.
This upgrades from the legacy version of Stripe's checkout system to the
new version:

> The legacy version of Checkout presented customers with a modal dialog
> that collected card information, and returned a token or a source to
> your website. In contrast, the new version of Checkout is a smart
> payment page hosted by Stripe that creates payments or subscriptions. It
> supports Apple Pay, Dynamic 3D Secure, and many other features.

Basic overview of the new system:

* We send the user to a checkout page on Stripe.
* Stripe collects payment and sends us a webhook notification when the
  order is complete.
* We receive the webhook notification and upgrade the user.

Docs:

* https://stripe.com/docs/payments/checkout
* https://stripe.com/docs/payments/checkout/migration#client-products
* https://stripe.com/docs/payments/handling-payment-events
* https://stripe.com/docs/payments/checkout/fulfill-orders
2020-12-24 19:58:29 -06:00
evazion
3fea5858b1 user upgrades: update incentive descriptions.
* Call them hidden tags instead of censored tags so that users don't
  think that buying gold removes censorship from images (yes, this happened).

* Remove API ratelimit information (not relevant to most users).
2020-04-06 14:13:21 -05:00
evazion
f464163885 users: allow all users to use the posts per page setting. 2020-03-21 23:06:50 -05:00
evazion
815703a922 views: adjust more <meta> descriptions.
* Add <meta> descriptions to more pages.
* Adjust wiki/pool/forum pages to use an excerpt of the first paragraph.
2020-01-26 19:16:38 -06:00
evazion
e10bb0aab1 views: remove old matomo analytics code.
This is no longer used and shouldn't have been hardcoded anyway.
2020-01-26 19:16:38 -06:00
evazion
6a984de3d5 views: refactor page titles.
Refactor `page_title` helper to automatically include site name.
2020-01-25 01:52:18 -06:00
evazion
c251d145e4 Revert "Add Danbooru Winter Sale."
This reverts commit 963f1f7991.
2020-01-02 01:29:55 -06:00
evazion
963f1f7991 Add Danbooru Winter Sale.
* 25% off Gold and Platinum accounts.
* Free 6 tag searches for Member-level users.
* Runs from midnight Dec. 25th to 28th (UTC time).
2019-12-24 15:39:29 -06:00
evazion
ef2eb9d0f5 user upgrades: factor out gold/platinum prices. 2019-12-24 12:04:15 -06:00
evazion
82564355e6 Add better error page for database timeouts. 2019-12-16 13:38:06 -06:00
evazion
48e0569832 login: add /login & /logout routes, rename 'sign in' to 'login'.
* Replace /session/new with /login and /session/sign_out with /logout.
* Rename 'sign in' to 'login'.

This changes are to make urls cleaner and terminology more consistent.
2019-12-14 15:27:13 -06:00
evazion
669ba6fc8d upgrades: fix post-upgrade landing page.
* Fix the post-upgrade message showing the gift message instead of the
  normal upgrade message.

* Link back to Danbooru so people don't stay on Safebooru and get
  confused when they can't see hidden posts.
2019-12-06 02:26:11 -06:00
evazion
56a2fae26f Revert "Temp disable account upgrades."
This reverts commit c4cdba0874.
2019-12-02 16:53:06 -06:00