Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processor initial config and Create Payment authorisation API implementation #3

Merged
merged 15 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion enabler/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<div id="app"></div>
<script type="module">
import { Connector } from '/lib/main.ts';
import { Connector } from '/enabler/src/main.ts';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running this locally with npm run dev it cant find this file. we will need to change this to :
/src/main.ts for it to start in dev


const sessionId = await getSessionId();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a new VITE env for session api url or region?

const res = await fetch(`http://localhost:3004/api/${projectKey}/sessions`, {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@koonweiteo-commercetools this file was just for testing purposes and we used it only locally, at some point we will remove this file entirelly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR, I am trying to focus only on Processor implementation, I will create another PR for Enabler changes.
you can ignore the small corrections in Enabler in this PR.

File renamed without changes.
3 changes: 2 additions & 1 deletion enabler/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"noUnusedParameters": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to set strict: true so that we can ensure stronger guarantees of program correctness.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree @koonweiteo-commercetools , but if that requiere to spend some time lets first try to deploy so we have a running connector and checkout can continue with the development of the integration and then this can be fixed.

"noFallthroughCasesInSwitch": true
},
"include": ["lib", "decs.d.ts"]
"include": [
"src", "decs.d.ts"]
}
17 changes: 17 additions & 0 deletions processor/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Server configuration
NODE_ENV=development
SERVER_HOST=0.0.0.0
SERVER_PORT=8080

# CoCo credentials
CTP_AUTH_URL=https://auth.[region].commercetools.com
CTP_API_URL=https://api.[region].commercetools.com
CTP_CLIENT_ID=[CoCo-client-id]
CTP_CLIENT_SECRET=[CoCo-client-secret]
CTP_PROJECT_KEY=[CoCo-project-key]
CTP_SESSION_URL=[CoCo-session-url]
prateek-ct marked this conversation as resolved.
Show resolved Hide resolved

# Merchant website
SELLER_RETURN_URL=[Merchant-website-return-url]
SELLER_SEND_NOTIFICATION_ENABLED=[true/false]
SELLER_NOTIFICATION_URL=[Merchant-website-return-url]
37 changes: 37 additions & 0 deletions processor/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"root": true,
"env": {
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint", "import", "jest", "prettier", "unused-imports"],
"rules": {
"no-redeclare": ["warn"],
"no-console": ["error"],
"no-unused-vars": "off",
"no-irregular-whitespace": "warn",
"no-duplicate-imports": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-unused-vars": ["warn"],
"import/no-duplicates": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
24 changes: 24 additions & 0 deletions processor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions processor/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
coverage
node_modules
pnpm-lock.yaml
10 changes: 10 additions & 0 deletions processor/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
arrowParens: 'always',
bracketSameLine: true,
bracketSpacing: true,
printWidth: 120,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
};
2 changes: 2 additions & 0 deletions processor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Payment Integration template Processor

6 changes: 6 additions & 0 deletions processor/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading
Loading