This commit is contained in:
Garrett K 2021-02-09 04:21:40 +00:00
parent 1ffad1a8fe
commit d6631201f9
5 changed files with 87 additions and 6 deletions

View File

@ -32,11 +32,12 @@ Contents
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
**Changes introduced in 0.3.12
[Enhance] When configuring template port ID, show last port ID in long abreviated list
[Enhance] Cable path connections generated programatically instead of static images
[Enhance] Added customer payment portal
[Fix] Corrected nested insert size as displayed in "Available Templates" box
[Fix] Template port ID add/remove field not refreshing when shown for different connectable partitions
[Fix] Fresh install inserted data in a way that would cause a "duplicate cabinet order" error on backup restore
[Enhance] When configuring template port ID, show last port ID in long abreviated list
[Enhance] Cable path connections generated programatically instead of static images
**Changes introduced in 0.3.11
[Enhance] Added ability to create inserts with enclosure partitions

View File

@ -139,13 +139,18 @@ $qls->Security->check_auth_page('administrator.php');
<span class="btn-label"><i class="fa fa-check"></i></span>Check
</button>
</div>
<div>
<button id="entitlementPaymentPortal" type="button" class="btn btn-sm btn-success waves-effect waves-light m-t-10">
<span class="btn-label"><i class="fa fa-credit-card"></i></span>Payment Portal
</button>
</div>
<!--
<div>
<button id="entitlementCancel" type="button" class="btn btn-sm btn-danger waves-effect waves-light m-t-10" data-toggle="modal" data-target="#cancelEntitlementModal" >
<span class="btn-label"><i class="fa fa-times"></i></span>Cancel
</button>
</div>
-->
</div>
</div>
</div>

View File

@ -269,6 +269,28 @@ $( document ).ready(function() {
});
});
$('#entitlementPaymentPortal').on('click', function(event){
var data = {
action: 'portal'
};
data = JSON.stringify(data);
// Process mail settings
$.post("backend/process_entitlement.php", {data:data}, function(response){
var responseJSON = JSON.parse(response);
if (responseJSON.active == 'inactive'){
window.location.replace("/");
} else if ($(responseJSON.error).size() > 0){
displayError(responseJSON.error);
} else {
displaySuccess(responseJSON.success.customerPortalURL);
window.open(responseJSON.success.customerPortalURL, '_blank');
}
});
});
$('#confirmEntitlementCancellation').on('click', function(event){
event.preventDefault();
var entitlementID = $('#inline-entitlement').editable('getValue')['inline-entitlement'];

View File

@ -40,13 +40,61 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
$qls->App->cancelEntitlement();
$qls->App->gatherEntitlementData();
$validate->returnData['success'] = $qls->App->entitlementArray;
} else if($action == 'portal') {
$entitlementID = $qls->App->entitlementArray['id'];
// POST Request
$data = array(
'action' => 'portal',
'entitlementID' => $entitlementID
);
$dataJSON = json_encode($data);
$POSTData = array('data' => $dataJSON);
$ch = curl_init('https://patchcablemgr.com/public/process_subscription.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, "/etc/ssl/certs/");
// Submit the POST request
$responseJSON = curl_exec($ch);
//Check for request errors.
$errMsg = false;
if(!curl_errno($ch)) {
error_log('Debug (responseJSON): '.$responseJSON);
if($response = json_decode($responseJSON, true)) {
if(!count($response['error'])) {
if($response['success'] != '') {
$validate->returnData['success']['customerPortalURL'] = $response['success'];
} else {
$errMsg = 'Entitlement not found, please contact support@patchcablemgr.com';
}
} else {
$errMsg = $response['error'][0];
}
} else {
$errMsg = 'Invalid server response, please contact support@patchcablemgr.com';
}
} else {
$errMsg = 'Unable to contact server, please contact support@patchcablemgr.com';
}
if($errMsg) {
array_push($validate->returnData['error'], $errMsg);
}
// Close cURL session handle
curl_close($ch);
}
}
echo json_encode($validate->returnData);
}
function validate($data, &$validate, &$qls){
$actionsArray = array('update', 'check', 'cancel');
$actionsArray = array('update', 'check', 'cancel', 'portal');
$action = strtolower($data['action']);
//Validate action
@ -57,6 +105,7 @@ function validate($data, &$validate, &$qls){
// Validate entitlement ID
$entitlementID = strtolower($data['entitlementID']);
$validate->validateSHA($entitlementID, 'Invalid entitlement ID.');
}
}
}

View File

@ -1945,6 +1945,11 @@ var $qls;
}
function logAction($function, $actionType, $actionString){
if(strlen($actionString) > 200) {
$actionString = substr($actionString, 0 , 200).'...';
}
$columns = array('date', 'function', 'action_type', 'user_id', 'action');
$values = array(time(), $function, $actionType, $this->qls->user_info['id'], $actionString);
$this->qls->SQL->insert('app_history', $columns, $values);
@ -2376,7 +2381,6 @@ var $qls;
$POSTData = array('data' => $dataJSON);
$ch = curl_init('https://patchcablemgr.com/public/process_subscription.php');
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Cookie: BACKDOOR=yes'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTData);