load payment gateway settings

This commit is contained in:
2023-08-30 16:07:53 +02:00
parent 6a3127a35a
commit f0d433a0eb
9 changed files with 133 additions and 10 deletions

View File

@@ -93,7 +93,11 @@ class GETHandler {
reject( { 'code': 500, 'message': 'ERR_DB: ' + err } );
} );
} else if ( call === 'getPaymentGatewaySettings' ) {
pluginManager.loadPaymentGatewaySettings();
this.pluginManager.loadPaymentGatewaySettings().then( dat => {
resolve( dat );
} ).catch( err => {
reject( { 'code': 500, 'error': err } );
} );
} else if ( call === 'getSettings' ) {
resolve( this.settings );
} else {

View File

@@ -143,6 +143,8 @@ class POSTHandler {
db.writeJSONData( 'events', updated );
} );
resolve( 'ok' );
} else if ( call === 'updatePaymentGatewaySettings' ) {
resolve( 'ok' );
} else {
reject( { 'code': 404, 'error': 'Route not found' } );
}

View File

@@ -41,22 +41,32 @@ class PluginManager {
loadPaymentGatewaySettings () {
return new Promise( ( resolve, reject ) => {
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/configOptions.json' ), ( err, options ) => {
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/configOptions.json' ), ( err, optionsBuffer ) => {
if ( err ) reject( err );
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/config.payments.json' ), ( err, config ) => {
fs.readFile( path.join( __dirname + '/payments/' + this.paymentGateway + '/config.payments.json' ), ( err, configBuffer ) => {
if ( err ) reject( err );
let options, config;
try {
options = JSON.parse( optionsBuffer );
config = JSON.parse( configBuffer );
} catch ( err ) {
reject( err );
return;
}
let f = options;
for ( let s in f ) {
f[ s ][ 'value' ] = config[ s ];
}
resolve( f );
resolve( { 'data': f, 'gateway': this.paymentGateway } );
} );
} );
} );
}
savePaymentGatewaySettings () {
return new Promise( ( resolve, reject ) => {
} );
}
saveSettings ( plugin, settings ) {

View File

@@ -0,0 +1,16 @@
{
"APIKey": {
"display": "API key",
"id": "APIKey",
"tooltip":"This is the secret key API key you can get from the stripe dashboard. Please make a test purchase (FREE) before you go live!",
"value": "",
"type": "text"
},
"instance": {
"display": "Instance",
"id": "instance",
"tooltip":"Please specify the instance name you used to create the payrexx account. (e.g. libreevent)",
"value": "",
"type": "text"
}
}

View File

@@ -0,0 +1,16 @@
{
"APIKey": {
"display": "API key",
"id": "APIKey",
"tooltip":"This is the secret key API key you can get from the stripe dashboard. Please make a test purchase (FREE) before you go live!",
"value": "",
"type": "text"
},
"endpointSecret": {
"display": "Webhook endpoint secret",
"id": "endpointSecret",
"tooltip":"Please specify the endpoint secret that you can get from the stripe dashboard when creating the webhook integration",
"value": "",
"type": "text"
}
}

View File

@@ -7,7 +7,13 @@
<title>libreevent</title>
</head>
<body>
<nav></nav>
<nav>
<a href="/">Home</a> |
<router-link to="/tickets">Tickets</router-link> |
<router-link to="/cart">Cart</router-link> |
<router-link to="/account">Account</router-link> |
<button @click="changeTheme();" v-html="theme" id="themeSelector"></button>
</nav>
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
<h1>Welcome to libreevent!</h1>
<p>No start page has been configured yet! Please configure one either by using the configurator in the settings or by uploading your own HTML page to the correct folder as detailed <a href="https://libreevent.janishutz.com/docs/admin-panel/pages">here</a></p>

View File

@@ -0,0 +1,62 @@
:root, :root.light {
--primary-color: #2c3e50;
--accent-background: rgb(30, 30, 82);
--secondary-color: white;
--background-color: white;
--popup-color: rgb(224, 224, 224);
--accent-color: #42b983;
--hover-color: rgb(165, 165, 165);
--accent-background-hover: rgb(124, 140, 236);
--overlay-color: rgba(0, 0, 0, 0.7);
--inactive-color: rgb(100, 100, 100);
--highlight-backdrop: rgb(143, 134, 192);
--hint-color: rgb(174, 210, 221);
--PI: 3.14159265358979;
}
:root.dark {
--primary-color: white;
--accent-background: rgb(56, 56, 112);
--secondary-color: white;
--background-color: rgb(32, 32, 32);
--popup-color: rgb(58, 58, 58);
--accent-color: #42b983;
--hover-color: rgb(83, 83, 83);
--accent-background-hover: #4380a8;
--overlay-color: rgba(104, 104, 104, 0.575);
--inactive-color: rgb(190, 190, 190);
--highlight-backdrop: rgb(85, 63, 207);
--hint-color: rgb(88, 91, 110);
}
@media ( prefers-color-scheme: dark ) {
:root {
--primary-color: white;
--accent-background: rgb(56, 56, 112);
--secondary-color: white;
--background-color: rgb(32, 32, 32);
--popup-color: rgb(58, 58, 58);
--accent-color: #42b983;
--hover-color: rgb(83, 83, 83);
--accent-background-hover: #4380a8;
--overlay-color: rgba(104, 104, 104, 0.575);
--inactive-color: rgb(190, 190, 190);
--highlight-backdrop: rgb(85, 63, 207);
--hint-color: rgb(88, 91, 110);
}
}
::selection {
background-color: var( --highlight-backdrop );
color: var( --secondary-color );
}
#themeSelector {
background-color: rgba( 0, 0, 0, 0 );
color: var( --primary-color );
font-size: 130%;
padding: 0;
margin: 0;
border: none;
cursor: pointer;
}