mirror of https://github.com/abpframework/eventhub
12 changed files with 357 additions and 304 deletions
@ -0,0 +1,56 @@ |
|||
@using EventHub.Web.PaymentRequests |
|||
@using Microsoft.Extensions.Options |
|||
@model EventHub.Organizations.OrganizationProfileDto |
|||
@inject IOptionsSnapshot<PremiumPlanInfoOptions> PremiumPlanInfoOptionsSnapshot |
|||
|
|||
<abp-container class="mt-4"> |
|||
<abp-row> |
|||
@if (Model.IsPremium && PremiumPlanInfoOptionsSnapshot.Value.IsActive && PremiumPlanInfoOptionsSnapshot.Value.IsExtendable && Model.PremiumEndDate!.Value.IsBetween(DateTime.Now, DateTime.Now.AddMonths(PremiumPlanInfoOptionsSnapshot.Value.OnePremiumPeriodAsMonth - PremiumPlanInfoOptionsSnapshot.Value.CanBeExtendedAfterHowManyMonths))) |
|||
{ |
|||
<span class="mb-2 ms-5 text-center strong">Premium end date: @Model.PremiumEndDate!.Value.ToShortDateString()</span> |
|||
} |
|||
<abp-column> |
|||
<a href="/organization/edit/@Model.Name" class="btn btn-success text-white">Edit</a> |
|||
</abp-column> |
|||
<abp-column size="_9"> |
|||
@if (PremiumPlanInfoOptionsSnapshot.Value.IsActive) |
|||
{ |
|||
@if (Model.IsPremium) |
|||
{ |
|||
@if (PremiumPlanInfoOptionsSnapshot.Value.IsExtendable && Model.PremiumEndDate!.Value.IsBetween(DateTime.Now, DateTime.Now.AddMonths(PremiumPlanInfoOptionsSnapshot.Value.OnePremiumPeriodAsMonth - PremiumPlanInfoOptionsSnapshot.Value.CanBeExtendedAfterHowManyMonths))) |
|||
{ |
|||
<div class="d-grid gap-2"> |
|||
<a href="@Url.Page("/Pricing", new { organizationName = Model.Name })" class="btn btn-info"> |
|||
<i class="fas fa-crown me-2"></i> Extend Now |
|||
</a> |
|||
</div> |
|||
} |
|||
else |
|||
{ |
|||
<div class="d-grid gap-2"> |
|||
<button class="btn btn-info"> |
|||
<span class="mt-2">Premium end date: @Model.PremiumEndDate!.Value.ToShortDateString()</span> |
|||
</button> |
|||
</div> |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
<div class="d-grid gap-2"> |
|||
<a href="@Url.Page("/Pricing", new { organizationName = Model.Name })" class="btn btn-info"> |
|||
<i class="fas fa-crown me-2"></i> Upgrade To @PremiumPlanInfoOptionsSnapshot.Value.PlanType |
|||
</a> |
|||
</div> |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
<abp-card class="text-center"> |
|||
<abp-card-body> |
|||
<span>Premium end date: @Model.PremiumEndDate!.Value.ToShortDateString()</span> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
} |
|||
</abp-column> |
|||
</abp-row> |
|||
</abp-container> |
|||
@ -1,13 +1,36 @@ |
|||
$(function () { |
|||
$('.events > .nav-item > a[data-toggle="tab"]').on('shown.bs.tab', function (e) { |
|||
var target = $(e.target).attr("href") |
|||
if (target === "#UpcomingEvent"){ |
|||
if (target === "#UpcomingEvent") { |
|||
$("a[href='#PastEvent']").removeClass('selected'); |
|||
$("a[href='#UpcomingEvent']").addClass('selected'); |
|||
|
|||
}else{ |
|||
} else { |
|||
$("a[href='#UpcomingEvent']").removeClass('selected'); |
|||
$("a[href='#PastEvent']").addClass('selected'); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
var searchParams = new URLSearchParams(window.location.search); |
|||
var paymentRequestId = searchParams.get('paymentRequestId'); |
|||
if (paymentRequestId.length === 36) { |
|||
payment.paymentRequests.paymentRequest |
|||
.get(paymentRequestId) |
|||
.then(function (r) { |
|||
if (r.extraProperties.Status === "COMPLETED") { |
|||
Swal.fire({ |
|||
title: 'Thank you for your purchase!', |
|||
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam utnulla consequat.', |
|||
imageUrl: '/assets/success.svg', |
|||
imageHeight: "70", |
|||
imageWidth: "70", |
|||
showCloseButton: true, |
|||
confirmButtonText: 'Close' |
|||
}).then(() => { |
|||
window.location.replace(window.location.pathname) |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
|
|||
@ -0,0 +1,77 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Organizations; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Options; |
|||
using Newtonsoft.Json; |
|||
using Payment.PaymentRequests; |
|||
using Payment.Web; |
|||
using Payment.Web.Pages.Payment; |
|||
using Payment.Web.PaymentRequest; |
|||
|
|||
namespace EventHub.Web.Pages.Payment; |
|||
|
|||
public class CustomPostCheckoutPageModel : PostCheckoutPageModel |
|||
{ |
|||
public string OrganizationName { get; set; } |
|||
|
|||
public CustomPostCheckoutPageModel( |
|||
IPaymentRequestAppService appService, |
|||
IOptions<PaymentWebOptions> paymentWebOptions, |
|||
IPaymentUrlBuilder paymentUrlBuilder) |
|||
: base( |
|||
appService, |
|||
paymentWebOptions, |
|||
paymentUrlBuilder) |
|||
{ |
|||
} |
|||
|
|||
public override async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
if (Token.IsNullOrWhiteSpace()) |
|||
{ |
|||
return BadRequest(); |
|||
} |
|||
|
|||
PaymentRequest = await PaymentRequestAppService.CompleteAsync(Token); |
|||
|
|||
FillOrganizationName(); |
|||
PaymentWebOptions.PaymentSuccessfulCallbackUrl = Url.Page("/Organizations/Profile", new { name = OrganizationName }); |
|||
|
|||
GoBackLink = PaymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri; |
|||
|
|||
if (PaymentRequest.State == PaymentRequestState.Completed |
|||
&& !PaymentWebOptions.PaymentSuccessfulCallbackUrl.IsNullOrWhiteSpace()) |
|||
{ |
|||
var callbackUrl = PaymentWebOptions.PaymentSuccessfulCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; |
|||
Response.Redirect(callbackUrl); |
|||
} |
|||
|
|||
if (PaymentRequest.State == PaymentRequestState.Failed |
|||
&& !PaymentWebOptions.PaymentFailureCallbackUrl.IsNullOrWhiteSpace()) |
|||
{ |
|||
var callbackUrl = PaymentWebOptions.PaymentFailureCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id; |
|||
Response.Redirect(callbackUrl); |
|||
} |
|||
|
|||
return Page(); |
|||
} |
|||
|
|||
private void FillOrganizationName() |
|||
{ |
|||
var isExistExtraProperties = PaymentRequest.ExtraProperties.TryGetValue(nameof(OrganizationPaymentRequestExtraParameterConfiguration), out var ExtraProperties); |
|||
if (!isExistExtraProperties) |
|||
{ |
|||
throw new BadHttpRequestException(""); |
|||
} |
|||
|
|||
var organizationPaymentExtraParameterConfiguration = JsonConvert.DeserializeObject<OrganizationPaymentRequestExtraParameterConfiguration>(ExtraProperties.ToString()); |
|||
if (organizationPaymentExtraParameterConfiguration is null) |
|||
{ |
|||
throw new BadHttpRequestException(""); |
|||
} |
|||
|
|||
OrganizationName = organizationPaymentExtraParameterConfiguration.OrganizationName; |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 561 B |
Loading…
Reference in new issue