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

2
.vscode/launch.json vendored
View File

@@ -33,7 +33,7 @@
"SOCKEYE_DB_CONNECTION": "Server=localhost;Username=postgres;Password=sockeye;Database=sockeye;CommandTimeout=300;",
"SOCKEYE_DATA_PATH": "c:\\temp\\sockeye",
"SOCKEYE_USE_URLS": "http://*:7676;",
//"SOCKEYE_PERMANENTLY_ERASE_DATABASE": "true",
"SOCKEYE_PERMANENTLY_ERASE_DATABASE": "true",
//"SOCKEYE_REPORT_RENDERING_TIMEOUT":"1",
"SOCKEYE_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
},

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

View File

@@ -1,18 +1,16 @@
TODO:
- JOB: notify user active license
- JOB: notify user active license saved
this should go out immediately on save once when state is changed from inactive to active
can manually re-send by toggling active
NOTE:
- JOB: Process purchases that are from vendor notification
- create customer if necessary from purchase notification or add to existing
- if v7 needs to account for there being a delay sometimes in order completeness
maybe just keep adding to the order and refreshing
- JOB: make a license from purchases but not active ready to send / in waiting only for approval
- JOB: Ping / check health route of subscription server
flag last health check
trigger event notification if fails
serverstate set so that it maybe has an OneFail then a TwoFail then a FAILED state where it notifies me so I don't get transient alerts
also server state used for other things like pending but not commissioned yet, decommissioned etc
- JOB: "SOCKBOT" virtual staff member,
sockbot - does everything we have to do manually on a delay if it hasn't been done by us yet
or tees up as much as possible whatever we need so we can just ok it or if too much time elapses just goes ahead with some things
@@ -54,6 +52,13 @@ TODO:
- direct open a case by case number like workorder
(id's differ so it isn't easy to just open a case in the url)
WHEN RUNNING
- Subscribe to following notifications:
Ops problem event should notify me immediately
server state first and second fails notify for starters but on a non alerting method so for FYI purposes
server state 3rd fail should notify via some immediate and loud means regardless of time of day for starters
server state 3rd fail age of more than XX minutes should esclate to a secondary means of alerting, maybe email to text?
todo: see if email to text can be set at phone end to recognize sender as a spcecific contact and set a crazy loud any time alarm for it
LATER