Browse Source

Removed unused sections

feature/billing
Teknikode 7 months ago
parent
commit
da8f467297
  1. 114
      Teknik/Areas/About/Controllers/AboutController.cs
  2. 3
      Teknik/Areas/About/ViewModels/AboutViewModel.cs
  3. 3
      Teknik/Areas/About/Views/About/Index.cshtml
  4. 11
      Teknik/Areas/User/Controllers/UserController.cs
  5. 12
      Teknik/Areas/User/ViewModels/GetPremiumViewModel.cs
  6. 131
      Teknik/Areas/User/Views/User/GetPremium.cshtml
  7. 2
      Teknik/Views/Shared/_Footer.cshtml
  8. 12
      Teknik/Views/Shared/_Navbar.cshtml

114
Teknik/Areas/About/Controllers/AboutController.cs

@ -33,120 +33,6 @@ namespace Teknik.Areas.About.Controllers @@ -33,120 +33,6 @@ namespace Teknik.Areas.About.Controllers
ViewBag.Description = "What is Teknik?";
var vm = new AboutViewModel();
// Get Biling Service
var billingService = BillingFactory.GetBillingService(_config.BillingConfig);
var subVM = new SubscriptionsViewModel();
// Get current subscriptions
var curPrices = new Dictionary<string, List<string>>();
if (User.Identity.IsAuthenticated)
{
var user = UserHelper.GetUser(_dbContext, User.Identity.Name);
if (user.BillingCustomer != null)
{
var currentSubs = billingService.GetSubscriptionList(user.BillingCustomer.CustomerId);
foreach (var curSub in currentSubs)
{
foreach (var price in curSub.Prices)
{
if (!curPrices.ContainsKey(price.ProductId))
curPrices[price.ProductId] = new List<string>();
curPrices[price.ProductId].Add(price.Id);
}
}
}
}
bool hasUploadProduct = curPrices.ContainsKey(_config.BillingConfig.UploadProductId);
bool hasEmailProduct = curPrices.ContainsKey(_config.BillingConfig.EmailProductId);
var curUploadPrice = string.Empty;
if (curPrices.ContainsKey(_config.BillingConfig.UploadProductId))
curUploadPrice = curPrices[_config.BillingConfig.UploadProductId].FirstOrDefault();
var curEmailPrice = string.Empty;
if (curPrices.ContainsKey(_config.BillingConfig.EmailProductId))
curEmailPrice = curPrices[_config.BillingConfig.EmailProductId].FirstOrDefault();
// Show Free Subscription
subVM.UploadSubscriptions.Add(new SubscriptionViewModel()
{
CurrentSubMonthly = !hasUploadProduct && User.Identity.IsAuthenticated,
SubscribeText = "Free",
SubscribeUrlMonthly = Url.SubRouteUrl("about", "About.Index"),
BaseStorage = _config.UploadConfig.MaxStorage
});
// Get Upload Prices
var uploadProduct = billingService.GetProduct(_config.BillingConfig.UploadProductId);
if (uploadProduct != null)
{
bool handledFirst = false;
foreach (var priceGrp in uploadProduct.Prices.GroupBy(p => p.Storage).OrderBy(p => p.Key))
{
// Get Monthly prices
var priceMonth = priceGrp.FirstOrDefault(p => p.Interval == BillingCore.Models.Interval.Month);
// Get Yearly prices
var priceYear = priceGrp.FirstOrDefault(p => p.Interval == BillingCore.Models.Interval.Year);
var curPrice = priceGrp.FirstOrDefault(p => p.Id == curUploadPrice);
subVM.UploadSubscriptions.Add(new SubscriptionViewModel()
{
Recommended = !handledFirst,
CurrentSubMonthly = curPrice?.Id == priceMonth?.Id,
CurrentSubYearly = curPrice?.Id == priceYear?.Id,
SubscribeUrlMonthly = Url.SubRouteUrl("billing",
hasUploadProduct ? "Billing.EditSubscription" : "Billing.Checkout",
new { priceId = priceMonth?.Id }),
SubscribeUrlYearly = Url.SubRouteUrl("billing",
hasUploadProduct ? "Billing.EditSubscription" : "Billing.Checkout",
new { priceId = priceYear?.Id }),
BaseStorage = priceMonth?.Storage,
BasePriceMonthly = priceMonth?.Amount,
BasePriceYearly = priceYear?.Amount
});
handledFirst = true;
}
}
// Get Email Prices
var emailProduct = billingService.GetProduct(_config.BillingConfig.EmailProductId);
if (emailProduct != null)
{
bool handledFirst = false;
foreach (var priceGrp in emailProduct.Prices.GroupBy(p => p.Storage).OrderBy(p => p.Key))
{
// Get Monthly prices
var priceMonth = priceGrp.FirstOrDefault(p => p.Interval == BillingCore.Models.Interval.Month);
// Get Yearly prices
var priceYear = priceGrp.FirstOrDefault(p => p.Interval == BillingCore.Models.Interval.Year);
var curPrice = priceGrp.FirstOrDefault(p => p.Id == curEmailPrice);
var emailSub = new SubscriptionViewModel()
{
Recommended = !handledFirst,
CurrentSubMonthly = curPrice?.Id == priceMonth?.Id,
CurrentSubYearly = curPrice?.Id == priceYear?.Id,
SubscribeUrlMonthly = Url.SubRouteUrl("billing",
hasEmailProduct ? "Billing.EditSubscription" : "Billing.Checkout",
new { priceId = priceMonth?.Id }),
SubscribeUrlYearly = Url.SubRouteUrl("billing",
hasEmailProduct ? "Billing.EditSubscription" : "Billing.Checkout",
new { priceId = priceYear?.Id }),
BaseStorage = priceMonth?.Storage,
BasePriceMonthly = priceMonth?.Amount,
BasePriceYearly = priceYear?.Amount
};
if (!handledFirst)
emailSub.PanelOffset = "3";
subVM.EmailSubscriptions.Add(emailSub);
handledFirst = true;
}
}
vm.Subscriptions = subVM;
return View(vm);
}
}

3
Teknik/Areas/About/ViewModels/AboutViewModel.cs

@ -9,11 +9,8 @@ namespace Teknik.Areas.About.ViewModels @@ -9,11 +9,8 @@ namespace Teknik.Areas.About.ViewModels
{
public class AboutViewModel : ViewModelBase
{
public SubscriptionsViewModel Subscriptions { get; set; }
public AboutViewModel()
{
Subscriptions = new SubscriptionsViewModel();
}
}
}

3
Teknik/Areas/About/Views/About/Index.cshtml

@ -114,9 +114,6 @@ @@ -114,9 +114,6 @@
</table>
</div>
</div>
<br />
@await Html.PartialAsync("../../Areas/Billing/Views/Billing/ViewSubscriptions", Model.Subscriptions);
<br />
<hr>

11
Teknik/Areas/User/Controllers/UserController.cs

@ -101,17 +101,6 @@ namespace Teknik.Areas.Users.Controllers @@ -101,17 +101,6 @@ namespace Teknik.Areas.Users.Controllers
//_logoutSessions.Add(sub, sid);
}
[AllowAnonymous]
[TrackPageView]
public IActionResult GetPremium()
{
ViewBag.Title = "Get a Premium Account";
GetPremiumViewModel model = new GetPremiumViewModel();
return View(model);
}
[HttpGet]
[AllowAnonymous]
[TrackPageView]

12
Teknik/Areas/User/ViewModels/GetPremiumViewModel.cs

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.ViewModels;
namespace Teknik.Areas.Users.ViewModels
{
public class GetPremiumViewModel : ViewModelBase
{
}
}

131
Teknik/Areas/User/Views/User/GetPremium.cshtml

@ -1,131 +0,0 @@ @@ -1,131 +0,0 @@
@model Teknik.Areas.Users.ViewModels.GetPremiumViewModel
@{
string currentPriceMsg = "The actual price will be determined by the exchange rate at the time of the transaction.";
}
<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="text-center">Purchase a Premium Account</h2>
<br />
<p class="text-center">You can purchase a Premium Account using multiple different methods.</p>
<p class="text-center">If you want to purchase an upgrade for multiple accounts, you can send the total amount at once with a list of the accounts you want upgraded.</p>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-4 text-center">
<h2>1</h2>
<h3>Send Payment</h3>
</div>
<div class="col-sm-4 text-center">
<h2>2</h2>
<h3>Send Account Information</h3>
</div>
<div class="col-sm-4 text-center">
<h2>3</h2>
<h3>Become Premium</h3>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title text-center"><strong>Paypal</strong></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 text-center">
Send a PayPal donation of $@Config.UserConfig.PremiumAccountPrice per account to: <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MBG93VKQ343P4" role="button" class="btn btn-default btn-sm" title="Paypal Donation">admin@teknik.io</a>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
Add a special instruction with the username of the teknik account(s) you want to upgrade to Premium.
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
Once the payment has been processed, the account(s) will be upgraded and a confirmation email sent to the upgraded account(s)
</div>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title text-center"><strong>Patreon</strong></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 text-center">
Become a Patreon of Teknik for at least $@Config.UserConfig.PremiumAccountPrice per account at: <a href="https://www.patreon.com/teknik" role="button" class="btn btn-default btn-sm" title="Patreon Donation">Teknik Patreon</a>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
After making the transaction, you will need to send an email with the teknik account username(s) you want upgraded, and then email it to <a href="mailto:@Config.SupportEmail">@Config.SupportEmail</a>.
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
Once the patreon amount has been confirmed, the account(s) will be upgraded and a confirmation email sent to the upgraded account(s)
</div>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title text-center"><strong>Bitcoin</strong></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12 text-center">
Send $@Config.UserConfig.PremiumAccountPrice worth of Bitcoin <span data-toggle="tooltip" data-placement="top" title="@currentPriceMsg">(Currently @(Math.Round((Config.UserConfig.PremiumAccountPrice / CurrencyHelper.GetExchangeRate(CurrencyType.BTC)), 6)))<small>*</small></span> per account to the following address
</div>
</div>
<br />
<div class="row">
<div class="col-sm-12 text-center">
<strong>@Config.BitcoinAddress</strong>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
After making the transaction, you will need to create a signed message of the teknik account username(s) with your wallet's key, and then email it to <a href="mailto:@Config.SupportEmail">@Config.SupportEmail</a>.
<br />
<br />
You can generate this signed message in multiple bitcoin clients. For an example, visit <a href="https://bitcoin.org/en/developer-reference#signmessage">here</a>
</div>
</div>
<hr />
<div class="row">
<div class="col-sm-12 text-center">
Once the transaction has been verified and the signed message matches the transaction's sending address, the account(s) will be upgraded and a confirmation email sent to the upgraded account(s)
</div>
</div>
</div>
</div>
<small>* @currentPriceMsg</small>
</div>
</div>
</div>
</div>
</div>

2
Teknik/Views/Shared/_Footer.cshtml

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<div class="text-center">
<p>
<small>
While we provide these services for free, sadly that doesn't make the cost magically go away. If you think we are doing a great job and would like to say thanks, we would greatly appreciate a small donation.
If you think we are doing a great job and would like to say thanks, we would greatly appreciate a small donation.
</small>
</p>
<!form class="form-inline">

12
Teknik/Views/Shared/_Navbar.cshtml

@ -28,8 +28,16 @@ @@ -28,8 +28,16 @@
<li is-active-route asp-controller="Home">
<a href="@Url.SubRouteUrl("www", "Home.Index")">Home</a>
</li>
<li is-active-route asp-controller="About">
<a href="@Url.SubRouteUrl("about", "About.Index")">About</a>
<li class="dropdown">
<a href="#" id="about_menu" class="dropdown-toggle" data-toggle="dropdown">About <strong class="caret"></strong></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="about_menu">
<li is-active-route asp-controller="About">
<a href="@Url.SubRouteUrl("about", "About.Index")">Features</a>
</li>
<li is-active-route asp-controller="Billing" asp-action="ViewSubscriptions">
<a href="@Url.SubRouteUrl("billing", "Billing.Subscriptions")">Subscriptions</a>
</li>
</ul>
</li>
<li is-active-route asp-controller="Blog" asp-action="Blog" asp-route-username="">
<a href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = string.Empty })">News</a>

Loading…
Cancel
Save