This commit is contained in:
2022-08-29 00:44:51 +00:00
parent c2cf61c4ce
commit 6318631014
7 changed files with 122 additions and 28 deletions

View File

@@ -16,7 +16,7 @@ namespace rockfishCore.Controllers
//### OUR ROUTE CALLED FROM ROCKFISH CLIENT ####
[Produces("application/json")]
[Route("api/order")]
[Authorize]
public class OrderController : Controller
{
private readonly rockfishContext ct;
@@ -45,10 +45,16 @@ namespace rockfishCore.Controllers
// Now use username and password with whatever authentication process you want
if (username == "Y24PYYDQSA1L12905N5MKU" && password == "MA8GMQK2PC3FDNT1RTR68R")
{
//put the notification into the db as freeform notification information
//put the jobject notification into the db as json string freeform notification information
//to be processed by other code later. i.e. just capture it as is cleanly and don't bother trying to do anything fancy here this should be tight and focused and side effect free
//save it to the database
var VendorNotification = new VendorNotification();
VendorNotification.Vendor = "shareit";
VendorNotification.Data = j.ToString();
VendorNotification.Processed = false;
await ct.VendorNotification.AddAsync(VendorNotification);
await ct.SaveChangesAsync();
}
@@ -59,7 +65,7 @@ namespace rockfishCore.Controllers
System.Diagnostics.Debug.WriteLine($"order/shareit - Exception processing request: {ex.Message}");
}
return NoContent();
return Ok("ok");//shareit robot looks for an OK response to know if it should resend or not https://account.mycommerce.com/home/wiki/7479805
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
namespace rockfishCore.Models
{
public partial class VendorNotification
{
public VendorNotification()
{
DtCreated = Util.DateUtil.NowAsEpoch();
}
public long Id { get; set; }
public long DtCreated { get; set; }
public string Vendor { get; set; }
public string Data { get; set; }
public long? DtProcessed { get; set; }
public bool Processed { get; set; }
}
}

View File

@@ -9,7 +9,7 @@ namespace rockfishCore.Models
public partial class rockfishContext : DbContext
{
public virtual DbSet<Customer> Customer { get; set; }
public virtual DbSet<LicenseTemplates> LicenseTemplates { get; set; }
public virtual DbSet<Purchase> Purchase { get; set; }
@@ -29,9 +29,11 @@ namespace rockfishCore.Models
//schema 10 case 3233
public virtual DbSet<License> License { get; set; }
//raven
public virtual DbSet<TrialRequest> TrialRequest { get; set; }
public virtual DbSet<VendorNotification> VendorNotification { get; set; }
//raven
public virtual DbSet<TrialRequest> TrialRequest { get; set; }
//Note: had to add this constructor to work with the code in startup.cs that gets the connection string from the appsettings.json file
//and commented out the above on configuring
@@ -51,7 +53,7 @@ namespace rockfishCore.Models
//************************************************
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
{
modelBuilder.Entity<Customer>(entity =>
{
entity.ToTable("customer");
@@ -97,10 +99,10 @@ namespace rockfishCore.Models
.HasColumnName("supportEmail")
.HasColumnType("text");
});
modelBuilder.Entity<LicenseTemplates>(entity =>
{
entity.ToTable("licenseTemplates");
@@ -142,7 +144,7 @@ namespace rockfishCore.Models
});
modelBuilder.Entity<Purchase>(entity =>
{
@@ -301,7 +303,7 @@ namespace rockfishCore.Models
//.WillCascadeOnDelete(true);
});
modelBuilder.Entity<User>(entity =>
@@ -416,7 +418,7 @@ namespace rockfishCore.Models
.HasColumnType("blob")
.IsRequired();
});
@@ -519,13 +521,43 @@ namespace rockfishCore.Models
.HasColumnName("key")
.HasColumnType("text")
.IsRequired();
});
modelBuilder.Entity<VendorNotification>(entity =>
{
entity.ToTable("vendornotification");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.DtCreated)
.HasColumnName("dtcreated")
.HasColumnType("integer")
.IsRequired();
entity.Property(e => e.Vendor)
.HasColumnName("vendor")
.HasColumnType("text")
.IsRequired();
entity.Property(e => e.Data)
.HasColumnName("data")
.HasColumnType("text")
.IsRequired();
entity.Property(e => e.Processed)
.HasColumnName("processed")
.HasColumnType("boolean")
.IsRequired();
entity.Property(e => e.DtProcessed)
.HasColumnName("dtprocessed")
.HasColumnType("integer");
});
//-----------
}

View File

@@ -13,7 +13,7 @@ namespace rockfishCore.Util
/////////////////////////////////////////////////////////////////
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
public const int DESIRED_SCHEMA_LEVEL = 17;
public const int DESIRED_SCHEMA_LEVEL = 18;
/////////////////////////////////////////////////////////////////
@@ -404,6 +404,22 @@ namespace rockfishCore.Util
currentSchema = 17;
setSchemaLevel(currentSchema);
}
//////////////////////////////////////////////////
//schema 18 Shareit notifications
if (currentSchema < 18)
{
exec("CREATE TABLE vendornotification (" +
"id INTEGER PRIMARY KEY, dtcreated integer not null, vendor text not null, data text not null, dtprocessed integer, processed boolean default 0 NOT NULL CHECK (processed IN (0,1))" +
")");
currentSchema = 18;
setSchemaLevel(currentSchema);
}
//*************************************************************************************

View File

@@ -415,9 +415,10 @@ app.api = (function () {
$.ajax({
method: "post",
dataType: "json",
url: app.shell.stateMap.apiUrl + "order/shareit",
username: 'Y24PYYDQSA1L12905N5MKU',
password: 'MA8GMQK2PC3FDNT1RTR68R',
url: app.shell.stateMap.apiUrl + "order/shareit",
headers: {
"Authorization": "Basic " + btoa('xxxxxx' + ":" + 'xxxxxx')
},
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objData),
success: function (data) {

View File

@@ -55,6 +55,7 @@ app.rfsettings = (function () {
//
onTest = function (event) {
event.preventDefault();
//debugger;
var submitData = {
creation_date: "2018-06-19T11:08:09.0000000Z", // <-- NEW
id: 283832781, // <-- NEW
@@ -93,10 +94,11 @@ app.rfsettings = (function () {
};
app.api.test(submitData, function (res) {
if (res.error) {
alert("ERROR");
$.gevent.publish("app-show-error", res.msg);
} else {
//do nothing, success!
alert("SUCCESS!");
//$('#key').val(res);
return false;
}

View File

@@ -1,19 +1,35 @@
<div>
<div class="alert alert-success mb-5" id="about" />
<div class="alert alert-success mb-5" id="about"></div>
<form id="frm" method="post" action="index.html">
<div class="form-group">
<label for="oldpassword">Change password</label>
<input class="form-control" type="text" id="oldpassword" name="oldpassword" placeholder="current password" value="">
<input class="form-control" type="text" id="newpassword" name="newpassword" placeholder="new password" value="">
<input
class="form-control"
type="text"
id="oldpassword"
name="oldpassword"
placeholder="current password"
value=""
/>
<input
class="form-control"
type="text"
id="newpassword"
name="newpassword"
placeholder="new password"
value=""
/>
<div class="app-frm-buttons mt-5">
<button id="btn-change-password">Update</button>
</div>
<div class="app-frm-buttons mt-5">
<button id="btn-test" class="btn btn-warning">TEST THAT THING</button>
</div>
</div>
</form>
<hr />
<div class="app-frm-buttons mt-5">
<button id="btn-test" class="btn btn-warning">TEST THAT THING</button>
</div>
</div>