This commit is contained in:
2022-08-28 23:10:17 +00:00
parent 4e5095d46c
commit c2cf61c4ce
3 changed files with 542 additions and 436 deletions

View File

@@ -43,7 +43,7 @@ namespace rockfishCore.Controllers
//do stuff with the notification //do stuff with the notification
(string username, string password) = rockfishCore.Util.AutoOrderProcessingUtil.GetUsernameAndPasswordFromAuthorizeHeader(Authorization); (string username, string password) = rockfishCore.Util.AutoOrderProcessingUtil.GetUsernameAndPasswordFromAuthorizeHeader(Authorization);
// Now use username and password with whatever authentication process you want // Now use username and password with whatever authentication process you want
if (username == "Y24PYYDQSA1L12905N5MKU" && password == "GI2F7CP17C2JS872MHASAF") if (username == "Y24PYYDQSA1L12905N5MKU" && password == "MA8GMQK2PC3FDNT1RTR68R")
{ {
//put the notification into the db as freeform notification information //put the notification into the db as 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 //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

View File

@@ -27,7 +27,8 @@ app.api = (function () {
createRavLicense, createRavLicense,
getLicenseRequests, getLicenseRequests,
generateFromRequest, generateFromRequest,
licenseEmailResponse; licenseEmailResponse,
test;
RockFishVersion = "6.20"; RockFishVersion = "6.20";
@@ -75,7 +76,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -98,7 +104,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -137,7 +148,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -158,7 +174,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -212,7 +233,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -239,7 +265,12 @@ app.api = (function () {
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
callback({ callback({
error: 1, error: 1,
msg: textStatus + "\n" + jqXHR.responseText + "\n" + errorThrown, msg:
textStatus +
"\n" +
jqXHR.responseText +
"\n" +
errorThrown,
error_detail: {} error_detail: {}
}); });
} }
@@ -332,7 +363,10 @@ app.api = (function () {
$.ajax({ $.ajax({
method: "GET", method: "GET",
dataType: "json", dataType: "json",
url: app.shell.stateMap.apiUrl + "license/generateFromRequest/" + uid, url:
app.shell.stateMap.apiUrl +
"license/generateFromRequest/" +
uid,
headers: getAuthHeaderObject(), headers: getAuthHeaderObject(),
success: function (data, textStatus) { success: function (data, textStatus) {
callback(data); callback(data);
@@ -372,6 +406,33 @@ app.api = (function () {
}); });
}; };
///////////////////////////////////////////////////////////
//test functin for rockfish endpoint testing
//
//
test = function (objData, callback) {
//Test fake shareit webhook
$.ajax({
method: "post",
dataType: "json",
url: app.shell.stateMap.apiUrl + "order/shareit",
username: 'Y24PYYDQSA1L12905N5MKU',
password: 'MA8GMQK2PC3FDNT1RTR68R',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objData),
success: function (data) {
callback(data);
},
error: function (jqXHR, textStatus, errorThrown) {
callback({
error: 1,
msg: textStatus + "\n" + errorThrown,
error_detail: {}
});
}
});
};
initModule = function () {}; initModule = function () {};
return { return {
@@ -389,6 +450,7 @@ app.api = (function () {
createRavLicense: createRavLicense, createRavLicense: createRavLicense,
getLicenseRequests: getLicenseRequests, getLicenseRequests: getLicenseRequests,
generateFromRequest: generateFromRequest, generateFromRequest: generateFromRequest,
licenseEmailResponse: licenseEmailResponse licenseEmailResponse: licenseEmailResponse,
test: test
}; };
})(); })();

View File

@@ -50,13 +50,57 @@ app.rfsettings = (function() {
return false; //prevent default? return false; //prevent default?
}; };
/////////////////////////////// ///////////////////////////////
//ONTEST //ONTEST
// //
onTest = function (event) { onTest = function (event) {
event.preventDefault(); event.preventDefault();
var submitData = {
creation_date: "2018-06-19T11:08:09.0000000Z", // <-- NEW
id: 283832781, // <-- NEW
order_notification: {
// <-- NEW - Type of the message (same as in XML with out the "e5"-prefix)
purchase: {
customer_data: {
billing_contact: {},
customer_payment_data: {},
delivery_contact: {},
language: "English",
language_iso: "en", // <-- NEW
reg_name: "Test",
shopper_id: "5678", // <-- NEW, also known as Customer ID
subscribe_newsletter: false,
user_id: "abc@test.com-100"
},
payment_status: "complete",
payment_status_id: "PCA", // <-- NEW, our status ID
purchase_id: 1234567890,
purchase_date: "2018-03-29T10:25:12.0000000Z",
purchase_item: [
// <-- NEW, this is now an array
{
running_no: 1,
your_product_id:
"this is the same as product_code in the API"
},
{
running_no: 2
}
],
purchase_origin: "online"
}
}
};
app.api.test(submitData, function (res) {
if (res.error) {
$.gevent.publish("app-show-error", res.msg);
} else {
//do nothing, success!
//$('#key').val(res);
return false;
}
});
return false; //prevent default? return false; //prevent default?
}; };