Remove leftover Stripe subscriptions code (#6243)
This commit is contained in:
parent
98a2aaf0ce
commit
aa5f4b8d85
5 changed files with 3 additions and 97 deletions
1
Envfile
1
Envfile
|
|
@ -145,7 +145,6 @@ variable :SLACK_WEBHOOK_URL, :String, default: ""
|
|||
# (https://stripe.com/docs/api)
|
||||
variable :STRIPE_PUBLISHABLE_KEY, :String, default: "Optional"
|
||||
variable :STRIPE_SECRET_KEY, :String, default: "Optional"
|
||||
variable :STRIPE_CANCELLATION_SECRET, :String, default: "Optional"
|
||||
|
||||
# For video calling in DEV Connect
|
||||
# (https://www.twilio.com/docs/video)
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
<h3>Your Membership Features</h3>
|
||||
<ul>
|
||||
<% if current_user.monthly_dues >= 2500 %>
|
||||
<li>Workshop Pass -- <a href="/events">see our events for the month!</a></li>
|
||||
<% end %>
|
||||
<li>Post Analytics (beta) now live on <a href="/dashboard">your dashboard</a></li>
|
||||
<li> Wall of Patrons and Scholars</li>
|
||||
<li>More on the way!</li>
|
||||
</ul>
|
||||
<% if current_user.monthly_dues >= 1000 %>
|
||||
<% cache "store_coupons_user_#{current_user.id}_dues_#{current_user.monthly_dues}" do %>
|
||||
<h3>Shop Coupons</h3>
|
||||
<div style="background: white;border: 1px dashed black;padding: 18px;border-radius:3px">
|
||||
<span style="font-weight:bold;font-size:1.3em">🎟 25% Off Everything:
|
||||
<em style="color:darkcyan;font-weight:700">
|
||||
<%= CouponGenerator.new(current_user.id, "member_discount").generate %>
|
||||
</em></span>
|
||||
<br /><br />
|
||||
<% if current_user.monthly_dues >= 2500 %>
|
||||
<span style="font-weight:bold;font-size:1.3em">🎟 Level 3 Merch Gift (one time use):
|
||||
<em style="color:darkcyan;font-weight:700">
|
||||
<%= CouponGenerator.new(current_user.id, "tee_pack").generate %>
|
||||
</em></span>
|
||||
<br /><br />
|
||||
👆 This coupon will give you 100% off:<br />
|
||||
<a href="https://shop.dev.to/collections/membership-rewards/products/rewards-only-unisex" target="_blank">
|
||||
DEV Tee Package (Unisex Cut)
|
||||
</a>
|
||||
or
|
||||
<a href="https://shop.dev.to/collections/membership-rewards/products/rewards-only-heather-womens" target="_blank">
|
||||
DEV Tee Package (Women's Cut)
|
||||
</a>.
|
||||
<br />
|
||||
Visit one of these links to claim your gift. The listed price is a placeholder that will be negated by the coupon.
|
||||
<% else %>
|
||||
<span style="font-weight:bold;font-size:1.3em">🎟 Level 2 Sticker Gift (one time use):
|
||||
<em style="color:darkcyan;font-weight:700">
|
||||
<%= CouponGenerator.new(current_user.id, "sticker_pack").generate %>
|
||||
</em></span>
|
||||
<br /><br />
|
||||
👆 This coupon will give you 100% off
|
||||
<a href="https://shop.dev.to/collections/membership-rewards/products/reward-only-sticker-pack" target="_blank">
|
||||
THE MEMBERS-ONLY STICKER PACK
|
||||
</a>.
|
||||
<br />
|
||||
Visit link to claim your gift. The listed price is a placeholder that will be negated by the coupon.
|
||||
<% end %>
|
||||
</div>
|
||||
<br /><br />
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h3>Want to change your membership level?</h3>
|
||||
<%= form_tag "/stripe_subscriptions/current_user", method: :patch do %>
|
||||
<div class="field">
|
||||
<%= label_tag :amount, "Monthly Contribution ($):", style: "width: 100%;" %>
|
||||
<%= number_field_tag :amount, current_user.monthly_dues / 100.0, class: "amount-input", step: "any", min: "1" %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= submit_tag "SUBMIT", class: "cta" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<%= form_tag "/stripe_subscriptions/current_user", method: :delete, onsubmit: "return confirm('Are you absolutely sure you want to perform this action?');" do %>
|
||||
<div>Don't want to keep your membership?</div>
|
||||
<button class="billing-item-detail billing-item-red">Cancel Membership</button>
|
||||
<% end %>
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
Rails.configuration.stripe = {
|
||||
publishable_key: ApplicationConfig["STRIPE_PUBLISHABLE_KEY"],
|
||||
secret_key: ApplicationConfig["STRIPE_SECRET_KEY"],
|
||||
stripe_cancellation_secret: ApplicationConfig["STRIPE_CANCELLATION_SECRET"]
|
||||
publishable_key: ApplicationConfig["STRIPE_PUBLISHABLE_KEY"]
|
||||
}
|
||||
|
||||
Stripe.api_key = Rails.configuration.stripe[:secret_key]
|
||||
Stripe.api_key = ApplicationConfig["STRIPE_SECRET_KEY"]
|
||||
|
||||
if Rails.env.development? && Stripe.api_key.present?
|
||||
Stripe.log_level = Stripe::LEVEL_INFO
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe StripeActiveCardPolicy, type: :policy do
|
||||
subject { described_class.new(user, :stripe_subscription) }
|
||||
subject { described_class.new(user, :stripe_active_card) }
|
||||
|
||||
context "when user is not signed in" do
|
||||
let(:user) { nil }
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe StripeSubscriptionPolicy, type: :policy do
|
||||
subject { described_class.new(user, :stripe_subscription) }
|
||||
|
||||
context "when user is not signed in" do
|
||||
let(:user) { nil }
|
||||
|
||||
it { within_block_is_expected.to raise_error(Pundit::NotAuthorizedError) }
|
||||
end
|
||||
|
||||
context "when user is signed in" do
|
||||
let(:user) { build_stubbed(:user) }
|
||||
|
||||
it { is_expected.to permit_actions(%i[create update destroy]) }
|
||||
|
||||
context "when user is banned" do
|
||||
let(:user) { build(:user, :banned) }
|
||||
|
||||
it { is_expected.to forbid_actions(%i[create update]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue