aboutsummaryrefslogtreecommitdiffstats
path: root/routes/shopify.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/shopify.js')
-rw-r--r--routes/shopify.js41
1 files changed, 0 insertions, 41 deletions
diff --git a/routes/shopify.js b/routes/shopify.js
deleted file mode 100644
index bcb60ea3..00000000
--- a/routes/shopify.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import got from "got";
-import { g } from "$lib/db";
-import { err } from "$lib/logging";
-
-let query = `mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) {
- orderMarkAsPaid(input: $input) {
- order { id }
- userErrors {
- field
- message
- }
- }
-}`;
-
-export default async ({ body: { hash }, params: { id } }, res) => {
- let p = await g(`payment:${hash}`);
- if (typeof p === "string") p = await g(`payment:${p}`);
- let user = await g(`user:${p.uid}`);
-
- try {
- let r = await got
- .post(
- `https://${user.shopifyStore}.myshopify.com/admin/api/2023-07/graphql.json`,
- {
- headers: {
- "Content-Type": "application/json",
- "X-Shopify-Access-Token": user.shopifyToken,
- },
- json: {
- query,
- variables: { input: { id: `gid://shopify/Order/${id}` } },
- },
- },
- )
- .json();
-
- res.send(r);
- } catch (e) {
- err("problem marking shopify order as paid", e.message);
- }
-};