implement coinbase integration

This commit is contained in:
r888888888
2014-11-24 20:21:54 -08:00
parent d9153769b8
commit 26fb28f8e3
7 changed files with 83 additions and 49 deletions

View File

@@ -0,0 +1,8 @@
<p>You can pay with Bitcoin. You will pay either $20 USD or $40 USD equivalent in Bitcoin. Danbooru uses <a href="https://www.coinbase.com">Coinbase</a> as a payment intermediary so none of your personal information will be stored on the site.</p>
<% if CurrentUser.user.level < User::Levels::GOLD %>
<%= raw coinbase.create_button("Upgrade to Gold", 20.to_money("USD"), "Upgrade your Basic Account to a Gold Account", encrypt_custom(User::Levels::GOLD), :button => {:style => "custom_small", :text => "Upgrade to Gold", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<%= raw coinbase.create_button("Upgrade to Platinum", 40.to_money("USD"), "Upgrade your Basic Account to a Platinum Account", encrypt_custom(User::Levels::PLATINUM), :button => {:style => "custom_small", :text => "Upgrade to Platinum", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<% elsif CurrentUser.level < User::Levels::PLATINUM %>
<%= raw coinbase.create_button("Upgrade to Platinum", 20.to_money("USD"), "Upgrade your Gold Account to a Platinum Account", encrypt_custom(User::Levels::PLATINUM), :button => {:style => "custom_small", :text => "Upgrade to Platinum", :callback_url => user_upgrade_path(:only_path => false, :host => Danbooru.config.hostname, :protocol => "https")}).embed_html %>
<% end %>

View File

@@ -82,6 +82,10 @@
</tbody>
</table>
</div>
<% if Danbooru.config.coinbase_api_key %>
<%= render "coinbase_payment" %>
<% end %>
</div>
</div>

View File

@@ -1,8 +1,6 @@
<div id="c-users">
<div id="a-upgrade-result">
<% if flash[:disable] %>
<p>You can upgrade your account at <%= link_to "Safebooru", new_user_upgrade_path(:protocol => "https", :host => "safebooru.donmai.us", :only_path => false) %>.</p>
<% elsif flash[:success] %>
<% if flash[:success] %>
<h1>Congradulations!</h1>
<p>You are now a <%= CurrentUser.user.level_string %> level account. Thanks for supporting the site!</p>