mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -37,8 +37,20 @@ const {
|
||||
computedAttributes: paymentsComputed,
|
||||
} = require('../../models/tiers/payments.attributes');
|
||||
|
||||
const cc = require('currency-codes');
|
||||
|
||||
const PENDING_PAYMENT_EXPIRY_MINUTES = 60;
|
||||
|
||||
// ─── CURRENCIES ───────────────────────────────────────────────────────────────
|
||||
|
||||
exports.getCurrencies = (req, res) => {
|
||||
const list = cc.codes().map((code) => {
|
||||
const entry = cc.code(code);
|
||||
return { code: entry.code, name: entry.currency };
|
||||
}).sort((a, b) => a.code.localeCompare(b.code));
|
||||
return R.success(res, 'OK', list);
|
||||
};
|
||||
|
||||
const expireStalePendingPayments = async () => {
|
||||
const expiresBefore = new Date(Date.now() - PENDING_PAYMENT_EXPIRY_MINUTES * 60 * 1000);
|
||||
await mdl_Payments.update(
|
||||
|
||||
Reference in New Issue
Block a user