Fix up paypal and discord.

main
Zed A. Shaw 2 years ago
parent 6a1bc0414b
commit 8e5121cbad
  1. 70
      package-lock.json
  2. 3
      package.json
  3. 10
      queues/discord.js
  4. 8
      queues/paypal.js

70
package-lock.json generated

@ -26,6 +26,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"date-fns": "^2.29.3", "date-fns": "^2.29.3",
"discord": "^0.8.2",
"discord.js": "^14.7.1", "discord.js": "^14.7.1",
"esbuild": "^0.16.7", "esbuild": "^0.16.7",
"esbuild-svelte": "^0.7.3", "esbuild-svelte": "^0.7.3",
@ -50,7 +51,7 @@
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"pino": "^6.14.0", "pino": "^6.14.0",
"pino-pretty": "^4.8.0", "pino-pretty": "^4.8.0",
"playwright": "^1.28.1", "playwright": "1.28.1",
"pm2": "^5.2.2", "pm2": "^5.2.2",
"random": "3.0.6", "random": "3.0.6",
"randomcolor": "^0.6.2", "randomcolor": "^0.6.2",
@ -3616,6 +3617,14 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/describe": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/describe/-/describe-1.2.0.tgz",
"integrity": "sha512-GcSTMsJD6d39QuE1Zor671dlY5pDY9IIVLHAidXLrTx6BmMQOyCKEX1btTI781+zA3GQYRcUITi+YoUjFB06UA==",
"dependencies": {
"string-color": ">= 0.8.0"
}
},
"node_modules/destroy": { "node_modules/destroy": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
@ -3649,6 +3658,20 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/discord": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/discord/-/discord-0.8.2.tgz",
"integrity": "sha512-n8uOSuwvh+JLS3nrU/Jjom7TYX3jpAueTQ4NSQLf+SMsBZAjdzll4+zwYxxHxH7hvngmT12P0zP08dfHGh1xmQ==",
"dependencies": {
"describe": ">=0.8.0",
"glob": ">3.0.1",
"mootools": ">=1.4.4",
"string-color": ">=0.8.0"
},
"engines": {
"node": "*"
}
},
"node_modules/discord-api-types": { "node_modules/discord-api-types": {
"version": "0.37.23", "version": "0.37.23",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.23.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.23.tgz",
@ -7344,6 +7367,14 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/mootools": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/mootools/-/mootools-1.5.2.tgz",
"integrity": "sha512-S1cOCsakr8GJ3P1j66pXGgQfLtcRpFLcBkRcq0xXQ15T6IYtFWIQhqqqH8RR7eAa7/vFmKz90IIrzTnfrCHPFw==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/morgan": { "node_modules/morgan": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
@ -11485,6 +11516,14 @@
"safe-buffer": "~5.2.0" "safe-buffer": "~5.2.0"
} }
}, },
"node_modules/string-color": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/string-color/-/string-color-0.8.0.tgz",
"integrity": "sha512-h1LLin9OfvTdEqmt1F+iUOnRuVloVy2kcaJ1LdJa1+DZxXrtKTfsq643HEG8i3uGOgrsiyaxAfiDudZN+FHcvg==",
"engines": {
"node": "*"
}
},
"node_modules/string-similarity": { "node_modules/string-similarity": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz",
@ -15536,6 +15575,14 @@
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
}, },
"describe": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/describe/-/describe-1.2.0.tgz",
"integrity": "sha512-GcSTMsJD6d39QuE1Zor671dlY5pDY9IIVLHAidXLrTx6BmMQOyCKEX1btTI781+zA3GQYRcUITi+YoUjFB06UA==",
"requires": {
"string-color": ">= 0.8.0"
}
},
"destroy": { "destroy": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
@ -15559,6 +15606,17 @@
"path-type": "^4.0.0" "path-type": "^4.0.0"
} }
}, },
"discord": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/discord/-/discord-0.8.2.tgz",
"integrity": "sha512-n8uOSuwvh+JLS3nrU/Jjom7TYX3jpAueTQ4NSQLf+SMsBZAjdzll4+zwYxxHxH7hvngmT12P0zP08dfHGh1xmQ==",
"requires": {
"describe": ">=0.8.0",
"glob": ">3.0.1",
"mootools": ">=1.4.4",
"string-color": ">=0.8.0"
}
},
"discord-api-types": { "discord-api-types": {
"version": "0.37.23", "version": "0.37.23",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.23.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.23.tgz",
@ -18292,6 +18350,11 @@
"moment": ">= 2.9.0" "moment": ">= 2.9.0"
} }
}, },
"mootools": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/mootools/-/mootools-1.5.2.tgz",
"integrity": "sha512-S1cOCsakr8GJ3P1j66pXGgQfLtcRpFLcBkRcq0xXQ15T6IYtFWIQhqqqH8RR7eAa7/vFmKz90IIrzTnfrCHPFw=="
},
"morgan": { "morgan": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
@ -21405,6 +21468,11 @@
"safe-buffer": "~5.2.0" "safe-buffer": "~5.2.0"
} }
}, },
"string-color": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/string-color/-/string-color-0.8.0.tgz",
"integrity": "sha512-h1LLin9OfvTdEqmt1F+iUOnRuVloVy2kcaJ1LdJa1+DZxXrtKTfsq643HEG8i3uGOgrsiyaxAfiDudZN+FHcvg=="
},
"string-similarity": { "string-similarity": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz",

@ -86,6 +86,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"date-fns": "^2.29.3", "date-fns": "^2.29.3",
"discord": "^0.8.2",
"discord.js": "^14.7.1", "discord.js": "^14.7.1",
"esbuild": "^0.16.7", "esbuild": "^0.16.7",
"esbuild-svelte": "^0.7.3", "esbuild-svelte": "^0.7.3",
@ -110,7 +111,7 @@
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"pino": "^6.14.0", "pino": "^6.14.0",
"pino-pretty": "^4.8.0", "pino-pretty": "^4.8.0",
"playwright": "^1.28.1", "playwright": "1.28.1",
"pm2": "^5.2.2", "pm2": "^5.2.2",
"random": "3.0.6", "random": "3.0.6",
"randomcolor": "^0.6.2", "randomcolor": "^0.6.2",

@ -1,6 +1,6 @@
import assert from "assert"; import assert from "assert";
import logging from '../lib/logging.js'; import logging from '../lib/logging.js';
import { Client, IntentsBitField, Partials } from "discord.js"; import { Client, IntentsBitField, Partials, ChannelType } from "discord.js";
import { User } from "../lib/models.js"; import { User } from "../lib/models.js";
import { company } from '../emails/config.js'; import { company } from '../emails/config.js';
import { discord } from "../lib/config.js"; import { discord } from "../lib/config.js";
@ -27,8 +27,8 @@ const load_guild_channel = async (client) => {
const channels = await guild.channels.fetch(); const channels = await guild.channels.fetch();
for(let chan of channels.entries()) { for(let chan of channels.entries()) {
if(chan[1].type === "GUILD_TEXT") { if(chan[1].type === ChannelType.GuildText) {
// remember, return await puts the errors here log.info(`Found guild text channel ${JSON.stringify(chan[1])}`);
return [guild, await chan[1].fetch()]; return [guild, await chan[1].fetch()];
} }
} }
@ -43,8 +43,8 @@ await client.login(discord.token);
const [guild, channel] = await load_guild_channel(client); const [guild, channel] = await load_guild_channel(client);
// if it doesn't exist make it and add it to their account // if it doesn't exist make it and add it to their account
log.info("Connected to Sever/Guild", guild.name); log.info(`Connected to Sever/Guild ${guild.name}`);
log.info("Sending invites from Channel", channel.name); log.info(`!!Sending invites from Channel ${JSON.stringify(channel, null, 4)}`);
const invite_email = await load_templates("discord_email"); const invite_email = await load_templates("discord_email");

@ -82,6 +82,12 @@ export const validate_order = async (job) => {
await Payment.update({id: payment.id}, {status: "failed", status_reason}); await Payment.update({id: payment.id}, {status: "failed", status_reason});
} }
} catch(error) { } catch(error) {
log.error(error, `Processing payment paypal varification for ${job.data.payment_id}`); log.error(error, `Processing payment paypal verification for ${job.data.payment_id}`);
try {
await Payment.update({id: job.data.payment_id}, {status: "failed", status_reason: "check_logs"});
} catch (e) {
log.error(error, `Failed to update the database with failure on payment id ${job.data.payment_id}`);
}
} }
} }

Loading…
Cancel
Save