Skip to content
Snippets Groups Projects
Commit dae75746 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

enhanced key expiration to two years

parent 9d5df22a
Branches
No related tags found
No related merge requests found
......@@ -106,7 +106,7 @@ class Key {
}
});
if (expiration === null) {
expiration = dayjs().add(config.get("keys.expiration_days"), "day");
expiration = dayjs().add(config.get("keys.expiration_years"), "year");
}
return expiration;
}
......
......@@ -197,7 +197,7 @@ class PaymentReference {
}
resolve(
parseInt(matcher[2]) -
config.get("price.number_range.payment_reference")
config.get("price.number_range.payment_reference")
);
});
}
......@@ -297,13 +297,13 @@ class PaymentReference {
key.charge_key_order(
charge_amount,
this.id,
dayjs().add(config.get("keys.expiration_days"), "days")
dayjs().add(config.get("keys.expiration_years"), "year")
);
} else {
key.discharge_key(
Math.abs(charge_amount),
this.id,
dayjs().add(config.get("keys.expiration_days"), "days")
dayjs().add(config.get("keys.expiration_years"), "year")
);
}
return key.save().then(() => payment);
......@@ -318,7 +318,7 @@ class PaymentReference {
*/
async chargeKey() {
return this.getKey(true).then((key) => {
let expiration = dayjs().add(config.get("keys.expiration_days"), "days");
let expiration = dayjs().add(config.get("keys.expiration_years"), "year");
return this.setExpiration(expiration).then(() => {
key.charge_key_order(this.amount, this.id, expiration);
return key.save();
......
......@@ -45,20 +45,8 @@
"price": {
"per_token": 0.01,
"vat": 7,
"purchasable": [
1000,
2000,
3000,
4000,
6000,
12000
],
"allowed_currencies": [
"EUR",
"USD",
"CAD",
"GBP"
],
"purchasable": [1000, 2000, 3000, 4000, 6000, 12000],
"allowed_currencies": ["EUR", "USD", "CAD", "GBP"],
"number_range": {
"payment_reference": 0,
"invoices": 0,
......@@ -85,7 +73,7 @@
"data_path": "/data"
},
"keys": {
"expiration_days": 365
"expiration_years": 2
},
"crypto": {
"hmac_integrity_seed": "<insert_secret_for_hmac_seed>",
......@@ -110,4 +98,4 @@
}
}
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment