All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Unit Tests (push) Successful in 3m10s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 5m13s
Build and Release / Lint (push) Successful in 5m25s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 3m13s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 8h5m42s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 7m30s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Successful in 7m55s
Build and Release / Build Binary (linux/arm64) (push) Successful in 7m36s
Implement complete subscription monetization system for repositories with Stripe and PayPal integration. Includes: - Database models and migrations for monetization settings, subscription products, and user subscriptions - Payment provider abstraction layer with Stripe and PayPal implementations - Admin UI for configuring payment providers and viewing subscriptions - Repository settings UI for managing subscription products and tiers - Subscription checkout flow and webhook handlers for payment events - Access control to gate repository code behind active subscriptions
88 lines
3.5 KiB
Handlebars
88 lines
3.5 KiB
Handlebars
{{template "base/head" .}}
|
|
<div role="main" aria-label="{{.Title}}" class="page-content repository">
|
|
{{template "repo/header" .}}
|
|
<div class="ui container">
|
|
<div class="ui segment">
|
|
<h2>{{svg "octicon-lock" 24}} {{ctx.Locale.Tr "repo.subscribe.title"}}</h2>
|
|
<p>{{ctx.Locale.Tr "repo.subscribe.description"}}</p>
|
|
|
|
{{if .Products}}
|
|
<div class="ui three stackable cards" id="subscribe-products">
|
|
{{range .Products}}
|
|
<div class="ui card" data-product-id="{{.ID}}" data-product-type="{{.Type}}" data-price-cents="{{.PriceCents}}" data-currency="{{.Currency}}" data-stripe-price-id="{{.StripePriceID}}" data-paypal-plan-id="{{.PayPalPlanID}}">
|
|
<div class="content">
|
|
<div class="header">{{.Name}}</div>
|
|
<div class="meta">
|
|
{{if eq .Type 1}}{{ctx.Locale.Tr "repo.subscribe.monthly"}}
|
|
{{else if eq .Type 2}}{{ctx.Locale.Tr "repo.subscribe.yearly"}}
|
|
{{else if eq .Type 3}}{{ctx.Locale.Tr "repo.subscribe.lifetime"}}
|
|
{{end}}
|
|
</div>
|
|
<div class="description">
|
|
<span class="ui large text" style="font-size: 2em; font-weight: bold;">
|
|
${{DivideInt64 .PriceCents 100}}<sup style="font-size: 0.5em;">.{{printf "%02d" (ModInt64 .PriceCents 100)}}</sup>
|
|
</span>
|
|
<span class="text grey">{{.Currency}}</span>
|
|
{{if eq .Type 1}}<span class="text grey">/ {{ctx.Locale.Tr "repo.subscribe.per_month"}}</span>
|
|
{{else if eq .Type 2}}<span class="text grey">/ {{ctx.Locale.Tr "repo.subscribe.per_year"}}</span>
|
|
{{else if eq .Type 3}}<span class="text grey">{{ctx.Locale.Tr "repo.subscribe.one_time"}}</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="extra content">
|
|
<button class="ui primary fluid button subscribe-btn" data-product-id="{{.ID}}">
|
|
{{svg "octicon-credit-card" 16}} {{ctx.Locale.Tr "repo.subscribe.choose"}}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
|
|
<!-- Payment Form Container (shown after selecting a product) -->
|
|
<div id="payment-form-container" class="ui segment" style="display: none; margin-top: 1em;">
|
|
<h3 id="payment-product-name"></h3>
|
|
|
|
{{if .StripeEnabled}}
|
|
<div id="stripe-payment" style="display: none;">
|
|
<div id="stripe-card-element" style="padding: 12px; border: 1px solid var(--color-secondary); border-radius: 4px; margin-bottom: 1em;"></div>
|
|
<div id="stripe-card-errors" class="ui error message" style="display: none;"></div>
|
|
<button id="stripe-submit-btn" class="ui primary button">
|
|
{{svg "octicon-credit-card" 16}} {{ctx.Locale.Tr "repo.subscribe.pay_with_stripe"}}
|
|
</button>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .PayPalEnabled}}
|
|
<div id="paypal-payment" style="{{if .StripeEnabled}}margin-top: 1em;{{end}}">
|
|
<div id="paypal-button-container"></div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
<div class="ui placeholder segment">
|
|
<div class="ui icon header">
|
|
{{svg "octicon-package" 48}}
|
|
<div class="content">
|
|
{{ctx.Locale.Tr "repo.subscribe.no_products"}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
window._subscribeData = {
|
|
repoLink: {{.RepoLink}},
|
|
stripeEnabled: {{if .StripeEnabled}}true{{else}}false{{end}},
|
|
stripePublishableKey: {{if .StripeEnabled}}{{.StripePublishableKey}}{{else}}""{{end}},
|
|
paypalEnabled: {{if .PayPalEnabled}}true{{else}}false{{end}},
|
|
paypalClientID: {{if .PayPalEnabled}}{{.PayPalClientID}}{{else}}""{{end}},
|
|
paypalSandbox: {{if .PayPalSandbox}}true{{else}}false{{end}},
|
|
csrfToken: {{.CsrfToken}}
|
|
};
|
|
</script>
|
|
|
|
{{template "base/footer" .}}
|