-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add checkout.com connector #522
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
base: main
Are you sure you want to change the base?
feat: add checkout.com connector #522
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for your contribution to Formance Connectivity module!
If you have any question or interrogation we'll be happy to help you.
Regarding the entityId issue, indeed it does not seem possible to fetch all accounts.
I think it is fine to have the entityId configured and to have multiple connectors if you have several accounts.
I’ll have a check on the testing issue for transfers
Would you need a first review from one of our dev (I’m not competent enough for a good review!)?
type: string | ||
name: | ||
type: string | ||
oauthClientID: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to specify "oauth", just name it "clientID" and "clientSecret" as we did for the other connectors
switch from.Status { | ||
case "Pending": | ||
return models.PAYMENT_STATUS_PENDING | ||
case "Captured", "Authorized", "Active": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure on this one, but we have "PAYMENT_STATUS_CAPTURE" which might be more relevant for this one?
type Config struct { | ||
// This is the config a user will pass when installing this connector. | ||
// Authentication criteria for connecting to your connector should be provided here. Example: | ||
Environment string `json:"environment" validate:"required"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest "isSandbox" with a boolean
OAuthClientID string `json:"oauthClientID" validate:"required"` | ||
OAuthClientSecret string `json:"oauthClientSecret" validate:"required"` | ||
EntityID string `json:"entityId" validate:"required"` | ||
ProcessingChannelId string `json:"processingChannelId" validate:"required"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different case in go and json for Id:
ID in go, Id in json
OAuthClientID string `json:"oauthClientID" validate:"required"` | |
OAuthClientSecret string `json:"oauthClientSecret" validate:"required"` | |
EntityID string `json:"entityId" validate:"required"` | |
ProcessingChannelId string `json:"processingChannelId" validate:"required"` | |
OAuthClientID string `json:"oauthClientId" validate:"required"` | |
OAuthClientSecret string `json:"oauthClientSecret" validate:"required"` | |
EntityID string `json:"entityId" validate:"required"` | |
ProcessingChannelID string `json:"processingChannelId" validate:"required"` |
WithScopes(getOAuthScopes()). | ||
Build() | ||
if err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic is reserved to prevent application startup. For regular business code like this we should propagate the error
// In plugin.go
cl, err := client.New(
cfg.Environment,
cfg.OAuthClientID,
cfg.OAuthClientSecret,
cfg.EntityID,
cfg.ProcessingChannelId,
)
if err != nil {
return nil, err
}
Description
This PR implements a new checkout.com connector for the Payments service, enabling integration with the checkout.com payment platform.
The connector supports:
We are using the checkout go sdk for operations, except for fetching payments (/payments/search api endpoint is not available yet on checkout go sdk)
Implementation issues
Currently here are the implementation issues while implementing checkout.com connector :
Fetching accounts
We fetch only the entity details (so only one account really fetched)
c.sdk.Accounts.GetEntity(c.entityID)
(entityID is from connector config)
There is no api endpoint on checkout.com to fetch all accounts
Required config for connector
Environment string
sandbox | production
OAuthClientID string
OAuthClientSecret string
EntityID string example :
ent_xxxxxx
ProcessingChannelId string example :
pc_xxxxxx
Transfers and payouts
Can't test transfers and payouts locally (we can't start the formance console UI in local do simulate actions)
All transfers are currently declared as "commission" on checkout.com
For payouts, only bank payouts are currently managed : https://api-reference.checkout.com/#operation/requestAPaymentOrPayout