diff options
| author | Adam Soltys <[email protected]> | 2024-08-26 21:17:43 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-08-26 21:17:43 -0700 |
| commit | fe62cadd6fb4a7e49f7d59401fc74ae0411e32a7 (patch) | |
| tree | aa8f34e1692bd2d638a2c996eeadb58671d07aea /routes/shopify.js | |
| parent | 00e43ddc0bf3d6dd719fc9295d156567fa2fecfb (diff) | |
| download | coinos-server-fe62cadd6fb4a7e49f7d59401fc74ae0411e32a7.tar.gz coinos-server-fe62cadd6fb4a7e49f7d59401fc74ae0411e32a7.zip | |
typescript
Diffstat (limited to 'routes/shopify.js')
| -rw-r--r-- | routes/shopify.js | 41 |
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); - } -}; |
