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.
22 lines
383 B
Ruby
22 lines
383 B
Ruby
class UserUpgradePolicy < ApplicationPolicy
|
|
def create?
|
|
user.is_member?
|
|
end
|
|
|
|
def new?
|
|
UserUpgrade.enabled?
|
|
end
|
|
|
|
def show?
|
|
record.recipient == user || record.purchaser == user || user.is_owner?
|
|
end
|
|
|
|
def receipt?
|
|
(record.purchaser == user || user.is_owner?) && record.has_receipt?
|
|
end
|
|
|
|
def payment?
|
|
user.is_owner? && record.has_payment?
|
|
end
|
|
end
|