From 9c0d520c9f3da8c1417144b0206713aa5ca7897b Mon Sep 17 00:00:00 2001 From: Harsha Somisetty Date: Sun, 16 Jul 2023 00:00:28 -0400 Subject: [PATCH 01/42] Eslint Configs (#423) * eslint and prettier working lfg * solana prettier and formatting * preitter clean * some more small changes --- .eslintrc.js | 10 +++- .prettierignore | 47 +++++++++++++++ .vscode/settings.json | 8 +++ apps/backend-serverless/.eslintrc | 19 ------- .../.eslintrc.cjs} | 0 apps/backend-serverless/jest.config.cjs | 22 +++---- apps/backend-serverless/package.json | 14 ++--- apps/backend-serverless/tsconfig.tests.json | 2 +- apps/docs/.eslintrc.js | 4 ++ apps/docs/package.json | 10 ++-- apps/merchant-ui/.eslintrc.js | 4 ++ apps/merchant-ui/.eslintrc.json | 3 - apps/merchant-ui/next.config.js | 4 +- apps/merchant-ui/package.json | 8 +-- apps/merchant-ui/postcss.config.js | 10 ++-- apps/merchant-ui/tsconfig.json | 57 +++++++------------ apps/mock-shopify-serverless/.eslintrc | 19 ------- apps/mock-shopify-serverless/.eslintrc.cjs | 4 ++ apps/mock-shopify-serverless/package.json | 10 +--- apps/mock-shopify-serverless/serverless.yml | 2 +- apps/mock-shopify-serverless/tsconfig.json | 24 ++++---- apps/payment-ui/.eslintrc.js | 4 ++ apps/payment-ui/.eslintrc.json | 3 - apps/payment-ui/.sample.env | 3 +- apps/payment-ui/next.config.js | 18 +++--- apps/payment-ui/package.json | 9 ++- apps/payment-ui/postcss.config.js | 10 ++-- apps/payment-ui/tailwind.config.js | 54 +++++++++--------- apps/payment-ui/tsconfig.json | 42 +++++++------- apps/transaction-request-serverless/.eslintrc | 19 ------- .../.eslintrc.cjs | 4 ++ apps/transaction-request-serverless/index.js | 24 ++++---- .../jest.config.cjs | 14 ++--- .../package.json | 12 ++-- .../tsconfig.json | 26 ++++----- .../tsconfig.tests.json | 2 +- package.json | 36 +++++------- packages/eslint-config-custom/index.js | 6 ++ packages/eslint-config-custom/package.json | 21 +++++++ turbo.json | 51 +++++++---------- 40 files changed, 321 insertions(+), 318 deletions(-) create mode 100755 .prettierignore create mode 100644 .vscode/settings.json delete mode 100644 apps/backend-serverless/.eslintrc rename apps/{docs/.eslint.js => backend-serverless/.eslintrc.cjs} (100%) create mode 100755 apps/docs/.eslintrc.js create mode 100755 apps/merchant-ui/.eslintrc.js delete mode 100755 apps/merchant-ui/.eslintrc.json delete mode 100644 apps/mock-shopify-serverless/.eslintrc create mode 100644 apps/mock-shopify-serverless/.eslintrc.cjs create mode 100755 apps/payment-ui/.eslintrc.js delete mode 100755 apps/payment-ui/.eslintrc.json delete mode 100644 apps/transaction-request-serverless/.eslintrc create mode 100644 apps/transaction-request-serverless/.eslintrc.cjs create mode 100644 packages/eslint-config-custom/index.js create mode 100644 packages/eslint-config-custom/package.json diff --git a/.eslintrc.js b/.eslintrc.js index 32cd503e..7143be65 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,8 @@ module.exports = { - extends: ['turbo', '@solana/eslint-config-solana', '@solana/eslint-config-solana/jest'], - root: true, -}; \ No newline at end of file + extends: ['custom'], + settings: { + next: { + rootDir: ['apps/*/'], + }, + }, +}; diff --git a/.prettierignore b/.prettierignore new file mode 100755 index 00000000..d518293c --- /dev/null +++ b/.prettierignore @@ -0,0 +1,47 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +**/node_modules +.pnp +.pnp.js +**/package-lock.json +**/yarn.lock + +# testing +**/coverage + +# next.js +**/.next +**/out +**/build +**/.build + +# misc +*.pem +.DS_Store + +# debug +*debug.log* +*error.log* + +# local env files +**/.env* + +# turbo +.turbo + +# apps and packages +**/dist +**/.serverless + +#packages-dist + +# General ignore rules for monorepos +**/.cache +**/.pnp +**/.pnp.js +**/coverage +**/.DS_Store + +# Working notes +working-notes.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1f7c5611 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "eslint.workingDirectories": [ + "apps/merchant-ui", + "apps/backend-serverless", + "apps/mock-shopify-serverless", + "apps/payment-ui" + ] +} diff --git a/apps/backend-serverless/.eslintrc b/apps/backend-serverless/.eslintrc deleted file mode 100644 index ce8a3295..00000000 --- a/apps/backend-serverless/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "root": true, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:require-extensions/recommended" - ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "require-extensions" - ], - "settings": { - }, - "rules": { - }, - "overrides": [ - ] -} diff --git a/apps/docs/.eslint.js b/apps/backend-serverless/.eslintrc.cjs similarity index 100% rename from apps/docs/.eslint.js rename to apps/backend-serverless/.eslintrc.cjs diff --git a/apps/backend-serverless/jest.config.cjs b/apps/backend-serverless/jest.config.cjs index 7f6ecb46..99709eaf 100644 --- a/apps/backend-serverless/jest.config.cjs +++ b/apps/backend-serverless/jest.config.cjs @@ -1,13 +1,13 @@ // jest.config.cjs module.exports = { - roots: ["/__tests__"], - transform: { - "^.+\\.tsx?$": ["ts-jest", { tsconfig: "./tsconfig.tests.json" }], - }, - testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$", - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1', -}, - moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], - testEnvironment: 'node', -}; \ No newline at end of file + roots: ['/__tests__'], + transform: { + '^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.tests.json' }], + }, + testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + testEnvironment: 'node', +}; diff --git a/apps/backend-serverless/package.json b/apps/backend-serverless/package.json index a821ef4d..545e64a6 100755 --- a/apps/backend-serverless/package.json +++ b/apps/backend-serverless/package.json @@ -1,6 +1,6 @@ { "name": "backend-serverless", - "version": "0.1.0", + "version": "1.0.0", "private": true, "description": "", "main": "handler.js", @@ -16,8 +16,6 @@ "scripts": { "predev": "yarn helius & npx prisma generate", "dev": "serverless offline start --stage dev --config serverless.purple.yml & serverless offline start --stage dev --config serverless.green.yml", - "lint": "eslint .", - "lint:fix": "eslint --fix .", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "test": "jest", "test:tx": "jest integration", @@ -37,7 +35,8 @@ "prisma:generate:dev": "dotenv -e .env.dev -- npx prisma generate", "prisma:generate:staging": "dotenv -e .env.staging -- npx prisma generate", "prisma:generate:production": "dotenv -e .env.production -- npx prisma generate", - "prisma:seed:dev": "dotenv -e .env.dev -- npx prisma db seed" + "prisma:seed:dev": "dotenv -e .env.dev -- npx prisma db seed", + "lint": "eslint ." }, "keywords": [], "author": "@solana_labs", @@ -63,18 +62,13 @@ "yup": "1.2.0" }, "devDependencies": { + "eslint-config-custom": "*", "@ngrok/ngrok": "^0.5.2", "@types/aws-lambda": "^8.10.101", "@types/jest": "^29.5.1", - "@types/node": "^20.4.1", "@types/winston": "^2.4.4", - "@typescript-eslint/eslint-plugin": "^5.59.1", - "@typescript-eslint/parser": "^5.59.1", "axios-mock-adapter": "^1.21.4", "dotenv-cli": "^7.2.1", - "esbuild": "^0.17.18", - "eslint": "^8.39.0", - "eslint-plugin-require-extensions": "^0.1.3", "jest": "^29.5.0", "jest-mock-extended": "2.0.4", "rimraf": "^5.0.1", diff --git a/apps/backend-serverless/tsconfig.tests.json b/apps/backend-serverless/tsconfig.tests.json index a93834b1..5bab8e2e 100644 --- a/apps/backend-serverless/tsconfig.tests.json +++ b/apps/backend-serverless/tsconfig.tests.json @@ -5,4 +5,4 @@ "jsx": "react" }, "moduleResolution": "node" -} \ No newline at end of file +} diff --git a/apps/docs/.eslintrc.js b/apps/docs/.eslintrc.js new file mode 100755 index 00000000..1e750924 --- /dev/null +++ b/apps/docs/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['custom'], +}; diff --git a/apps/docs/package.json b/apps/docs/package.json index 5753ecd1..70174f06 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,6 +1,6 @@ { - "name": "docs", - "version": "0.0.0", + "name": "shopify-docs", + "version": "1.0.0", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -22,11 +22,11 @@ "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5", "react": "^18.2.0", - "react-dom": "^18.2.0", - "eslint-config-custom": "*" + "react-dom": "^18.2.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "2.4.1" + "@docusaurus/module-type-aliases": "2.4.1", + "eslint-config-custom": "*" }, "browserslist": { "production": [ diff --git a/apps/merchant-ui/.eslintrc.js b/apps/merchant-ui/.eslintrc.js new file mode 100755 index 00000000..1e750924 --- /dev/null +++ b/apps/merchant-ui/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['custom'], +}; diff --git a/apps/merchant-ui/.eslintrc.json b/apps/merchant-ui/.eslintrc.json deleted file mode 100755 index bffb357a..00000000 --- a/apps/merchant-ui/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/apps/merchant-ui/next.config.js b/apps/merchant-ui/next.config.js index a843cbee..91ef62f0 100755 --- a/apps/merchant-ui/next.config.js +++ b/apps/merchant-ui/next.config.js @@ -1,6 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, -} +}; -module.exports = nextConfig +module.exports = nextConfig; diff --git a/apps/merchant-ui/package.json b/apps/merchant-ui/package.json index 7c137ced..f8d7492a 100755 --- a/apps/merchant-ui/package.json +++ b/apps/merchant-ui/package.json @@ -1,12 +1,12 @@ { "name": "merchant-ui", - "version": "0.1.0", + "version": "1.0.0", "private": true, "scripts": { "dev": "NODE_ENV=development next dev -p 3005", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "eslint ." }, "dependencies": { "@carbon/icons-react": "^11.20.0", @@ -51,11 +51,11 @@ "@types/node": "^18.16.1", "@types/react": "^18.2.6", "autoprefixer": "^10.4.13", - "eslint": "^8.40.0", "postcss": "^8.4.21", "prisma": "^4.13.0", "tailwindcss": "^3.2.7", "ts-node": "^10.9.1", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "eslint-config-custom": "*" } } diff --git a/apps/merchant-ui/postcss.config.js b/apps/merchant-ui/postcss.config.js index 33ad091d..67cdf1a5 100755 --- a/apps/merchant-ui/postcss.config.js +++ b/apps/merchant-ui/postcss.config.js @@ -1,6 +1,6 @@ module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/apps/merchant-ui/tsconfig.json b/apps/merchant-ui/tsconfig.json index 58dcccea..2680fccd 100755 --- a/apps/merchant-ui/tsconfig.json +++ b/apps/merchant-ui/tsconfig.json @@ -1,37 +1,24 @@ { - "compilerOptions": { - "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "baseUrl": ".", - "paths": { - "@/*": [ - "./src/*" - ] - } - }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "**/*.svg" - ], - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.svg"], + "exclude": ["node_modules"] } diff --git a/apps/mock-shopify-serverless/.eslintrc b/apps/mock-shopify-serverless/.eslintrc deleted file mode 100644 index ce8a3295..00000000 --- a/apps/mock-shopify-serverless/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "root": true, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:require-extensions/recommended" - ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "require-extensions" - ], - "settings": { - }, - "rules": { - }, - "overrides": [ - ] -} diff --git a/apps/mock-shopify-serverless/.eslintrc.cjs b/apps/mock-shopify-serverless/.eslintrc.cjs new file mode 100644 index 00000000..1e750924 --- /dev/null +++ b/apps/mock-shopify-serverless/.eslintrc.cjs @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['custom'], +}; diff --git a/apps/mock-shopify-serverless/package.json b/apps/mock-shopify-serverless/package.json index 08266c40..ee6cdc19 100644 --- a/apps/mock-shopify-serverless/package.json +++ b/apps/mock-shopify-serverless/package.json @@ -1,6 +1,6 @@ { "name": "mock-shopify-serverless", - "version": "0.1.0", + "version": "1.0.0", "private": true, "description": "", "main": "handler.js", @@ -12,8 +12,7 @@ "type": "module", "scripts": { "dev": "NODE_ENV=development serverless offline start --stage dev", - "lint": "eslint .", - "lint:fix": "eslint --fix ." + "lint": "eslint ." }, "keywords": [], "author": "@solana_labs", @@ -27,12 +26,9 @@ "devDependencies": { "@types/aws-lambda": "^8.10.101", "@types/crypto-js": "4.1.1", - "@typescript-eslint/eslint-plugin": "^5.59.1", - "@typescript-eslint/parser": "^5.59.1", "esbuild": "^0.17.18", - "eslint": "^8.39.0", - "eslint-plugin-require-extensions": "^0.1.3", "serverless": "^3.21.0", + "eslint-config-custom": "*", "serverless-esbuild": "^1.43.1", "serverless-offline": "^12.0.4", "serverless-plugin-common-excludes": "^4.0.0", diff --git a/apps/mock-shopify-serverless/serverless.yml b/apps/mock-shopify-serverless/serverless.yml index 188120cc..e31fbc16 100644 --- a/apps/mock-shopify-serverless/serverless.yml +++ b/apps/mock-shopify-serverless/serverless.yml @@ -53,4 +53,4 @@ custom: serverless-offline: httpPort: 4004 lambdaPort: 4005 - httpsProtocol: "dev-certs" + httpsProtocol: 'dev-certs' diff --git a/apps/mock-shopify-serverless/tsconfig.json b/apps/mock-shopify-serverless/tsconfig.json index 4e43eba5..768c2fd1 100644 --- a/apps/mock-shopify-serverless/tsconfig.json +++ b/apps/mock-shopify-serverless/tsconfig.json @@ -1,17 +1,17 @@ { "compilerOptions": { - "preserveConstEnums": true, - "strictNullChecks": true, - "module": "es2015", - "sourceMap": true, - "allowJs": false, - "target": "es5", - "outDir": ".build", - "moduleResolution": "nodenext", - "lib": ["es2015"], - "rootDir": "./", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "preserveConstEnums": true, + "strictNullChecks": true, + "module": "es2015", + "sourceMap": true, + "allowJs": false, + "target": "es5", + "outDir": ".build", + "moduleResolution": "nodenext", + "lib": ["es2015"], + "rootDir": "./", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true }, "include": ["src/**/*.ts", "src"], "exclude": ["node_modules"] diff --git a/apps/payment-ui/.eslintrc.js b/apps/payment-ui/.eslintrc.js new file mode 100755 index 00000000..1e750924 --- /dev/null +++ b/apps/payment-ui/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['custom'], +}; diff --git a/apps/payment-ui/.eslintrc.json b/apps/payment-ui/.eslintrc.json deleted file mode 100755 index bffb357a..00000000 --- a/apps/payment-ui/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/apps/payment-ui/.sample.env b/apps/payment-ui/.sample.env index 4e324aec..a38db361 100644 --- a/apps/payment-ui/.sample.env +++ b/apps/payment-ui/.sample.env @@ -1,2 +1,3 @@ NEXT_PUBLIC_BACKEND_URL=apiurl.com -NEXT_PUBLIC_WEBSOCKET_URL=websocketurl.com \ No newline at end of file +NEXT_PUBLIC_WEBSOCKET_URL=websocketurl.com +NODE_ENV="development" \ No newline at end of file diff --git a/apps/payment-ui/next.config.js b/apps/payment-ui/next.config.js index bcb0f5a9..7313c7b8 100755 --- a/apps/payment-ui/next.config.js +++ b/apps/payment-ui/next.config.js @@ -1,13 +1,13 @@ // next.config.js const nextConfig = { - reactStrictMode: false, - exportPathMap: function () { - return { - '/': { page: '/' }, - '/404': { page: '/404' }, - '/500': { page: '/500' }, - }; - }, + reactStrictMode: false, + exportPathMap: function () { + return { + '/': { page: '/' }, + '/404': { page: '/404' }, + '/500': { page: '/500' }, + }; + }, }; -module.exports = nextConfig; \ No newline at end of file +module.exports = nextConfig; diff --git a/apps/payment-ui/package.json b/apps/payment-ui/package.json index b2bc3979..024296ec 100755 --- a/apps/payment-ui/package.json +++ b/apps/payment-ui/package.json @@ -1,13 +1,13 @@ { "name": "payment-ui", - "version": "0.1.0", + "version": "1.0.0", "private": true, "scripts": { "dev": "next dev -p 3001", "dev:local": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "eslint ." }, "dependencies": { "@carbon/icons-react": "^11.20.0", @@ -22,8 +22,6 @@ "@types/node": "18.15.3", "axios": "^1.3.4", "daisyui": "^3.0.2", - "eslint": "8.36.0", - "eslint-config-next": "13.2.4", "next": "latest", "react": "^18.2.0", "react-dom": "latest", @@ -37,6 +35,7 @@ "devDependencies": { "autoprefixer": "^10.4.14", "postcss": "^8.4.21", - "tailwindcss": "^3.2.7" + "tailwindcss": "^3.2.7", + "eslint-config-custom": "*" } } diff --git a/apps/payment-ui/postcss.config.js b/apps/payment-ui/postcss.config.js index 33ad091d..67cdf1a5 100755 --- a/apps/payment-ui/postcss.config.js +++ b/apps/payment-ui/postcss.config.js @@ -1,6 +1,6 @@ module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/apps/payment-ui/tailwind.config.js b/apps/payment-ui/tailwind.config.js index 35d539b6..2b85b482 100755 --- a/apps/payment-ui/tailwind.config.js +++ b/apps/payment-ui/tailwind.config.js @@ -1,30 +1,30 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: [ - "./app/**/*.{js,ts,jsx,tsx}", - "./pages/**/*.{js,ts,jsx,tsx}", - "./components/**/*.{js,ts,jsx,tsx}", - - // Or if using `src` directory: - "./src/**/*.{js,ts,jsx,tsx}", - ], - theme: { - extend: {}, - }, - plugins: [require("daisyui")], - daisyui: { - themes: [ - { - mytheme: { - primary: "#FFFFFF", - secondary: "#f6d860", - accent: "#37cdbe", - neutral: "#3d4451", - "base-100": "#ffffff", - }, - }, - "dark", - "cupcake", + content: [ + './app/**/*.{js,ts,jsx,tsx}', + './pages/**/*.{js,ts,jsx,tsx}', + './components/**/*.{js,ts,jsx,tsx}', + + // Or if using `src` directory: + './src/**/*.{js,ts,jsx,tsx}', ], - }, -} + theme: { + extend: {}, + }, + plugins: [require('daisyui')], + daisyui: { + themes: [ + { + mytheme: { + primary: '#FFFFFF', + secondary: '#f6d860', + accent: '#37cdbe', + neutral: '#3d4451', + 'base-100': '#ffffff', + }, + }, + 'dark', + 'cupcake', + ], + }, +}; diff --git a/apps/payment-ui/tsconfig.json b/apps/payment-ui/tsconfig.json index 61c19abd..e0c8da51 100755 --- a/apps/payment-ui/tsconfig.json +++ b/apps/payment-ui/tsconfig.json @@ -1,23 +1,23 @@ { - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "paths": { - "@/*": ["./src/*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] } diff --git a/apps/transaction-request-serverless/.eslintrc b/apps/transaction-request-serverless/.eslintrc deleted file mode 100644 index ce8a3295..00000000 --- a/apps/transaction-request-serverless/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "root": true, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:require-extensions/recommended" - ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "require-extensions" - ], - "settings": { - }, - "rules": { - }, - "overrides": [ - ] -} diff --git a/apps/transaction-request-serverless/.eslintrc.cjs b/apps/transaction-request-serverless/.eslintrc.cjs new file mode 100644 index 00000000..1e750924 --- /dev/null +++ b/apps/transaction-request-serverless/.eslintrc.cjs @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ['custom'], +}; diff --git a/apps/transaction-request-serverless/index.js b/apps/transaction-request-serverless/index.js index 9aa78b44..ade5e9fd 100644 --- a/apps/transaction-request-serverless/index.js +++ b/apps/transaction-request-serverless/index.js @@ -1,13 +1,13 @@ -module.exports.handler = async (event) => { - return { - statusCode: 200, - body: JSON.stringify( - { - message: "Go Serverless v3.0! Your function executed successfully!", - input: event, - }, - null, - 2 - ), - }; +module.exports.handler = async event => { + return { + statusCode: 200, + body: JSON.stringify( + { + message: 'Go Serverless v3.0! Your function executed successfully!', + input: event, + }, + null, + 2, + ), + }; }; diff --git a/apps/transaction-request-serverless/jest.config.cjs b/apps/transaction-request-serverless/jest.config.cjs index 2c0ba96e..a52d3f23 100644 --- a/apps/transaction-request-serverless/jest.config.cjs +++ b/apps/transaction-request-serverless/jest.config.cjs @@ -1,14 +1,14 @@ // jest.config.cjs module.exports = { - roots: ["/__tests__"], + roots: ['/__tests__'], transform: { - "^.+\\.tsx?$": ["ts-jest", { tsconfig: "./tsconfig.tests.json" }], + '^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.tests.json' }], }, - testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$", + testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1', - }, - moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], + '^(\\.{1,2}/.*)\\.js$': '$1', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], testEnvironment: 'node', testTimeout: 60000, - }; \ No newline at end of file +}; diff --git a/apps/transaction-request-serverless/package.json b/apps/transaction-request-serverless/package.json index b9532fd9..b65ae62e 100755 --- a/apps/transaction-request-serverless/package.json +++ b/apps/transaction-request-serverless/package.json @@ -1,6 +1,6 @@ { "name": "transaction-request-serverless", - "version": "0.1.0", + "version": "1.0.0", "description": "", "private": true, "main": "handler.js", @@ -12,10 +12,9 @@ "type": "module", "scripts": { "dev": "NODE_ENV=development sls offline", - "lint": "eslint .", - "lint:fix": "eslint --fix .", "test": "jest", "test:integration": "jest integration", + "lint": "eslint .", "offline": "NODE_ENV=development serverless offline start --stage dev", "deploy:production": "serverless deploy --stage production --config serverless.yml", "deploy:staging": "serverless deploy --stage staging --config serverless.yml" @@ -35,11 +34,7 @@ "devDependencies": { "@types/aws-lambda": "^8.10.101", "@types/jest": "^29.5.1", - "@typescript-eslint/eslint-plugin": "^5.59.1", - "@typescript-eslint/parser": "^5.59.1", "esbuild": "^0.17.18", - "eslint": "^8.39.0", - "eslint-plugin-require-extensions": "^0.1.3", "jest": "^29.5.0", "jest-mock-extended": "2.0.4", "serverless": "^3.21.0", @@ -49,6 +44,7 @@ "serverless-plugin-include-dependencies": "^5.1.0", "serverless-plugin-typescript": "2.1.4", "ts-jest": "^29.1.0", - "typescript": "^4.7.4" + "typescript": "^4.7.4", + "eslint-config-custom": "*" } } diff --git a/apps/transaction-request-serverless/tsconfig.json b/apps/transaction-request-serverless/tsconfig.json index 67c7552d..768c2fd1 100644 --- a/apps/transaction-request-serverless/tsconfig.json +++ b/apps/transaction-request-serverless/tsconfig.json @@ -1,18 +1,18 @@ { "compilerOptions": { - "preserveConstEnums": true, - "strictNullChecks": true, - "module": "es2015", - "sourceMap": true, - "allowJs": false, - "target": "es5", - "outDir": ".build", - "moduleResolution": "nodenext", - "lib": ["es2015"], - "rootDir": "./", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true + "preserveConstEnums": true, + "strictNullChecks": true, + "module": "es2015", + "sourceMap": true, + "allowJs": false, + "target": "es5", + "outDir": ".build", + "moduleResolution": "nodenext", + "lib": ["es2015"], + "rootDir": "./", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true }, "include": ["src/**/*.ts", "src"], "exclude": ["node_modules"] - } +} diff --git a/apps/transaction-request-serverless/tsconfig.tests.json b/apps/transaction-request-serverless/tsconfig.tests.json index a93834b1..5bab8e2e 100644 --- a/apps/transaction-request-serverless/tsconfig.tests.json +++ b/apps/transaction-request-serverless/tsconfig.tests.json @@ -5,4 +5,4 @@ "jsx": "react" }, "moduleResolution": "node" -} \ No newline at end of file +} diff --git a/package.json b/package.json index ccf6489e..ba22d7cf 100755 --- a/package.json +++ b/package.json @@ -1,42 +1,36 @@ { "name": "solana-payments-app", - "version": "0.0.0", + "version": "1.0.0", "private": true, + "engines": { + "node": ">=14.0.0" + }, + "packageManager": "yarn@1.22.17", "workspaces": [ "apps/payment-ui", "apps/merchant-ui", "apps/backend-serverless", "apps/transaction-request-serverless", - "apps/mock-shopify-serverless" + "apps/mock-shopify-serverless", + "apps/docs" ], "scripts": { "build": "turbo run build", "dev": "docker-compose up & turbo run dev", "lint": "turbo run lint", - "format": "prettier --write \"**/*.{ts,tsx,md}\"" - }, - "devDependencies": { - "@solana/eslint-config-solana": "^1.0.1", - "@solana/prettier-config-solana": "^0.0.2", - "@typescript-eslint/eslint-plugin": "^5.57.1", - "@typescript-eslint/parser": "^5.57.1", - "eslint": "^8.37.0", - "eslint-config-custom": "*", - "eslint-plugin-jest": "^27.2.1", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-sort-keys-fix": "^1.1.2", - "prettier": "^2.8.7", - "turbo": "latest" - }, - "engines": { - "node": ">=14.0.0" + "lint:fix": "turbo run lint:fix", + "format": "prettier --write \"**/*.{ts,tsx,md,js,jsx,mdx}\"" }, "dependencies": { "@shopify/app": "^3.47.5", "@shopify/cli": "^3.47.5", "typescript": "^5.0.3" }, - "packageManager": "yarn@1.22.17", + "devDependencies": { + "eslint-config-custom": "*", + "prettier": "latest", + "turbo": "latest", + "@solana/prettier-config-solana": "^0.0.2" + }, "prettier": "@solana/prettier-config-solana" } diff --git a/packages/eslint-config-custom/index.js b/packages/eslint-config-custom/index.js new file mode 100644 index 00000000..6d2edb80 --- /dev/null +++ b/packages/eslint-config-custom/index.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['next', 'turbo', 'prettier'], + rules: { + '@next/next/no-html-link-for-pages': 'off', + }, +}; diff --git a/packages/eslint-config-custom/package.json b/packages/eslint-config-custom/package.json new file mode 100644 index 00000000..834ec66e --- /dev/null +++ b/packages/eslint-config-custom/package.json @@ -0,0 +1,21 @@ +{ + "name": "eslint-config-custom", + "main": "index.js", + "version": "1.0.0", + "dependencies": { + "eslint": "latest", + "eslint-config-next": "latest", + "eslint-config-prettier": "latest", + "eslint-plugin-react": "latest", + "eslint-config-turbo": "latest", + "eslint-plugin-require-extensions": "latest", + "eslint-plugin-jest": "latest", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-simple-import-sort": "^10.0.0", + "eslint-plugin-sort-keys-fix": "^1.1.2", + "eslint-plugin-jsonc": "latest", + "@solana/eslint-config-solana": "latest", + "@typescript-eslint/parser": "latest", + "@typescript-eslint/eslint-plugin": "latest" + } +} diff --git a/turbo.json b/turbo.json index 426d5e45..d79dd9a2 100755 --- a/turbo.json +++ b/turbo.json @@ -1,31 +1,24 @@ { - "$schema": "https://turbo.build/schema.json", - "globalDependencies": [ - "**/.env.*local" - ], - "pipeline": { - "build:payment-ui": { - "outputs": [ - "./apps/payment-ui/.next/**" - ] - }, - "build:merchant-ui": { - "outputs": [ - "./apps/merchant-ui/.next/**" - ] - }, - "build": { - "dependsOn": [ - "build:payment-ui", - "build:merchant-ui" - ], - "outputs": [] - }, - "lint": { - "outputs": [] - }, - "dev": { - "cache": false + "$schema": "https://turbo.build/schema.json", + "globalDependencies": ["**/.env.*local"], + "pipeline": { + "build:payment-ui": { + "env": ["NEXT_PUBLIC_BACKEND_URL", "NEXT_PUBLIC_WEBSOCKET_URL", "NODE_ENV"], + "outputs": ["./apps/payment-ui/.next/**"] + }, + "build:merchant-ui": { + "env": ["NODE_ENV", "NEXT_PUBLIC_API_BASE_URL"], + "outputs": ["./apps/merchant-ui/.next/**"] + }, + "build": { + "dependsOn": ["build:payment-ui", "build:merchant-ui"], + "outputs": [] + }, + "lint": { + "outputs": [] + }, + "dev": { + "cache": false + } } - } -} \ No newline at end of file +} From 38214a9b4c00c2bed92bbc32e7c4687c3c1dd6a2 Mon Sep 17 00:00:00 2001 From: Harsha Somisetty Date: Sun, 16 Jul 2023 00:39:53 -0400 Subject: [PATCH 02/42] Formatting changes (#424) * some formatting bugs * mvoe env stuff and bugs --- .../src/components/Merchant404.tsx | 2 +- apps/merchant-ui/src/components/Refunds.tsx | 4 +- apps/merchant-ui/src/pages/404.tsx | 2 +- .../src/components/PaymentLoadingView.tsx | 12 +++--- .../src/components/PaymentMethodTab.tsx | 11 ++--- apps/payment-ui/src/components/ThankYou.tsx | 20 ++++++--- .../src/components/WalletCopyButton.tsx | 29 ++++++------- .../src/components/WalletDisconnectButton.tsx | 43 ++++++++++--------- .../src/components/handlers/RouterHandler.tsx | 10 ++--- 9 files changed, 66 insertions(+), 67 deletions(-) diff --git a/apps/merchant-ui/src/components/Merchant404.tsx b/apps/merchant-ui/src/components/Merchant404.tsx index 03928015..1a303ae9 100644 --- a/apps/merchant-ui/src/components/Merchant404.tsx +++ b/apps/merchant-ui/src/components/Merchant404.tsx @@ -13,7 +13,7 @@ export default function Merchant404() {
-

We can't find that merchant

+

We can't find that merchant

Router.push('/')} className="w-max"> Sign In diff --git a/apps/merchant-ui/src/components/Refunds.tsx b/apps/merchant-ui/src/components/Refunds.tsx index eac71fa5..46a95edf 100644 --- a/apps/merchant-ui/src/components/Refunds.tsx +++ b/apps/merchant-ui/src/components/Refunds.tsx @@ -29,7 +29,7 @@ export function Refunds(props: Props) {
- In order to process a refund, you'll need a self-custodial wallet + In order to process a refund, you'll need a self-custodial wallet
@@ -37,7 +37,7 @@ export function Refunds(props: Props) {
• Refunds cannot be processed with a Coinbase account
- What's a self-custodial wallet? + What's a self-custodial wallet?
); - - }; diff --git a/apps/payment-ui/src/components/WalletDisconnectButton.tsx b/apps/payment-ui/src/components/WalletDisconnectButton.tsx index 6a5a2c82..68c7fc1f 100644 --- a/apps/payment-ui/src/components/WalletDisconnectButton.tsx +++ b/apps/payment-ui/src/components/WalletDisconnectButton.tsx @@ -1,32 +1,32 @@ +import { setWalletDisconnected } from '@/features/wallet/walletSlice'; +import { AppDispatch } from '@/store'; import { useWallet } from '@solana/wallet-adapter-react'; -import type { FC, MouseEventHandler } from 'react'; -import React, { useCallback, useMemo } from 'react'; -import type { ButtonProps } from './Button'; -import { Button } from './Button'; -import { WalletIcon } from '@solana/wallet-adapter-react-ui'; import Image from 'next/image'; -import { AppDispatch } from '@/store'; +import type { FC, MouseEventHandler } from 'react'; +import { useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; -import { setWalletDisconnected } from '@/features/wallet/walletSlice'; -import { removeNotification } from '@/features/notification/notificationSlice'; +import type { ButtonProps } from './Button'; export const WalletDisconnectButton: FC = ({ children, disabled, onClick, ...props }) => { const dispatch = useDispatch(); const { wallet, disconnect, disconnecting } = useWallet(); const handleClick: MouseEventHandler = useCallback( - (event) => { + event => { if (onClick) { // onClick(event); // dispatch(removeNotification()) // dispatch(setWalletDisconnected()) } - // eslint-disable-next-line @typescript-eslint/no-empty-function - if (!event.defaultPrevented) disconnect().then(() => { - dispatch(setWalletDisconnected()) - }).catch(() => {}); + // eslint-disable-next-line + if (!event.defaultPrevented) + disconnect() + .then(() => { + dispatch(setWalletDisconnected()); + }) + .catch(() => {}); }, - [onClick, disconnect] + [onClick, disconnect], ); const content = useMemo(() => { @@ -37,15 +37,16 @@ export const WalletDisconnectButton: FC = ({ children, disabled, on }, [children, disconnecting, wallet]); return ( -
-
); - - }; diff --git a/apps/payment-ui/src/components/handlers/RouterHandler.tsx b/apps/payment-ui/src/components/handlers/RouterHandler.tsx index e7cf56fd..43992d3b 100644 --- a/apps/payment-ui/src/components/handlers/RouterHandler.tsx +++ b/apps/payment-ui/src/components/handlers/RouterHandler.tsx @@ -10,22 +10,22 @@ const RouterHandler: React.FC = () => { const dispatch = useDispatch(); const router = useRouter(); - if (!router.isReady) { - return null; - } - const paymentId = router.query.paymentId as string; const blockedString = router.query.blocked as string; const blocked = blockedString == 'true' ? true : false; useEffect(() => { + if (!router.isReady) { + return; + } + if (blocked) { dispatch(setGeoIsBlocked()); } dispatch(setPaymentId(paymentId)); dispatch(setWebsocketReadyToConnect()); - }, [dispatch]); + }, [router.isReady, blocked, paymentId, dispatch]); return null; }; From 3e37c123f73c002c4d44ec3c23cac8e044a96383 Mon Sep 17 00:00:00 2001 From: Harsha Somisetty Date: Sun, 16 Jul 2023 02:29:37 -0400 Subject: [PATCH 03/42] Cleaning files (#425) * prettier formatted all files * prettier removed imports --- .../__tests__/integration/wallet.test.ts | 2 +- .../install-query-params.model.test.ts | 4 +- .../redirect-query-params.model.test.ts | 2 +- ...transaction-request-response.model.test.ts | 4 +- .../database/merchant.service.test.ts | 6 +- .../database/payment-record.service.test.ts | 4 +- .../database/refund-record.service.test.ts | 4 +- .../transaction-record.service.test.ts | 6 +- .../retry-app-configure.service.test.ts | 8 +- .../retry-payment-reject.service.test.ts | 10 +- .../retry-payment-resolve.service.test.ts | 8 +- .../retry-refund-reject.service.test.ts | 10 +- .../retry-refund-resolve.service.test.ts | 15 +- .../payment-app-configure.service.test.ts | 2 +- .../payment-session-resolve.service.test.ts | 2 +- .../payment-sesson-reject.service.test.ts | 8 +- .../refund-session-reject.service.test.ts | 2 +- .../sqs/sqs-send-message.service.test.ts | 4 +- ...rt-execution-shopify-retry.service.test.ts | 2 +- .../fetch-payment-transaction.service.test.ts | 8 +- ...overed-payment-transaction.service.test.ts | 18 +- ...covered-refund-transaction.service.test.ts | 4 +- .../shopify/stringify-params.utility.test.ts | 2 +- .../transaction-inspection.utility.test.ts | 2 +- apps/backend-serverless/prisma-singleton.ts | 2 +- apps/backend-serverless/scripts/reporting.js | 4 +- .../src/configs/tokens.config.ts | 2 +- .../merchant-ui/read-data/merchant-data.ts | 2 +- .../merchant-ui/read-data/payment-data.ts | 4 +- .../merchant-ui/read-data/refund-data.ts | 4 +- .../merchant-ui/read-data/refund-status.ts | 2 +- .../merchant-ui/write-data/reject-refund.ts | 6 +- .../merchant-ui/write-data/update-merchant.ts | 4 +- .../handlers/clients/payment-ui/balance.ts | 2 +- .../clients/payment-ui/payment-status.ts | 4 +- .../src/handlers/shopify-handlers/install.ts | 2 +- .../src/handlers/shopify-handlers/logout.ts | 2 +- .../src/handlers/shopify-handlers/payment.ts | 8 +- .../src/handlers/shopify-handlers/redirect.ts | 2 +- .../src/handlers/shopify-handlers/refund.ts | 6 +- .../src/handlers/testing/error.ts | 2 +- .../src/handlers/testing/queue.ts | 2 +- .../transactions/payment-transaction.ts | 10 +- .../transactions/refund-transaction.ts | 10 +- .../src/handlers/webhooks/cron.ts | 4 +- .../webhooks/gdpr/customers-data-request.ts | 4 +- .../webhooks/gdpr/customers-redact.ts | 2 +- .../src/handlers/webhooks/gdpr/shop-redact.ts | 2 +- .../src/handlers/webhooks/helius.ts | 6 +- .../src/handlers/webhooks/retry.ts | 4 +- .../webhooks/s3/safety-key-uploaded.ts | 2 +- .../sqs/process-transaction-message.ts | 4 +- .../webhooks/sqs/solana-pay-info-message.ts | 4 +- .../webhooks/sqs/sqs-message-receive.ts | 2 +- .../step-functions/safety-key-sweep.ts | 2 +- .../src/handlers/websockets/connect.ts | 2 +- .../src/handlers/websockets/disconnect.ts | 2 +- .../merchant-ui/merchant-auth-token.model.ts | 2 +- .../payment-address-request.model.ts | 4 +- .../merchant-ui/payment-data-request.model.ts | 4 +- .../merchant-ui/refund-data-request.model.ts | 4 +- .../refund-status-request.model.ts | 2 +- .../reject-refund-request.model.ts | 2 +- .../balance-request-parameters.model.ts | 2 +- .../payment-status-request.model.ts | 2 +- .../dependencies/get-account-info.model.ts | 2 +- .../dependencies/helius-balance.model.ts | 2 +- .../helius-enhanced-transaction.model.ts | 4 +- .../dependencies/helius-header.model.ts | 2 +- .../trm-wallet-screen-response.model.ts | 2 +- .../admin-data.response.model.ts | 2 +- .../payment-app-configure-response.model.ts | 4 +- .../reject-payment-response.model.ts | 2 +- .../reject-refund-response.model.ts | 2 +- .../resolve-payment-response.model.ts | 2 +- .../resolve-refund-response.model.ts | 2 +- .../shopify-graphql-responses/shared.model.ts | 2 +- .../shopify/access-token-response.model.ts | 2 +- .../shopify/install-query-params.model.ts | 2 +- .../shopify/process-payment-request.model.ts | 4 +- .../shopify/process-refund.request.model.ts | 4 +- .../shopify/redirect-query-params.model.ts | 2 +- .../shopify/shop-redact-request.model.ts | 2 +- .../shopify/shopify-request-headers.model.ts | 2 +- .../shopify/shopify-webhook-headers.model.ts | 2 +- .../sqs/process-transaction-message.model.ts | 4 +- .../sqs/shopify-mutation-retry.model.ts | 2 +- .../sqs/solana-pay-info-message.model.ts | 2 +- .../step-functions/safety-key-sweep.model.ts | 2 +- .../payment-request-parameters.model.ts | 2 +- .../refund-transaction-request.model.ts | 4 +- .../transaction-request-body.model.ts | 2 +- .../transaction-request-response.model.ts | 4 +- .../src/models/websockets/connect.model.ts | 2 +- ...ontigently-handle-app-configure.service.ts | 4 +- .../process-transaction.service.ts | 2 +- .../src/services/coin-gecko.service.ts | 2 +- .../database/gdpr-service.database.service.ts | 2 +- .../merchant-service.database.service.ts | 10 +- ...payment-record-service.database.service.ts | 30 +- .../record-service.database.service.ts | 2 +- .../refund-record-service.database.service.ts | 36 +-- ...saction-record-service.database.service.ts | 2 +- .../database/websocket.database.service.ts | 4 +- .../services/fetch-access-token.service.ts | 2 +- .../src/services/fetch-transaction.service.ts | 2 +- .../src/services/helius.service.ts | 2 +- .../retry-app-configure.service.ts | 4 +- .../retry-payment-reject.service.ts | 4 +- .../retry-payment-resolve.service.ts | 4 +- .../retry-refund-reject.service.ts | 4 +- .../retry-refund-resolve.service.ts | 2 +- .../shopify/payment-app-configure.service.ts | 2 +- .../shopify/payment-session-reject.service.ts | 6 +- .../payment-session-resolve.service.ts | 2 +- .../shopify/refund-session-reject.service.ts | 4 +- .../shopify/refund-session-resolve.service.ts | 2 +- ...validate-payment-app-configured.service.ts | 6 +- ...lidate-payment-session-rejected.service.ts | 6 +- ...lidate-payment-session-resolved.service.ts | 8 +- ...alidate-refund-session-rejected.service.ts | 6 +- ...alidate-refund-session-resolved.service.ts | 6 +- .../services/sqs/sqs-send-message.service.ts | 12 +- .../start-execution-safety-sweep.service.ts | 4 +- .../start-execution-shopify-retry.service.ts | 6 +- .../fetch-payment-transaction.service.ts | 4 +- .../fetch-refund-transaction.service.ts | 4 +- ...-discovered-payment-transaction.service.ts | 4 +- .../src/services/trm-service.service.ts | 2 +- .../send-websocket-message.service.ts | 2 +- .../merchant-ui/create-general-response.ts | 2 +- .../create-payment-response.utility.ts | 8 +- .../create-refund-response.utility.ts | 6 +- .../merchant-ui/refund-record.utility.ts | 2 +- .../create-payment-status-response.utility.ts | 2 +- .../generate-single-use-keypair.utility.ts | 2 +- .../src/utilities/persona/get-kyb-state.ts | 2 +- .../src/utilities/pubkeys.utility.ts | 6 +- .../responses/request-response.utility.ts | 4 +- .../common-model-test.utility.ts | 12 +- .../testing-helper/create-mock.utility.ts | 16 +- .../transaction-inspection.utility.ts | 4 +- .../transaction-request/endpoints.utility.ts | 2 +- .../src/utilities/transaction.utility.ts | 2 +- apps/merchant-ui/README.md | 3 +- apps/merchant-ui/next.config.js | 2 +- apps/merchant-ui/src/AcceptModals.tsx | 4 +- .../src/components/AddressInput.tsx | 4 +- .../src/components/Button/Primary.tsx | 4 +- .../src/components/Button/Secondary.tsx | 4 +- .../src/components/ClosedRefunds.tsx | 4 +- .../components/CompleteAccountSetupPrompt.tsx | 4 +- .../src/components/DefaultLayout.tsx | 4 +- .../components/DefaultLayoutNavigation.tsx | 4 +- .../DefaultLayoutNavigationExternalLink.tsx | 2 +- .../DefaultLayoutNavigationLink.tsx | 6 +- apps/merchant-ui/src/components/FAQ.tsx | 4 +- .../components/FinishAccountSetupPrompt.tsx | 2 +- .../FinishAccountSetupPromptListItem.tsx | 4 +- .../components/GettingStartedAddWallet.tsx | 4 +- .../src/components/ImageUpload.tsx | 2 +- apps/merchant-ui/src/components/Input.tsx | 2 +- apps/merchant-ui/src/components/KYBButton.tsx | 2 +- .../src/components/LoadingDots.tsx | 2 +- .../src/components/OpenRefunds.tsx | 8 +- .../src/components/PaginatedTable.tsx | 22 +- .../components/PaginatedTableArrowButton.tsx | 2 +- .../PaginatedTablePageIndicatorButton.tsx | 2 +- .../src/components/PaymentsHistoryStatus.tsx | 2 +- .../src/components/PlaceholderLogo.tsx | 2 +- .../src/components/RefundCount.tsx | 2 +- .../src/components/ShopifySignIn.tsx | 2 +- .../src/components/StoreStatusBadge.tsx | 4 +- apps/merchant-ui/src/components/Tabs.tsx | 6 +- .../src/components/TokenSelect.tsx | 6 +- .../src/components/icons/UsdcIconCircle.tsx | 48 ++- apps/merchant-ui/src/components/ui/input.tsx | 2 +- apps/merchant-ui/src/components/ui/toast.tsx | 8 +- .../src/components/ui/use-toast.ts | 296 +++++++++--------- apps/merchant-ui/src/hooks/useMockPayments.ts | 2 +- apps/merchant-ui/src/hooks/useMockRefunds.ts | 2 +- apps/merchant-ui/src/lib/Result.ts | 6 +- apps/merchant-ui/src/lib/utils.ts | 8 +- apps/merchant-ui/src/pages/_app.tsx | 2 +- .../src/handlers/access-token.ts | 2 +- .../src/handlers/payment-app.ts | 3 +- .../src/handlers/payment.ts | 3 +- .../src/models/authorize.models.ts | 4 +- apps/payment-ui/src/components/Button.tsx | 3 +- apps/payment-ui/src/components/BuyButton.tsx | 6 +- .../components/CancelTransactionButton.tsx | 30 +- .../src/components/CartAmountDisplay.tsx | 10 +- .../src/components/DisplaySection.tsx | 4 +- .../payment-ui/src/components/ErrorGoBack.tsx | 47 +-- apps/payment-ui/src/components/ErrorView.tsx | 63 ++-- apps/payment-ui/src/components/FeeDisplay.tsx | 22 +- .../src/components/FooterSection.tsx | 51 +-- .../src/components/GeoBlockedView.tsx | 13 +- .../payment-ui/src/components/MainSection.tsx | 16 +- .../src/components/PayAmountDisplay.tsx | 15 +- .../src/components/PayAmountTokensDisplay.tsx | 14 +- .../src/components/PayToDisplay.tsx | 15 +- apps/payment-ui/src/components/PayToLabel.tsx | 74 +++-- .../src/components/PayWithQRCodeSection.tsx | 2 - .../src/components/PayWithWalletSection.tsx | 4 - .../src/components/PaymentTokenSelector.tsx | 4 +- .../payment-ui/src/components/PaymentView.tsx | 37 +-- .../src/components/SimpleNotificationView.tsx | 33 +- .../src/components/SolanaPayErrorView.tsx | 53 ++-- .../src/components/SolanaPayQRCode.tsx | 2 +- .../components/TransactionFeeDetailModal.tsx | 26 +- apps/payment-ui/src/components/Wallet.tsx | 2 +- .../src/components/WalletButton.tsx | 66 ++-- .../src/components/WalletMultiButton.tsx | 7 +- .../src/components/WalletSection.tsx | 88 +++--- .../components/handlers/BalanceHandler.tsx | 30 +- .../components/handlers/CompletingHandler.tsx | 11 +- .../src/components/handlers/FinishHandler.tsx | 4 +- .../handlers/SetPaymentMethodHandler.tsx | 12 +- .../components/handlers/WebsocketHandler.tsx | 6 +- .../src/components/handlers/WindowHandler.tsx | 5 +- .../src/features/mobile/mobileSlice.ts | 1 - .../payment-details/paymentDetailsSlice.ts | 4 +- .../payment-options/paymentOptionsSlice.ts | 2 +- .../src/features/wallet/walletSlice.ts | 2 +- apps/payment-ui/src/pages/_document.tsx | 2 +- apps/payment-ui/src/pages/login.tsx | 10 +- apps/payment-ui/src/pages/secret-page.tsx | 10 +- apps/payment-ui/src/store.ts | 10 +- .../__tests__/sample.test.ts | 10 +- .../payment-transaction-request.model.test.ts | 2 +- .../src/configs/pubkeys.config.ts | 2 +- .../src/configs/token-list.config.ts | 6 +- .../src/handlers/pay.ts | 4 +- .../payment-transaction-request.model.ts | 8 +- .../src/models/transaction-body.model.ts | 2 +- .../builders/create-account-ix.builder.ts | 4 +- .../builders/create-index-ix.builder.ts | 4 +- .../services/builders/transfer-ix.builder.ts | 10 +- .../src/services/swaps/jupiter.service.ts | 2 +- .../src/utilities/ata.utility.ts | 8 +- .../src/utils/ata.util.ts | 8 +- package.json | 5 +- 243 files changed, 1004 insertions(+), 1023 deletions(-) diff --git a/apps/backend-serverless/__tests__/integration/wallet.test.ts b/apps/backend-serverless/__tests__/integration/wallet.test.ts index 2d1d60cf..20464eaf 100644 --- a/apps/backend-serverless/__tests__/integration/wallet.test.ts +++ b/apps/backend-serverless/__tests__/integration/wallet.test.ts @@ -1,4 +1,4 @@ -import { getAccountInfo, getPubkeyType } from '../../src/services/helius.service.js'; +import { getPubkeyType } from '../../src/services/helius.service.js'; describe('Wallet', () => { it('should create a wallet', async () => { diff --git a/apps/backend-serverless/__tests__/unit/models/shopify/install-query-params.model.test.ts b/apps/backend-serverless/__tests__/unit/models/shopify/install-query-params.model.test.ts index 424a7676..b4c8baea 100644 --- a/apps/backend-serverless/__tests__/unit/models/shopify/install-query-params.model.test.ts +++ b/apps/backend-serverless/__tests__/unit/models/shopify/install-query-params.model.test.ts @@ -28,12 +28,12 @@ describe('Install Query Params Model', () => { runMissingFieldTests( parseAndValidateAppInstallQueryParms, validParams, - fields.filter(field => field !== 'hmac') + fields.filter(field => field !== 'hmac'), ); runInvalidFieldTypeTests(parseAndValidateAppInstallQueryParms, validParams, fields, wrongTypes); runEmptyFieldTests( parseAndValidateAppInstallQueryParms, validParams, - fields.filter(field => field !== 'hmac') + fields.filter(field => field !== 'hmac'), ); }); diff --git a/apps/backend-serverless/__tests__/unit/models/shopify/redirect-query-params.model.test.ts b/apps/backend-serverless/__tests__/unit/models/shopify/redirect-query-params.model.test.ts index 7337f3cf..d5d536b1 100644 --- a/apps/backend-serverless/__tests__/unit/models/shopify/redirect-query-params.model.test.ts +++ b/apps/backend-serverless/__tests__/unit/models/shopify/redirect-query-params.model.test.ts @@ -30,7 +30,7 @@ describe('unit testing redirect query parameters model', () => { runMissingFieldTests( parseAndValidateAppRedirectQueryParams, validParams, - fields.filter(field => field !== 'hmac') + fields.filter(field => field !== 'hmac'), ); runInvalidFieldTypeTests(parseAndValidateAppRedirectQueryParams, validParams, fields, wrongTypes); runEmptyFieldTests(parseAndValidateAppRedirectQueryParams, validParams, fields); diff --git a/apps/backend-serverless/__tests__/unit/models/transaction-requests/transaction-request-response.model.test.ts b/apps/backend-serverless/__tests__/unit/models/transaction-requests/transaction-request-response.model.test.ts index 7c543a01..af9af1ba 100644 --- a/apps/backend-serverless/__tests__/unit/models/transaction-requests/transaction-request-response.model.test.ts +++ b/apps/backend-serverless/__tests__/unit/models/transaction-requests/transaction-request-response.model.test.ts @@ -23,12 +23,12 @@ describe('unit testing the transation request response model', () => { runMissingFieldTests( parseAndValidateTransactionRequestResponse, validParams, - fields.filter(field => field !== 'message') + fields.filter(field => field !== 'message'), ); runInvalidFieldTypeTests(parseAndValidateTransactionRequestResponse, validParams, fields, wrongTypes); runEmptyFieldTests( parseAndValidateTransactionRequestResponse, validParams, - fields.filter(field => field !== 'message') + fields.filter(field => field !== 'message'), ); }); diff --git a/apps/backend-serverless/__tests__/unit/services/database/merchant.service.test.ts b/apps/backend-serverless/__tests__/unit/services/database/merchant.service.test.ts index 16817181..3a50c8c7 100644 --- a/apps/backend-serverless/__tests__/unit/services/database/merchant.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/database/merchant.service.test.ts @@ -1,5 +1,5 @@ -import { MerchantService } from '../../../../src/services/database/merchant-service.database.service.js'; import { prismaMock } from '../../../../prisma-singleton.js'; +import { MerchantService } from '../../../../src/services/database/merchant-service.database.service.js'; import { createMockMerchant } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; describe('Merchant Testing Suite', () => { let merchantService: MerchantService; @@ -41,7 +41,7 @@ describe('Merchant Testing Suite', () => { const merchant = await merchantService.createMerchant( 'abcd', 'mock-merchant-create.myshopify.com', - 'abcd-1234' + 'abcd-1234', ); expect(merchant).toEqual(mockMerchant); @@ -76,7 +76,7 @@ describe('Merchant Testing Suite', () => { await expect( merchantService.updateMerchant(mockMerchantThatDoesNotExist, { lastNonce: 'efgh-5678', - }) + }), ).rejects.toThrow(); }); }); diff --git a/apps/backend-serverless/__tests__/unit/services/database/payment-record.service.test.ts b/apps/backend-serverless/__tests__/unit/services/database/payment-record.service.test.ts index edcae98d..18e9ca86 100644 --- a/apps/backend-serverless/__tests__/unit/services/database/payment-record.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/database/payment-record.service.test.ts @@ -1,6 +1,6 @@ -import { PaymentRecordService } from '../../../../src/services/database/payment-record-service.database.service.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; import { PaymentRecordStatus } from '@prisma/client'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { PaymentRecordService } from '../../../../src/services/database/payment-record-service.database.service.js'; import { createMockPaymentRecord } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; describe('Payment Record Testing Suite', () => { diff --git a/apps/backend-serverless/__tests__/unit/services/database/refund-record.service.test.ts b/apps/backend-serverless/__tests__/unit/services/database/refund-record.service.test.ts index 9f8bd42f..8a620cad 100644 --- a/apps/backend-serverless/__tests__/unit/services/database/refund-record.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/database/refund-record.service.test.ts @@ -1,6 +1,6 @@ -import { RefundRecordService } from '../../../../src/services/database/refund-record-service.database.service.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; import { RefundRecordStatus } from '@prisma/client'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { RefundRecordService } from '../../../../src/services/database/refund-record-service.database.service.js'; describe('Refund Record Testing Suite', () => { let refundRecordService: RefundRecordService; diff --git a/apps/backend-serverless/__tests__/unit/services/database/transaction-record.service.test.ts b/apps/backend-serverless/__tests__/unit/services/database/transaction-record.service.test.ts index 265c0fc5..df538846 100644 --- a/apps/backend-serverless/__tests__/unit/services/database/transaction-record.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/database/transaction-record.service.test.ts @@ -1,6 +1,6 @@ -import { TransactionRecordService } from '../../../../src/services/database/transaction-record-service.database.service.js'; import { TransactionType } from '@prisma/client'; import { prismaMock } from '../../../../prisma-singleton.js'; +import { TransactionRecordService } from '../../../../src/services/database/transaction-record-service.database.service.js'; describe('Transaction Record Testing Suite', () => { let transactionRecordService: TransactionRecordService; @@ -44,7 +44,7 @@ describe('Transaction Record Testing Suite', () => { '1234', TransactionType.payment, 'abcd', - null + null, ); expect(transactionRecord).toEqual(mockTransactionRecord); @@ -66,7 +66,7 @@ describe('Transaction Record Testing Suite', () => { '1234', TransactionType.refund, null, - 'abcd' + 'abcd', ); expect(transactionRecord).toEqual(mockTransactionRecord); diff --git a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-app-configure.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-app-configure.service.test.ts index 3836a6e3..9b5dd007 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-app-configure.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-app-configure.service.test.ts @@ -1,13 +1,13 @@ -import { ShopifyMutationAppConfigure } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; -import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { ShopifyMutationAppConfigure } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { retryAppConfigure } from '../../../../src/services/shopify-retry/retry-app-configure.service.js'; import { createMockMerchant, createMockPaymentAppConfigureResponse, createMockPaymentRecord, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { retryAppConfigure } from '../../../../src/services/shopify-retry/retry-app-configure.service.js'; describe('Shopify Retry App Configure Testing Suite', () => { it('should execute successfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-reject.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-reject.service.test.ts index ddf83741..4e07e9f1 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-reject.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-reject.service.test.ts @@ -1,14 +1,14 @@ -import { ShopifyMutationPaymentReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; -import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; +import { ShopifyMutationPaymentReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { retryPaymentReject } from '../../../../src/services/shopify-retry/retry-payment-reject.service.js'; import { createMockMerchant, createMockPaymentRecord, createMockSuccessPaymentSessionRejectResponse, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { retryPaymentReject } from '../../../../src/services/shopify-retry/retry-payment-reject.service.js'; -import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; describe('Shopify Retry Payment Reject Testing Suite', () => { it('should execute successfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-resolve.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-resolve.service.test.ts index b8b6e1a7..f611a2fe 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-resolve.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-payment-resolve.service.test.ts @@ -1,13 +1,13 @@ -import { ShopifyMutationPaymentResolve } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; -import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { ShopifyMutationPaymentResolve } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { retryPaymentResolve } from '../../../../src/services/shopify-retry/retry-payment-resolve.service.js'; import { createMockMerchant, createMockPaymentRecord, createMockSuccessPaymentSessionResolveResponse, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { retryPaymentResolve } from '../../../../src/services/shopify-retry/retry-payment-resolve.service.js'; describe('Shopify Retry Payment Resolve Testing Suite', () => { it('should execute successfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-reject.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-reject.service.test.ts index 12ddae00..83e273dc 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-reject.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-reject.service.test.ts @@ -1,14 +1,14 @@ -import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; -import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; +import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { retryRefundReject } from '../../../../src/services/shopify-retry/retry-refund-reject.service.js'; import { createMockMerchant, createMockRefundRecord, createMockSuccessRefundSessionRejectResponse, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { retryRefundReject } from '../../../../src/services/shopify-retry/retry-refund-reject.service.js'; -import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; describe('Shopify Retry Refund Reject Testing Suite', () => { it('should execute successfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-resolve.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-resolve.service.test.ts index 13fcb00e..0042daf0 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-resolve.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify-retry/retry-refund-resolve.service.test.ts @@ -1,19 +1,14 @@ -import { - ShopifyMutationRefundReject, - ShopifyMutationRefundResolve, -} from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; -import { prismaMock } from '../../../../prisma-singleton.js'; -import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { prismaMock } from '../../../../prisma-singleton.js'; +import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; +import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { retryRefundResolve } from '../../../../src/services/shopify-retry/retry-refund-resolve.service.js'; import { createMockMerchant, - createMockPaymentRecord, createMockRefundRecord, - createMockSuccessPaymentSessionResolveResponse, createMockSuccessRefundSessionResolveResponse, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { retryRefundResolve } from '../../../../src/services/shopify-retry/retry-refund-resolve.service.js'; -import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; describe('Shopify Retry Refund Resolve Testing Suite', () => { it('should execute successfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/shopify/payment-app-configure.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify/payment-app-configure.service.test.ts index 2f21c92e..8e352076 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify/payment-app-configure.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify/payment-app-configure.service.test.ts @@ -11,7 +11,7 @@ describe('unit testing payment app configure', () => { const mockPaymentAppConfigure = makePaymentAppConfigure(axios); await expect( - mockPaymentAppConfigure('mock-external-id', true, 'mock-shop', 'mock-token') + mockPaymentAppConfigure('mock-external-id', true, 'mock-shop', 'mock-token'), ).resolves.not.toThrow(); }); diff --git a/apps/backend-serverless/__tests__/unit/services/shopify/payment-session-resolve.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify/payment-session-resolve.service.test.ts index ef4c9024..3928459c 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify/payment-session-resolve.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify/payment-session-resolve.service.test.ts @@ -11,7 +11,7 @@ describe('unit testing payment session resolve', () => { const mockPaymentSessionResolve = makePaymentSessionResolve(axios); await expect( - mockPaymentSessionResolve('mock-id', 'mock-shop.shopify.com', 'mock-token') + mockPaymentSessionResolve('mock-id', 'mock-shop.shopify.com', 'mock-token'), ).resolves.not.toThrow(); }); diff --git a/apps/backend-serverless/__tests__/unit/services/shopify/payment-sesson-reject.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify/payment-sesson-reject.service.test.ts index 01becbaf..f412ce8a 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify/payment-sesson-reject.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify/payment-sesson-reject.service.test.ts @@ -1,8 +1,8 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; import { makePaymentSessionReject } from '../../../../src/services/shopify/payment-session-reject.service.js'; import { createMockSuccessPaymentSessionRejectResponse } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js'; describe('unit testing payment session reject', () => { it('valid response', async () => { @@ -12,7 +12,7 @@ describe('unit testing payment session reject', () => { const mockPaymentSessionReject = makePaymentSessionReject(axios); await expect( - mockPaymentSessionReject('mock-id', PaymentSessionStateRejectedReason.risky, 'mock-shop', 'mock-token') + mockPaymentSessionReject('mock-id', PaymentSessionStateRejectedReason.risky, 'mock-shop', 'mock-token'), ).resolves.not.toThrow(); }); @@ -45,8 +45,8 @@ describe('unit testing payment session reject', () => { 'mock-id', PaymentSessionStateRejectedReason.processingError, 'mock-shop', - 'mock-token' - ) + 'mock-token', + ), ).rejects.toThrow(); }); }); diff --git a/apps/backend-serverless/__tests__/unit/services/shopify/refund-session-reject.service.test.ts b/apps/backend-serverless/__tests__/unit/services/shopify/refund-session-reject.service.test.ts index 540f35d7..bc6181a1 100644 --- a/apps/backend-serverless/__tests__/unit/services/shopify/refund-session-reject.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/shopify/refund-session-reject.service.test.ts @@ -11,7 +11,7 @@ describe('unit testing refund session reject', () => { const mockRefundSessionReject = makeRefundSessionReject(axios); await expect( - mockRefundSessionReject('mock-id', 'REJECTED', 'mock-message', 'mock-shop', 'mock-token') + mockRefundSessionReject('mock-id', 'REJECTED', 'mock-message', 'mock-shop', 'mock-token'), ).resolves.not.toThrow(); }); diff --git a/apps/backend-serverless/__tests__/unit/services/sqs/sqs-send-message.service.test.ts b/apps/backend-serverless/__tests__/unit/services/sqs/sqs-send-message.service.test.ts index d479d5da..6003dbb9 100644 --- a/apps/backend-serverless/__tests__/unit/services/sqs/sqs-send-message.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/sqs/sqs-send-message.service.test.ts @@ -1,7 +1,7 @@ // File: sqsRetryService.test.ts -import { sendRetryMessage } from '../../../../src/services/sqs/sqs-send-message.service.js'; import { SQS } from 'aws-sdk'; import { ShopifyMutationRetryType } from '../../../../src/models/sqs/shopify-mutation-retry.model.js'; +import { sendRetryMessage } from '../../../../src/services/sqs/sqs-send-message.service.js'; describe('unit testing the sqs send message service', () => { it('should call SQS.sendMessage with correct parameters', async () => { @@ -27,7 +27,7 @@ describe('unit testing the sqs send message service', () => { null, null, 0, - mockSqs + mockSqs, ); // Validate sendMessage has been called with correct parameters diff --git a/apps/backend-serverless/__tests__/unit/services/step-function/start-execution-shopify-retry.service.test.ts b/apps/backend-serverless/__tests__/unit/services/step-function/start-execution-shopify-retry.service.test.ts index 8fe05abd..603ad405 100644 --- a/apps/backend-serverless/__tests__/unit/services/step-function/start-execution-shopify-retry.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/step-function/start-execution-shopify-retry.service.test.ts @@ -1,5 +1,5 @@ -import { startExecutionOfShopifyMutationRetry } from '../../../../src/services/step-function/start-execution-shopify-retry.service.js'; import { StepFunctions } from 'aws-sdk'; +import { startExecutionOfShopifyMutationRetry } from '../../../../src/services/step-function/start-execution-shopify-retry.service.js'; describe('unit testing start execution shopify retry', () => { it('should execute succesfully', async () => { diff --git a/apps/backend-serverless/__tests__/unit/services/transaction-request/fetch-payment-transaction.service.test.ts b/apps/backend-serverless/__tests__/unit/services/transaction-request/fetch-payment-transaction.service.test.ts index 7b75ada4..d69f78cd 100644 --- a/apps/backend-serverless/__tests__/unit/services/transaction-request/fetch-payment-transaction.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/transaction-request/fetch-payment-transaction.service.test.ts @@ -1,12 +1,12 @@ import * as web3 from '@solana/web3.js'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import { fetchPaymentTransaction } from '../../../../src/services/transaction-request/fetch-payment-transaction.service.js'; import { createMockMerchant, createMockPaymentRecord, createMockTransactionRequestResponse, } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; -import { fetchPaymentTransaction } from '../../../../src/services/transaction-request/fetch-payment-transaction.service.js'; -import MockAdapter from 'axios-mock-adapter'; -import axios from 'axios'; describe('fetch payment transaction request testing suite', () => { it('should fetch a payment transaction request', async () => { @@ -34,7 +34,7 @@ describe('fetch payment transaction request testing suite', () => { mockGasKeypair.publicKey.toBase58(), mockSingleUseKeypair.publicKey.toBase58(), mockGasKeypair.publicKey.toBase58(), - axios + axios, ); expect(true).toEqual(true); diff --git a/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-payment-transaction.service.test.ts b/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-payment-transaction.service.test.ts index 2aaecb19..b22f2598 100644 --- a/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-payment-transaction.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-payment-transaction.service.test.ts @@ -1,11 +1,11 @@ -import { - verifyTransferInstructionIsCorrect, - verifyTransactionWithRecord, - verifySingleUseInstruction, -} from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js'; import { TOKEN_PROGRAM_ID, createTransferCheckedInstruction } from '@solana/spl-token'; import * as web3 from '@solana/web3.js'; import { USDC_MINT } from '../../../../src/configs/tokens.config.js'; +import { + verifySingleUseInstruction, + verifyTransactionWithRecord, + verifyTransferInstructionIsCorrect, +} from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js'; import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js'; import { createMockPaymentRecord } from '../../../../src/utilities/testing-helper/create-mock.utility.js'; @@ -32,7 +32,7 @@ describe('unit testing validating discovered payment transactions', () => { transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction); @@ -60,7 +60,7 @@ describe('unit testing validating discovered payment transactions', () => { transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction); @@ -89,7 +89,7 @@ describe('unit testing validating discovered payment transactions', () => { transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction); @@ -136,7 +136,7 @@ describe('unit testing validating discovered payment transactions', () => { transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const ix = web3.SystemProgram.createAccount({ fromPubkey: aliceKeypair.publicKey, diff --git a/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-refund-transaction.service.test.ts b/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-refund-transaction.service.test.ts index ede62b3e..15b8af81 100644 --- a/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-refund-transaction.service.test.ts +++ b/apps/backend-serverless/__tests__/unit/services/transaction-validation/validate-discovered-refund-transaction.service.test.ts @@ -2,8 +2,8 @@ import { RefundRecord, RefundRecordStatus } from '@prisma/client'; import { TOKEN_PROGRAM_ID, createTransferCheckedInstruction } from '@solana/spl-token'; import * as web3 from '@solana/web3.js'; import { USDC_MINT } from '../../../../src/configs/tokens.config.js'; -import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js'; import { verifyTransactionWithRecord } from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js'; +import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js'; describe('unit testing validating discovered payment transactions', () => { process.env.HISTORICAL_FEE_PAYERS = 'historical'; @@ -40,7 +40,7 @@ describe('unit testing validating discovered payment transactions', () => { transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const ix = web3.SystemProgram.createAccount({ fromPubkey: aliceKeypair.publicKey, diff --git a/apps/backend-serverless/__tests__/unit/utilities/shopify/stringify-params.utility.test.ts b/apps/backend-serverless/__tests__/unit/utilities/shopify/stringify-params.utility.test.ts index 4fa2be09..5bc626f1 100644 --- a/apps/backend-serverless/__tests__/unit/utilities/shopify/stringify-params.utility.test.ts +++ b/apps/backend-serverless/__tests__/unit/utilities/shopify/stringify-params.utility.test.ts @@ -1,5 +1,5 @@ -import { stringifyParams } from '../../../../src/utilities/shopify/stringify-params.utility.js'; import { parseAndValidateAppInstallQueryParms } from '../../../../src/models/shopify/install-query-params.model.js'; +import { stringifyParams } from '../../../../src/utilities/shopify/stringify-params.utility.js'; describe('stringifyParams', () => { it('should return a string', () => { diff --git a/apps/backend-serverless/__tests__/unit/utilities/transaction-inspection.utility.test.ts b/apps/backend-serverless/__tests__/unit/utilities/transaction-inspection.utility.test.ts index a30707aa..ea6a115d 100644 --- a/apps/backend-serverless/__tests__/unit/utilities/transaction-inspection.utility.test.ts +++ b/apps/backend-serverless/__tests__/unit/utilities/transaction-inspection.utility.test.ts @@ -1,6 +1,6 @@ import * as web3 from '@solana/web3.js'; -import { findPayingWalletFromTransaction } from '../../../src/utilities/transaction-inspection.utility.js'; import { createMockTransaction } from '../../../src/utilities/testing-helper/create-mock.utility.js'; +import { findPayingWalletFromTransaction } from '../../../src/utilities/transaction-inspection.utility.js'; describe('Transaction Inspection Utility', () => { it('should find the paying wallet from a transaction', async () => { diff --git a/apps/backend-serverless/prisma-singleton.ts b/apps/backend-serverless/prisma-singleton.ts index c2b058aa..cc1b48f5 100644 --- a/apps/backend-serverless/prisma-singleton.ts +++ b/apps/backend-serverless/prisma-singleton.ts @@ -1,5 +1,5 @@ import { PrismaClient } from '@prisma/client'; -import { mockDeep, mockReset, DeepMockProxy } from 'jest-mock-extended'; +import { DeepMockProxy, mockDeep, mockReset } from 'jest-mock-extended'; import prisma from './client.js'; diff --git a/apps/backend-serverless/scripts/reporting.js b/apps/backend-serverless/scripts/reporting.js index 060a89f8..ee2e392b 100644 --- a/apps/backend-serverless/scripts/reporting.js +++ b/apps/backend-serverless/scripts/reporting.js @@ -57,7 +57,7 @@ async function generateReport() { const body = data .map( d => - `$${d.totalSalesVolume},${d.totalTransactions},$${d.averageTransactionSize},$${d.totalRefundVolume},${d.totalRefunds},${d.activeMerchants}` + `$${d.totalSalesVolume},${d.totalTransactions},$${d.averageTransactionSize},$${d.totalRefundVolume},${d.totalRefunds},${d.activeMerchants}`, ) .join('\n'); @@ -92,7 +92,7 @@ async function generateReport() { const merchantBody = merchantData .map( d => - `${d.merchantId},$${d.totalSalesVolume},${d.totalTransactions},$${d.averageTransactionSize},$${d.totalRefundVolume},${d.totalRefunds}` + `${d.merchantId},$${d.totalSalesVolume},${d.totalTransactions},$${d.averageTransactionSize},$${d.totalRefundVolume},${d.totalRefunds}`, ) .join('\n'); diff --git a/apps/backend-serverless/src/configs/tokens.config.ts b/apps/backend-serverless/src/configs/tokens.config.ts index fbceaf23..d4cf30e2 100644 --- a/apps/backend-serverless/src/configs/tokens.config.ts +++ b/apps/backend-serverless/src/configs/tokens.config.ts @@ -3,5 +3,5 @@ import * as web3 from '@solana/web3.js'; export const USDC_MINT = new web3.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'); export const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID: web3.PublicKey = new web3.PublicKey( - 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' + 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/merchant-data.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/merchant-data.ts index 0afdc13d..4f126fd5 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/merchant-data.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/merchant-data.ts @@ -78,5 +78,5 @@ export const merchantData = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/payment-data.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/payment-data.ts index 0e850a1b..8b2e459b 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/payment-data.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/payment-data.ts @@ -31,7 +31,7 @@ export const paymentData = Sentry.AWSLambda.wrapHandler( const merchant = await merchantService.getMerchant({ id: merchantAuthToken.id }); const paymentDataRequestParameters = parseAndValidatePaymentDataRequestParameters( - event.queryStringParameters + event.queryStringParameters, ); const pagination: Pagination = { page: paymentDataRequestParameters.pageNumber, @@ -59,5 +59,5 @@ export const paymentData = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-data.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-data.ts index 83d2b4d4..2b066dc5 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-data.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-data.ts @@ -45,7 +45,7 @@ export const refundData = Sentry.AWSLambda.wrapHandler( merchantAuthToken, refundDataRequestParameters.refundStatus, pagination, - prisma + prisma, ); const generalResponse = await createGeneralResponse(merchantAuthToken, prisma); @@ -68,5 +68,5 @@ export const refundData = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-status.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-status.ts index c43c547b..b6675c0e 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-status.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/read-data/refund-status.ts @@ -50,5 +50,5 @@ export const refundStatus = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/reject-refund.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/reject-refund.ts index f9fd5c98..966fbdb7 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/reject-refund.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/reject-refund.ts @@ -63,7 +63,7 @@ export const rejectRefund = Sentry.AWSLambda.wrapHandler( RefundSessionStateRejectedReason.processingError, rejectRefundRequest.merchantReason, shop, - accessToken + accessToken, ); validateRefundSessionRejected(rejectRefundResponse); @@ -72,7 +72,7 @@ export const rejectRefund = Sentry.AWSLambda.wrapHandler( await sendRefundRejectRetryMessage( refundRecord.id, RefundSessionStateRejectedReason.processingError, - rejectRefundRequest.merchantReason + rejectRefundRequest.merchantReason, ); } catch (sendMessageError) { throw new DependencyError('failed to send refund reject retry message'); @@ -96,5 +96,5 @@ export const rejectRefund = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/update-merchant.ts b/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/update-merchant.ts index 1b998e5e..6e2e4800 100644 --- a/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/update-merchant.ts +++ b/apps/backend-serverless/src/handlers/clients/merchant-ui/write-data/update-merchant.ts @@ -74,7 +74,7 @@ export const updateMerchant = Sentry.AWSLambda.wrapHandler( if (merchantUpdateRequest.paymentAddress != null) { merchant = await merchantService.updateMerchantWalletAddress( merchant, - merchantUpdateRequest.paymentAddress + merchantUpdateRequest.paymentAddress, ); } merchant = await merchantService.updateMerchant(merchant, merchantUpdateQuery as MerchantUpdate); @@ -127,5 +127,5 @@ export const updateMerchant = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/payment-ui/balance.ts b/apps/backend-serverless/src/handlers/clients/payment-ui/balance.ts index c1f90a1e..ecf4df1c 100644 --- a/apps/backend-serverless/src/handlers/clients/payment-ui/balance.ts +++ b/apps/backend-serverless/src/handlers/clients/payment-ui/balance.ts @@ -31,5 +31,5 @@ export const balance = Sentry.AWSLambda.wrapHandler( } catch (error) { return createErrorResponse(error); } - } + }, ); diff --git a/apps/backend-serverless/src/handlers/clients/payment-ui/payment-status.ts b/apps/backend-serverless/src/handlers/clients/payment-ui/payment-status.ts index 194a00df..4e18f1eb 100644 --- a/apps/backend-serverless/src/handlers/clients/payment-ui/payment-status.ts +++ b/apps/backend-serverless/src/handlers/clients/payment-ui/payment-status.ts @@ -39,7 +39,7 @@ export const paymentStatus = Sentry.AWSLambda.wrapHandler( const paymentStatusResponse = createPaymentStatusResponse( paymentRecord, merchant, - parsedPaymentStatusQuery.language + parsedPaymentStatusQuery.language, ); const paymentErrorResponse = createPaymentErrorResponse(paymentRecord); const responseBodyData = { @@ -54,5 +54,5 @@ export const paymentStatus = Sentry.AWSLambda.wrapHandler( } catch (error) { return createErrorResponse(error); } - } + }, ); diff --git a/apps/backend-serverless/src/handlers/shopify-handlers/install.ts b/apps/backend-serverless/src/handlers/shopify-handlers/install.ts index 5b15d3bd..e79bc636 100755 --- a/apps/backend-serverless/src/handlers/shopify-handlers/install.ts +++ b/apps/backend-serverless/src/handlers/shopify-handlers/install.ts @@ -65,5 +65,5 @@ export const install = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/shopify-handlers/logout.ts b/apps/backend-serverless/src/handlers/shopify-handlers/logout.ts index d02f824f..60d00dd1 100644 --- a/apps/backend-serverless/src/handlers/shopify-handlers/logout.ts +++ b/apps/backend-serverless/src/handlers/shopify-handlers/logout.ts @@ -33,5 +33,5 @@ export const logout = Sentry.AWSLambda.wrapHandler( cookies: [merchantCookie, nonceCookie], body: JSON.stringify({ message: 'Logged out' }), }; - } + }, ); diff --git a/apps/backend-serverless/src/handlers/shopify-handlers/payment.ts b/apps/backend-serverless/src/handlers/shopify-handlers/payment.ts index 367483b9..4ab76a80 100644 --- a/apps/backend-serverless/src/handlers/shopify-handlers/payment.ts +++ b/apps/backend-serverless/src/handlers/shopify-handlers/payment.ts @@ -62,7 +62,7 @@ export const payment = Sentry.AWSLambda.wrapHandler( usdcSize = await convertAmountAndCurrencyToUsdcSize( paymentInitiation.amount, paymentInitiation.currency, - axios + axios, ); } @@ -71,14 +71,14 @@ export const payment = Sentry.AWSLambda.wrapHandler( newPaymentRecordId, paymentInitiation, merchant, - usdcSize + usdcSize, ); } return { statusCode: 201, body: JSON.stringify({ - redirect_url: `${paymentUiUrl}?paymentId=${paymentRecord.id}`, + redirect_url: `${paymentUiUrl}/${shop.split('.')[0]}/?paymentId=${paymentRecord.id}`, }), }; } catch (error) { @@ -87,5 +87,5 @@ export const payment = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/shopify-handlers/redirect.ts b/apps/backend-serverless/src/handlers/shopify-handlers/redirect.ts index bc395dea..6e8883aa 100755 --- a/apps/backend-serverless/src/handlers/shopify-handlers/redirect.ts +++ b/apps/backend-serverless/src/handlers/shopify-handlers/redirect.ts @@ -99,5 +99,5 @@ export const redirect = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/shopify-handlers/refund.ts b/apps/backend-serverless/src/handlers/shopify-handlers/refund.ts index f0d40255..275c7d66 100644 --- a/apps/backend-serverless/src/handlers/shopify-handlers/refund.ts +++ b/apps/backend-serverless/src/handlers/shopify-handlers/refund.ts @@ -61,7 +61,7 @@ export const refund = Sentry.AWSLambda.wrapHandler( usdcSize = await convertAmountAndCurrencyToUsdcSize( refundInitiation.amount, refundInitiation.currency, - axios + axios, ); } @@ -70,7 +70,7 @@ export const refund = Sentry.AWSLambda.wrapHandler( newRefundRecordId, refundInitiation, merchant, - usdcSize + usdcSize, ); } else { throw error; @@ -87,5 +87,5 @@ export const refund = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/testing/error.ts b/apps/backend-serverless/src/handlers/testing/error.ts index dd6da69c..d370835b 100644 --- a/apps/backend-serverless/src/handlers/testing/error.ts +++ b/apps/backend-serverless/src/handlers/testing/error.ts @@ -25,5 +25,5 @@ export const error = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/testing/queue.ts b/apps/backend-serverless/src/handlers/testing/queue.ts index 7b0b908c..cf8f919c 100644 --- a/apps/backend-serverless/src/handlers/testing/queue.ts +++ b/apps/backend-serverless/src/handlers/testing/queue.ts @@ -28,5 +28,5 @@ export const queue = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/transactions/payment-transaction.ts b/apps/backend-serverless/src/handlers/transactions/payment-transaction.ts index 8e879032..d3815d35 100644 --- a/apps/backend-serverless/src/handlers/transactions/payment-transaction.ts +++ b/apps/backend-serverless/src/handlers/transactions/payment-transaction.ts @@ -129,7 +129,7 @@ export const paymentTransaction = Sentry.AWSLambda.wrapHandler( { paymentRecordId: paymentRecord.id, }, - websocketSessionService + websocketSessionService, ); await websocketService.sendTransacationRequestStartedMessage(); @@ -176,7 +176,7 @@ export const paymentTransaction = Sentry.AWSLambda.wrapHandler( gasKeypair.publicKey.toBase58(), singleUseKeypair.publicKey.toBase58(), gasKeypair.publicKey.toBase58(), - axios + axios, ); } catch (error) { console.log('failed fetching payment transaction, prob lol'); @@ -206,7 +206,7 @@ export const paymentTransaction = Sentry.AWSLambda.wrapHandler( paymentRecord.shopGid, rejectionReason, merchant.shop, - merchant.accessToken + merchant.accessToken, ); paymentSessionData = validatePaymentSessionRejected(paymentSessionRejectResponse); @@ -277,7 +277,7 @@ export const paymentTransaction = Sentry.AWSLambda.wrapHandler( signatureString, TransactionType.payment, paymentRecord.id, - null + null, ); } catch (error) { await websocketService.sendTransactionRequestFailedMessage(); @@ -303,7 +303,7 @@ export const paymentTransaction = Sentry.AWSLambda.wrapHandler( { captureTimeoutWarning: false, rethrowAfterCapture: false, - } + }, ); export const paymentMetadata = async (event: APIGatewayProxyEventV2): Promise => { diff --git a/apps/backend-serverless/src/handlers/transactions/refund-transaction.ts b/apps/backend-serverless/src/handlers/transactions/refund-transaction.ts index 866a0288..47475caa 100644 --- a/apps/backend-serverless/src/handlers/transactions/refund-transaction.ts +++ b/apps/backend-serverless/src/handlers/transactions/refund-transaction.ts @@ -142,7 +142,7 @@ export const refundTransaction = Sentry.AWSLambda.wrapHandler( gasKeypair.publicKey.toBase58(), singleUseKeypair.publicKey.toBase58(), gasKeypair.publicKey.toBase58(), - axios + axios, ); } catch (error) { return createErrorResponse(error); @@ -178,7 +178,7 @@ export const refundTransaction = Sentry.AWSLambda.wrapHandler( await trmService.screenAddress(account); } catch (error) { return createErrorResponse( - new InvalidInputError('Bad address for merchant: ' + merchant.id + ' ' + account) + new InvalidInputError('Bad address for merchant: ' + merchant.id + ' ' + account), ); } } @@ -188,7 +188,7 @@ export const refundTransaction = Sentry.AWSLambda.wrapHandler( signatureString, TransactionType.refund, null, - refundRecord.id + refundRecord.id, ); } catch (error) { return createErrorResponse(error); @@ -208,11 +208,11 @@ export const refundTransaction = Sentry.AWSLambda.wrapHandler( message: `Refunding customer ${refundRecord.usdcAmount.toFixed(2)} USDC`, }, null, - 2 + 2, ), }; }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/cron.ts b/apps/backend-serverless/src/handlers/webhooks/cron.ts index eac388db..a3aea020 100644 --- a/apps/backend-serverless/src/handlers/webhooks/cron.ts +++ b/apps/backend-serverless/src/handlers/webhooks/cron.ts @@ -56,7 +56,7 @@ export const cron = Sentry.AWSLambda.wrapHandler( { signatures: signatures, }, - paymentRecordService + paymentRecordService, ); await websocketService.sendProcessingTransactionMessage(); @@ -77,5 +77,5 @@ export const cron = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-data-request.ts b/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-data-request.ts index f5029bb7..e17db4ab 100644 --- a/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-data-request.ts +++ b/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-data-request.ts @@ -24,7 +24,7 @@ export const customersDataRequest = Sentry.AWSLambda.wrapHandler( }); if (event.body == null) { return createErrorResponse( - new InvalidInputError('Customer data Missing body' + ' ' + JSON.stringify(event.headers)) + new InvalidInputError('Customer data Missing body' + ' ' + JSON.stringify(event.headers)), ); } @@ -44,5 +44,5 @@ export const customersDataRequest = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-redact.ts b/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-redact.ts index 29b727af..d10563ad 100644 --- a/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-redact.ts +++ b/apps/backend-serverless/src/handlers/webhooks/gdpr/customers-redact.ts @@ -43,5 +43,5 @@ export const customersRedact = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/gdpr/shop-redact.ts b/apps/backend-serverless/src/handlers/webhooks/gdpr/shop-redact.ts index 32fae7be..6e89524d 100644 --- a/apps/backend-serverless/src/handlers/webhooks/gdpr/shop-redact.ts +++ b/apps/backend-serverless/src/handlers/webhooks/gdpr/shop-redact.ts @@ -59,5 +59,5 @@ export const shopRedact = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/helius.ts b/apps/backend-serverless/src/handlers/webhooks/helius.ts index c62b8711..df83c301 100755 --- a/apps/backend-serverless/src/handlers/webhooks/helius.ts +++ b/apps/backend-serverless/src/handlers/webhooks/helius.ts @@ -60,7 +60,7 @@ export const helius = Sentry.AWSLambda.wrapHandler( { signatures: signatures, }, - paymentRecordService + paymentRecordService, ); try { @@ -108,7 +108,7 @@ export const helius = Sentry.AWSLambda.wrapHandler( { signatures: failedTransactionRecordSignatures, }, - paymentRecordService + paymentRecordService, ); try { @@ -127,5 +127,5 @@ export const helius = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/retry.ts b/apps/backend-serverless/src/handlers/webhooks/retry.ts index f99bfd78..623b1475 100644 --- a/apps/backend-serverless/src/handlers/webhooks/retry.ts +++ b/apps/backend-serverless/src/handlers/webhooks/retry.ts @@ -86,7 +86,7 @@ export const retry = Sentry.AWSLambda.wrapHandler( shopifyMutationRetry.refundResolve, shopifyMutationRetry.refundReject, shopifyMutationRetry.appConfigure, - nextStep + nextStep, ); } catch (error) { return createErrorResponse(error); @@ -100,5 +100,5 @@ export const retry = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/s3/safety-key-uploaded.ts b/apps/backend-serverless/src/handlers/webhooks/s3/safety-key-uploaded.ts index 8f63f4d3..7007041e 100644 --- a/apps/backend-serverless/src/handlers/webhooks/s3/safety-key-uploaded.ts +++ b/apps/backend-serverless/src/handlers/webhooks/s3/safety-key-uploaded.ts @@ -24,5 +24,5 @@ export const safetyKeyUploaded = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/sqs/process-transaction-message.ts b/apps/backend-serverless/src/handlers/webhooks/sqs/process-transaction-message.ts index bba38aa9..7959eeb1 100644 --- a/apps/backend-serverless/src/handlers/webhooks/sqs/process-transaction-message.ts +++ b/apps/backend-serverless/src/handlers/webhooks/sqs/process-transaction-message.ts @@ -56,7 +56,7 @@ export const processTransactionMessage = Sentry.AWSLambda.wrapHandler( { signatures: [processTransactionMessage.signature], }, - paymentRecordService + paymentRecordService, ); try { @@ -76,5 +76,5 @@ export const processTransactionMessage = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/sqs/solana-pay-info-message.ts b/apps/backend-serverless/src/handlers/webhooks/sqs/solana-pay-info-message.ts index 03848aaa..1032cba9 100644 --- a/apps/backend-serverless/src/handlers/webhooks/sqs/solana-pay-info-message.ts +++ b/apps/backend-serverless/src/handlers/webhooks/sqs/solana-pay-info-message.ts @@ -52,7 +52,7 @@ export const solanaPayInfoMessage = Sentry.AWSLambda.wrapHandler( { paymentRecordId: solanaPayInfoMessage.paymentRecordId, }, - websocketSessionService + websocketSessionService, ); let paymentRecord; @@ -85,7 +85,7 @@ export const solanaPayInfoMessage = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); const successfulMessage = (): APIGatewayProxyResultV2 => { diff --git a/apps/backend-serverless/src/handlers/webhooks/sqs/sqs-message-receive.ts b/apps/backend-serverless/src/handlers/webhooks/sqs/sqs-message-receive.ts index 5ce689da..b66f0f24 100644 --- a/apps/backend-serverless/src/handlers/webhooks/sqs/sqs-message-receive.ts +++ b/apps/backend-serverless/src/handlers/webhooks/sqs/sqs-message-receive.ts @@ -52,5 +52,5 @@ export const sqsMessageReceive = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/webhooks/step-functions/safety-key-sweep.ts b/apps/backend-serverless/src/handlers/webhooks/step-functions/safety-key-sweep.ts index 85ce2747..0ff65fcc 100644 --- a/apps/backend-serverless/src/handlers/webhooks/step-functions/safety-key-sweep.ts +++ b/apps/backend-serverless/src/handlers/webhooks/step-functions/safety-key-sweep.ts @@ -46,5 +46,5 @@ export const safetyKeySweep = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/websockets/connect.ts b/apps/backend-serverless/src/handlers/websockets/connect.ts index 4bd81308..b99a0b73 100644 --- a/apps/backend-serverless/src/handlers/websockets/connect.ts +++ b/apps/backend-serverless/src/handlers/websockets/connect.ts @@ -44,5 +44,5 @@ export const connect = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/handlers/websockets/disconnect.ts b/apps/backend-serverless/src/handlers/websockets/disconnect.ts index 884f7a9f..f6f450a7 100644 --- a/apps/backend-serverless/src/handlers/websockets/disconnect.ts +++ b/apps/backend-serverless/src/handlers/websockets/disconnect.ts @@ -31,5 +31,5 @@ export const disconnect = Sentry.AWSLambda.wrapHandler( }, { rethrowAfterCapture: false, - } + }, ); diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/merchant-auth-token.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/merchant-auth-token.model.ts index cd34ab9c..30b6dccb 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/merchant-auth-token.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/merchant-auth-token.model.ts @@ -13,6 +13,6 @@ export const parseAndValidateMerchantAuthToken = (merchantAuthTokenBody: unknown return parseAndValidateStrict( merchantAuthTokenBody, merchantAuthTokenSchema, - 'Could not parse the merchant auth token body. Unknown Reason.' + 'Could not parse the merchant auth token body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/payment-address-request.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/payment-address-request.model.ts index a4b874a5..b4dbfad7 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/payment-address-request.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/payment-address-request.model.ts @@ -13,11 +13,11 @@ export const merchantUpdateRequestBodySchema = object().shape({ export type MerchantUpdateRequest = InferType; export const parseAndValidatePaymentAddressRequestBody = ( - merchantUpdateRequestBody: unknown + merchantUpdateRequestBody: unknown, ): MerchantUpdateRequest => { return parseAndValidateStrict( merchantUpdateRequestBody, merchantUpdateRequestBodySchema, - 'Could not parse the merchant update request body. Unknown Reason.' + 'Could not parse the merchant update request body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/payment-data-request.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/payment-data-request.model.ts index e5f60a7d..0fc4a3c2 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/payment-data-request.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/payment-data-request.model.ts @@ -17,11 +17,11 @@ export const paymentDataRequestParametersSchema = object().shape({ export type PaymentDataRequestParameters = InferType; export const parseAndValidatePaymentDataRequestParameters = ( - paymentDataRequestParametersBody: any + paymentDataRequestParametersBody: any, ): PaymentDataRequestParameters => { return parseAndValidateStrict( parseParameters(paymentDataRequestParametersBody), paymentDataRequestParametersSchema, - 'Could not parse the payment data request parameters. Unknown Reason.' + 'Could not parse the payment data request parameters. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/refund-data-request.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/refund-data-request.model.ts index 1a7d2428..e446e5fd 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/refund-data-request.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/refund-data-request.model.ts @@ -20,11 +20,11 @@ export const refundDataRequestParametersSchema = object().shape({ export type RefundDataRequestParameters = InferType; export const parseAndValidateRefundDataRequestParameters = ( - refundDataRequestParmatersBody: unknown + refundDataRequestParmatersBody: unknown, ): RefundDataRequestParameters => { return parseAndValidateStrict( parseParameters(refundDataRequestParmatersBody), refundDataRequestParametersSchema, - 'Could not parse the refund data request parameters. Unknown Reason.' + 'Could not parse the refund data request parameters. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/refund-status-request.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/refund-status-request.model.ts index 1e2a1851..7e954aaa 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/refund-status-request.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/refund-status-request.model.ts @@ -11,6 +11,6 @@ export const parseAndValidateRefundStatusRequest = (refundStatusRequestParameter return parseAndValidateStrict( refundStatusRequestParameters, refundStatusRequestScheme, - 'Could not parse the refund status request parameters. Unknown Reason.' + 'Could not parse the refund status request parameters. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/merchant-ui/reject-refund-request.model.ts b/apps/backend-serverless/src/models/clients/merchant-ui/reject-refund-request.model.ts index db359ef6..51779ac6 100644 --- a/apps/backend-serverless/src/models/clients/merchant-ui/reject-refund-request.model.ts +++ b/apps/backend-serverless/src/models/clients/merchant-ui/reject-refund-request.model.ts @@ -12,6 +12,6 @@ export const parseAndValidateRejectRefundRequest = (rejectRefundRequestBody: unk return parseAndValidateStrict( rejectRefundRequestBody, rejectRefundRequestBodySchema, - 'Could not parse the reject refund request. Unknown Reason.' + 'Could not parse the reject refund request. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/payment-ui/balance-request-parameters.model.ts b/apps/backend-serverless/src/models/clients/payment-ui/balance-request-parameters.model.ts index e2dc756b..7ae4a394 100644 --- a/apps/backend-serverless/src/models/clients/payment-ui/balance-request-parameters.model.ts +++ b/apps/backend-serverless/src/models/clients/payment-ui/balance-request-parameters.model.ts @@ -21,6 +21,6 @@ export const parseAndValidateBalanceParameters = (balanceRequestParameters: unkn return parseAndValidateStrict( balanceRequestParameters, balanceRequestParametersScheme, - 'Can not parse balance parameters. Unkownn reason.' + 'Can not parse balance parameters. Unkownn reason.', ); }; diff --git a/apps/backend-serverless/src/models/clients/payment-ui/payment-status-request.model.ts b/apps/backend-serverless/src/models/clients/payment-ui/payment-status-request.model.ts index eef0480a..2a356382 100644 --- a/apps/backend-serverless/src/models/clients/payment-ui/payment-status-request.model.ts +++ b/apps/backend-serverless/src/models/clients/payment-ui/payment-status-request.model.ts @@ -12,6 +12,6 @@ export const parseAndValidatePaymentStatusRequest = (paymentStatusRequestParamet return parseAndValidateStrict( paymentStatusRequestParameters, paymentStatusRequestScheme, - 'Can not parse payment status request. Unkownn reason.' + 'Can not parse payment status request. Unkownn reason.', ); }; diff --git a/apps/backend-serverless/src/models/dependencies/get-account-info.model.ts b/apps/backend-serverless/src/models/dependencies/get-account-info.model.ts index 455a3676..aae1e0b1 100644 --- a/apps/backend-serverless/src/models/dependencies/get-account-info.model.ts +++ b/apps/backend-serverless/src/models/dependencies/get-account-info.model.ts @@ -70,6 +70,6 @@ export const parseAndValidateGetAccountInfo = (getAccountInfoResponseBody: unkno return parseAndValidateStrict( getAccountInfoResponseBody, getAccountInfoResponseSchema, - 'Could not parse the get account info response body. Unknown Reason.' + 'Could not parse the get account info response body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/dependencies/helius-balance.model.ts b/apps/backend-serverless/src/models/dependencies/helius-balance.model.ts index 24eae965..8a509764 100644 --- a/apps/backend-serverless/src/models/dependencies/helius-balance.model.ts +++ b/apps/backend-serverless/src/models/dependencies/helius-balance.model.ts @@ -38,6 +38,6 @@ export const parseAndValidateHeliusBalance = (heliusBalanceResponse: unknown): H return parseAndValidateStrict( heliusBalanceResponse, heliusBalanceSchema, - 'Could not parse the heluis balance response. Unknown Reason.' + 'Could not parse the heluis balance response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/dependencies/helius-enhanced-transaction.model.ts b/apps/backend-serverless/src/models/dependencies/helius-enhanced-transaction.model.ts index 952dbe14..76906817 100755 --- a/apps/backend-serverless/src/models/dependencies/helius-enhanced-transaction.model.ts +++ b/apps/backend-serverless/src/models/dependencies/helius-enhanced-transaction.model.ts @@ -135,11 +135,11 @@ export type HeliusEnhancedTransaction = InferType; export const parseAndValidateHeliusEnchancedTransaction = ( - heliusEnhancedTransactionResponseBody: unknown + heliusEnhancedTransactionResponseBody: unknown, ): HeliusEnhancedTransactionArray => { return parseAndValidateStrict( heliusEnhancedTransactionResponseBody, heliusEnhancedTransactionResponseSchema, - 'Could not parse the heluis enhanced transaction body. Unknown Reason.' + 'Could not parse the heluis enhanced transaction body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/dependencies/helius-header.model.ts b/apps/backend-serverless/src/models/dependencies/helius-header.model.ts index 0324fa8f..d10a059b 100644 --- a/apps/backend-serverless/src/models/dependencies/helius-header.model.ts +++ b/apps/backend-serverless/src/models/dependencies/helius-header.model.ts @@ -11,6 +11,6 @@ export const parseAndValidateHeliusHeader = (heliusHeaderBody: unknown): HeliusH return parseAndValidateStrict( heliusHeaderBody, heliusHeaderSchema, - 'Could not parse the heluis header body. Unknown Reason.' + 'Could not parse the heluis header body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/dependencies/trm-wallet-screen-response.model.ts b/apps/backend-serverless/src/models/dependencies/trm-wallet-screen-response.model.ts index afaaaa76..b9f1fc56 100644 --- a/apps/backend-serverless/src/models/dependencies/trm-wallet-screen-response.model.ts +++ b/apps/backend-serverless/src/models/dependencies/trm-wallet-screen-response.model.ts @@ -43,6 +43,6 @@ export const parseAndValidateTrmWalletScreenResponse = (walletScreenResponse: un return parseAndValidateStrict( walletScreenResponse, trmWalletScreenResponseSchema, - 'Failed to parse and validate TRM wallet screen response. Unknown reason.' + 'Failed to parse and validate TRM wallet screen response. Unknown reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/admin-data.response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/admin-data.response.model.ts index eb5289a3..aa89f3c2 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/admin-data.response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/admin-data.response.model.ts @@ -23,6 +23,6 @@ export const parseAndValidateAdminDataResponse = (adminDataResponeBody: unknown) return parseAndValidateStrict( adminDataResponeBody, adminDataResponseSchema, - 'Could not parse the admin data response. Unknown Reason.' + 'Could not parse the admin data response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/payment-app-configure-response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/payment-app-configure-response.model.ts index 424938a1..03f8e42c 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/payment-app-configure-response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/payment-app-configure-response.model.ts @@ -24,11 +24,11 @@ export const paymentAppConfigureResponseSchema = object().shape({ export type PaymentAppConfigureResponse = InferType; export const parseAndValidatePaymentAppConfigureResponse = ( - paymentAppConfigureResponseBody: unknown + paymentAppConfigureResponseBody: unknown, ): PaymentAppConfigureResponse => { return parseAndValidateStrict( paymentAppConfigureResponseBody, paymentAppConfigureResponseSchema, - 'Could not parse the payment app configure response. Unknown Reason.' + 'Could not parse the payment app configure response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/reject-payment-response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/reject-payment-response.model.ts index f9ef732b..fd930c31 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/reject-payment-response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/reject-payment-response.model.ts @@ -17,6 +17,6 @@ export const parseAndValidateRejectPaymentResponse = (rejectPaymentResponeBody: return parseAndValidateStrict( rejectPaymentResponeBody, paymentSessionRejectResponseSchema, - 'Could not parse the reject payment response. Unknown Reason.' + 'Could not parse the reject payment response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/reject-refund-response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/reject-refund-response.model.ts index 90535d4c..8b8eb795 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/reject-refund-response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/reject-refund-response.model.ts @@ -17,6 +17,6 @@ export const parseAndValidateRejectRefundResponse = (rejectRefundResponeBody: un return parseAndValidateStrict( rejectRefundResponeBody, refundSessionRejectResponseSchema, - 'Could not parse the reject refund response body. Unknown Reason.' + 'Could not parse the reject refund response body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-payment-response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-payment-response.model.ts index 9dcc5133..ef712b43 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-payment-response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-payment-response.model.ts @@ -17,6 +17,6 @@ export const parseAndValidateResolvePaymentResponse = (resolvePaymentResponeBody return parseAndValidateStrict( resolvePaymentResponeBody, paymentSessionResolveResponseSchema, - 'Could not parse the resolve payment response. Unknown Reason.' + 'Could not parse the resolve payment response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-refund-response.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-refund-response.model.ts index 507b79ff..b0e125a9 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-refund-response.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/resolve-refund-response.model.ts @@ -17,6 +17,6 @@ export const parseAndValidateResolveRefundResponse = (resolveRefundResponeBody: return parseAndValidateStrict( resolveRefundResponeBody, refundSessionResolveResponseSchema, - 'Could not parse the resolve refund response body. Unknown Reason.' + 'Could not parse the resolve refund response body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify-graphql-responses/shared.model.ts b/apps/backend-serverless/src/models/shopify-graphql-responses/shared.model.ts index 7166ad8e..19cebb01 100644 --- a/apps/backend-serverless/src/models/shopify-graphql-responses/shared.model.ts +++ b/apps/backend-serverless/src/models/shopify-graphql-responses/shared.model.ts @@ -1,4 +1,4 @@ -import { object, string, array, mixed, number, InferType } from 'yup'; +import { InferType, array, mixed, number, object, string } from 'yup'; enum RefundSessionResolveUserErrorCode { invalidState = 'REFUND_SESSION_INVALID_STATE', diff --git a/apps/backend-serverless/src/models/shopify/access-token-response.model.ts b/apps/backend-serverless/src/models/shopify/access-token-response.model.ts index 56e28fd3..df4afc37 100755 --- a/apps/backend-serverless/src/models/shopify/access-token-response.model.ts +++ b/apps/backend-serverless/src/models/shopify/access-token-response.model.ts @@ -12,6 +12,6 @@ export const parseAndValidateAccessTokenResponse = (accessTokenResponseBody: unk return parseAndValidateStrict( accessTokenResponseBody, accessTokenResponseSchema, - 'Could not parse the access token response. Unknown Reason.' + 'Could not parse the access token response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/install-query-params.model.ts b/apps/backend-serverless/src/models/shopify/install-query-params.model.ts index 4e169fe4..78d35aa3 100755 --- a/apps/backend-serverless/src/models/shopify/install-query-params.model.ts +++ b/apps/backend-serverless/src/models/shopify/install-query-params.model.ts @@ -24,6 +24,6 @@ export const parseAndValidateAppInstallQueryParms = (appInstallQuery: unknown): return parseAndValidateStrict( appInstallQuery, appInstallQueryParmSchema, - 'Could not parse the app install query. Unknown Reason.' + 'Could not parse the app install query. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/process-payment-request.model.ts b/apps/backend-serverless/src/models/shopify/process-payment-request.model.ts index 113e571e..050d8b1e 100755 --- a/apps/backend-serverless/src/models/shopify/process-payment-request.model.ts +++ b/apps/backend-serverless/src/models/shopify/process-payment-request.model.ts @@ -67,11 +67,11 @@ export const shopifyPaymentInitiationScheme = object().shape({ export type ShopifyPaymentInitiation = InferType; export const parseAndValidateShopifyPaymentInitiation = ( - paymentInitiationRequestBody: unknown + paymentInitiationRequestBody: unknown, ): ShopifyPaymentInitiation => { return parseAndValidateStrict( parseParameters(paymentInitiationRequestBody), shopifyPaymentInitiationScheme, - 'Could not parse the Shopify payment initiation request. Unknown Reason.' + 'Could not parse the Shopify payment initiation request. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/process-refund.request.model.ts b/apps/backend-serverless/src/models/shopify/process-refund.request.model.ts index 4d7e1c05..8bcedf19 100755 --- a/apps/backend-serverless/src/models/shopify/process-refund.request.model.ts +++ b/apps/backend-serverless/src/models/shopify/process-refund.request.model.ts @@ -28,11 +28,11 @@ export const shopifyRefundInitiationScheme = object().shape({ export type ShopifyRefundInitiation = InferType; export const parseAndValidateShopifyRefundInitiation = ( - shopifyRefundInitiationBody: unknown + shopifyRefundInitiationBody: unknown, ): ShopifyRefundInitiation => { return parseAndValidateStrict( parseParameters(shopifyRefundInitiationBody), shopifyRefundInitiationScheme, - 'Could not parse the shopify refund initiation body. Unknown Reason.' + 'Could not parse the shopify refund initiation body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/redirect-query-params.model.ts b/apps/backend-serverless/src/models/shopify/redirect-query-params.model.ts index 0c7099de..a6c06592 100755 --- a/apps/backend-serverless/src/models/shopify/redirect-query-params.model.ts +++ b/apps/backend-serverless/src/models/shopify/redirect-query-params.model.ts @@ -26,6 +26,6 @@ export const parseAndValidateAppRedirectQueryParams = (appRedirectQuery: unknown return parseAndValidateStrict( appRedirectQuery, appRedirectQueryParmSchema, - 'Could not parse the app install query. Unknown Reason.' + 'Could not parse the app install query. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/shop-redact-request.model.ts b/apps/backend-serverless/src/models/shopify/shop-redact-request.model.ts index adcd7d40..c1cf8067 100644 --- a/apps/backend-serverless/src/models/shopify/shop-redact-request.model.ts +++ b/apps/backend-serverless/src/models/shopify/shop-redact-request.model.ts @@ -12,6 +12,6 @@ export const parseAndValidateShopRedactRequestBody = (shopRedactRequestBody: unk return parseAndValidateStrict( shopRedactRequestBody, shopRedactRequestScheme, - 'Could not parse the shop redact body. Unknown Reason.' + 'Could not parse the shop redact body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/shopify-request-headers.model.ts b/apps/backend-serverless/src/models/shopify/shopify-request-headers.model.ts index 27dab7a2..9c09bfad 100644 --- a/apps/backend-serverless/src/models/shopify/shopify-request-headers.model.ts +++ b/apps/backend-serverless/src/models/shopify/shopify-request-headers.model.ts @@ -13,6 +13,6 @@ export const parseAndValidateShopifyRequestHeaders = (shopifyRequestHeaders: unk return parseAndValidateStrict( shopifyRequestHeaders, shopifyRequestHeadersScheme, - 'Could not parse the shopify request headers. Unknown Reason.' + 'Could not parse the shopify request headers. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/shopify/shopify-webhook-headers.model.ts b/apps/backend-serverless/src/models/shopify/shopify-webhook-headers.model.ts index d410699c..0432f867 100644 --- a/apps/backend-serverless/src/models/shopify/shopify-webhook-headers.model.ts +++ b/apps/backend-serverless/src/models/shopify/shopify-webhook-headers.model.ts @@ -26,6 +26,6 @@ export const parseAndValidateShopifyWebhookHeaders = (shopifyRequestHeaders: any return parseAndValidateStrict( headersLowerCased, shopifyWebhookHeadersScheme, - 'Could not parse the Shopify webhook headers. Unknown Reason.' + 'Could not parse the Shopify webhook headers. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/sqs/process-transaction-message.model.ts b/apps/backend-serverless/src/models/sqs/process-transaction-message.model.ts index 52ea5d04..6b891424 100644 --- a/apps/backend-serverless/src/models/sqs/process-transaction-message.model.ts +++ b/apps/backend-serverless/src/models/sqs/process-transaction-message.model.ts @@ -8,11 +8,11 @@ export const processTransactionMessageSchema = object().shape({ export type ProcessTransactionMessage = InferType; export const parseAndValidateProcessTransactionMessage = ( - processTransctionMessageBody: unknown + processTransctionMessageBody: unknown, ): ProcessTransactionMessage => { return parseAndValidateStrict( processTransctionMessageBody, processTransactionMessageSchema, - 'Could not parse the process transaction message body. Unknown Reason.' + 'Could not parse the process transaction message body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/sqs/shopify-mutation-retry.model.ts b/apps/backend-serverless/src/models/sqs/shopify-mutation-retry.model.ts index 5a3a49bb..886b4184 100644 --- a/apps/backend-serverless/src/models/sqs/shopify-mutation-retry.model.ts +++ b/apps/backend-serverless/src/models/sqs/shopify-mutation-retry.model.ts @@ -63,6 +63,6 @@ export const parseAndValidateShopifyMutationRetry = (shopifyMutationRetryBody: u return parseAndValidateStrict( shopifyMutationRetryBody, shopifyMutationRetrySchema, - 'Could not parse the shopify mutation retry body. Unknown Reason.' + 'Could not parse the shopify mutation retry body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/sqs/solana-pay-info-message.model.ts b/apps/backend-serverless/src/models/sqs/solana-pay-info-message.model.ts index 39c4376e..c878d0c2 100644 --- a/apps/backend-serverless/src/models/sqs/solana-pay-info-message.model.ts +++ b/apps/backend-serverless/src/models/sqs/solana-pay-info-message.model.ts @@ -12,6 +12,6 @@ export const parseAndValidateSolanaPayInfoMessage = (solanaPayInfoMessageBody: u return parseAndValidateStrict( solanaPayInfoMessageBody, solanaPayInfoMessageSchema, - 'Could not parse the solana pay info message body. Unknown Reason.' + 'Could not parse the solana pay info message body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/step-functions/safety-key-sweep.model.ts b/apps/backend-serverless/src/models/step-functions/safety-key-sweep.model.ts index 7ee3458b..a93596d3 100644 --- a/apps/backend-serverless/src/models/step-functions/safety-key-sweep.model.ts +++ b/apps/backend-serverless/src/models/step-functions/safety-key-sweep.model.ts @@ -11,6 +11,6 @@ export const parseAndValidateSafetyKeyMessage = (safetyKeyMessageBody: unknown): return parseAndValidateStrict( safetyKeyMessageBody, safetyKeyMessageSchema, - 'Could not parse the safety key message. Unknown Reason.' + 'Could not parse the safety key message. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/transaction-requests/payment-request-parameters.model.ts b/apps/backend-serverless/src/models/transaction-requests/payment-request-parameters.model.ts index 26d8d8a9..3c74f2f8 100644 --- a/apps/backend-serverless/src/models/transaction-requests/payment-request-parameters.model.ts +++ b/apps/backend-serverless/src/models/transaction-requests/payment-request-parameters.model.ts @@ -11,6 +11,6 @@ export const parseAndValidatePaymentRequest = (paymentStatusRequestParameters: u return parseAndValidateStrict( paymentStatusRequestParameters, paymentRequestParametersScheme, - 'Can not parse payment transaction request parameters. Unkownn reason.' + 'Can not parse payment transaction request parameters. Unkownn reason.', ); }; diff --git a/apps/backend-serverless/src/models/transaction-requests/refund-transaction-request.model.ts b/apps/backend-serverless/src/models/transaction-requests/refund-transaction-request.model.ts index 44c23702..b0d0d8aa 100644 --- a/apps/backend-serverless/src/models/transaction-requests/refund-transaction-request.model.ts +++ b/apps/backend-serverless/src/models/transaction-requests/refund-transaction-request.model.ts @@ -8,11 +8,11 @@ export const refundTransactionRequestScheme = object().shape({ export type RefundTransactionRequest = InferType; export const parseAndValidateRefundTransactionRequest = ( - refundTransactionRequestBody: unknown + refundTransactionRequestBody: unknown, ): RefundTransactionRequest => { return parseAndValidateStrict( refundTransactionRequestBody, refundTransactionRequestScheme, - 'Could not parse the refund transaction request body. Unknown Reason.' + 'Could not parse the refund transaction request body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/transaction-requests/transaction-request-body.model.ts b/apps/backend-serverless/src/models/transaction-requests/transaction-request-body.model.ts index a5d10e48..504d33d6 100644 --- a/apps/backend-serverless/src/models/transaction-requests/transaction-request-body.model.ts +++ b/apps/backend-serverless/src/models/transaction-requests/transaction-request-body.model.ts @@ -11,6 +11,6 @@ export const parseAndValidateTransactionRequestBody = (transactionRequestBody: u return parseAndValidateStrict( transactionRequestBody, transactionRequestBodySchema, - 'Could not parse the transaction request body. Unknown Reason.' + 'Could not parse the transaction request body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/transaction-requests/transaction-request-response.model.ts b/apps/backend-serverless/src/models/transaction-requests/transaction-request-response.model.ts index ade33fe3..ca6f0014 100644 --- a/apps/backend-serverless/src/models/transaction-requests/transaction-request-response.model.ts +++ b/apps/backend-serverless/src/models/transaction-requests/transaction-request-response.model.ts @@ -9,11 +9,11 @@ export const transactionRequestResponseScheme = object().shape({ export type TransactionRequestResponse = InferType; export const parseAndValidateTransactionRequestResponse = ( - transactionRequestResponseBody: unknown + transactionRequestResponseBody: unknown, ): TransactionRequestResponse => { return parseAndValidateStrict( transactionRequestResponseBody, transactionRequestResponseScheme, - 'Could not parse the transaction request response. Unknown Reason.' + 'Could not parse the transaction request response. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/models/websockets/connect.model.ts b/apps/backend-serverless/src/models/websockets/connect.model.ts index 0f73967c..feac497a 100644 --- a/apps/backend-serverless/src/models/websockets/connect.model.ts +++ b/apps/backend-serverless/src/models/websockets/connect.model.ts @@ -11,6 +11,6 @@ export const parseAndValidateConnectSchema = (connectSchemaBody: unknown): Conne return parseAndValidateStrict( connectSchemaBody, connectSchema, - 'Could not parse the merchant auth token body. Unknown Reason.' + 'Could not parse the merchant auth token body. Unknown Reason.', ); }; diff --git a/apps/backend-serverless/src/services/business-logic/contigently-handle-app-configure.service.ts b/apps/backend-serverless/src/services/business-logic/contigently-handle-app-configure.service.ts index 72bd02f8..cab073e5 100644 --- a/apps/backend-serverless/src/services/business-logic/contigently-handle-app-configure.service.ts +++ b/apps/backend-serverless/src/services/business-logic/contigently-handle-app-configure.service.ts @@ -9,7 +9,7 @@ import { sendAppConfigureRetryMessage } from '../sqs/sqs-send-message.service.js export const contingentlyHandleAppConfigure = async ( merchant: Merchant, axiosInstance: typeof axios, - prisma: PrismaClient + prisma: PrismaClient, ): Promise => { const merchantService = new MerchantService(prisma); @@ -27,7 +27,7 @@ export const contingentlyHandleAppConfigure = async ( merchant.id.slice(0, 10), true, merchant.shop, - merchant.accessToken + merchant.accessToken, ); validatePaymentAppConfigured(appConfigureResponse, merchant); diff --git a/apps/backend-serverless/src/services/business-logic/process-transaction.service.ts b/apps/backend-serverless/src/services/business-logic/process-transaction.service.ts index 55af1feb..b30a81ab 100644 --- a/apps/backend-serverless/src/services/business-logic/process-transaction.service.ts +++ b/apps/backend-serverless/src/services/business-logic/process-transaction.service.ts @@ -17,7 +17,7 @@ export const processTransaction = async ( signature: string, prisma: PrismaClient, websocketService: WebSocketService | null, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const transactionRecordService = new TransactionRecordService(prisma); diff --git a/apps/backend-serverless/src/services/coin-gecko.service.ts b/apps/backend-serverless/src/services/coin-gecko.service.ts index 18ba3f63..887db82b 100644 --- a/apps/backend-serverless/src/services/coin-gecko.service.ts +++ b/apps/backend-serverless/src/services/coin-gecko.service.ts @@ -10,7 +10,7 @@ const COIN_GECKO_API_BASE_URL = 'https://api.coingecko.com'; export const convertAmountAndCurrencyToUsdcSize = async ( givenAmount: number, currency: string, - axiosInstance: typeof axios + axiosInstance: typeof axios, ): Promise => { const coinGeckoApiKey = process.env.COIN_GECKO_API_KEY; diff --git a/apps/backend-serverless/src/services/database/gdpr-service.database.service.ts b/apps/backend-serverless/src/services/database/gdpr-service.database.service.ts index ce24caa9..a008899b 100644 --- a/apps/backend-serverless/src/services/database/gdpr-service.database.service.ts +++ b/apps/backend-serverless/src/services/database/gdpr-service.database.service.ts @@ -15,7 +15,7 @@ export class GDPRService { merchantId: merchantId, completed: false, }, - }) + }), ); } } diff --git a/apps/backend-serverless/src/services/database/merchant-service.database.service.ts b/apps/backend-serverless/src/services/database/merchant-service.database.service.ts index 20025c7e..1011a93f 100644 --- a/apps/backend-serverless/src/services/database/merchant-service.database.service.ts +++ b/apps/backend-serverless/src/services/database/merchant-service.database.service.ts @@ -45,12 +45,12 @@ export class MerchantService { const merchant = await prismaErrorHandler( this.prisma.merchant.findUnique({ where: query, - }) + }), ); if (merchant == null) { throw new MissingExpectedDatabaseRecordError( - 'Could not find merchant ' + JSON.stringify(query) + ' in database' + 'Could not find merchant ' + JSON.stringify(query) + ' in database', ); } return merchant; @@ -64,7 +64,7 @@ export class MerchantService { shop: shop, lastNonce: lastNonce, }, - }) + }), ); } @@ -77,7 +77,7 @@ export class MerchantService { id: merchant.id, }, data: filteredUpdate, - }) + }), ); } @@ -108,7 +108,7 @@ export class MerchantService { walletAddress: updatedWalletAddress, tokenAddress: updatedTokenAddress, }, - }) + }), ); } } diff --git a/apps/backend-serverless/src/services/database/payment-record-service.database.service.ts b/apps/backend-serverless/src/services/database/payment-record-service.database.service.ts index 7ad43b52..a3f6b37c 100644 --- a/apps/backend-serverless/src/services/database/payment-record-service.database.service.ts +++ b/apps/backend-serverless/src/services/database/payment-record-service.database.service.ts @@ -92,7 +92,7 @@ export class PaymentRecordService where: { id: transactionRecord.paymentRecordId, }, - }) + }), ); } @@ -102,7 +102,7 @@ export class PaymentRecordService where: { id, }, - }) + }), ); } @@ -117,7 +117,7 @@ export class PaymentRecordService transactionSignature: transactionSignature, completedAt: new Date(), }, - }) + }), ); } @@ -136,7 +136,7 @@ export class PaymentRecordService redirectUrl: resolveResponse.redirectUrl, completedAt: new Date(), }, - }) + }), ); } @@ -166,7 +166,7 @@ export class PaymentRecordService const paymentRecord = await prismaErrorHandler( this.prisma.paymentRecord.findFirst({ where: query, - }) + }), ); if (paymentRecord == null) { @@ -177,7 +177,7 @@ export class PaymentRecordService async getPaymentRecordsForMerchantWithPagination( query: PaymentRecordQuery, - pagination: Pagination + pagination: Pagination, ): Promise { return prismaErrorHandler( this.prisma.paymentRecord.findMany({ @@ -200,7 +200,7 @@ export class PaymentRecordService }, take: pagination.pageSize, skip: calculatePaginationSkip(pagination), - }) + }), ); } @@ -210,7 +210,7 @@ export class PaymentRecordService } async getPaymentRecordAndWebsocketServiceForTransactionSignature( - transactionSignature: string + transactionSignature: string, ): Promise<{ websocketSessions: WebsocketSession[] }> { const transactionRecord = await prismaErrorHandler( this.prisma.transactionRecord.findUnique({ @@ -222,7 +222,7 @@ export class PaymentRecordService }, }, }, - }) + }), ); if (transactionRecord && transactionRecord.paymentRecord) { @@ -237,7 +237,7 @@ export class PaymentRecordService } async getPaymentRecordAndWebsocketServiceForTransactionSignatures( - transactionSignatures: string[] + transactionSignatures: string[], ): Promise<{ websocketSessions: WebsocketSession[] }> { const transactionRecords = await prismaErrorHandler( this.prisma.transactionRecord.findMany({ @@ -249,7 +249,7 @@ export class PaymentRecordService }, }, }, - }) + }), ); let websocketSessions: WebsocketSession[] = []; @@ -279,7 +279,7 @@ export class PaymentRecordService }, ], }, - }) + }), ); } @@ -287,7 +287,7 @@ export class PaymentRecordService id: string, paymentInitiation: ShopifyPaymentInitiation, merchant: Merchant, - usdcAmount: number + usdcAmount: number, ): Promise { return prismaErrorHandler( this.prisma.paymentRecord.create({ @@ -308,7 +308,7 @@ export class PaymentRecordService completedAt: null, rejectionReason: null, }, - }) + }), ); } @@ -319,7 +319,7 @@ export class PaymentRecordService id: paymentRecord.id, }, data: update, - }) + }), ); } } diff --git a/apps/backend-serverless/src/services/database/record-service.database.service.ts b/apps/backend-serverless/src/services/database/record-service.database.service.ts index 8ed460f9..d2bd29ff 100644 --- a/apps/backend-serverless/src/services/database/record-service.database.service.ts +++ b/apps/backend-serverless/src/services/database/record-service.database.service.ts @@ -34,7 +34,7 @@ export interface RecordService { export const getRecordServiceForTransaction = async ( transactionRecord: TransactionRecord, - prisma: PrismaClient + prisma: PrismaClient, ): Promise> => { switch (transactionRecord.type) { case 'payment': diff --git a/apps/backend-serverless/src/services/database/refund-record-service.database.service.ts b/apps/backend-serverless/src/services/database/refund-record-service.database.service.ts index 1c55f44c..93af3343 100644 --- a/apps/backend-serverless/src/services/database/refund-record-service.database.service.ts +++ b/apps/backend-serverless/src/services/database/refund-record-service.database.service.ts @@ -83,7 +83,7 @@ export class RefundRecordService implements RecordService { const refundRecord = await prismaErrorHandler( this.prisma.refundRecord.findFirst({ @@ -173,12 +173,12 @@ export class RefundRecordService implements RecordService { return prismaErrorHandler( this.prisma.refundRecord.findMany({ @@ -206,13 +206,13 @@ export class RefundRecordService implements RecordService { return prismaErrorHandler( this.prisma.refundRecord.findMany({ @@ -238,7 +238,7 @@ export class RefundRecordService implements RecordService { return await prismaErrorHandler( this.prisma.refundRecord.create({ @@ -314,7 +314,7 @@ export class RefundRecordService implements RecordService { if (paymentRecordId == null && refundRecordId == null) { throw new Error('paymentRecordId and refundRecordId cannot both be null'); diff --git a/apps/backend-serverless/src/services/database/websocket.database.service.ts b/apps/backend-serverless/src/services/database/websocket.database.service.ts index 1bc4f4e8..4949e2fe 100644 --- a/apps/backend-serverless/src/services/database/websocket.database.service.ts +++ b/apps/backend-serverless/src/services/database/websocket.database.service.ts @@ -1,6 +1,6 @@ import { PrismaClient, WebsocketSession } from '@prisma/client'; -import { prismaErrorHandler } from './shared.database.service.js'; import { WebSocketSessionFetcher } from '../websocket/send-websocket-message.service.js'; +import { prismaErrorHandler } from './shared.database.service.js'; export type WebsocketPaymentRecordIdQuery = { paymentRecordId: string; @@ -30,7 +30,7 @@ export class WebsocketSessionService implements WebSocketSessionFetcher { const endpoint = accessTokenEndpoint(shop, authCode); diff --git a/apps/backend-serverless/src/services/fetch-transaction.service.ts b/apps/backend-serverless/src/services/fetch-transaction.service.ts index 9f3dea8e..9b48dcc3 100644 --- a/apps/backend-serverless/src/services/fetch-transaction.service.ts +++ b/apps/backend-serverless/src/services/fetch-transaction.service.ts @@ -1,5 +1,5 @@ -import axios from 'axios'; import * as web3 from '@solana/web3.js'; +import axios from 'axios'; import pkg from 'bs58'; import { MissingEnvError } from '../errors/missing-env.error.js'; const { decode } = pkg; diff --git a/apps/backend-serverless/src/services/helius.service.ts b/apps/backend-serverless/src/services/helius.service.ts index 41bf1882..4094c435 100644 --- a/apps/backend-serverless/src/services/helius.service.ts +++ b/apps/backend-serverless/src/services/helius.service.ts @@ -153,7 +153,7 @@ export const getPubkeyTypeForProgramOwner = (owner: PubkeyOwner): PubkeyType => return PubkeyType.token; default: throw new InvalidInputError( - 'Invalid payment address input. You must enter a wallet address or USDC token account address.' + 'Invalid payment address input. You must enter a wallet address or USDC token account address.', ); } }; diff --git a/apps/backend-serverless/src/services/shopify-retry/retry-app-configure.service.ts b/apps/backend-serverless/src/services/shopify-retry/retry-app-configure.service.ts index 5f7171ae..9981abc5 100644 --- a/apps/backend-serverless/src/services/shopify-retry/retry-app-configure.service.ts +++ b/apps/backend-serverless/src/services/shopify-retry/retry-app-configure.service.ts @@ -9,7 +9,7 @@ import { validatePaymentAppConfigured } from '../shopify/validate-payment-app-co export const retryAppConfigure = async ( appConfigureInfo: ShopifyMutationAppConfigure | null, prisma: PrismaClient, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const merchantService = new MerchantService(prisma); @@ -30,7 +30,7 @@ export const retryAppConfigure = async ( merchant.id, appConfigureInfo.state, merchant.shop, - merchant.accessToken + merchant.accessToken, ); validatePaymentAppConfigured(configureAppResponse, merchant); diff --git a/apps/backend-serverless/src/services/shopify-retry/retry-payment-reject.service.ts b/apps/backend-serverless/src/services/shopify-retry/retry-payment-reject.service.ts index 0b32625e..ad775a57 100644 --- a/apps/backend-serverless/src/services/shopify-retry/retry-payment-reject.service.ts +++ b/apps/backend-serverless/src/services/shopify-retry/retry-payment-reject.service.ts @@ -10,7 +10,7 @@ import { validatePaymentSessionRejected } from '../shopify/validate-payment-sess export const retryPaymentReject = async ( paymentRejectInfo: ShopifyMutationPaymentReject | null, prisma: PrismaClient, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const merchantService = new MerchantService(prisma); const paymentRecordService = new PaymentRecordService(prisma); @@ -37,7 +37,7 @@ export const retryPaymentReject = async ( paymentRecord.shopGid, paymentRejectInfo.reason, merchant.shop, - merchant.accessToken + merchant.accessToken, ); validatePaymentSessionRejected(rejectPaymentResponse); diff --git a/apps/backend-serverless/src/services/shopify-retry/retry-payment-resolve.service.ts b/apps/backend-serverless/src/services/shopify-retry/retry-payment-resolve.service.ts index 4e1e72dd..83b919b3 100644 --- a/apps/backend-serverless/src/services/shopify-retry/retry-payment-resolve.service.ts +++ b/apps/backend-serverless/src/services/shopify-retry/retry-payment-resolve.service.ts @@ -10,7 +10,7 @@ import { validatePaymentSessionResolved } from '../shopify/validate-payment-sess export const retryPaymentResolve = async ( paymentResolveInfo: ShopifyMutationPaymentResolve | null, prisma: PrismaClient, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const merchantService = new MerchantService(prisma); const paymentRecordService = new PaymentRecordService(prisma); @@ -36,7 +36,7 @@ export const retryPaymentResolve = async ( const resolvePaymentResponse = await paymentSessionResolve( paymentRecord.shopGid, merchant.shop, - merchant.accessToken + merchant.accessToken, ); const resolvePaymentData = validatePaymentSessionResolved(resolvePaymentResponse); diff --git a/apps/backend-serverless/src/services/shopify-retry/retry-refund-reject.service.ts b/apps/backend-serverless/src/services/shopify-retry/retry-refund-reject.service.ts index c19607f7..92e8ae22 100644 --- a/apps/backend-serverless/src/services/shopify-retry/retry-refund-reject.service.ts +++ b/apps/backend-serverless/src/services/shopify-retry/retry-refund-reject.service.ts @@ -9,7 +9,7 @@ import { validateRefundSessionRejected } from '../shopify/validate-refund-sessio export const retryRefundReject = async ( refundRejectInfo: ShopifyMutationRefundReject | null, prisma: PrismaClient, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const merchantService = new MerchantService(prisma); const refundRecordService = new RefundRecordService(prisma); @@ -37,7 +37,7 @@ export const retryRefundReject = async ( refundRejectInfo.code, refundRejectInfo.merchantMessage, merchant.shop, - merchant.accessToken + merchant.accessToken, ); validateRefundSessionRejected(rejectRefundResponse); diff --git a/apps/backend-serverless/src/services/shopify-retry/retry-refund-resolve.service.ts b/apps/backend-serverless/src/services/shopify-retry/retry-refund-resolve.service.ts index 93f6a3f4..2a7cc42c 100644 --- a/apps/backend-serverless/src/services/shopify-retry/retry-refund-resolve.service.ts +++ b/apps/backend-serverless/src/services/shopify-retry/retry-refund-resolve.service.ts @@ -9,7 +9,7 @@ import { validateRefundSessionResolved } from '../shopify/validate-refund-sessio export const retryRefundResolve = async ( refundResolveInfo: ShopifyMutationRefundResolve | null, prisma: PrismaClient, - axiosInstance: typeof axios + axiosInstance: typeof axios, ) => { const merchantService = new MerchantService(prisma); const refundRecordService = new RefundRecordService(prisma); diff --git a/apps/backend-serverless/src/services/shopify/payment-app-configure.service.ts b/apps/backend-serverless/src/services/shopify/payment-app-configure.service.ts index 4e823528..8df80a16 100755 --- a/apps/backend-serverless/src/services/shopify/payment-app-configure.service.ts +++ b/apps/backend-serverless/src/services/shopify/payment-app-configure.service.ts @@ -58,7 +58,7 @@ export const makePaymentAppConfigure = (axiosInstance: typeof axios) => { break; default: throw new ShopifyResponseError( - 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data) + 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data), ); } } catch (error) { diff --git a/apps/backend-serverless/src/services/shopify/payment-session-reject.service.ts b/apps/backend-serverless/src/services/shopify/payment-session-reject.service.ts index d3086288..6caa5459 100755 --- a/apps/backend-serverless/src/services/shopify/payment-session-reject.service.ts +++ b/apps/backend-serverless/src/services/shopify/payment-session-reject.service.ts @@ -11,7 +11,7 @@ import { PaymentSessionStateRejectedReason } from '../../models/shopify-graphql- // TODO: Update these to marketing strings export const paymentSessionRejectionDisplayMessages = ( - reason: PaymentRecordRejectionReason + reason: PaymentRecordRejectionReason, ): { errorTitle: string; errorDescription: string } => { switch (reason) { case PaymentRecordRejectionReason.dependencySafetyReason: @@ -59,7 +59,7 @@ export const makePaymentSessionReject = id: string, reason: PaymentSessionStateRejectedReason, shop: string, - token: string + token: string, ): Promise => { const headers = { 'content-type': 'application/graphql', @@ -96,7 +96,7 @@ export const makePaymentSessionReject = break; default: throw new ShopifyResponseError( - 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data) + 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data), ); } } catch (error) { diff --git a/apps/backend-serverless/src/services/shopify/payment-session-resolve.service.ts b/apps/backend-serverless/src/services/shopify/payment-session-resolve.service.ts index 3884c62a..1b556b3a 100755 --- a/apps/backend-serverless/src/services/shopify/payment-session-resolve.service.ts +++ b/apps/backend-serverless/src/services/shopify/payment-session-resolve.service.ts @@ -70,7 +70,7 @@ export const makePaymentSessionResolve = (axiosInstance: typeof axios) => { break; default: throw new ShopifyResponseError( - 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data) + 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data), ); } } catch (error) { diff --git a/apps/backend-serverless/src/services/shopify/refund-session-reject.service.ts b/apps/backend-serverless/src/services/shopify/refund-session-reject.service.ts index b042928b..0d5cf4ec 100755 --- a/apps/backend-serverless/src/services/shopify/refund-session-reject.service.ts +++ b/apps/backend-serverless/src/services/shopify/refund-session-reject.service.ts @@ -34,7 +34,7 @@ export const makeRefundSessionReject = code: string, merchantMessage: string | undefined, shop: string, - token: string + token: string, ): Promise => { const headers = { 'content-type': 'application/json', @@ -77,7 +77,7 @@ export const makeRefundSessionReject = break; default: throw new ShopifyResponseError( - 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data) + 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data), ); } } catch (error) { diff --git a/apps/backend-serverless/src/services/shopify/refund-session-resolve.service.ts b/apps/backend-serverless/src/services/shopify/refund-session-resolve.service.ts index 07d3244c..d928d7c7 100755 --- a/apps/backend-serverless/src/services/shopify/refund-session-resolve.service.ts +++ b/apps/backend-serverless/src/services/shopify/refund-session-resolve.service.ts @@ -59,7 +59,7 @@ export const makeRefundSessionResolve = break; default: throw new ShopifyResponseError( - 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data) + 'non successful status code ' + response.status + '. data: ' + JSON.stringify(response.data), ); } } catch (error) { diff --git a/apps/backend-serverless/src/services/shopify/validate-payment-app-configured.service.ts b/apps/backend-serverless/src/services/shopify/validate-payment-app-configured.service.ts index 6519f17b..7ce05fad 100644 --- a/apps/backend-serverless/src/services/shopify/validate-payment-app-configured.service.ts +++ b/apps/backend-serverless/src/services/shopify/validate-payment-app-configured.service.ts @@ -1,11 +1,11 @@ import { Merchant } from '@prisma/client'; +import * as Sentry from '@sentry/serverless'; import { ShopifyResponseError } from '../../errors/shopify-response.error.js'; import { PaymentAppConfigureResponse } from '../../models/shopify-graphql-responses/payment-app-configure-response.model.js'; -import * as Sentry from '@sentry/serverless'; export const validatePaymentAppConfigured = ( paymentAppConfiguredResponse: PaymentAppConfigureResponse, - merchant: Merchant + merchant: Merchant, ) => { const userErrors = paymentAppConfiguredResponse.data.paymentsAppConfigure.userErrors; @@ -36,7 +36,7 @@ export const validatePaymentAppConfigured = ( 'merchant id does not match external handle. external handler: ' + externalHandle + ' merchant id: ' + - merchant.id + merchant.id, ); console.log(error); Sentry.captureException(error); diff --git a/apps/backend-serverless/src/services/shopify/validate-payment-session-rejected.service.ts b/apps/backend-serverless/src/services/shopify/validate-payment-session-rejected.service.ts index 5142a6f1..271316c5 100644 --- a/apps/backend-serverless/src/services/shopify/validate-payment-session-rejected.service.ts +++ b/apps/backend-serverless/src/services/shopify/validate-payment-session-rejected.service.ts @@ -8,7 +8,7 @@ import { } from '../../models/shopify-graphql-responses/shared.model.js'; export const validatePaymentSessionRejected = ( - paymentSessionRejectResponse: RejectPaymentResponse + paymentSessionRejectResponse: RejectPaymentResponse, ): { redirectUrl: string } => { const userErrors = paymentSessionRejectResponse.data.paymentSessionReject.userErrors; @@ -23,7 +23,7 @@ export const validatePaymentSessionRejected = ( if (paymentSession == null) { const error = new ShopifyResponseError( - 'payment session is null. ' + JSON.stringify(paymentSessionRejectResponse.data) + 'payment session is null. ' + JSON.stringify(paymentSessionRejectResponse.data), ); console.log(error); Sentry.captureException(error); @@ -44,7 +44,7 @@ export const validatePaymentSessionRejected = ( if (paymentSessionNextAction == null) { const error = new ShopifyResponseError( - 'payment session next action is nukk. ' + JSON.stringify(paymentSession) + 'payment session next action is nukk. ' + JSON.stringify(paymentSession), ); console.log(error); Sentry.captureException(error); diff --git a/apps/backend-serverless/src/services/shopify/validate-payment-session-resolved.service.ts b/apps/backend-serverless/src/services/shopify/validate-payment-session-resolved.service.ts index 8b4966f6..b8ea1835 100644 --- a/apps/backend-serverless/src/services/shopify/validate-payment-session-resolved.service.ts +++ b/apps/backend-serverless/src/services/shopify/validate-payment-session-resolved.service.ts @@ -1,3 +1,4 @@ +import * as Sentry from '@sentry/serverless'; import { ShopifyResponseError } from '../../errors/shopify-response.error.js'; import { ResolvePaymentResponse } from '../../models/shopify-graphql-responses/resolve-payment-response.model.js'; import { @@ -5,10 +6,9 @@ import { PaymentSessionStateCode, PaymentSessionStateResolved, } from '../../models/shopify-graphql-responses/shared.model.js'; -import * as Sentry from '@sentry/serverless'; export const validatePaymentSessionResolved = ( - paymentSessionResolveResponse: ResolvePaymentResponse + paymentSessionResolveResponse: ResolvePaymentResponse, ): { redirectUrl: string } => { const userErrors = paymentSessionResolveResponse.data.paymentSessionResolve.userErrors; @@ -23,7 +23,7 @@ export const validatePaymentSessionResolved = ( if (paymentSession == null) { const error = new ShopifyResponseError( - 'Payment session is null. ' + JSON.stringify(paymentSessionResolveResponse.data) + 'Payment session is null. ' + JSON.stringify(paymentSessionResolveResponse.data), ); console.log(error); Sentry.captureException(error); @@ -44,7 +44,7 @@ export const validatePaymentSessionResolved = ( if (paymentSessionNextAction == null) { const error = new ShopifyResponseError( - 'Payment session next action is null. ' + JSON.stringify(paymentSession) + 'Payment session next action is null. ' + JSON.stringify(paymentSession), ); console.log(error); Sentry.captureException(error); diff --git a/apps/backend-serverless/src/services/shopify/validate-refund-session-rejected.service.ts b/apps/backend-serverless/src/services/shopify/validate-refund-session-rejected.service.ts index bab2e5ef..3d1d8ce4 100644 --- a/apps/backend-serverless/src/services/shopify/validate-refund-session-rejected.service.ts +++ b/apps/backend-serverless/src/services/shopify/validate-refund-session-rejected.service.ts @@ -1,10 +1,10 @@ +import * as Sentry from '@sentry/serverless'; import { ShopifyResponseError } from '../../errors/shopify-response.error.js'; import { RejectRefundResponse } from '../../models/shopify-graphql-responses/reject-refund-response.model.js'; import { RefundSessionStateCode, RefundSessionStateRejected, } from '../../models/shopify-graphql-responses/shared.model.js'; -import * as Sentry from '@sentry/serverless'; export const validateRefundSessionRejected = (refundSessionRejectResponse: RejectRefundResponse) => { const userErrors = refundSessionRejectResponse.data.refundSessionReject.userErrors; @@ -20,7 +20,7 @@ export const validateRefundSessionRejected = (refundSessionRejectResponse: Rejec if (refundSession == null) { const error = new ShopifyResponseError( - 'Refund session is null. ' + JSON.stringify(refundSessionRejectResponse.data) + 'Refund session is null. ' + JSON.stringify(refundSessionRejectResponse.data), ); console.log(error); Sentry.captureException(error); @@ -31,7 +31,7 @@ export const validateRefundSessionRejected = (refundSessionRejectResponse: Rejec if (refundSessionStateTestResolved.code != RefundSessionStateCode.rejected) { const error = new ShopifyResponseError( - 'Refund session state is not rejected. ' + refundSessionStateTestResolved.code + 'Refund session state is not rejected. ' + refundSessionStateTestResolved.code, ); console.log(error); Sentry.captureException(error); diff --git a/apps/backend-serverless/src/services/shopify/validate-refund-session-resolved.service.ts b/apps/backend-serverless/src/services/shopify/validate-refund-session-resolved.service.ts index 334e9761..fd56fe90 100644 --- a/apps/backend-serverless/src/services/shopify/validate-refund-session-resolved.service.ts +++ b/apps/backend-serverless/src/services/shopify/validate-refund-session-resolved.service.ts @@ -1,10 +1,10 @@ +import * as Sentry from '@sentry/serverless'; import { ShopifyResponseError } from '../../errors/shopify-response.error.js'; import { ResolveRefundResponse } from '../../models/shopify-graphql-responses/resolve-refund-response.model.js'; import { RefundSessionStateCode, RefundSessionStateResolved, } from '../../models/shopify-graphql-responses/shared.model.js'; -import * as Sentry from '@sentry/serverless'; export const validateRefundSessionResolved = (refundSessionResolveResponse: ResolveRefundResponse) => { const userErrors = refundSessionResolveResponse.data.refundSessionResolve.userErrors; @@ -20,7 +20,7 @@ export const validateRefundSessionResolved = (refundSessionResolveResponse: Reso if (refundSession == null) { const error = new ShopifyResponseError( - 'Refund session is null. ' + JSON.stringify(refundSessionResolveResponse.data) + 'Refund session is null. ' + JSON.stringify(refundSessionResolveResponse.data), ); console.log(error); Sentry.captureException(error); @@ -31,7 +31,7 @@ export const validateRefundSessionResolved = (refundSessionResolveResponse: Reso if (refundSessionStateTestResolved.code != RefundSessionStateCode.resolved) { const error = new ShopifyResponseError( - 'Refund session state is not resolved. ' + refundSessionStateTestResolved.code + 'Refund session state is not resolved. ' + refundSessionStateTestResolved.code, ); console.log(error); Sentry.captureException(error); diff --git a/apps/backend-serverless/src/services/sqs/sqs-send-message.service.ts b/apps/backend-serverless/src/services/sqs/sqs-send-message.service.ts index c32adc38..8c4fd846 100644 --- a/apps/backend-serverless/src/services/sqs/sqs-send-message.service.ts +++ b/apps/backend-serverless/src/services/sqs/sqs-send-message.service.ts @@ -31,7 +31,7 @@ export const sendPaymentResolveRetryMessage = async (paymentId: string) => { null, null, null, - null + null, ); }; @@ -45,7 +45,7 @@ export const sendPaymentRejectRetryMessage = async (paymentId: string, reason: P }, null, null, - null + null, ); }; @@ -58,14 +58,14 @@ export const sendRefundResolveRetryMessage = async (refundId: string) => { refundId: refundId, }, null, - null + null, ); }; export const sendRefundRejectRetryMessage = async ( refundId: string, code: RefundSessionStateRejectedReason, - reason: string | undefined + reason: string | undefined, ) => { await sendRetryMessage( ShopifyMutationRetryType.refundReject, @@ -77,7 +77,7 @@ export const sendRefundRejectRetryMessage = async ( code: code, merchantMessage: reason, }, - null + null, ); }; @@ -96,7 +96,7 @@ export const sendRetryMessage = async ( refundReject: ShopifyMutationRefundReject | null, appConfigure: ShopifyMutationAppConfigure | null, retryStepIndex = 0, - sqs: pkg.SQS = new SQS() + sqs: pkg.SQS = new SQS(), ) => { const queueUrl = process.env.SHOPIFY_SQS_URL; diff --git a/apps/backend-serverless/src/services/step-function/start-execution-safety-sweep.service.ts b/apps/backend-serverless/src/services/step-function/start-execution-safety-sweep.service.ts index 35ca9990..fadb56a3 100644 --- a/apps/backend-serverless/src/services/step-function/start-execution-safety-sweep.service.ts +++ b/apps/backend-serverless/src/services/step-function/start-execution-safety-sweep.service.ts @@ -13,7 +13,7 @@ const { StepFunctions } = pkg; // Dependency injection is used here for easier testing export const startExecutionOfSafetySweep = async ( key: string, - stepFunctions: pkg.StepFunctions = new StepFunctions() + stepFunctions: pkg.StepFunctions = new StepFunctions(), ) => { const safetyMachineArn = process.env.SAFETY_ARN; @@ -31,7 +31,7 @@ export const startExecutionOfSafetySweep = async ( input: JSON.stringify({ key: key }), }) .promise(), - maxNumberOfExecutionAttempts + maxNumberOfExecutionAttempts, ); // TODO: Get error out of retry diff --git a/apps/backend-serverless/src/services/step-function/start-execution-shopify-retry.service.ts b/apps/backend-serverless/src/services/step-function/start-execution-shopify-retry.service.ts index 6db47067..f1b2496f 100644 --- a/apps/backend-serverless/src/services/step-function/start-execution-shopify-retry.service.ts +++ b/apps/backend-serverless/src/services/step-function/start-execution-shopify-retry.service.ts @@ -1,6 +1,6 @@ import pkg from 'aws-sdk'; -import { retry } from '../../utilities/shopify-retry/shopify-retry.utility.js'; import { MissingEnvError } from '../../errors/missing-env.error.js'; +import { retry } from '../../utilities/shopify-retry/shopify-retry.utility.js'; const { StepFunctions } = pkg; /** @@ -12,7 +12,7 @@ const { StepFunctions } = pkg; // Dependency injection is used here for easier testing export const startExecutionOfShopifyMutationRetry = async ( input: string, - stepFunctions: pkg.StepFunctions = new StepFunctions() + stepFunctions: pkg.StepFunctions = new StepFunctions(), ) => { const retryMachineArn = process.env.RETRY_ARN; @@ -30,7 +30,7 @@ export const startExecutionOfShopifyMutationRetry = async ( input: input, }) .promise(), - maxNumberOfExecutionAttempts + maxNumberOfExecutionAttempts, ); if (attempts === maxNumberOfExecutionAttempts) { diff --git a/apps/backend-serverless/src/services/transaction-request/fetch-payment-transaction.service.ts b/apps/backend-serverless/src/services/transaction-request/fetch-payment-transaction.service.ts index 958fc220..6f44e42e 100644 --- a/apps/backend-serverless/src/services/transaction-request/fetch-payment-transaction.service.ts +++ b/apps/backend-serverless/src/services/transaction-request/fetch-payment-transaction.service.ts @@ -14,7 +14,7 @@ export const fetchPaymentTransaction = async ( gas: string, singleUseNewAcc: string, singleUsePayer: string, - axiosInstance: typeof axios + axiosInstance: typeof axios, ): Promise => { if (merchant.walletAddress == null && merchant.tokenAddress == null) { throw new Error('Merchant payment address not found.'); @@ -42,7 +42,7 @@ export const fetchPaymentTransaction = async ( 'true', singleUseNewAcc, singleUsePayer, - 'test-one,test-two' // TODO: Update these with real values + 'test-one,test-two', // TODO: Update these with real values ); const headers = { 'Content-Type': 'application/json', diff --git a/apps/backend-serverless/src/services/transaction-request/fetch-refund-transaction.service.ts b/apps/backend-serverless/src/services/transaction-request/fetch-refund-transaction.service.ts index 410938d5..57ef9f4e 100644 --- a/apps/backend-serverless/src/services/transaction-request/fetch-refund-transaction.service.ts +++ b/apps/backend-serverless/src/services/transaction-request/fetch-refund-transaction.service.ts @@ -16,7 +16,7 @@ export const fetchRefundTransaction = async ( gas: string, singleUseNewAcc: string, singleUsePayer: string, - axiosInstance: typeof axios + axiosInstance: typeof axios, ): Promise => { // We can't refund a payment that doesn't exist if (associatedPaymentRecord.transactionSignature == null) { @@ -52,7 +52,7 @@ export const fetchRefundTransaction = async ( 'true', singleUseNewAcc, singleUsePayer, - 'test-one,test-two' // TODO: Update these with real values + 'test-one,test-two', // TODO: Update these with real values ); const headers = { 'Content-Type': 'application/json', diff --git a/apps/backend-serverless/src/services/transaction-validation/validate-discovered-payment-transaction.service.ts b/apps/backend-serverless/src/services/transaction-validation/validate-discovered-payment-transaction.service.ts index 7e5520e5..b8a55167 100644 --- a/apps/backend-serverless/src/services/transaction-validation/validate-discovered-payment-transaction.service.ts +++ b/apps/backend-serverless/src/services/transaction-validation/validate-discovered-payment-transaction.service.ts @@ -8,7 +8,7 @@ import { findPayingWalletFromTransaction } from '../../utilities/transaction-ins export const verifyTransactionWithRecord = ( record: PaymentRecord | RefundRecord, transaction: web3.Transaction, - weShouldHaveSigned: boolean + weShouldHaveSigned: boolean, ) => { if (weShouldHaveSigned) { verifyAppCreatedTheTransaction(transaction); @@ -90,7 +90,7 @@ export const verifyPayerIsNotHistoricalFeePayer = async (transaction: web3.Trans // KEEP export const verifyTransferInstructionIsCorrect = ( transaction: web3.Transaction, - record: PaymentRecord | RefundRecord + record: PaymentRecord | RefundRecord, ) => { // The token transfer is the second to last instruction included. We should check it's spot and that the // amount is correct. diff --git a/apps/backend-serverless/src/services/trm-service.service.ts b/apps/backend-serverless/src/services/trm-service.service.ts index 216ca321..33275e54 100644 --- a/apps/backend-serverless/src/services/trm-service.service.ts +++ b/apps/backend-serverless/src/services/trm-service.service.ts @@ -56,7 +56,7 @@ export class TrmService { private validateRiskLevelBelowMax(response: TrmWalletScreenResponse) { const riskLevelBelow5 = response.every((item: any) => - item.entities.every((entity: any) => entity.riskScoreLevel < TRM_MAX_RISK_LEVEL) + item.entities.every((entity: any) => entity.riskScoreLevel < TRM_MAX_RISK_LEVEL), ); if (!riskLevelBelow5) { diff --git a/apps/backend-serverless/src/services/websocket/send-websocket-message.service.ts b/apps/backend-serverless/src/services/websocket/send-websocket-message.service.ts index 7620d622..0787af5a 100644 --- a/apps/backend-serverless/src/services/websocket/send-websocket-message.service.ts +++ b/apps/backend-serverless/src/services/websocket/send-websocket-message.service.ts @@ -14,7 +14,7 @@ export class WebSocketService { constructor( apiGatewayEndpoint: string, private query: WebsocketQuery, - private websocketSessionService: WebSocketSessionFetcher + private websocketSessionService: WebSocketSessionFetcher, ) { this.apiGatewayManagementApi = new ApiGatewayManagementApi({ endpoint: apiGatewayEndpoint }); } diff --git a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-general-response.ts b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-general-response.ts index ede56619..ddaa7185 100644 --- a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-general-response.ts +++ b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-general-response.ts @@ -8,7 +8,7 @@ export interface GeneralResponse { export const createGeneralResponse = async ( merchantAuthToken: MerchantAuthToken, - prisma: PrismaClient + prisma: PrismaClient, ): Promise => { const refundRecordService = new RefundRecordService(prisma); const total = await refundRecordService.getTotalOpenRefundRecordsForMerchant({ diff --git a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-payment-response.utility.ts b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-payment-response.utility.ts index 6332495b..e14d38c1 100644 --- a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-payment-response.utility.ts +++ b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-payment-response.utility.ts @@ -1,8 +1,8 @@ -import { MerchantAuthToken } from '../../../models/clients/merchant-ui/merchant-auth-token.model.js'; import { PrismaClient } from '@prisma/client'; +import { MerchantAuthToken } from '../../../models/clients/merchant-ui/merchant-auth-token.model.js'; +import { PaymentRecordService } from '../../../services/database/payment-record-service.database.service.js'; import { Pagination } from './database-services.utility.js'; import { PaymentDataResponse, createPaymentDataResponseFromPaymentRecord } from './payment-record.utility.js'; -import { PaymentRecordService } from '../../../services/database/payment-record-service.database.service.js'; export interface PaymentResponse { page: number; @@ -14,12 +14,12 @@ export interface PaymentResponse { export const createPaymentResponse = async ( merchantAuthToken: MerchantAuthToken, pagination: Pagination, - prisma: PrismaClient + prisma: PrismaClient, ): Promise => { const paymentRecordService = new PaymentRecordService(prisma); const paymentsRecords = await paymentRecordService.getPaymentRecordsForMerchantWithPagination( { merchantId: merchantAuthToken.id }, - pagination + pagination, ); if (paymentsRecords == null || paymentsRecords.length == 0) { diff --git a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-refund-response.utility.ts b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-refund-response.utility.ts index df6898bf..66cbef25 100644 --- a/apps/backend-serverless/src/utilities/clients/merchant-ui/create-refund-response.utility.ts +++ b/apps/backend-serverless/src/utilities/clients/merchant-ui/create-refund-response.utility.ts @@ -20,7 +20,7 @@ export const createRefundResponse = async ( merchantAuthToken: MerchantAuthToken, status: RefundStatusOption, pagination: Pagination, - prisma: PrismaClient + prisma: PrismaClient, ): Promise => { const refundRecordService = new RefundRecordService(prisma); let refundRecords: (RefundRecord & { paymentRecord: PaymentRecord | null })[] | null; @@ -29,7 +29,7 @@ export const createRefundResponse = async ( if (status == RefundStatusOption.open) { refundRecords = await refundRecordService.getOpenRefundRecordsForMerchantWithPagination( { merchantId: merchantAuthToken.id }, - pagination + pagination, ); total = (await refundRecordService.getTotalOpenRefundRecordsForMerchant({ @@ -38,7 +38,7 @@ export const createRefundResponse = async ( } else { refundRecords = await refundRecordService.getClosedRefundRecordsForMerchantWithPagination( { merchantId: merchantAuthToken.id }, - pagination + pagination, ); total = (await refundRecordService.getTotalClosedRefundRecordsForMerchant({ diff --git a/apps/backend-serverless/src/utilities/clients/merchant-ui/refund-record.utility.ts b/apps/backend-serverless/src/utilities/clients/merchant-ui/refund-record.utility.ts index 8c1c7c6e..10ff1507 100644 --- a/apps/backend-serverless/src/utilities/clients/merchant-ui/refund-record.utility.ts +++ b/apps/backend-serverless/src/utilities/clients/merchant-ui/refund-record.utility.ts @@ -10,7 +10,7 @@ export interface RefundDataResponse { } export const createRefundDataResponseFromRefundRecord = ( - refundRecord: RefundRecord & { paymentRecord: PaymentRecord | null } + refundRecord: RefundRecord & { paymentRecord: PaymentRecord | null }, ): RefundDataResponse => { return { shopifyOrder: refundRecord.shopId, diff --git a/apps/backend-serverless/src/utilities/clients/payment-ui/create-payment-status-response.utility.ts b/apps/backend-serverless/src/utilities/clients/payment-ui/create-payment-status-response.utility.ts index 12d455d9..ca4a23b8 100644 --- a/apps/backend-serverless/src/utilities/clients/payment-ui/create-payment-status-response.utility.ts +++ b/apps/backend-serverless/src/utilities/clients/payment-ui/create-payment-status-response.utility.ts @@ -19,7 +19,7 @@ export interface PaymentErrrorResponse { export const createPaymentStatusResponse = ( paymentRecord: PaymentRecord, merchant: Merchant, - language: string + language: string, ): PaymentStatusResponse => { const merchantDisplayName = merchant.name ?? merchant.shop.split('.')[0]; const totalAmountFiatDisplay = paymentRecord.amount.toLocaleString(language, { diff --git a/apps/backend-serverless/src/utilities/generate-single-use-keypair.utility.ts b/apps/backend-serverless/src/utilities/generate-single-use-keypair.utility.ts index c4fcbfbe..bbe268be 100644 --- a/apps/backend-serverless/src/utilities/generate-single-use-keypair.utility.ts +++ b/apps/backend-serverless/src/utilities/generate-single-use-keypair.utility.ts @@ -12,6 +12,6 @@ export const generateSingleUseKeypairFromRecord = async (record: ShopifyRecord) const hashIntoPublicKey = async (inputs: string[]) => { return await web3.PublicKey.findProgramAddressSync( inputs.map(input => Buffer.from(input)), - web3.SystemProgram.programId + web3.SystemProgram.programId, )[0]; }; diff --git a/apps/backend-serverless/src/utilities/persona/get-kyb-state.ts b/apps/backend-serverless/src/utilities/persona/get-kyb-state.ts index 5409d09e..a14b7d47 100644 --- a/apps/backend-serverless/src/utilities/persona/get-kyb-state.ts +++ b/apps/backend-serverless/src/utilities/persona/get-kyb-state.ts @@ -1,7 +1,7 @@ import { KybState } from '@prisma/client'; import fetch from 'node-fetch'; -import { MissingEnvError } from '../../errors/missing-env.error.js'; import { DependencyError } from '../../errors/dependency.error.js'; +import { MissingEnvError } from '../../errors/missing-env.error.js'; export const getKybState = async (inquiryId: string): Promise => { const personaApiKey = process.env.PERSONA_API_KEY; diff --git a/apps/backend-serverless/src/utilities/pubkeys.utility.ts b/apps/backend-serverless/src/utilities/pubkeys.utility.ts index a7f13d0e..1fda28f3 100644 --- a/apps/backend-serverless/src/utilities/pubkeys.utility.ts +++ b/apps/backend-serverless/src/utilities/pubkeys.utility.ts @@ -1,15 +1,15 @@ -import * as web3 from '@solana/web3.js'; import { TOKEN_PROGRAM_ID } from '@solana/spl-token'; +import * as web3 from '@solana/web3.js'; import { SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID } from '../configs/tokens.config.js'; export async function findAssociatedTokenAddress( walletAddress: web3.PublicKey, - tokenMintAddress: web3.PublicKey + tokenMintAddress: web3.PublicKey, ): Promise { return ( await web3.PublicKey.findProgramAddress( [walletAddress.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), tokenMintAddress.toBuffer()], - SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID + SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID, ) )[0]; } diff --git a/apps/backend-serverless/src/utilities/responses/request-response.utility.ts b/apps/backend-serverless/src/utilities/responses/request-response.utility.ts index 18ff733c..8e53a32e 100755 --- a/apps/backend-serverless/src/utilities/responses/request-response.utility.ts +++ b/apps/backend-serverless/src/utilities/responses/request-response.utility.ts @@ -7,7 +7,7 @@ export const requestErrorResponse = (error: unknown) => { error: error.message, }, null, - 2 + 2, ), }; } else { @@ -18,7 +18,7 @@ export const requestErrorResponse = (error: unknown) => { error: 'Unknown Error', }, null, - 2 + 2, ), }; } diff --git a/apps/backend-serverless/src/utilities/testing-helper/common-model-test.utility.ts b/apps/backend-serverless/src/utilities/testing-helper/common-model-test.utility.ts index 4ad36747..b7b9982d 100644 --- a/apps/backend-serverless/src/utilities/testing-helper/common-model-test.utility.ts +++ b/apps/backend-serverless/src/utilities/testing-helper/common-model-test.utility.ts @@ -11,7 +11,7 @@ export function runValidParameterTest(parseAndValidateFunction: ParseAndValid export function runMissingFieldTests( parseAndValidateFunction: ParseAndValidateFn, validParams: T, - fields: string[] + fields: string[], ) { for (const field of fields) { it(`missing required field ${field}`, () => { @@ -29,7 +29,7 @@ export function runInvalidFieldTypeTests( parseAndValidateFunction: ParseAndValidateFn, validParams: T, fields: string[], - wrongTypes: Record + wrongTypes: Record, ) { for (const field of fields) { it(`invalid field type for ${field}`, () => { @@ -46,7 +46,7 @@ export function runInvalidFieldTypeTests( export function runEmptyFieldTests( parseAndValidateFunction: ParseAndValidateFn, validParams: T, - fields: string[] + fields: string[], ) { for (const field of fields) { it(`should throw an error when ${field} is empty`, () => { @@ -64,7 +64,7 @@ export function runMissingFieldTestsInArray( validatorFn: ParseAndValidateFn, validParams: T, arrayFieldName: string, - fields: string[] + fields: string[], ) { for (const field of fields) { it(`missing ${field} in array field ${arrayFieldName}`, () => { @@ -87,7 +87,7 @@ export function runInvalidFieldTypeTestsInArray( validParams: T, arrayFieldName: string, fields: string[], - wrongTypes: Record + wrongTypes: Record, ) { for (const field of fields) { it(`invalid type for ${field} in array field ${arrayFieldName}`, () => { @@ -107,7 +107,7 @@ export function runEmptyFieldTestsInArray( validatorFn: ParseAndValidateFn, validParams: T, arrayFieldName: string, - fields: string[] + fields: string[], ) { for (const field of fields) { it(`empty ${field} in array field ${arrayFieldName}`, () => { diff --git a/apps/backend-serverless/src/utilities/testing-helper/create-mock.utility.ts b/apps/backend-serverless/src/utilities/testing-helper/create-mock.utility.ts index ba14d2b9..f05249f4 100644 --- a/apps/backend-serverless/src/utilities/testing-helper/create-mock.utility.ts +++ b/apps/backend-serverless/src/utilities/testing-helper/create-mock.utility.ts @@ -98,7 +98,7 @@ export const createMockRefundRecord = (refundRecordData: Partial = * @returns a mock payment session resolve response to be used for testing only */ export const createMockSuccessPaymentSessionResolveResponse = ( - paymentSessionResolveResponse: Partial = {} + paymentSessionResolveResponse: Partial = {}, ): ResolvePaymentResponse => { return { data: { @@ -128,7 +128,7 @@ export const createMockSuccessPaymentSessionResolveResponse = ( * @returns a mock payment session resolve response to be used for testing only */ export const createMockSuccessPaymentSessionRejectResponse = ( - paymentSessionRejectResponse: Partial = {} + paymentSessionRejectResponse: Partial = {}, ): RejectPaymentResponse => { return { data: { @@ -167,7 +167,7 @@ export const createMockSuccessPaymentSessionRejectResponse = ( * @returns a mock refund session resolve response to be used for testing only */ export const createMockSuccessRefundSessionResolveResponse = ( - refundSessionResolveResponse: Partial = {} + refundSessionResolveResponse: Partial = {}, ): ResolveRefundResponse => { return { data: { @@ -191,7 +191,7 @@ export const createMockSuccessRefundSessionResolveResponse = ( * @returns a mock refund session reject response to be used for testing only */ export const createMockSuccessRefundSessionRejectResponse = ( - refundSessionRejectResponse: Partial = {} + refundSessionRejectResponse: Partial = {}, ): RejectRefundResponse => { return { data: { @@ -217,7 +217,7 @@ export const createMockSuccessRefundSessionRejectResponse = ( * @returns a mock payment app configure response to be used for testing only */ export const createMockPaymentAppConfigureResponse = ( - paymentAppConfigureResponse: Partial = {} + paymentAppConfigureResponse: Partial = {}, ): PaymentAppConfigureResponse => { return { data: { @@ -281,7 +281,7 @@ export const createMockTransactionRequestResponse = async ( payer: web3.PublicKey; receiver: web3.PublicKey; feePayer: web3.PublicKey; - }> = {} + }> = {}, ): Promise => { // const mockTransaction = await createMockTransaction(transactionResponseResponse); @@ -307,7 +307,7 @@ export const createMockTransaction = async ( payer: web3.PublicKey | null; receiver: web3.PublicKey | null; feePayer: web3.PublicKey | null; - }> = {} + }> = {}, ): Promise => { // Set up the transaction const payerPubkey = mockTransactionInputs.payer ?? web3.Keypair.generate().publicKey; @@ -323,7 +323,7 @@ export const createMockTransaction = async ( transferQuantity, 6, [], - TOKEN_PROGRAM_ID + TOKEN_PROGRAM_ID, ); const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction); return mockTransaction; diff --git a/apps/backend-serverless/src/utilities/transaction-inspection.utility.ts b/apps/backend-serverless/src/utilities/transaction-inspection.utility.ts index 491bc4d2..e4e1de0a 100644 --- a/apps/backend-serverless/src/utilities/transaction-inspection.utility.ts +++ b/apps/backend-serverless/src/utilities/transaction-inspection.utility.ts @@ -1,7 +1,7 @@ -import * as web3 from '@solana/web3.js'; +import * as Sentry from '@sentry/serverless'; import { TOKEN_PROGRAM_ID, decodeTransferCheckedInstruction } from '@solana/spl-token'; +import * as web3 from '@solana/web3.js'; import { USDC_MINT } from '../configs/tokens.config.js'; -import * as Sentry from '@sentry/serverless'; /** * * @param transaction the transaction to inspect diff --git a/apps/backend-serverless/src/utilities/transaction-request/endpoints.utility.ts b/apps/backend-serverless/src/utilities/transaction-request/endpoints.utility.ts index 2071ac22..e53dfe17 100755 --- a/apps/backend-serverless/src/utilities/transaction-request/endpoints.utility.ts +++ b/apps/backend-serverless/src/utilities/transaction-request/endpoints.utility.ts @@ -18,7 +18,7 @@ export const buildTransactionRequestEndpoint = ( createAta: string, singleUseNewAcc: string, singleUsePayer: string, - indexInputs: string + indexInputs: string, ) => { const TRANSACTION_REQUEST_SERVER_URL = process.env.TRANSACTION_REQUEST_SERVER_URL; diff --git a/apps/backend-serverless/src/utilities/transaction.utility.ts b/apps/backend-serverless/src/utilities/transaction.utility.ts index fad21794..bc9c823e 100644 --- a/apps/backend-serverless/src/utilities/transaction.utility.ts +++ b/apps/backend-serverless/src/utilities/transaction.utility.ts @@ -6,7 +6,7 @@ import { findAssociatedTokenAddress } from './pubkeys.utility.js'; export const createSweepingTransaction = async ( sendingKeypair: web3.PublicKey, - receivingKeypair: web3.PublicKey + receivingKeypair: web3.PublicKey, ): Promise => { const heliusApiKey = process.env.HELIUS_API_KEY; diff --git a/apps/merchant-ui/README.md b/apps/merchant-ui/README.md index 7b4a95c4..db145321 100755 --- a/apps/merchant-ui/README.md +++ b/apps/merchant-ui/README.md @@ -1,4 +1,3 @@ # Merchant UI -This UI allows merchants to approve and deny refunds, and have a record of all the payments they have received through solana pay - +This UI allows merchants to approve and deny refunds, and have a record of all the payments they have received through solana pay diff --git a/apps/merchant-ui/next.config.js b/apps/merchant-ui/next.config.js index 91ef62f0..b13dbe4e 100755 --- a/apps/merchant-ui/next.config.js +++ b/apps/merchant-ui/next.config.js @@ -1,6 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, + reactStrictMode: true, }; module.exports = nextConfig; diff --git a/apps/merchant-ui/src/AcceptModals.tsx b/apps/merchant-ui/src/AcceptModals.tsx index fabadfa4..3e1fe691 100644 --- a/apps/merchant-ui/src/AcceptModals.tsx +++ b/apps/merchant-ui/src/AcceptModals.tsx @@ -44,7 +44,7 @@ export function AcceptPolicy({ 'place-items-center', 'right-0', 'top-0', - 'z-10' + 'z-10', )} />
diff --git a/apps/merchant-ui/src/components/AddressInput.tsx b/apps/merchant-ui/src/components/AddressInput.tsx index e2fd13ec..37fefc07 100755 --- a/apps/merchant-ui/src/components/AddressInput.tsx +++ b/apps/merchant-ui/src/components/AddressInput.tsx @@ -35,7 +35,7 @@ export function AddressInput(props: Props) { 'grid-cols-[max-content,1fr]', 'grid', 'overflow-hidden', - 'rounded-lg' + 'rounded-lg', )} > @@ -48,7 +48,7 @@ export function AddressInput(props: Props) { 'w-11', 'disabled:opacity-50', 'hover:bg-gray-50', - 'disabled:hover:bg-transparent' + 'disabled:hover:bg-transparent', )} disabled={props.addressIsInvalid} onClick={async () => { diff --git a/apps/merchant-ui/src/components/Button/Primary.tsx b/apps/merchant-ui/src/components/Button/Primary.tsx index c37adfe7..0a6f8f0d 100755 --- a/apps/merchant-ui/src/components/Button/Primary.tsx +++ b/apps/merchant-ui/src/components/Button/Primary.tsx @@ -33,7 +33,7 @@ export const Primary = forwardRef(function Primary(pro 'disabled:bg-zinc-300', 'disabled:cursor-not-allowed', !pending && 'hover:bg-indigo-500', - pending && 'cursor-not-allowed' + pending && 'cursor-not-allowed', )} onClick={e => { if (!pending && !disabled) { @@ -52,7 +52,7 @@ export const Primary = forwardRef(function Primary(pro 'text-sm', 'transition-all', 'group-disabled:text-neutral-400', - pending ? 'opacity-0' : 'opacity-100' + pending ? 'opacity-0' : 'opacity-100', )} > {rest.children} diff --git a/apps/merchant-ui/src/components/Button/Secondary.tsx b/apps/merchant-ui/src/components/Button/Secondary.tsx index 68c0af39..b13730df 100755 --- a/apps/merchant-ui/src/components/Button/Secondary.tsx +++ b/apps/merchant-ui/src/components/Button/Secondary.tsx @@ -34,7 +34,7 @@ export const Secondary = forwardRef(function Secondary 'disabled:bg-zinc-300', 'disabled:cursor-not-allowed', !pending && 'hover:border-indigo-300', - pending && 'cursor-not-allowed' + pending && 'cursor-not-allowed', )} onClick={e => { if (!pending && !rest.disabled) { @@ -52,7 +52,7 @@ export const Secondary = forwardRef(function Secondary 'text-sm', 'transition-all', 'group-disabled:text-neutral-400', - pending ? 'opacity-0' : 'opacity-100' + pending ? 'opacity-0' : 'opacity-100', )} > {rest.children} diff --git a/apps/merchant-ui/src/components/ClosedRefunds.tsx b/apps/merchant-ui/src/components/ClosedRefunds.tsx index ed477d8e..234e4f96 100644 --- a/apps/merchant-ui/src/components/ClosedRefunds.tsx +++ b/apps/merchant-ui/src/components/ClosedRefunds.tsx @@ -143,7 +143,7 @@ export function ClosedRefunds(props: Props) { 'text-slate-700', 'text-sm', 'font-medium', - 'bg-slate-50' + 'bg-slate-50', )} > Refunded @@ -159,7 +159,7 @@ export function ClosedRefunds(props: Props) { 'text-red-700', 'text-sm', 'font-medium', - 'bg-red-50' + 'bg-red-50', )} > Refund Denied diff --git a/apps/merchant-ui/src/components/CompleteAccountSetupPrompt.tsx b/apps/merchant-ui/src/components/CompleteAccountSetupPrompt.tsx index bb09547d..44921df4 100755 --- a/apps/merchant-ui/src/components/CompleteAccountSetupPrompt.tsx +++ b/apps/merchant-ui/src/components/CompleteAccountSetupPrompt.tsx @@ -16,7 +16,7 @@ export function CompleteAccountSetupPrompt(props: Props) { 'place-items-center', 'relative', 'rounded-full', - 'w-14' + 'w-14', )} >
{props.percentComplete}% diff --git a/apps/merchant-ui/src/components/DefaultLayout.tsx b/apps/merchant-ui/src/components/DefaultLayout.tsx index 387592dd..8bc3cb84 100755 --- a/apps/merchant-ui/src/components/DefaultLayout.tsx +++ b/apps/merchant-ui/src/components/DefaultLayout.tsx @@ -30,7 +30,7 @@ export function DefaultLayout(props: Props) { 'top-0', 'z-10', navIsOpen && 'block', - 'md:hidden' + 'md:hidden', )} onClick={() => setNavIsOpen(false)} /> @@ -47,7 +47,7 @@ export function DefaultLayout(props: Props) { 'justify-between', 'px-3', 'py-5', - 'md:hidden' + 'md:hidden', )} > diff --git a/apps/merchant-ui/src/components/DefaultLayoutNavigation.tsx b/apps/merchant-ui/src/components/DefaultLayoutNavigation.tsx index 1d895725..5ce2c0b1 100755 --- a/apps/merchant-ui/src/components/DefaultLayoutNavigation.tsx +++ b/apps/merchant-ui/src/components/DefaultLayoutNavigation.tsx @@ -71,7 +71,7 @@ export function DefaultLayoutNavigation(props: Props) { 'md:relative', 'md:top-auto', 'md:translate-x-0', - props.className + props.className, )} orientation="vertical" > @@ -153,7 +153,7 @@ export function DefaultLayoutNavigation(props: Props) { 'px-3', 'py-2', 'rounded-md', - 'grid-cols-[24px,1fr,max-content]' + 'grid-cols-[24px,1fr,max-content]', )} > {cloneElement(, { diff --git a/apps/merchant-ui/src/components/DefaultLayoutNavigationExternalLink.tsx b/apps/merchant-ui/src/components/DefaultLayoutNavigationExternalLink.tsx index b2a8d0c9..6d3fdc97 100755 --- a/apps/merchant-ui/src/components/DefaultLayoutNavigationExternalLink.tsx +++ b/apps/merchant-ui/src/components/DefaultLayoutNavigationExternalLink.tsx @@ -22,7 +22,7 @@ export function DefaultLayoutNavigationExternalLink(props: Props) { 'px-3', 'py-2', 'rounded-md', - 'transition-colors' + 'transition-colors', )} href={props.href} target="_blank" diff --git a/apps/merchant-ui/src/components/DefaultLayoutNavigationLink.tsx b/apps/merchant-ui/src/components/DefaultLayoutNavigationLink.tsx index 0e3e1f3f..66dd7c9f 100755 --- a/apps/merchant-ui/src/components/DefaultLayoutNavigationLink.tsx +++ b/apps/merchant-ui/src/components/DefaultLayoutNavigationLink.tsx @@ -30,7 +30,7 @@ export function DefaultLayoutNavigationLink(props: Props) { 'rounded-md', 'transition-colors', isSelected && 'bg-slate-50', - props.renderInRhs ? 'grid-cols-[24px,1fr,max-content]' : 'grid-cols-[24px,1fr]' + props.renderInRhs ? 'grid-cols-[24px,1fr,max-content]' : 'grid-cols-[24px,1fr]', )} href={props.href} > @@ -41,14 +41,14 @@ export function DefaultLayoutNavigationLink(props: Props) { 'transition-colors', 'w-6', isSelected && 'fill-indigo-600', - props.icon.props.className + props.icon.props.className, ), })}
{props.text} diff --git a/apps/merchant-ui/src/components/FAQ.tsx b/apps/merchant-ui/src/components/FAQ.tsx index affb61e7..55b5f7f4 100644 --- a/apps/merchant-ui/src/components/FAQ.tsx +++ b/apps/merchant-ui/src/components/FAQ.tsx @@ -1,6 +1,6 @@ import * as Accordion from '@radix-ui/react-accordion'; -import { twMerge } from 'tailwind-merge'; import { useState } from 'react'; +import { twMerge } from 'tailwind-merge'; import { ArrowDropDownCircle } from './icons/ArrowDropDownCircle'; @@ -33,7 +33,7 @@ export function FAQ(props: Props) { 'h-6', 'w-6', 'transition-transform', - open.includes(qa.question) && '-rotate-180' + open.includes(qa.question) && '-rotate-180', )} /> diff --git a/apps/merchant-ui/src/components/FinishAccountSetupPrompt.tsx b/apps/merchant-ui/src/components/FinishAccountSetupPrompt.tsx index d9dd7114..ece56dce 100755 --- a/apps/merchant-ui/src/components/FinishAccountSetupPrompt.tsx +++ b/apps/merchant-ui/src/components/FinishAccountSetupPrompt.tsx @@ -121,7 +121,7 @@ export function FinishAccountSetupPrompt(props: Props) { 'space-y-2', 'flex-col', 'items-center', - props.className + props.className, )} >
🎉 Congrats, Solana Pay is now live!
diff --git a/apps/merchant-ui/src/components/FinishAccountSetupPromptListItem.tsx b/apps/merchant-ui/src/components/FinishAccountSetupPromptListItem.tsx index 1f63c1f9..e26050ad 100755 --- a/apps/merchant-ui/src/components/FinishAccountSetupPromptListItem.tsx +++ b/apps/merchant-ui/src/components/FinishAccountSetupPromptListItem.tsx @@ -31,7 +31,7 @@ export function FinishAccountSetupPromptListItem(props: Props) { 'grid', 'grid-cols-[max-content,1fr,max-content]', 'items-center', - props.className + props.className, )} > {/* */} @@ -56,7 +56,7 @@ export function FinishAccountSetupPromptListItem(props: Props) { 'items-center', 'space-x-2.5', 'text-emerald-700', - 'text-sm' + 'text-sm', )} >
Complete
diff --git a/apps/merchant-ui/src/components/GettingStartedAddWallet.tsx b/apps/merchant-ui/src/components/GettingStartedAddWallet.tsx index 9bb22d9d..810b65f4 100644 --- a/apps/merchant-ui/src/components/GettingStartedAddWallet.tsx +++ b/apps/merchant-ui/src/components/GettingStartedAddWallet.tsx @@ -65,7 +65,7 @@ export function GettingStartedAddWallet(props: Props) { 'grid', 'items-start', 'max-w-4xl', - 'mt-9' + 'mt-9', )} >
@@ -93,7 +93,7 @@ export function GettingStartedAddWallet(props: Props) { 'justify-end', 'mt-6', 'py-5', - 'space-x-3' + 'space-x-3', )} > router.back()}>Cancel diff --git a/apps/merchant-ui/src/components/ImageUpload.tsx b/apps/merchant-ui/src/components/ImageUpload.tsx index b051d400..0d97df88 100755 --- a/apps/merchant-ui/src/components/ImageUpload.tsx +++ b/apps/merchant-ui/src/components/ImageUpload.tsx @@ -48,7 +48,7 @@ export function ImageUpload(props: Props) { 'rounded-xl', 'transition-colors', isDragActive && 'border-indigo-300', - className + className, )} {...rootProps} > diff --git a/apps/merchant-ui/src/components/Input.tsx b/apps/merchant-ui/src/components/Input.tsx index 20b44e7b..f127da42 100755 --- a/apps/merchant-ui/src/components/Input.tsx +++ b/apps/merchant-ui/src/components/Input.tsx @@ -17,7 +17,7 @@ export function Input(props: Props) { 'text-slate-800', rest.disabled && 'bg-gray-100', rest.disabled && 'cursor-not-allowed', - className + className, )} /> ); diff --git a/apps/merchant-ui/src/components/KYBButton.tsx b/apps/merchant-ui/src/components/KYBButton.tsx index a8878c38..0ed0b5bd 100755 --- a/apps/merchant-ui/src/components/KYBButton.tsx +++ b/apps/merchant-ui/src/components/KYBButton.tsx @@ -56,7 +56,7 @@ export function KYBButton(props: Props) { 'place-items-center', 'right-0', 'top-0', - 'z-10' + 'z-10', )} > @@ -375,7 +375,7 @@ export function OpenRefunds(props: Props) { 'place-items-center', 'right-0', 'top-0', - 'z-10' + 'z-10', )} > diff --git a/apps/merchant-ui/src/components/PaginatedTable.tsx b/apps/merchant-ui/src/components/PaginatedTable.tsx index 67e185a5..b84673ef 100755 --- a/apps/merchant-ui/src/components/PaginatedTable.tsx +++ b/apps/merchant-ui/src/components/PaginatedTable.tsx @@ -86,7 +86,7 @@ export function PaginatedTable - ) + ), )}
@@ -163,7 +163,7 @@ export function PaginatedTable 0 ? 'pl-12' : 'pl-6' + ci > 0 ? 'pl-12' : 'pl-6', )} key={`${ri}-${ci}`} style={{ @@ -173,7 +173,7 @@ export function PaginatedTable - )) + )), )} ), @@ -190,7 +190,7 @@ export function PaginatedTable 0 ? 'pl-12' : 'pl-6' + ci > 0 ? 'pl-12' : 'pl-6', )} key={`${ri}-${ci}`} style={{ @@ -200,7 +200,7 @@ export function PaginatedTable - )) + )), )} ), @@ -220,7 +220,7 @@ export function PaginatedTable 0 ? 'pl-12' : 'pl-6' + ci > 0 ? 'pl-12' : 'pl-6', )} key={`${ri}-${ci}`} style={{ @@ -233,10 +233,10 @@ export function PaginatedTable ); - }) + }), )} - ) + ), )}
diff --git a/apps/merchant-ui/src/components/PaginatedTableArrowButton.tsx b/apps/merchant-ui/src/components/PaginatedTableArrowButton.tsx index 7295c3f9..fb9c9b2f 100755 --- a/apps/merchant-ui/src/components/PaginatedTableArrowButton.tsx +++ b/apps/merchant-ui/src/components/PaginatedTableArrowButton.tsx @@ -24,7 +24,7 @@ export function PaginatedTableArrowButton(props: Props) { 'disabled:opacity-50', 'md:border-none', 'md:p-0', - className + className, )} > {direction === 'left' && } diff --git a/apps/merchant-ui/src/components/PaginatedTablePageIndicatorButton.tsx b/apps/merchant-ui/src/components/PaginatedTablePageIndicatorButton.tsx index b3602b9d..7fe123af 100755 --- a/apps/merchant-ui/src/components/PaginatedTablePageIndicatorButton.tsx +++ b/apps/merchant-ui/src/components/PaginatedTablePageIndicatorButton.tsx @@ -23,7 +23,7 @@ export function PaginatedTablePageIndicatorButton(props: Props) { selected && 'bg-gray-50', selected && 'text-slate-800', 'w-10', - className + className, )} > {children} diff --git a/apps/merchant-ui/src/components/PaymentsHistoryStatus.tsx b/apps/merchant-ui/src/components/PaymentsHistoryStatus.tsx index 4bd4af89..9fc16855 100755 --- a/apps/merchant-ui/src/components/PaymentsHistoryStatus.tsx +++ b/apps/merchant-ui/src/components/PaymentsHistoryStatus.tsx @@ -70,7 +70,7 @@ export function PaymentsHistoryStatus(props: Props) { getBorder(props.status), getBgColor(props.status), getTextColor(props.status), - props.className + props.className, )} > {getText(props.status)} diff --git a/apps/merchant-ui/src/components/PlaceholderLogo.tsx b/apps/merchant-ui/src/components/PlaceholderLogo.tsx index 121c027f..91c7b85c 100755 --- a/apps/merchant-ui/src/components/PlaceholderLogo.tsx +++ b/apps/merchant-ui/src/components/PlaceholderLogo.tsx @@ -16,7 +16,7 @@ export function PlaceholderLogo(props: Props) { 'px-2', 'py-1', 'rounded-lg', - props.className + props.className, )} > diff --git a/apps/merchant-ui/src/components/RefundCount.tsx b/apps/merchant-ui/src/components/RefundCount.tsx index 85904c5b..fffc2b1d 100755 --- a/apps/merchant-ui/src/components/RefundCount.tsx +++ b/apps/merchant-ui/src/components/RefundCount.tsx @@ -16,7 +16,7 @@ export function RefundCount(props: Props) { 'rounded-full', 'text-indigo-600', 'text-xs', - props.className + props.className, )} > {props.refundCount} diff --git a/apps/merchant-ui/src/components/ShopifySignIn.tsx b/apps/merchant-ui/src/components/ShopifySignIn.tsx index 664031b7..ab8bf7ad 100755 --- a/apps/merchant-ui/src/components/ShopifySignIn.tsx +++ b/apps/merchant-ui/src/components/ShopifySignIn.tsx @@ -25,7 +25,7 @@ export function ShopifySignIn(props: Props) { 'items-center', 'justify-center', 'space-x-2', - props.className + props.className, )} > Shopify Logo diff --git a/apps/merchant-ui/src/components/StoreStatusBadge.tsx b/apps/merchant-ui/src/components/StoreStatusBadge.tsx index f096c571..76e9bfc1 100755 --- a/apps/merchant-ui/src/components/StoreStatusBadge.tsx +++ b/apps/merchant-ui/src/components/StoreStatusBadge.tsx @@ -24,7 +24,7 @@ export function StoreStatusBadge(props: Props) { 'text-sm', props.status === Status.Active ? 'bg-emerald-50' : 'bg-gray-100', props.status === Status.Active ? 'text-green-600' : 'text-slate-700', - props.className + props.className, )} >
Store {props.status === Status.Active ? 'active' : 'inactive'}
diff --git a/apps/merchant-ui/src/components/Tabs.tsx b/apps/merchant-ui/src/components/Tabs.tsx index 6eead848..e9a82bc1 100644 --- a/apps/merchant-ui/src/components/Tabs.tsx +++ b/apps/merchant-ui/src/components/Tabs.tsx @@ -1,5 +1,5 @@ -import { twMerge } from 'tailwind-merge'; import * as Tabs from '@radix-ui/react-tabs'; +import { twMerge } from 'tailwind-merge'; export const Root = Tabs.Root; export const Content = Tabs.Content; @@ -14,7 +14,7 @@ export function List(props: Tabs.TabsListProps) { 'flex', 'items-center', 'space-x-4', - props.className + props.className, )} /> ); @@ -35,7 +35,7 @@ export function Trigger(props: Tabs.TabsTriggerProps) { 'data-[state="active"]:border-indigo-600', 'data-[state="active"]:text-indigo-600', 'data-[state="active"]:font-semibold', - props.className + props.className, )} /> ); diff --git a/apps/merchant-ui/src/components/TokenSelect.tsx b/apps/merchant-ui/src/components/TokenSelect.tsx index e1463b75..5de64a0b 100755 --- a/apps/merchant-ui/src/components/TokenSelect.tsx +++ b/apps/merchant-ui/src/components/TokenSelect.tsx @@ -75,7 +75,7 @@ export function TokenSelect(props: Props) { !props.disabled && 'hover:bg-slate-50', props.disabled && 'bg-gray-100', props.disabled && 'cursor-not-allowed', - props.className + props.className, )} disabled={props.disabled} > @@ -103,7 +103,7 @@ export function TokenSelect(props: Props) { 'border-gray-300', 'overflow-hidden', 'p-1.5', - 'rounded-md' + 'rounded-md', )} > @@ -122,7 +122,7 @@ export function TokenSelect(props: Props) { 'rounded-md', 'transition-colors', 'hover:bg-slate-50', - 'focus:bg-slate-50' + 'focus:bg-slate-50', )} key={token} value={getTokenSymbol(token)} diff --git a/apps/merchant-ui/src/components/icons/UsdcIconCircle.tsx b/apps/merchant-ui/src/components/icons/UsdcIconCircle.tsx index 04da0b25..a4e08530 100644 --- a/apps/merchant-ui/src/components/icons/UsdcIconCircle.tsx +++ b/apps/merchant-ui/src/components/icons/UsdcIconCircle.tsx @@ -1,33 +1,23 @@ type Props = React.SVGAttributes; export function UsdcIconCircle(props: Props) { - return ( - - - - - - - - - - ); + return ( + + + + + + + + + + ); } diff --git a/apps/merchant-ui/src/components/ui/input.tsx b/apps/merchant-ui/src/components/ui/input.tsx index 7131b565..432d46a7 100644 --- a/apps/merchant-ui/src/components/ui/input.tsx +++ b/apps/merchant-ui/src/components/ui/input.tsx @@ -10,7 +10,7 @@ const Input = React.forwardRef(({ className, type, type={type} className={cn( 'flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', - className + className, )} ref={ref} {...props} diff --git a/apps/merchant-ui/src/components/ui/toast.tsx b/apps/merchant-ui/src/components/ui/toast.tsx index 3a35b028..c7773d99 100644 --- a/apps/merchant-ui/src/components/ui/toast.tsx +++ b/apps/merchant-ui/src/components/ui/toast.tsx @@ -14,7 +14,7 @@ const ToastViewport = React.forwardRef< ref={ref} className={cn( 'fixed bottom-0 right-0 md:right-1/3 z-[100] flex max-h-screen w-full flex-col p-4 md:max-w-[420px]', - className + className, )} {...props} /> @@ -36,7 +36,7 @@ const toastVariants = cva( defaultVariants: { variant: 'default', }, - } + }, ); const Toast = React.forwardRef< @@ -55,7 +55,7 @@ const ToastAction = React.forwardRef< ref={ref} className={cn( 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive/30 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive', - className + className, )} {...props} /> @@ -70,7 +70,7 @@ const ToastClose = React.forwardRef< ref={ref} className={cn( 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600', - className + className, )} toast-close="" {...props} diff --git a/apps/merchant-ui/src/components/ui/use-toast.ts b/apps/merchant-ui/src/components/ui/use-toast.ts index 2c94c2d4..9607cb06 100644 --- a/apps/merchant-ui/src/components/ui/use-toast.ts +++ b/apps/merchant-ui/src/components/ui/use-toast.ts @@ -1,189 +1,187 @@ // Inspired by react-hot-toast library -import * as React from "react" +import * as React from 'react'; -import type { ToastActionElement, ToastProps } from "@/components/ui/toast" +import type { ToastActionElement, ToastProps } from '@/components/ui/toast'; -const TOAST_LIMIT = 1 -const TOAST_REMOVE_DELAY = 1000000 +const TOAST_LIMIT = 1; +const TOAST_REMOVE_DELAY = 1000000; type ToasterToast = ToastProps & { - id: string - title?: React.ReactNode - description?: React.ReactNode - action?: ToastActionElement -} + id: string; + title?: React.ReactNode; + description?: React.ReactNode; + action?: ToastActionElement; +}; const actionTypes = { - ADD_TOAST: "ADD_TOAST", - UPDATE_TOAST: "UPDATE_TOAST", - DISMISS_TOAST: "DISMISS_TOAST", - REMOVE_TOAST: "REMOVE_TOAST", -} as const + ADD_TOAST: 'ADD_TOAST', + UPDATE_TOAST: 'UPDATE_TOAST', + DISMISS_TOAST: 'DISMISS_TOAST', + REMOVE_TOAST: 'REMOVE_TOAST', +} as const; -let count = 0 +let count = 0; function genId() { - count = (count + 1) % Number.MAX_VALUE - return count.toString() + count = (count + 1) % Number.MAX_VALUE; + return count.toString(); } -type ActionType = typeof actionTypes +type ActionType = typeof actionTypes; type Action = - | { - type: ActionType["ADD_TOAST"] - toast: ToasterToast - } - | { - type: ActionType["UPDATE_TOAST"] - toast: Partial - } - | { - type: ActionType["DISMISS_TOAST"] - toastId?: ToasterToast["id"] - } - | { - type: ActionType["REMOVE_TOAST"] - toastId?: ToasterToast["id"] - } + | { + type: ActionType['ADD_TOAST']; + toast: ToasterToast; + } + | { + type: ActionType['UPDATE_TOAST']; + toast: Partial; + } + | { + type: ActionType['DISMISS_TOAST']; + toastId?: ToasterToast['id']; + } + | { + type: ActionType['REMOVE_TOAST']; + toastId?: ToasterToast['id']; + }; interface State { - toasts: ToasterToast[] + toasts: ToasterToast[]; } -const toastTimeouts = new Map>() +const toastTimeouts = new Map>(); const addToRemoveQueue = (toastId: string) => { - if (toastTimeouts.has(toastId)) { - return - } + if (toastTimeouts.has(toastId)) { + return; + } - const timeout = setTimeout(() => { - toastTimeouts.delete(toastId) - dispatch({ - type: "REMOVE_TOAST", - toastId: toastId, - }) - }, TOAST_REMOVE_DELAY) + const timeout = setTimeout(() => { + toastTimeouts.delete(toastId); + dispatch({ + type: 'REMOVE_TOAST', + toastId: toastId, + }); + }, TOAST_REMOVE_DELAY); - toastTimeouts.set(toastId, timeout) -} + toastTimeouts.set(toastId, timeout); +}; export const reducer = (state: State, action: Action): State => { - switch (action.type) { - case "ADD_TOAST": - return { - ...state, - toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT), - } - - case "UPDATE_TOAST": - return { - ...state, - toasts: state.toasts.map((t) => - t.id === action.toast.id ? { ...t, ...action.toast } : t - ), - } - - case "DISMISS_TOAST": { - const { toastId } = action - - // ! Side effects ! - This could be extracted into a dismissToast() action, - // but I'll keep it here for simplicity - if (toastId) { - addToRemoveQueue(toastId) - } else { - state.toasts.forEach((toast) => { - addToRemoveQueue(toast.id) - }) - } - - return { - ...state, - toasts: state.toasts.map((t) => - t.id === toastId || toastId === undefined - ? { - ...t, - open: false, - } - : t - ), - } - } - case "REMOVE_TOAST": - if (action.toastId === undefined) { - return { - ...state, - toasts: [], + switch (action.type) { + case 'ADD_TOAST': + return { + ...state, + toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT), + }; + + case 'UPDATE_TOAST': + return { + ...state, + toasts: state.toasts.map(t => (t.id === action.toast.id ? { ...t, ...action.toast } : t)), + }; + + case 'DISMISS_TOAST': { + const { toastId } = action; + + // ! Side effects ! - This could be extracted into a dismissToast() action, + // but I'll keep it here for simplicity + if (toastId) { + addToRemoveQueue(toastId); + } else { + state.toasts.forEach(toast => { + addToRemoveQueue(toast.id); + }); + } + + return { + ...state, + toasts: state.toasts.map(t => + t.id === toastId || toastId === undefined + ? { + ...t, + open: false, + } + : t, + ), + }; } - } - return { - ...state, - toasts: state.toasts.filter((t) => t.id !== action.toastId), - } - } -} + case 'REMOVE_TOAST': + if (action.toastId === undefined) { + return { + ...state, + toasts: [], + }; + } + return { + ...state, + toasts: state.toasts.filter(t => t.id !== action.toastId), + }; + } +}; -const listeners: Array<(state: State) => void> = [] +const listeners: Array<(state: State) => void> = []; -let memoryState: State = { toasts: [] } +let memoryState: State = { toasts: [] }; function dispatch(action: Action) { - memoryState = reducer(memoryState, action) - listeners.forEach((listener) => { - listener(memoryState) - }) + memoryState = reducer(memoryState, action); + listeners.forEach(listener => { + listener(memoryState); + }); } -type Toast = Omit +type Toast = Omit; function toast({ ...props }: Toast) { - const id = genId() + const id = genId(); + + const update = (props: ToasterToast) => + dispatch({ + type: 'UPDATE_TOAST', + toast: { ...props, id }, + }); + const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id }); - const update = (props: ToasterToast) => dispatch({ - type: "UPDATE_TOAST", - toast: { ...props, id }, - }) - const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id }) - - dispatch({ - type: "ADD_TOAST", - toast: { - ...props, - id, - open: true, - onOpenChange: (open) => { - if (!open) dismiss() - }, - }, - }) - - return { - id: id, - dismiss, - update, - } + type: 'ADD_TOAST', + toast: { + ...props, + id, + open: true, + onOpenChange: open => { + if (!open) dismiss(); + }, + }, + }); + + return { + id: id, + dismiss, + update, + }; } function useToast() { - const [state, setState] = React.useState(memoryState) - - React.useEffect(() => { - listeners.push(setState) - return () => { - const index = listeners.indexOf(setState) - if (index > -1) { - listeners.splice(index, 1) - } - } - }, [state]) - - return { - ...state, - toast, - dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }), - } + const [state, setState] = React.useState(memoryState); + + React.useEffect(() => { + listeners.push(setState); + return () => { + const index = listeners.indexOf(setState); + if (index > -1) { + listeners.splice(index, 1); + } + }; + }, [state]); + + return { + ...state, + toast, + dismiss: (toastId?: string) => dispatch({ type: 'DISMISS_TOAST', toastId }), + }; } -export { useToast, toast } +export { toast, useToast }; diff --git a/apps/merchant-ui/src/hooks/useMockPayments.ts b/apps/merchant-ui/src/hooks/useMockPayments.ts index 4ae55743..3af96cbd 100755 --- a/apps/merchant-ui/src/hooks/useMockPayments.ts +++ b/apps/merchant-ui/src/hooks/useMockPayments.ts @@ -60,7 +60,7 @@ export function useMockPayments(page: number): RE.Result<{ RE.ok({ payments: MOCK_paymentS.slice(page * PAGE_SIZE, PAGE_SIZE + page * PAGE_SIZE), totalPages: 10, - }) + }), ); }, 500); }, [page]); diff --git a/apps/merchant-ui/src/hooks/useMockRefunds.ts b/apps/merchant-ui/src/hooks/useMockRefunds.ts index 9c268858..44494669 100644 --- a/apps/merchant-ui/src/hooks/useMockRefunds.ts +++ b/apps/merchant-ui/src/hooks/useMockRefunds.ts @@ -1,5 +1,5 @@ -import { useState, useEffect } from 'react'; import * as RE from '@/lib/Result'; +import { useEffect, useState } from 'react'; enum RefundStatus { AwaitingAction, diff --git a/apps/merchant-ui/src/lib/Result.ts b/apps/merchant-ui/src/lib/Result.ts index 4fc9f3d2..6a7b42f6 100644 --- a/apps/merchant-ui/src/lib/Result.ts +++ b/apps/merchant-ui/src/lib/Result.ts @@ -103,20 +103,20 @@ export function match( onFailure: (error: E) => R, onPending: () => R, onOk: (data: D) => R, - onStale: (data: D) => R + onStale: (data: D) => R, ): R; export function match( result: Result, onFailure: (error: E) => R, onPending: () => R, - onOk: (data: D, isStale: boolean) => R + onOk: (data: D, isStale: boolean) => R, ): R; export function match( result: Result, onFailure: (error: E) => R, onPending: () => R, onOk: (data: D, isStale: boolean) => R, - onStale?: (data: D) => R + onStale?: (data: D) => R, ): R { if (isFailed(result)) { return onFailure(result.error); diff --git a/apps/merchant-ui/src/lib/utils.ts b/apps/merchant-ui/src/lib/utils.ts index 23af5b26..883213c3 100644 --- a/apps/merchant-ui/src/lib/utils.ts +++ b/apps/merchant-ui/src/lib/utils.ts @@ -1,6 +1,6 @@ -import { ClassValue, clsx } from "clsx" -import { twMerge } from "tailwind-merge" - +import { ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; + export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)); } diff --git a/apps/merchant-ui/src/pages/_app.tsx b/apps/merchant-ui/src/pages/_app.tsx index a5ec0236..a7a00857 100755 --- a/apps/merchant-ui/src/pages/_app.tsx +++ b/apps/merchant-ui/src/pages/_app.tsx @@ -72,7 +72,7 @@ const Context: FC<{ children: ReactNode }> = ({ children }) => { onWalletNotFound: createDefaultWalletNotFoundHandler(), }), ], - [] + [], ); return ( diff --git a/apps/mock-shopify-serverless/src/handlers/access-token.ts b/apps/mock-shopify-serverless/src/handlers/access-token.ts index e30a6dae..23b6a66d 100644 --- a/apps/mock-shopify-serverless/src/handlers/access-token.ts +++ b/apps/mock-shopify-serverless/src/handlers/access-token.ts @@ -1,4 +1,4 @@ -import { APIGatewayProxyResultV2, APIGatewayProxyEventV2 } from 'aws-lambda'; +import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from 'aws-lambda'; export const accessToken = async (event: APIGatewayProxyEventV2): Promise => { return { diff --git a/apps/mock-shopify-serverless/src/handlers/payment-app.ts b/apps/mock-shopify-serverless/src/handlers/payment-app.ts index fa5d304b..fd3f239d 100644 --- a/apps/mock-shopify-serverless/src/handlers/payment-app.ts +++ b/apps/mock-shopify-serverless/src/handlers/payment-app.ts @@ -1,5 +1,4 @@ -import { APIGatewayProxyResultV2, APIGatewayProxyEventV2 } from 'aws-lambda'; -import crypto from 'crypto-js'; +import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from 'aws-lambda'; export const paymentApp = async (event: APIGatewayProxyEventV2): Promise => { const body = JSON.parse(event.body!); diff --git a/apps/mock-shopify-serverless/src/handlers/payment.ts b/apps/mock-shopify-serverless/src/handlers/payment.ts index 3bfcd64b..aa676e53 100644 --- a/apps/mock-shopify-serverless/src/handlers/payment.ts +++ b/apps/mock-shopify-serverless/src/handlers/payment.ts @@ -1,5 +1,4 @@ -import { APIGatewayProxyResultV2, APIGatewayProxyEventV2 } from 'aws-lambda'; -import crypto from 'crypto-js'; +import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from 'aws-lambda'; import axios from 'axios'; function getRandomArbitrary(min: number, max: number): number { diff --git a/apps/mock-shopify-serverless/src/models/authorize.models.ts b/apps/mock-shopify-serverless/src/models/authorize.models.ts index 86351583..63c4a493 100644 --- a/apps/mock-shopify-serverless/src/models/authorize.models.ts +++ b/apps/mock-shopify-serverless/src/models/authorize.models.ts @@ -1,4 +1,4 @@ -import { object, string, InferType, array } from 'yup'; +import { InferType, object, string } from 'yup'; import { parseAndValidate } from '../utilities/yup.utilities.js'; export const authorizeSchema = object().shape({ @@ -14,6 +14,6 @@ export const parseAndValidateRejectPaymentResponse = (authorizeParameters: any): return parseAndValidate( authorizeParameters, authorizeSchema, - 'Could not parse the authorize parameters. Unknown Reason.' + 'Could not parse the authorize parameters. Unknown Reason.', ); }; diff --git a/apps/payment-ui/src/components/Button.tsx b/apps/payment-ui/src/components/Button.tsx index c79b5b3c..c41d7874 100644 --- a/apps/payment-ui/src/components/Button.tsx +++ b/apps/payment-ui/src/components/Button.tsx @@ -1,5 +1,4 @@ import type { CSSProperties, FC, MouseEvent, PropsWithChildren, ReactElement } from 'react'; -import React from 'react'; export type ButtonProps = PropsWithChildren<{ className?: string; @@ -11,7 +10,7 @@ export type ButtonProps = PropsWithChildren<{ tabIndex?: number; }>; -export const Button: FC = (props) => { +export const Button: FC = props => { return (
); -} +}; -export default CancelTransactionButton; \ No newline at end of file +export default CancelTransactionButton; diff --git a/apps/payment-ui/src/components/CartAmountDisplay.tsx b/apps/payment-ui/src/components/CartAmountDisplay.tsx index 1f578158..c7effed7 100644 --- a/apps/payment-ui/src/components/CartAmountDisplay.tsx +++ b/apps/payment-ui/src/components/CartAmountDisplay.tsx @@ -1,15 +1,15 @@ -export const CartAmountDisplay = ( props: { displayAmount: string } ) => { +export const CartAmountDisplay = (props: { displayAmount: string }) => { return (
{props.displayAmount}
- ) -} + ); +}; export const CartAmountLoading = () => { return (
- ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/DisplaySection.tsx b/apps/payment-ui/src/components/DisplaySection.tsx index 2a79c485..9da770c4 100755 --- a/apps/payment-ui/src/components/DisplaySection.tsx +++ b/apps/payment-ui/src/components/DisplaySection.tsx @@ -1,6 +1,6 @@ -import { MdArrowBack } from 'react-icons/md'; -import Image from 'next/image'; import { getPaymentDetails } from '@/features/payment-details/paymentDetailsSlice'; +import Image from 'next/image'; +import { MdArrowBack } from 'react-icons/md'; import { useSelector } from 'react-redux'; const DisplaySection = () => { diff --git a/apps/payment-ui/src/components/ErrorGoBack.tsx b/apps/payment-ui/src/components/ErrorGoBack.tsx index e565bac7..5303e761 100644 --- a/apps/payment-ui/src/components/ErrorGoBack.tsx +++ b/apps/payment-ui/src/components/ErrorGoBack.tsx @@ -1,39 +1,42 @@ -import { VscArrowLeft } from 'react-icons/vsc' -import { ImWarning } from 'react-icons/im' +import { ImWarning } from 'react-icons/im'; +import { VscArrowLeft } from 'react-icons/vsc'; -export const ErrorGoBack = ( props: { top: string, bottom: string, redirect: string | null } ) => { +export const ErrorGoBack = (props: { top: string; bottom: string; redirect: string | null }) => { return (
- ) -} + ); +}; -const ErrorDisplay = ( props: { top: string, bottom: string } ) => { +const ErrorDisplay = (props: { top: string; bottom: string }) => { return ( -
-
- +
+
+
{'.'}
-
+
{props.top}
{props.bottom}
- ) -} + ); +}; -const GoBackButton = ( props: { redirect: string | null } ) => { +const GoBackButton = (props: { redirect: string | null }) => { return ( - - ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/ErrorView.tsx b/apps/payment-ui/src/components/ErrorView.tsx index 57b459c9..0d160791 100644 --- a/apps/payment-ui/src/components/ErrorView.tsx +++ b/apps/payment-ui/src/components/ErrorView.tsx @@ -1,47 +1,52 @@ -import { VscArrowLeft } from 'react-icons/vsc' -import { ImWarning } from 'react-icons/im' -import { getErrorDetails } from '@/features/payment-details/paymentDetailsSlice' -import { useSelector } from 'react-redux' +import { getErrorDetails } from '@/features/payment-details/paymentDetailsSlice'; +import { ImWarning } from 'react-icons/im'; +import { VscArrowLeft } from 'react-icons/vsc'; +import { useSelector } from 'react-redux'; export const ErrorView = () => { - - const errorDetails = useSelector(getErrorDetails) + const errorDetails = useSelector(getErrorDetails); + + const DEFAULT_ERROR_TITLE = 'Unknown Error'; + const DEFAULT_ERROR_DETAIL = 'Something went wrong. Please try again.'; - const DEFAULT_ERROR_TITLE = 'Unknown Error' - const DEFAULT_ERROR_DETAIL = 'Something went wrong. Please try again.' - return (
- +
- ) -} + ); +}; -const ErrorDisplay = ( props: { top: string, bottom: string } ) => { +const ErrorDisplay = (props: { top: string; bottom: string }) => { return ( -
-
- +
+
+
{'.'}
-
+
{props.top}
{props.bottom}
- ) -} + ); +}; -const GoBackButton = ( props: { redirect: string | null } ) => { +const GoBackButton = (props: { redirect: string | null }) => { return ( - - ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/FeeDisplay.tsx b/apps/payment-ui/src/components/FeeDisplay.tsx index 72cdc580..bbdb5305 100644 --- a/apps/payment-ui/src/components/FeeDisplay.tsx +++ b/apps/payment-ui/src/components/FeeDisplay.tsx @@ -1,21 +1,19 @@ -const FeePriceDisplayBase = ( props: { showFree: boolean } ) => { +const FeePriceDisplayBase = (props: { showFree: boolean }) => { return (
- { props.showFree ? 'Free' : '' } + {props.showFree ? 'Free' : ''}
- ) -} + ); +}; -export const FeePriceDisplay = ( ) => { - return ( - - ) -} +export const FeePriceDisplay = () => { + return ; +}; -export const FeePriceDisplayLoading = ( ) => { +export const FeePriceDisplayLoading = () => { return (
- ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/FooterSection.tsx b/apps/payment-ui/src/components/FooterSection.tsx index cd352b9e..fe36caca 100644 --- a/apps/payment-ui/src/components/FooterSection.tsx +++ b/apps/payment-ui/src/components/FooterSection.tsx @@ -1,27 +1,34 @@ -import { getPaymentMethod } from "@/features/payment-options/paymentOptionsSlice"; -import { MergedState, getMergedState } from "@/features/payment-session/paymentSessionSlice"; -import { useSelector } from "react-redux"; -import PayWithWalletSection from "./PayWithWalletSection"; -import CancelTransactionButton from "./CancelTransactionButton"; -import SolanaPayErrorView from "./SolanaPayErrorView"; -import { getConnectWalletNotification, getIsSolanaPayNotification, Notification } from "@/features/notification/notificationSlice"; +import { + Notification, + getConnectWalletNotification, + getIsSolanaPayNotification, +} from '@/features/notification/notificationSlice'; +import { getPaymentMethod } from '@/features/payment-options/paymentOptionsSlice'; +import { MergedState, getMergedState } from '@/features/payment-session/paymentSessionSlice'; +import { useSelector } from 'react-redux'; +import CancelTransactionButton from './CancelTransactionButton'; +import PayWithWalletSection from './PayWithWalletSection'; +import SolanaPayErrorView from './SolanaPayErrorView'; const FooterSection = () => { + const paymentMethod = useSelector(getPaymentMethod); + const mergedState = useSelector(getMergedState); + const isSolanaPayNotification = useSelector(getIsSolanaPayNotification); + const connectedWalletNotification = useSelector(getConnectWalletNotification); - const paymentMethod = useSelector(getPaymentMethod) - const mergedState = useSelector(getMergedState) - const isSolanaPayNotification = useSelector(getIsSolanaPayNotification) - const connectedWalletNotification = useSelector(getConnectWalletNotification) - - if ( paymentMethod == 'connect-wallet' && mergedState == MergedState.start ) { - return - } else if ( paymentMethod == 'qr-code' && isSolanaPayNotification ) { - return - } else if ( mergedState > MergedState.start && mergedState < MergedState.completed && connectedWalletNotification != Notification.declined ) { - return - } else { - return (
) + if (paymentMethod == 'connect-wallet' && mergedState == MergedState.start) { + return ; + } else if (paymentMethod == 'qr-code' && isSolanaPayNotification) { + return ; + } else if ( + mergedState > MergedState.start && + mergedState < MergedState.completed && + connectedWalletNotification != Notification.declined + ) { + return ; + } else { + return
; } -} +}; -export default FooterSection; \ No newline at end of file +export default FooterSection; diff --git a/apps/payment-ui/src/components/GeoBlockedView.tsx b/apps/payment-ui/src/components/GeoBlockedView.tsx index cc979443..aa2dce69 100644 --- a/apps/payment-ui/src/components/GeoBlockedView.tsx +++ b/apps/payment-ui/src/components/GeoBlockedView.tsx @@ -1,12 +1,9 @@ -import { useSelector } from "react-redux"; -import { ErrorGoBack } from "./ErrorGoBack" -import { getPaymentDetails } from "@/features/payment-details/paymentDetailsSlice"; +import { getPaymentDetails } from '@/features/payment-details/paymentDetailsSlice'; +import { useSelector } from 'react-redux'; +import { ErrorGoBack } from './ErrorGoBack'; export const GeoBlockedView = () => { - const paymentDetails = useSelector(getPaymentDetails); - return ( - - ) -} \ No newline at end of file + return ; +}; diff --git a/apps/payment-ui/src/components/MainSection.tsx b/apps/payment-ui/src/components/MainSection.tsx index 186f3fbf..abd9a53a 100755 --- a/apps/payment-ui/src/components/MainSection.tsx +++ b/apps/payment-ui/src/components/MainSection.tsx @@ -1,22 +1,14 @@ +import { BlockedProps } from '@/pages'; +import { useRouter } from 'next/router'; import React, { ReactNode } from 'react'; -import DisplaySection from './DisplaySection'; import CheckoutSection from './CheckoutSection'; -import { useDispatch, useSelector } from 'react-redux'; -import { AppDispatch } from '../store'; -import { useEffect } from 'react'; -import { useRouter } from 'next/router'; -import { BlockedProps } from '@/pages'; interface CheckoutWrapperProps { children: ReactNode; } - + const CheckoutWrapper: React.FC = ({ children }) => { - return ( -
- {children} -
- ); + return
{children}
; }; const MainSection = (props: BlockedProps) => { diff --git a/apps/payment-ui/src/components/PayAmountDisplay.tsx b/apps/payment-ui/src/components/PayAmountDisplay.tsx index 11da585a..71b21c15 100644 --- a/apps/payment-ui/src/components/PayAmountDisplay.tsx +++ b/apps/payment-ui/src/components/PayAmountDisplay.tsx @@ -1,16 +1,11 @@ -export const PayAmountDisplay = ( props: { displayAmoumt: string } ) => { - return ( -
- {props.displayAmoumt} -
- ) -} +export const PayAmountDisplay = (props: { displayAmoumt: string }) => { + return
{props.displayAmoumt}
; +}; export const PayAmountLoading = () => { return (
- ) -} - + ); +}; diff --git a/apps/payment-ui/src/components/PayAmountTokensDisplay.tsx b/apps/payment-ui/src/components/PayAmountTokensDisplay.tsx index cb871ccc..937128b8 100644 --- a/apps/payment-ui/src/components/PayAmountTokensDisplay.tsx +++ b/apps/payment-ui/src/components/PayAmountTokensDisplay.tsx @@ -1,15 +1,11 @@ -export const PayAmountTokensDisplay = ( props: { displayAmoumt: string } ) => { - return ( -
- {props.displayAmoumt} -
- ) -} +export const PayAmountTokensDisplay = (props: { displayAmoumt: string }) => { + return
{props.displayAmoumt}
; +}; export const PayAmountTokensLoading = () => { return (
- ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/PayToDisplay.tsx b/apps/payment-ui/src/components/PayToDisplay.tsx index abdf4c59..3091b45f 100644 --- a/apps/payment-ui/src/components/PayToDisplay.tsx +++ b/apps/payment-ui/src/components/PayToDisplay.tsx @@ -1,16 +1,11 @@ -export const PayToDisplay = ( props: { merchantName: string } ) => { - return ( -
- {'Pay to ' + props.merchantName} -
- ) - -} +export const PayToDisplay = (props: { merchantName: string }) => { + return
{'Pay to ' + props.merchantName}
; +}; export const PayToLoading = () => { return (
- ) -} \ No newline at end of file + ); +}; diff --git a/apps/payment-ui/src/components/PayToLabel.tsx b/apps/payment-ui/src/components/PayToLabel.tsx index f471a6cc..54bd175d 100755 --- a/apps/payment-ui/src/components/PayToLabel.tsx +++ b/apps/payment-ui/src/components/PayToLabel.tsx @@ -1,17 +1,21 @@ -import { useDispatch, useSelector } from 'react-redux'; -import { AppDispatch } from '../store'; -import { getPaymentDetails } from '@/features/payment-details/paymentDetailsSlice'; -import PaymentTokenSelector from '@/components/PaymentTokenSelector'; -import { FeePriceDisplay, FeePriceDisplayLoading } from '@/components/FeeDisplay'; import { CartAmountDisplay, CartAmountLoading } from '@/components/CartAmountDisplay'; -import { PayToDisplay, PayToLoading } from '@/components/PayToDisplay'; +import { FeePriceDisplay, FeePriceDisplayLoading } from '@/components/FeeDisplay'; import { PayAmountDisplay, PayAmountLoading } from '@/components/PayAmountDisplay'; import { PayAmountTokensDisplay, PayAmountTokensLoading } from '@/components/PayAmountTokensDisplay'; -import { PaymentMethod, getPayingToken, getPaymentMethod, setPaymentMethod } from '../features/payment-options/paymentOptionsSlice'; +import { PayToDisplay, PayToLoading } from '@/components/PayToDisplay'; +import PaymentTokenSelector from '@/components/PaymentTokenSelector'; +import { getPaymentDetails } from '@/features/payment-details/paymentDetailsSlice'; import { BiInfoCircle } from 'react-icons/bi'; +import { useDispatch, useSelector } from 'react-redux'; +import { + PaymentMethod, + getPayingToken, + getPaymentMethod, + setPaymentMethod, +} from '../features/payment-options/paymentOptionsSlice'; +import { AppDispatch } from '../store'; export const PayToLabel = () => { - const dispatch = useDispatch(); const payingToken = useSelector(getPayingToken); const paymentMethod = useSelector(getPaymentMethod); @@ -36,10 +40,22 @@ export const PayToLabel = () => { return (
- { paymentDetails == null ? : } - { paymentDetails == null ? : } + {paymentDetails == null ? ( + + ) : ( + + )} + {paymentDetails == null ? ( + + ) : ( + + )}
- { paymentDetails == null ? : } + {paymentDetails == null ? ( + + ) : ( + + )}
@@ -50,34 +66,44 @@ export const PayToLabel = () => {
Cart
- { paymentDetails == null ? : } + {paymentDetails == null ? ( + + ) : ( + + )}