8000 feat: connectors sdks test e2e by paul-nicolas · Pull Request #401 · formancehq/payments · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: connectors sdks test e2e #401

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.

8000

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
13,498 changes: 6,788 additions & 6,710 deletions coverage.txt

Large diffs are not rendered by default.

53 changes: 45 additions & 8 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,28 @@ Accept: application/json
```json
{
"data": {
"connector": {
"key": {
"property1": {
"property1": {
"dataType": "string",
"required": true
"required": true,
"defaultValue": "string"
},
"property2": {
"dataType": "string",
"required": true,
"defaultValue": "string"
}
},
"property2": {
"property1": {
"dataType": "string",
"required": true,
"defaultValue": "string"
},
"property2": {
"dataType": "string",
"required": true,
"defaultValue": "string"
}
}
}
Expand Down Expand Up @@ -3254,10 +3272,28 @@ None ( Scopes: payments:read )
```json
{
"data": {
"connector": {
"key": {
"property1": {
"property1": {
"dataType": "string",
"required": true,
"defaultValue": "string"
},
"property2": {
"dataType": "string",
"required": true,
"defaultValue": "string"
}
},
"property2": {
"property1": {
"dataType": "string",
"required": true,
"defaultValue": "string"
},
"property2": {
"dataType": "string",
"required": true
"required": true,
"defaultValue": "string"
}
}
}
Expand All @@ -3270,10 +3306,11 @@ None ( Scopes: payments:read )
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|object|true|none|none|
connector|object|true|none|none|
|»» key|object|true|none|none|
**additionalProperties**|object|false|none|none|
|»» **additionalProperties**|object|false|none|none|
|»»» dataType|string|true|none|none|
|»»» required|boolean|true| F438 none|none|
|»»» defaultValue|string|false|none|none|

<h2 id="tocS_V3GetConnectorConfigResponse">V3GetConnectorConfigResponse</h2>
<!-- backwards compatibility -->
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/ThreeDotsLabs/watermill v1.4.6
github.com/adyen/adyen-go-api-library/v7 v7.3.1
github.com/bombsimon/logrusr/v3 v3.1.0
github.com/formancehq/go-libs v1.7.2
github.com/formancehq/go-libs/v3 v3.0.0-20250407134146-8be8ce3ddc42
github.com/formancehq/payments/genericclient v0.0.0-00010101000000-000000000000
github.com/formancehq/payments/pkg/client v0.0.0-00010101000000-000000000000
Expand Down Expand Up @@ -105,6 +104,7 @@ require (
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/formancehq/go-libs v1.7.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-chi/chi v4.1.2+incompatible // indirect
github.com/go-chi/render v1.0.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions internal/api/v2/handler_payments_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func paymentsCreate(backend backend.Backend, validator *validation.Validator) ht
return
}

req.Scheme = toV3PaymentScheme(req.Scheme)
populateSpanFromPaymentCreateRequest(span, req)

if _, err := validator.Validate(req); err != nil {
Expand Down Expand Up @@ -78,6 +79,7 @@ func paymentsCreate(backend backend.Backend, validator *validation.Validator) ht
Type: paymentType,
InitialAmount: req.Amount,
Amount: req.Amount,
Status: status,
Asset: req.Asset,
Scheme: models.MustPaymentSchemeFromString(req.Scheme),
SourceAccountID: func() *models.AccountID {
Expand Down
55 changes: 55 additions & 0 deletions internal/api/v2/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,58 @@
return paymentSchemeUnknown
}
}

func toV3PaymentScheme(scheme string) string {
switch scheme {
case "unknown":
return models.PAYMENT_SCHEME_UNKNOWN.String()
case "other":
return models.PAYMENT_SCHEME_OTHER.String()
case "visa":
return models.PAYMENT_SCHEME_CARD_VISA.String()
case "mastercard":
return models.PAYMENT_SCHEME_CARD_MASTERCARD.String()
case "amex":
return models.PAYMENT_SCHEME_CARD_AMEX.String()
case "diners":
return models.PAYMENT_SCHEME_CARD_DINERS.String()
case "discover":
return models.PAYMENT_SCHEME_CARD_DISCOVER.String()
case "jcb":
return models.PAYMENT_SCHEME_CARD_JCB.String()
case "unionpay":
return models.PAYMENT_SCHEME_CARD_UNION_PAY.String()
case "alipay":
return models.PAYMENT_SCHEME_CARD_ALIPAY.String()
case "cup":
return models.PAYMENT_SCHEME_CARD_CUP.String()
case "sepa debit":
return models.PAYMENT_SCHEME_SEPA_DEBIT.String()
case "sepa credit":
return models.PAYMENT_SCHEME_SEPA_CREDIT.String()
case "sepa":
return models.PAYMENT_SCHEME_SEPA.String()
case "apple pay":
return models.PAYMENT_SCHEME_APPLE_PAY.String()
case "google pay":
return models.PAYMENT_SCHEME_GOOGLE_PAY.String()
case "doku":
return models.PAYMENT_SCHEME_DOKU.String()
case "dragonpay":
return models.PAYMENT_SCHEME_DRAGON_PAY.String()
case "maestro":
return models.PAYMENT_SCHEME_MAESTRO.String()
case "molpay":
return models.PAYMENT_SCHEME_MOL_PAY.String()
case "a2a":
return models.PAYMENT_SCHEME_A2A.String()
case "ach debit":
return models.PAYMENT_SCHEME_ACH_DEBIT.String()
case "ach":
return models.PAYMENT_SCHEME_ACH.String()
case "rtp":
return models.PAYMENT_SCHEME_RTP.String()

Check warning on line 249 in internal/api/v2/utils.go

View check run for this annotation

Codecov / codecov/patch

internal/api/v2/utils.go#L202-L249

Added lines #L202 - L249 were not covered by tests
default:
return scheme
}
}
2 changes: 1 addition & 1 deletion internal/models/payment_scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
PAYMENT_SCHEME_ACH
PAYMENT_SCHEME_RTP

PAYMENT_SCHEME_OTHER = 100
PAYMENT_SCHEME_OTHER PaymentScheme = 100
)

func (s PaymentScheme) String() string {
Expand Down
53 changes: 22 additions & 31 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2259,24 +2259,20 @@ components:
properties:
data:
type: object
required:
- connector
properties:
connector:
additionalProperties:
type: object
additionalProperties:
type: object
required:
- key
- dataType
- required
properties:
key:
type: object
required:
- dataType
- required
properties:
dataType:
type: string
required:
type: boolean
dataType:
type: string
required:
type: boolean
defaultValue:
type: string
TaskResponse:
type: object
required:
Expand Down Expand Up @@ -3269,7 +3265,6 @@ components:
type: object
required:
- country
- connectorID
- name
properties:
country:
Expand Down Expand Up @@ -3866,24 +3861,20 @@ components:
properties:
data:
type: object
required:
- connector
properties:
connector:
additionalProperties:
type: object
additionalProperties:
type: object
required:
- key
- dataType
- required
properties:
key:
type: object
required:
- dataType
- required
properties:
dataType:
type: string
required:
type: boolean
dataType:
type: string
required:
type: boolean
defaultValue:
type: string
V3GetConnectorConfigResponse:
type: object
required:
Expand Down
27 changes: 11 additions & 16 deletions openapi/v1-2/v1-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1336,24 +1336,20 @@ components:
properties:
data:
type: object
required:
- connector
properties:
connector:
additionalProperties:
type: object
additionalProperties:
type: object
required:
- key
- dataType
- required
properties:
key:
type: object
required:
- dataType
- required
properties:
dataType:
type: string
required:
type: boolean
dataType:
type: string
required:
type: boolean
defaultValue:
type: string
TaskResponse:
type: object
required:
Expand Down Expand Up @@ -2367,7 +2363,6 @@ components:
type: object
required:
- country
- connectorID
- name
properties:
country:
Expand Down
26 changes: 11 additions & 15 deletions openapi/v3/v3-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,24 +372,20 @@ components:
properties:
data:
type: object
required:
- connector
properties:
connector:
additionalProperties:
type: object
additionalProperties:
type: object
required:
- key
- dataType
- required
properties:
key:
type: object
required:
- dataType
- required
properties:
dataType:
type: string
required:
type: boolean
dataType:
type: string
required:
type: boolean
defaultValue:
type: string

V3GetConnectorConfigResponse:
type: object
Expand Down
12 changes: 4 additions & 8 deletions pkg/client/.speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
lockVersion: 2.0.0
id: 86668c33-fde8-4164-be98-cfc24d333a1e
management:
docChecksum: ad8faa4c230b316c7f45a98da4e1f25a
docChecksum: 5f20771a5daabbffb6f654f7ef009068
docVersion: v1
speakeasyVersion: 1.525.0
generationVersion: 2.562.2
Expand Down Expand Up @@ -47,9 +47,9 @@ generatedFiles:
- /models/components/bankaccountresponse.go
- /models/components/bankaccountscursor.go
- /models/components/bankingcircleconfig.go
- /models/components/connector.go
- /models/components/connectorconfig.go
- /models/components/connectorconfigresponse.go
- /models/components/connectorenum.go
- /models/components/connectorresponse.go
- /models/components/connectorsconfigsresponse.go
- /models/components/connectorsresponse.go
Expand Down Expand Up @@ -290,15 +290,13 @@ generatedFiles:
- docs/models/components/bankaccountscursorcursor.md
- docs/models/components/bankingcircleconfig.md
- docs/models/components/config.md
- docs/models/components/connector.md
- docs/models/components/connectorconfig.md
- docs/models/components/connectorconfigresponse.md
- docs/models/components/connectorenum.md
- docs/models/components/connectorresponse.md
- docs/models/components/connectorresponsedata.md
- docs/models/components/connectorsconfigsresponse.md
- docs/models/components/connectorsconfigsresponseconnector.md
- docs/models/components/connectorsconfigsresponsedata.md
- docs/models/components/connectorsconfigsresponsekey.md
- docs/models/components/connectorsresponse.md
- docs/models/components/connectorsresponsedata.md
- docs/models/components/currencycloudconfig.md
Expand Down Expand Up @@ -399,9 +397,7 @@ generatedFiles:
- docs/models/components/v3connector.md
- docs/models/components/v3connectorconfig.md
- docs/models/components/v3connectorconfigsresponse.md
- docs/models/components/v3connectorconfigsresponseconnector.md
- docs/models/components/v3connectorconfigsresponsedata.md
- docs/models/components/v3connectorconfigsresponsekey.md
- docs/models/components/v3connectorscheduleinstancescursorresponse.md
- docs/models/components/v3connectorscheduleinstancescursorresponsecursor.md
- docs/models/components/v3connectorscheduleresponse.md
Expand Down Expand Up @@ -961,7 +957,7 @@ examples:
speakeasy-default-list-configs-available-connectors:
responses:
"200":
application/json: {"data": {"connector": {"key": {"dataType": "real", "required": false}}}}
application/json: {}
default:
application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing reference"}
installConnector:
Expand Down
Loading
Loading
0