This commit is contained in:
2023-01-19 02:18:24 +00:00
parent 9800d5a672
commit 1332ddca65
8 changed files with 56 additions and 49 deletions

View File

@@ -757,7 +757,7 @@ namespace Sockeye.Biz
tlr.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
tlr.LicenseId = TrialKeyId;
var biz = TrialLicenseRequestBiz.GetBiz(ct);
await biz.CreateAsync(tlr);
await biz.CreateAsync(tlr,true);
}

View File

@@ -476,7 +476,7 @@ namespace Sockeye.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//UPDATE
//
internal async Task<License> PutAsync(License putObject)
internal async Task<License> PutAsync(License putObject, bool importingDoNotNotify = false)
{
var dbObject = await GetAsync(putObject.Id, false);
if (dbObject == null)
@@ -500,11 +500,12 @@ namespace Sockeye.Biz
try
{
await ct.SaveChangesAsync();
//TODO: NOTIFICATION ON NEW KEY
//BUT NOT if REVOKED token is the regto, we don't want them to know, just let AyaNova install it
//this is for non-payment scenarios or chargebacks after license was sent
if (!importingDoNotNotify)
{
//TODO: NOTIFICATION ON NEW KEY
//BUT NOT if REVOKED token is the regto, we don't want them to know, just let AyaNova install it
//this is for non-payment scenarios or chargebacks after license was sent
}
}
catch (DbUpdateConcurrencyException)
@@ -653,7 +654,7 @@ namespace Sockeye.Biz
}
//MISC / NOTSET product group are not valid for keys
if (proposedObj.PGroup == ProductGroup.Misc || proposedObj.PGroup == ProductGroup.NotSet )
if (proposedObj.PGroup == ProductGroup.Misc || proposedObj.PGroup == ProductGroup.NotSet)
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "pGroup");
return;

View File

@@ -31,8 +31,8 @@ Inspiring quotes used to help complete this huge project by myself
ServerOperationsProblem = 28,//* NO OBJECT and serious issue with SOCKEY server (NOT CUSTOMER SUBSCRIPTION SERVER) operations requiring intervention,
ReviewImminent = 34,//*Review object, Advance notice setting tag conditional
DirectSMTPMessage= 35, //Used internally when sending a message via email directly to a Customer (initially) and possibly other objects in future. Shows in sent log but not user subscribable
ServerStateStatusChange = 36,
ServerStateStatusAge=37,
ServerStateStatusChange = 36,//on change of status, this includes new records that had no status before
ServerStateStatusAge=37,//Age used for things like if a server is fail state for too long triggers a even higher level notification etc, or reminder about trial request server awaiting activation
SubscriptionServerExpiring = 38,
SubscriptionServerLastUpdateAge = 39,//here this means the operating system, not RAVEN which should always be updated on all servers when released
SubscriptionServerRequestReceived = 40,

View File

@@ -41,7 +41,7 @@ namespace Sockeye.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE
//
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject)
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject, bool importingDoNotNotify = false)
{
await ValidateAsync(newObject, null);
if (HasErrors)
@@ -62,36 +62,37 @@ namespace Sockeye.Biz
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
//## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ----------------
//ValidateEmail request message,RavenTrialApproved (which sends pending manual generation message) and RavenTrialRejected messages are sent in this block
//
//Send verification request
var verifyUrl = ServerGlobalOpsSettingsCache.Notify.SockeyeServerURL.Trim().TrimEnd('/') + $"/rvr/verify/{newObject.EmailConfirmCode}";
var body = ServerGlobalBizSettings.Cache.ValidateEmail.Replace("{verifyUrl}", verifyUrl);//$"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\nOnce your email is verified the request will be processed manually during business hours.\r\n(If you did not request this you can ignore this message)";
var notifyDirectSMTP = new Sockeye.Api.Controllers.NotifyController.NotifyDirectSMTP()
if (!importingDoNotNotify)
{
ToAddress = newObject.Email,
Subject = "AyaNova trial request email verification",
TextBody = body
};
//## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ----------------
//ValidateEmail request message,RavenTrialApproved (which sends pending manual generation message) and RavenTrialRejected messages are sent in this block
//
//Send verification request
var verifyUrl = ServerGlobalOpsSettingsCache.Notify.SockeyeServerURL.Trim().TrimEnd('/') + $"/rvr/verify/{newObject.EmailConfirmCode}";
var body = ServerGlobalBizSettings.Cache.ValidateEmail.Replace("{verifyUrl}", verifyUrl);//$"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\nOnce your email is verified the request will be processed manually during business hours.\r\n(If you did not request this you can ignore this message)";
var notifyDirectSMTP = new Sockeye.Api.Controllers.NotifyController.NotifyDirectSMTP()
{
ToAddress = newObject.Email,
Subject = "AyaNova trial request email verification",
TextBody = body
};
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
try
{
await m.SendEmailAsync(notifyDirectSMTP.ToAddress, notifyDirectSMTP.Subject, notifyDirectSMTP.TextBody, ServerGlobalOpsSettingsCache.Notify, null, null, null);
await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, notifyDirectSMTP.ObjectId, notifyDirectSMTP.SockType, SockEvent.DirectSMTP, $"\"{notifyDirectSMTP.Subject}\"->{notifyDirectSMTP.ToAddress}"), ct);
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
try
{
await m.SendEmailAsync(notifyDirectSMTP.ToAddress, notifyDirectSMTP.Subject, notifyDirectSMTP.TextBody, ServerGlobalOpsSettingsCache.Notify, null, null, null);
await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, notifyDirectSMTP.ObjectId, notifyDirectSMTP.SockType, SockEvent.DirectSMTP, $"\"{notifyDirectSMTP.Subject}\"->{notifyDirectSMTP.ToAddress}"), ct);
}
catch (Exception ex)
{
var err = "TrialLicenseRequest sending email confirmation request: SMTP direct message failed";
await NotifyEventHelper.AddOpsProblemEvent(err, ex);
AddError(ApiErrorCode.API_SERVER_ERROR, null, err + ExceptionUtil.ExtractAllExceptionMessages(ex));
return null;
}
}
catch (Exception ex)
{
var err = "TrialLicenseRequest sending email confirmation request: SMTP direct message failed";
await NotifyEventHelper.AddOpsProblemEvent(err, ex);
AddError(ApiErrorCode.API_SERVER_ERROR, null, err + ExceptionUtil.ExtractAllExceptionMessages(ex));
return null;
}
await HandlePotentialNotificationEvent(SockEvent.Created, newObject);
return newObject;

View File

@@ -16,7 +16,7 @@ namespace Sockeye.Models
public uint Concurrency { get; set; }
public DateTime Created { get; set; }
public bool Active { get; set; }//active licenses can be fetched by customer, inactive means still putting together or it's been kiboshed
public bool Active { get; set; }//active licenses will be notified immediately on save and can be fetched by customer, inactive means still putting together or it's been kiboshed
public bool NotificationSent { get; set; }
public long? CustomerId { get; set; }
[NotMapped]

View File

@@ -22,16 +22,16 @@ namespace Sockeye.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 17;
internal const long EXPECTED_COLUMN_COUNT = 513;
internal const long EXPECTED_COLUMN_COUNT = 515;
internal const long EXPECTED_INDEX_COUNT = 74;
internal const long EXPECTED_CHECK_CONSTRAINTS = 242;
internal const long EXPECTED_CHECK_CONSTRAINTS = 241;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 34;
internal const long EXPECTED_VIEWS = 0;
internal const long EXPECTED_ROUTINES = 2;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////// (C512:I74:CC242:FC34:V0:R2)
///////////////////////////////////////// (C515:I74:CC241:FC34:V0:R2)
/*
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS