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

Conversation

praveenkumarct
Copy link
Contributor

@praveenkumarct praveenkumarct commented Jan 29, 2024

Processor implementation:

  • Initial configuration
  • Create Payment Authorization API
  • Process Card Payment using MockPaymentProvider Implementation
  • Config API
  • Status API

TODO:

  • Tests needs to be added

Ref: https://commercetools.atlassian.net/browse/IM-833

@praveenkumarct praveenkumarct requested review from a team, ddeliziact, prateek-ct and koonweiteo-commercetools and removed request for a team January 29, 2024 08:55
…-implementation

# Conflicts:
#	processor/package-lock.json
#	processor/package.json
processor/package.json Outdated Show resolved Hide resolved
processor/package.json Outdated Show resolved Hide resolved
processor/src/config/config.ts Outdated Show resolved Hide resolved
processor/src/libs/fastify/error-handler.ts Outdated Show resolved Hide resolved
processor/src/main.ts Outdated Show resolved Hide resolved
@leungkinghin-ct

This comment was marked as resolved.

@ddeliziact

This comment was marked as resolved.

processor/.env.template Outdated Show resolved Hide resolved
processor/src/config/config.ts Outdated Show resolved Hide resolved
const handler = statusHandler({
timeout: 3000,
checks: [
healthCheckCoCoPermissions({
Copy link
Contributor

Choose a reason for hiding this comment

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

this method will need improvement in terms of naming and managing permissions, client credentials might not have that hardcoded scope.

processor/src/services/payment.service.ts Outdated Show resolved Hide resolved
}),
});

ctCart = await this.ctCartService.addPayment({
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add some logic for error scenarios but something for later.

@@ -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

@@ -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.

@koonweiteo-commercetools
Copy link
Contributor

Please change vite config entry to src/main.ts. If not build wont work

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.

@@ -0,0 +1,24 @@
export const config = {
// Required by Payment SDK
projectKey: process.env.CTP_PROJECT_KEY || 'test',
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are required, it will be better to fail at startup instead of setting a default value as it will cause runtime errors.
We can leverage on fastify core plugin: https://github.com/fastify/fastify-env

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree... anyway lets do not focus on thee small things at this point and lets make sure to have a running connector and then we can fix the details.

Copy link
Contributor

Choose a reason for hiding this comment

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

@praveenkumarct if it is necessary lets create tickets to follow up on this once we have a running connector.

@praveenkumarct
Copy link
Contributor Author

Added TODOs for the other comments and few other small improvements in the processor implementation.

@prateek-ct prateek-ct merged commit 87fca38 into main Feb 1, 2024
2 checks passed
@praveenkumarct praveenkumarct deleted the enabler-and-processor-implementation branch February 6, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants