diff --git a/docs/api/README.md b/docs/api/README.md index c83c16fea..fc140ea82 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -2406,6 +2406,586 @@ To perform this operation, you must be authenticated by means of one of the foll None ( Scopes: payments:read ) +## Delete a payment service user by ID + + + +> Code samples + +```http +DELETE /v3/payment-service-users/{paymentServiceUserID} HTTP/1.1 + +Accept: application/json + +``` + +`DELETE /v3/payment-service-users/{paymentServiceUserID}` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| + +> Example responses + +> 202 Response + +```json +{ + "data": { + "taskID": "string" + } +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|202|[Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3)|Accepted|[V3PaymentServiceUserDeleteResponse](#schemav3paymentserviceuserdeleteresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## List all connections for a payment service user + + + +> Code samples + +```http +GET /v3/payment-service-users/{paymentServiceUserID}/connections HTTP/1.1 + +Content-Type: application/json +Accept: application/json + +``` + +`GET /v3/payment-service-users/{paymentServiceUserID}/connections` + +> Body parameter + +```json +{} +``` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|pageSize|query|integer(int64)|false|The number of items to return| +|cursor|query|string|false|Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.| +|body|body|[V3QueryBuilder](#schemav3querybuilder)|false|none| + +#### Detailed descriptions + +**cursor**: Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + +> Example responses + +> 200 Response + +```json +{ + "cursor": { + "pageSize": 15, + "hasMore": false, + "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "data": [ + { + "connectionID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "dataUpdatedAt": "2019-08-24T14:15:22Z", + "status": "ACTIVE", + "error": "string", + "metadata": { + "property1": "string", + "property2": "string" + } + } + ] + } +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[V3PaymentServiceUserConnectionsCursorResponse](#schemav3paymentserviceuserconnectionscursorresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Remove a payment service user from a connector, the PSU will still exist in Formance + + + +> Code samples + +```http +DELETE /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID} HTTP/1.1 + +Accept: application/json + +``` + +`DELETE /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| + +> Example responses + +> 202 Response + +```json +{ + "data": { + "taskID": "string" + } +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|202|[Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3)|Accepted|[V3PaymentServiceUserDeleteConnectorResponse](#schemav3paymentserviceuserdeleteconnectorresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Register/forward a payment service user on/to a connector + + + +> Code samples + +```http +POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/forward HTTP/1.1 + +Accept: application/json + +``` + +`POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/forward` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| + +> Example responses + +> default Response + +```json +{ + "errorCode": "VALIDATION", + "errorMessage": "[VALIDATION] missing required config field: pollingPeriod", + "details": "string" +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|None| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Create an authentication link for a payment service user on a connector, for oauth flow + + + +> Code samples + +```http +POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/create-link HTTP/1.1 + +Content-Type: application/json +Accept: application/json + +``` + +`POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/create-link` + +> Body parameter + +```json +{ + "applicationName": "string", + "clientRedirectURL": "string" +} +``` + + + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|body|body|[V3PaymentServiceUserCreateLinkRequest](#schemav3paymentserviceusercreatelinkrequest)|false|none| + +> Example responses + +> 201 Response + +```json +{ + "attemptID": "string", + "link": "string" +} +``` + + + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Created|[V3PaymentServiceUserCreateLinkResponse](#schemav3paymentserviceusercreatelinkresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) + + + +> Code samples + +```http +GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections HTTP/1.1 + +Content-Type: application/json +Accept: application/json + +``` + +`GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections` + +> Body parameter + +```json +{} +``` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|pageSize|query|integer(int64)|false|The number of items to return| +|cursor|query|string|false|Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.| +|body|body|[V3QueryBuilder](#schemav3querybuilder)|false|none| + +#### Detailed descriptions + +**cursor**: Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + +> Example responses + +> 200 Response + +```json +{ + "cursor": { + "pageSize": 15, + "hasMore": false, + "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "data": [ + { + "connectionID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "dataUpdatedAt": "2019-08-24T14:15:22Z", + "status": "ACTIVE", + "error": "string", + "metadata": { + "property1": "string", + "property2": "string" + } + } + ] + } +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[V3PaymentServiceUserConnectionsCursorResponse](#schemav3paymentserviceuserconnectionscursorresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## List all link attempts for a payment service user on a connector. +Allows to check if users used the link and completed the oauth flow. + + + +> Code samples + +```http +GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts HTTP/1.1 + +Content-Type: application/json +Accept: application/json + +``` + +`GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts` + +> Body parameter + +```json +{} +``` + + + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|pageSize|query|integer(int64)|false|The number of items to return| +|cursor|query|string|false|Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.| +|body|body|[V3QueryBuilder](#schemav3querybuilder)|false|none| + +#### Detailed descriptions + +**cursor**: Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + +> Example responses + +> 200 Response + +```json +{ + "cursor": { + "pageSize": 15, + "hasMore": false, + "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "data": [ + { + "id": "string", + "psuID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "status": "pending", + "clientRedirectURL": "string", + "error": "string" + } + ] + } +} +``` + + + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[V3PaymentServiceUserLinkAttemptsCursorResponse](#schemav3paymentserviceuserlinkattemptscursorresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Get a link attempt for a payment service user on a connector + + + +> Code samples + +```http +GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID} HTTP/1.1 + +Accept: application/json + +``` + +`GET /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}` + + + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|attemptID|path|string|true|The attempt ID| + +> Example responses + +> 200 Response + +```json +{ + "id": "string", + "psuID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "status": "pending", + "clientRedirectURL": "string", + "error": "string" +} +``` + + + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[V3PaymentServiceUserLinkAttempt](#schemav3paymentserviceuserlinkattempt)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Delete a connection for a payment service user on a connector + + + +> Code samples + +```http +DELETE /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID} HTTP/1.1 + +Accept: application/json + +``` + +`DELETE /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}` + +

Parameters

+ +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|connectionID|path|string|true|The connection ID| + +> Example responses + +> 202 Response + +```json +{ + "data": { + "taskID": "string" + } +} +``` + +

Responses

+ +|Status|Meaning|Description|Schema| +|---|---|---|---| +|202 |Unknown|Accepted|[V3PaymentServiceUserDeleteConnectionResponse](#schemav3paymentserviceuserdeleteconnectionresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + +## Update/Regenerate a link for a payment service user on a connector + + + +> Code samples + +```http +POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}/update-link HTTP/1.1 + +Content-Type: application/json +Accept: application/json + +``` + +`POST /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}/update-link` + +> Body parameter + +```json +{ + "applicationName": "string", + "clientRedirectURL": "string" +} +``` + + + +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|paymentServiceUserID|path|string|true|The payment service user ID| +|connectorID|path|string|true|The connector ID| +|connectionID|path|string|true|The connection ID| +|body|body|[V3PaymentServiceUserUpdateLinkRequest](#schemav3paymentserviceuserupdatelinkrequest)|false|none| + +> Example responses + +> 201 Response + +```json +{ + "attemptID": "string", + "link": "string" +} +``` + + + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Created|[V3PaymentServiceUserUpdateLinkResponse](#schemav3paymentserviceuserupdatelinkresponse)| +|default|Default|Error|[V3ErrorResponse](#schemav3errorresponse)| + + + ## Add a bank account to a payment service user @@ -5060,6 +5640,75 @@ None ( Scopes: payments:read ) |---|---|---|---|---| |data|string|true|none|The ID of the created payment service user| +

V3PaymentServiceUserDeleteResponse

+ + + + + + +```json +{ + "data": { + "taskID": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|data|object|true|none|none| +|» taskID|string|true|none|Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user. You can use the task API to check the status of the task.| + +

V3PaymentServiceUserDeleteConnectorResponse

+ + + + + + +```json +{ + "data": { + "taskID": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|data|object|true|none|none| +|» taskID|string|true|none|Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user on the connector. You can use the task API to check the status of the task.| + +

V3PaymentServiceUserDeleteConnectionResponse

+ + + + + + +```json +{ + "data": { + "taskID": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|data|object|true|none|none| +|» taskID|string|true|none|Since this call is asynchronous, the response will contain the ID of the task that was created to delete the connection. You can use the task API to check the status of the task.| +

V3PaymentServiceUsersCursorResponse

@@ -5116,6 +5765,91 @@ None ( Scopes: payments:read ) |» next|string|false|none|none| |» data|[[V3PaymentServiceUser](#schemav3paymentserviceuser)]|true|none|none| +

V3PaymentServiceUserConnectionsCursorResponse

+ + + + + + +```json +{ + "cursor": { + "pageSize": 15, + "hasMore": false, + "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "data": [ + { + "connectionID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "dataUpdatedAt": "2019-08-24T14:15:22Z", + "status": "ACTIVE", + "error": "string", + "metadata": { + "property1": "string", + "property2": "string" + } + } + ] + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|cursor|object|true|none|none| +|» pageSize|integer(int64)|true|none|none| +|» hasMore|boolean|true|none|none| +|» previous|string|false|none|none| +|» next|string|false|none|none| +|» data|[[V3PaymentServiceUserConnection](#schemav3paymentserviceuserconnection)]|true|none|none| + +

V3PaymentServiceUserLinkAttemptsCursorResponse

+ + + + + + +```json +{ + "cursor": { + "pageSize": 15, + "hasMore": false, + "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", + "data": [ + { + "id": "string", + "psuID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "status": "pending", + "clientRedirectURL": "string", + "error": "string" + } + ] + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|cursor|object|true|none|none| +|» pageSize|integer(int64)|true|none|none| +|» hasMore|boolean|true|none|none| +|» previous|string|false|none|none| +|» next|string|false|none|none| +|» data|[[V3PaymentServiceUserLinkAttempt](#schemav3paymentserviceuserlinkattempt)]|true|none|none| +

V3PaymentServiceUser

@@ -5163,6 +5897,73 @@ None ( Scopes: payments:read ) |bankAccountIDs|[string]¦null|false|none|none| |metadata|[V3Metadata](#schemav3metadata)|false|none|none| +

V3PaymentServiceUserConnection

+ + + + + + +```json +{ + "connectionID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "dataUpdatedAt": "2019-08-24T14:15:22Z", + "status": "ACTIVE", + "error": "string", + "metadata": { + "property1": "string", + "property2": "string" + } +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|connectionID|string|true|none|none| +|connectorID|string|true|none|none| +|createdAt|string(date-time)|true|none|none| +|dataUpdatedAt|string(date-time)|true|none|none| +|status|[V3ConnectionStatusEnum](#schemav3connectionstatusenum)|true|none|none| +|error|string¦null|false|none|none| +|metadata|[V3Metadata](#schemav3metadata)|false|none|none| + +

V3PaymentServiceUserLinkAttempt

+ + + + + + +```json +{ + "id": "string", + "psuID": "string", + "connectorID": "string", + "createdAt": "2019-08-24T14:15:22Z", + "status": "pending", + "clientRedirectURL": "string", + "error": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|id|string|true|none|none| +|psuID|string|true|none|none| +|connectorID|string|true|none|none| +|createdAt|string(date-time)|true|none|none| +|status|[V3PSUBankBridgeConnectionAttemptStatusEnum](#schemav3psubankbridgeconnectionattemptstatusenum)|true|none|none| +|clientRedirectURL|string(url)|true|none|none| +|error|string¦null|false|none|none| +

V3ContactDetails

@@ -5301,6 +6102,145 @@ None ( Scopes: payments:read ) |data|object|true|none|none| |» taskID|string|true|none|Since this call is asynchronous, the response will contain the ID of the task that was created to forward the bank account to the PSP. You can use the task API to check the status of the task and get the resulting bank account ID.| +

V3ConnectionStatusEnum

+ + + + + + +```json +"ACTIVE" + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|string|false|none|none| + +#### Enumerated Values + +|Property|Value| +|---|---| +|*anonymous*|ACTIVE| +|*anonymous*|ERROR| + +

V3PSUBankBridgeConnectionAttemptStatusEnum

+ + + + + + +```json +"pending" + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|*anonymous*|string|false|none|none| + +#### Enumerated Values + +|Property|Value| +|---|---| +|*anonymous*|pending| +|*anonymous*|completed| +|*anonymous*|exited| + +

V3PaymentServiceUserCreateLinkRequest

+ + + + + + +```json +{ + "applicationName": "string", + "clientRedirectURL": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|applicationName|string|true|none|The name of the application to be displayed to the user when they click the link (depending on the open banking provider).| +|clientRedirectURL|string(url)|true|none|The URL to redirect the user to after the link flow is completed.| + +

V3PaymentServiceUserCreateLinkResponse

+ + + + + + +```json +{ + "attemptID": "string", + "link": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|attemptID|string|true|none|none| +|link|string(url)|true|none|none| + +

V3PaymentServiceUserUpdateLinkRequest

+ + + + + + +```json +{ + "applicationName": "string", + "clientRedirectURL": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|applicationName|string|true|none|none| +|clientRedirectURL|string(url)|true|none|none| + +

V3PaymentServiceUserUpdateLinkResponse

+ + + + + + +```json +{ + "attemptID": "string", + "link": "string" +} + +``` + +### Properties + +|Name|Type|Required|Restrictions|Description| +|---|---|---|---|---| +|attemptID|string|true|none|none| +|link|string(url)|true|none|none| +

V3CreatePoolRequest

diff --git a/openapi.yaml b/openapi.yaml index 4dbb8d6d2..88dd56290 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1798,6 +1798,295 @@ paths: security: - Authorization: - payments:read + delete: + tags: + - payments.v3 + summary: Delete a payment service user by ID + operationId: v3DeletePaymentServiceUser + x-speakeasy-name-override: DeletePaymentServiceUser + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + responses: + "202": + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserDeleteResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write + /v3/payment-service-users/{paymentServiceUserID}/connections: + get: + tags: + - payments.v3 + summary: List all connections for a payment service user + operationId: v3ListPaymentServiceUserConnections + x-speakeasy-name-override: ListPaymentServiceUserConnections + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3QueryBuilder' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserConnectionsCursorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}: + delete: + tags: + - payments.v3 + summary: Remove a payment service user from a connector, the PSU will still exist in Formance + operationId: v3DeletePaymentServiceUserConnector + x-speakeasy-name-override: DeletePaymentServiceUserConnector + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + responses: + "202": + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserDeleteConnectorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/forward: + post: + tags: + - payments.v3 + summary: Register/forward a payment service user on/to a connector + operationId: v3ForwardPaymentServiceUserToBankBridge + x-speakeasy-name-override: ForwardPaymentServiceUserToBankBridge + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + responses: + "204": + description: No Content + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/create-link: + post: + tags: + - payments.v3 + summary: Create an authentication link for a payment service user on a connector, for oauth flow + operationId: v3CreateLinkForPaymentServiceUser + x-speakeasy-name-override: CreateLinkForPaymentServiceUser + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserCreateLinkRequest' + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserCreateLinkResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections: + get: + tags: + - payments.v3 + summary: List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) + operationId: v3ListPaymentServiceUserConnectionsFromConnectorID + x-speakeasy-name-override: ListPaymentServiceUserConnectionsFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3QueryBuilder' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserConnectionsCursorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts: + get: + tags: + - payments.v3 + summary: | + List all link attempts for a payment service user on a connector. + Allows to check if users used the link and completed the oauth flow. + operationId: v3ListPaymentServiceUserLinkAttemptsFromConnectorID + x-speakeasy-name-override: ListPaymentServiceUserLinkAttemptsFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3QueryBuilder' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserLinkAttemptsCursorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}: + get: + tags: + - payments.v3 + summary: Get a link attempt for a payment service user on a connector + operationId: v3GetPaymentServiceUserLinkAttemptFromConnectorID + x-speakeasy-name-override: GetPaymentServiceUserLinkAttemptFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3AttemptID' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserLinkAttempt' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}: + delete: + tags: + - payments.v3 + summary: Delete a connection for a payment service user on a connector + operationId: v3DeletePaymentServiceUserConnectionFromConnectorID + x-speakeasy-name-override: DeletePaymentServiceUserConnectionFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3ConnectionID' + responses: + '202 ': + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserDeleteConnectionResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}/update-link: + post: + tags: + - payments.v3 + summary: Update/Regenerate a link for a payment service user on a connector + operationId: v3UpdateLinkForPaymentServiceUserOnConnector + x-speakeasy-name-override: UpdateLinkForPaymentServiceUserOnConnector + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3ConnectionID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserUpdateLinkRequest' + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/V3PaymentServiceUserUpdateLinkResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:write /v3/payment-service-users/{paymentServiceUserID}/bank-accounts/{bankAccountID}: post: tags: @@ -4842,6 +5131,48 @@ components: data: description: The ID of the created payment service user type: string + V3PaymentServiceUserDeleteResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: | + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user. You can use the task API to check the status of the task. + type: string + V3PaymentServiceUserDeleteConnectorResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: | + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user on the connector. You can use the task API to check the status of the task. + type: string + V3PaymentServiceUserDeleteConnectionResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: | + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the connection. You can use the task API to check the status of the task. + type: string V3PaymentServiceUsersCursorResponse: type: object required: @@ -4872,6 +5203,66 @@ components: type: array items: $ref: '#/components/schemas/V3PaymentServiceUser' + V3PaymentServiceUserConnectionsCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + data: + type: array + items: + $ref: '#/components/schemas/V3PaymentServiceUserConnection' + V3PaymentServiceUserLinkAttemptsCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + data: + type: array + items: + $ref: '#/components/schemas/V3PaymentServiceUserLinkAttempt' V3PaymentServiceUser: type: object required: @@ -4899,6 +5290,59 @@ components: nullable: true metadata: $ref: '#/components/schemas/V3Metadata' + V3PaymentServiceUserConnection: + type: object + required: + - connectionID + - connectorID + - createdAt + - dataUpdatedAt + - status + properties: + connectionID: + type: string + connectorID: + type: string + createdAt: + type: string + format: date-time + dataUpdatedAt: + type: string + format: date-time + status: + $ref: '#/components/schemas/V3ConnectionStatusEnum' + error: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/V3Metadata' + V3PaymentServiceUserLinkAttempt: + type: object + required: + - id + - psuID + - connectorID + - createdAt + - status + - clientRedirectURL + properties: + id: + type: string + psuID: + type: string + connectorID: + type: string + createdAt: + type: string + format: date-time + status: + $ref: '#/components/schemas/V3PSUBankBridgeConnectionAttemptStatusEnum' + clientRedirectURL: + type: string + format: url + error: + type: string + nullable: true V3ContactDetails: type: object properties: @@ -4950,6 +5394,63 @@ components: description: | Since this call is asynchronous, the response will contain the ID of the task that was created to forward the bank account to the PSP. You can use the task API to check the status of the task and get the resulting bank account ID. type: string + V3ConnectionStatusEnum: + type: string + enum: + - ACTIVE + - ERROR + V3PSUBankBridgeConnectionAttemptStatusEnum: + type: string + enum: + - pending + - completed + - exited + V3PaymentServiceUserCreateLinkRequest: + type: object + required: + - applicationName + - clientRedirectURL + properties: + applicationName: + type: string + description: The name of the application to be displayed to the user when they click the link (depending on the open banking provider). + clientRedirectURL: + type: string + format: url + description: The URL to redirect the user to after the link flow is completed. + V3PaymentServiceUserCreateLinkResponse: + type: object + required: + - attemptID + - link + properties: + attemptID: + type: string + link: + type: string + format: url + V3PaymentServiceUserUpdateLinkRequest: + type: object + required: + - applicationName + - clientRedirectURL + properties: + applicationName: + type: string + clientRedirectURL: + type: string + format: url + V3PaymentServiceUserUpdateLinkResponse: + type: object + required: + - attemptID + - link + properties: + attemptID: + type: string + link: + type: string + format: url V3CreatePoolRequest: type: object required: @@ -5710,6 +6211,20 @@ components: description: The payment service user ID schema: type: string + V3AttemptID: + name: attemptID + in: path + required: true + description: The attempt ID + schema: + type: string + V3ConnectionID: + name: connectionID + in: path + required: true + description: The connection ID + schema: + type: string V3PaymentID: name: paymentID in: path diff --git a/openapi/v3/v3-api.yaml b/openapi/v3/v3-api.yaml index 29c8cfef3..9bae90d94 100644 --- a/openapi/v3/v3-api.yaml +++ b/openapi/v3/v3-api.yaml @@ -1015,6 +1015,305 @@ paths: security: - Authorization: - payments:read + delete: + tags: + - payments.v3 + summary: Delete a payment service user by ID + operationId: v3DeletePaymentServiceUser + x-speakeasy-name-override: DeletePaymentServiceUser + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + responses: + "202": + description: Accepted + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserDeleteResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write + + + /v3/payment-service-users/{paymentServiceUserID}/connections: + get: + tags: + - payments.v3 + summary: List all connections for a payment service user + operationId: v3ListPaymentServiceUserConnections + x-speakeasy-name-override: ListPaymentServiceUserConnections + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V3QueryBuilder" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserConnectionsCursorResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:read + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}: + delete: + tags: + - payments.v3 + summary: Remove a payment service user from a connector, the PSU will still exist in Formance + operationId: v3DeletePaymentServiceUserConnector + x-speakeasy-name-override: DeletePaymentServiceUserConnector + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + responses: + "202": + description: Accepted + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserDeleteConnectorResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/forward: + post: + tags: + - payments.v3 + summary: Register/forward a payment service user on/to a connector + operationId: v3ForwardPaymentServiceUserToBankBridge + x-speakeasy-name-override: ForwardPaymentServiceUserToBankBridge + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + responses: + "204": + description: No Content + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/create-link: + post: + tags: + - payments.v3 + summary: Create an authentication link for a payment service user on a connector, for oauth flow + operationId: v3CreateLinkForPaymentServiceUser + x-speakeasy-name-override: CreateLinkForPaymentServiceUser + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserCreateLinkRequest" + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserCreateLinkResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections: + get: + tags: + - payments.v3 + summary: List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) + operationId: v3ListPaymentServiceUserConnectionsFromConnectorID + x-speakeasy-name-override: ListPaymentServiceUserConnectionsFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V3QueryBuilder" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserConnectionsCursorResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:read + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts: + get: + tags: + - payments.v3 + summary: | + List all link attempts for a payment service user on a connector. + Allows to check if users used the link and completed the oauth flow. + operationId: v3ListPaymentServiceUserLinkAttemptsFromConnectorID + x-speakeasy-name-override: ListPaymentServiceUserLinkAttemptsFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V3QueryBuilder" + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserLinkAttemptsCursorResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:read + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}: + get: + tags: + - payments.v3 + summary: Get a link attempt for a payment service user on a connector + operationId: v3GetPaymentServiceUserLinkAttemptFromConnectorID + x-speakeasy-name-override: GetPaymentServiceUserLinkAttemptFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3AttemptID' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserLinkAttempt" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:read + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}: + delete: + tags: + - payments.v3 + summary: Delete a connection for a payment service user on a connector + operationId: v3DeletePaymentServiceUserConnectionFromConnectorID + x-speakeasy-name-override: DeletePaymentServiceUserConnectionFromConnectorID + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3ConnectionID' + responses: + "202 ": + description: Accepted + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserDeleteConnectionResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write + + /v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}/update-link: + post: + tags: + - payments.v3 + summary: Update/Regenerate a link for a payment service user on a connector + operationId: v3UpdateLinkForPaymentServiceUserOnConnector + x-speakeasy-name-override: UpdateLinkForPaymentServiceUserOnConnector + parameters: + - $ref: '#/components/parameters/V3PaymentServiceUserID' + - $ref: '#/components/parameters/V3ConnectorID' + - $ref: '#/components/parameters/V3ConnectionID' + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserUpdateLinkRequest" + responses: + "201": + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/V3PaymentServiceUserUpdateLinkResponse" + default: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - payments:write /v3/payment-service-users/{paymentServiceUserID}/bank-accounts/{bankAccountID}: post: diff --git a/openapi/v3/v3-parameters.yaml b/openapi/v3/v3-parameters.yaml index f109e1894..c299a1f30 100644 --- a/openapi/v3/v3-parameters.yaml +++ b/openapi/v3/v3-parameters.yaml @@ -29,6 +29,22 @@ components: schema: type: string + V3AttemptID: + name: attemptID + in: path + required: true + description: The attempt ID + schema: + type: string + + V3ConnectionID: + name: connectionID + in: path + required: true + description: The connection ID + schema: + type: string + V3PaymentID: name: paymentID in: path diff --git a/openapi/v3/v3-schemas.yaml b/openapi/v3/v3-schemas.yaml index b13626b89..55c166ac8 100644 --- a/openapi/v3/v3-schemas.yaml +++ b/openapi/v3/v3-schemas.yaml @@ -1204,6 +1204,54 @@ components: description: The ID of the created payment service user type: string + V3PaymentServiceUserDeleteResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: > + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user. You can use the task API to check the status of + the task. + type: string + + V3PaymentServiceUserDeleteConnectorResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: > + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user on the connector. You can use the task API to check the status of + the task. + type: string + + V3PaymentServiceUserDeleteConnectionResponse: + type: object + required: + - data + properties: + data: + type: object + required: + - taskID + properties: + taskID: + description: > + Since this call is asynchronous, the response will contain the ID of the task that was created to delete the connection. You can use the task API to check the status of + the task. + type: string + V3PaymentServiceUsersCursorResponse: type: object required: @@ -1235,6 +1283,68 @@ components: items: $ref: '#/components/schemas/V3PaymentServiceUser' + V3PaymentServiceUserConnectionsCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + data: + type: array + items: + $ref: '#/components/schemas/V3PaymentServiceUserConnection' + + V3PaymentServiceUserLinkAttemptsCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + data: + type: array + items: + $ref: '#/components/schemas/V3PaymentServiceUserLinkAttempt' + V3PaymentServiceUser: type: object required: @@ -1263,6 +1373,61 @@ components: metadata: $ref: '#/components/schemas/V3Metadata' + V3PaymentServiceUserConnection: + type: object + required: + - connectionID + - connectorID + - createdAt + - dataUpdatedAt + - status + properties: + connectionID: + type: string + connectorID: + type: string + createdAt: + type: string + format: date-time + dataUpdatedAt: + type: string + format: date-time + status: + $ref: '#/components/schemas/V3ConnectionStatusEnum' + error: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/V3Metadata' + + V3PaymentServiceUserLinkAttempt: + type: object + required: + - id + - psuID + - connectorID + - createdAt + - status + - clientRedirectURL + properties: + id: + type: string + psuID: + type: string + connectorID: + type: string + createdAt: + type: string + format: date-time + status: + $ref: '#/components/schemas/V3PSUBankBridgeConnectionAttemptStatusEnum' + clientRedirectURL: + type: string + format: url + error: + type: string + nullable: true + V3ContactDetails: type: object properties: @@ -1320,6 +1485,69 @@ components: the task and get the resulting bank account ID. type: string + V3ConnectionStatusEnum: + type: string + enum: + - ACTIVE + - ERROR + + V3PSUBankBridgeConnectionAttemptStatusEnum: + type: string + enum: + - pending + - completed + - exited + + V3PaymentServiceUserCreateLinkRequest: + type: object + required: + - applicationName + - clientRedirectURL + properties: + applicationName: + type: string + description: The name of the application to be displayed to the user when they click the link (depending on the open banking provider). + clientRedirectURL: + type: string + format: url + description: The URL to redirect the user to after the link flow is completed. + + V3PaymentServiceUserCreateLinkResponse: + type: object + required: + - attemptID + - link + properties: + attemptID: + type: string + link: + type: string + format: url + + V3PaymentServiceUserUpdateLinkRequest: + type: object + required: + - applicationName + - clientRedirectURL + properties: + applicationName: + type: string + clientRedirectURL: + type: string + format: url + + V3PaymentServiceUserUpdateLinkResponse: + type: object + required: + - attemptID + - link + properties: + attemptID: + type: string + link: + type: string + format: url + # POOLS V3CreatePoolRequest: type: object diff --git a/pkg/client/.speakeasy/gen.lock b/pkg/client/.speakeasy/gen.lock index 4f240e0e8..4a4f40772 100644 --- a/pkg/client/.speakeasy/gen.lock +++ b/pkg/client/.speakeasy/gen.lock @@ -1,7 +1,7 @@ lockVersion: 2.0.0 id: 1fa8a26f-45d9-44b7-8b97-fbeebcdcd8b1 management: - docChecksum: 68f7c47837506f36da64bca001197daa + docChecksum: 6ebaedba7e289dd0a5ecfb1860264901 docVersion: v1 speakeasyVersion: 1.525.0 generationVersion: 2.562.2 @@ -120,6 +120,7 @@ generatedFiles: - /models/components/v3bankaccountscursorresponse.go - /models/components/v3bankingcircleconfig.go - /models/components/v3columnconfig.go + - /models/components/v3connectionstatusenum.go - /models/components/v3connector.go - /models/components/v3connectorconfig.go - /models/components/v3connectorconfigsresponse.go @@ -177,7 +178,18 @@ generatedFiles: - /models/components/v3paymentinitiationtypeenum.go - /models/components/v3paymentscursorresponse.go - /models/components/v3paymentserviceuser.go + - /models/components/v3paymentserviceuserconnection.go + - /models/components/v3paymentserviceuserconnectionscursorresponse.go + - /models/components/v3paymentserviceusercreatelinkrequest.go + - /models/components/v3paymentserviceusercreatelinkresponse.go + - /models/components/v3paymentserviceuserdeleteconnectionresponse.go + - /models/components/v3paymentserviceuserdeleteconnectorresponse.go + - /models/components/v3paymentserviceuserdeleteresponse.go + - /models/components/v3paymentserviceuserlinkattempt.go + - /models/components/v3paymentserviceuserlinkattemptscursorresponse.go - /models/components/v3paymentserviceuserscursorresponse.go + - /models/components/v3paymentserviceuserupdatelinkrequest.go + - /models/components/v3paymentserviceuserupdatelinkresponse.go - /models/components/v3paymentstatusenum.go - /models/components/v3paymenttypeenum.go - /models/components/v3plaidconfig.go @@ -186,6 +198,7 @@ generatedFiles: - /models/components/v3poolbalancesresponse.go - /models/components/v3poolscursorresponse.go - /models/components/v3powensconfig.go + - /models/components/v3psubankbridgeconnectionattemptstatusenum.go - /models/components/v3qontoconfig.go - /models/components/v3resetconnectorresponse.go - /models/components/v3retrypaymentinitiationresponse.go @@ -251,13 +264,18 @@ generatedFiles: - /models/operations/v3approvepaymentinitiation.go - /models/operations/v3createaccount.go - /models/operations/v3createbankaccount.go + - /models/operations/v3createlinkforpaymentserviceuser.go - /models/operations/v3createpayment.go - /models/operations/v3createpaymentserviceuser.go - /models/operations/v3createpool.go - /models/operations/v3deletepaymentinitiation.go + - /models/operations/v3deletepaymentserviceuser.go + - /models/operations/v3deletepaymentserviceuserconnectionfromconnectorid.go + - /models/operations/v3deletepaymentserviceuserconnector.go - /models/operations/v3deletepool.go - /models/operations/v3forwardbankaccount.go - /models/operations/v3forwardpaymentserviceuserbankaccount.go + - /models/operations/v3forwardpaymentserviceusertobankbridge.go - /models/operations/v3getaccount.go - /models/operations/v3getaccountbalances.go - /models/operations/v3getbankaccount.go @@ -266,6 +284,7 @@ generatedFiles: - /models/operations/v3getpayment.go - /models/operations/v3getpaymentinitiation.go - /models/operations/v3getpaymentserviceuser.go + - /models/operations/v3getpaymentserviceuserlinkattemptfromconnectorid.go - /models/operations/v3getpool.go - /models/operations/v3getpoolbalances.go - /models/operations/v3getpoolbalanceslatest.go @@ -282,6 +301,9 @@ generatedFiles: - /models/operations/v3listpaymentinitiationrelatedpayments.go - /models/operations/v3listpaymentinitiations.go - /models/operations/v3listpayments.go + - /models/operations/v3listpaymentserviceuserconnections.go + - /models/operations/v3listpaymentserviceuserconnectionsfromconnectorid.go + - /models/operations/v3listpaymentserviceuserlinkattemptsfromconnectorid.go - /models/operations/v3listpaymentserviceusers.go - /models/operations/v3listpools.go - /models/operations/v3rejectpaymentinitiation.go @@ -292,6 +314,7 @@ generatedFiles: - /models/operations/v3uninstallconnector.go - /models/operations/v3updatebankaccountmetadata.go - /models/operations/v3updateconnectorconfig.go + - /models/operations/v3updatelinkforpaymentserviceuseronconnector.go - /models/operations/v3updatepaymentmetadata.go - USAGE.md - docs/models/components/account.md @@ -423,6 +446,7 @@ generatedFiles: - docs/models/components/v3bankaccountscursorresponsecursor.md - docs/models/components/v3bankingcircleconfig.md - docs/models/components/v3columnconfig.md + - docs/models/components/v3connectionstatusenum.md - docs/models/components/v3connector.md - docs/models/components/v3connectorconfig.md - docs/models/components/v3connectorconfigsresponse.md @@ -492,8 +516,24 @@ generatedFiles: - docs/models/components/v3paymentscursorresponse.md - docs/models/components/v3paymentscursorresponsecursor.md - docs/models/components/v3paymentserviceuser.md + - docs/models/components/v3paymentserviceuserconnection.md + - docs/models/components/v3paymentserviceuserconnectionscursorresponse.md + - docs/models/components/v3paymentserviceuserconnectionscursorresponsecursor.md + - docs/models/components/v3paymentserviceusercreatelinkrequest.md + - docs/models/components/v3paymentserviceusercreatelinkresponse.md + - docs/models/components/v3paymentserviceuserdeleteconnectionresponse.md + - docs/models/components/v3paymentserviceuserdeleteconnectionresponsedata.md + - docs/models/components/v3paymentserviceuserdeleteconnectorresponse.md + - docs/models/components/v3paymentserviceuserdeleteconnectorresponsedata.md + - docs/models/components/v3paymentserviceuserdeleteresponse.md + - docs/models/components/v3paymentserviceuserdeleteresponsedata.md + - docs/models/components/v3paymentserviceuserlinkattempt.md + - docs/models/components/v3paymentserviceuserlinkattemptscursorresponse.md + - docs/models/components/v3paymentserviceuserlinkattemptscursorresponsecursor.md - docs/models/components/v3paymentserviceuserscursorresponse.md - docs/models/components/v3paymentserviceuserscursorresponsecursor.md + - docs/models/components/v3paymentserviceuserupdatelinkrequest.md + - docs/models/components/v3paymentserviceuserupdatelinkresponse.md - docs/models/components/v3paymentstatusenum.md - docs/models/components/v3paymenttypeenum.md - docs/models/components/v3plaidconfig.md @@ -503,6 +543,7 @@ generatedFiles: - docs/models/components/v3poolscursorresponse.md - docs/models/components/v3poolscursorresponsecursor.md - docs/models/components/v3powensconfig.md + - docs/models/components/v3psubankbridgeconnectionattemptstatusenum.md - docs/models/components/v3qontoconfig.md - docs/models/components/v3resetconnectorresponse.md - docs/models/components/v3retrypaymentinitiationresponse.md @@ -611,17 +652,27 @@ generatedFiles: - docs/models/operations/v3approvepaymentinitiationresponse.md - docs/models/operations/v3createaccountresponse.md - docs/models/operations/v3createbankaccountresponse.md + - docs/models/operations/v3createlinkforpaymentserviceuserrequest.md + - docs/models/operations/v3createlinkforpaymentserviceuserresponse.md - docs/models/operations/v3createpaymentresponse.md - docs/models/operations/v3createpaymentserviceuserresponse.md - docs/models/operations/v3createpoolresponse.md - docs/models/operations/v3deletepaymentinitiationrequest.md - docs/models/operations/v3deletepaymentinitiationresponse.md + - docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridrequest.md + - docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridresponse.md + - docs/models/operations/v3deletepaymentserviceuserconnectorrequest.md + - docs/models/operations/v3deletepaymentserviceuserconnectorresponse.md + - docs/models/operations/v3deletepaymentserviceuserrequest.md + - docs/models/operations/v3deletepaymentserviceuserresponse.md - docs/models/operations/v3deletepoolrequest.md - docs/models/operations/v3deletepoolresponse.md - docs/models/operations/v3forwardbankaccountrequest.md - docs/models/operations/v3forwardbankaccountresponse.md - docs/models/operations/v3forwardpaymentserviceuserbankaccountrequest.md - docs/models/operations/v3forwardpaymentserviceuserbankaccountresponse.md + - docs/models/operations/v3forwardpaymentserviceusertobankbridgerequest.md + - docs/models/operations/v3forwardpaymentserviceusertobankbridgeresponse.md - docs/models/operations/v3getaccountbalancesrequest.md - docs/models/operations/v3getaccountbalancesresponse.md - docs/models/operations/v3getaccountrequest.md @@ -636,6 +687,8 @@ generatedFiles: - docs/models/operations/v3getpaymentinitiationresponse.md - docs/models/operations/v3getpaymentrequest.md - docs/models/operations/v3getpaymentresponse.md + - docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridrequest.md + - docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridresponse.md - docs/models/operations/v3getpaymentserviceuserrequest.md - docs/models/operations/v3getpaymentserviceuserresponse.md - docs/models/operations/v3getpoolbalanceslatestrequest.md @@ -667,6 +720,12 @@ generatedFiles: - docs/models/operations/v3listpaymentinitiationrelatedpaymentsresponse.md - docs/models/operations/v3listpaymentinitiationsrequest.md - docs/models/operations/v3listpaymentinitiationsresponse.md + - docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridrequest.md + - docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridresponse.md + - docs/models/operations/v3listpaymentserviceuserconnectionsrequest.md + - docs/models/operations/v3listpaymentserviceuserconnectionsresponse.md + - docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridrequest.md + - docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridresponse.md - docs/models/operations/v3listpaymentserviceusersrequest.md - docs/models/operations/v3listpaymentserviceusersresponse.md - docs/models/operations/v3listpaymentsrequest.md @@ -689,6 +748,8 @@ generatedFiles: - docs/models/operations/v3updatebankaccountmetadataresponse.md - docs/models/operations/v3updateconnectorconfigrequest.md - docs/models/operations/v3updateconnectorconfigresponse.md + - docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorrequest.md + - docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorresponse.md - docs/models/operations/v3updatepaymentmetadatarequest.md - docs/models/operations/v3updatepaymentmetadataresponse.md - docs/sdks/formance/README.md @@ -1631,5 +1692,152 @@ examples: application/json: {"data": {"id": "", "status": "FAILED", "createdAt": "2025-09-07T00:11:01.351Z", "updatedAt": "2023-03-17T17:53:01.920Z"}} default: application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3DeletePaymentServiceUser: + speakeasy-default-v3-delete-payment-service-user: + parameters: + path: + paymentServiceUserID: "" + responses: + "202": + application/json: {"data": {"taskID": ""}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ListPaymentServiceUserConnections: + speakeasy-default-v3-list-payment-service-user-connections: + parameters: + path: + paymentServiceUserID: "" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"connectionID": "", "connectorID": "", "createdAt": "2023-09-22T05:20:37.449Z", "dataUpdatedAt": "2025-02-21T06:12:46.620Z", "status": "ACTIVE"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + "": + parameters: + path: + paymentServiceUserID: "" + query: + pageSize: 100 + cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"connectionID": "", "connectorID": "", "createdAt": "2023-09-22T05:20:37.449Z", "dataUpdatedAt": "2025-02-21T06:12:46.620Z", "status": "ACTIVE"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3DeletePaymentServiceUserConnector: + speakeasy-default-v3-delete-payment-service-user-connector: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + responses: + "202": + application/json: {"data": {"taskID": ""}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ForwardPaymentServiceUserToBankBridge: + speakeasy-default-v3-forward-payment-service-user-to-bank-bridge: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + responses: + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3CreateLinkForPaymentServiceUser: + speakeasy-default-v3-create-link-for-payment-service-user: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + responses: + "201": + application/json: {"attemptID": "", "link": "https://all-trash.info"} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ListPaymentServiceUserConnectionsFromConnectorID: + speakeasy-default-v3-list-payment-service-user-connections-from-connector-ID: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"connectionID": "", "connectorID": "", "createdAt": "2024-03-17T03:01:59.982Z", "dataUpdatedAt": "2024-06-24T12:14:28.260Z", "status": "ERROR"}, {"connectionID": "", "connectorID": "", "createdAt": "2024-02-13T23:50:26.851Z", "dataUpdatedAt": "2025-12-09T21:21:43.784Z", "status": "ACTIVE"}, {"connectionID": "", "connectorID": "", "createdAt": "2024-02-08T09:44:12.931Z", "dataUpdatedAt": "2023-07-18T08:34:16.806Z", "status": "ACTIVE"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + "": + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + query: + pageSize: 100 + cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"connectionID": "", "connectorID": "", "createdAt": "2024-03-17T03:01:59.982Z", "dataUpdatedAt": "2024-06-24T12:14:28.260Z", "status": "ERROR"}, {"connectionID": "", "connectorID": "", "createdAt": "2024-02-13T23:50:26.851Z", "dataUpdatedAt": "2025-12-09T21:21:43.784Z", "status": "ACTIVE"}, {"connectionID": "", "connectorID": "", "createdAt": "2024-02-08T09:44:12.931Z", "dataUpdatedAt": "2023-07-18T08:34:16.806Z", "status": "ACTIVE"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ListPaymentServiceUserLinkAttemptsFromConnectorID: + speakeasy-default-v3-list-payment-service-user-link-attempts-from-connector-ID: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"id": "", "psuID": "", "connectorID": "", "createdAt": "2025-08-03T20:18:34.993Z", "status": "pending", "clientRedirectURL": "https://alive-siege.net/"}, {"id": "", "psuID": "", "connectorID": "", "createdAt": "2024-06-01T09:58:35.647Z", "status": "exited", "clientRedirectURL": "https://puzzled-consistency.biz/"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + "": + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + query: + pageSize: 100 + cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==" + responses: + "200": + application/json: {"cursor": {"pageSize": 15, "hasMore": false, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "next": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=", "data": [{"id": "", "psuID": "", "connectorID": "", "createdAt": "2025-08-03T20:18:34.993Z", "status": "pending", "clientRedirectURL": "https://alive-siege.net/"}, {"id": "", "psuID": "", "connectorID": "", "createdAt": "2024-06-01T09:58:35.647Z", "status": "exited", "clientRedirectURL": "https://puzzled-consistency.biz/"}]}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3GetPaymentServiceUserLinkAttemptFromConnectorID: + speakeasy-default-v3-get-payment-service-user-link-attempt-from-connector-ID: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + attemptID: "" + responses: + "200": + application/json: {"id": "", "psuID": "", "connectorID": "", "createdAt": "2025-10-07T08:28:43.008Z", "status": "pending", "clientRedirectURL": "https://vibrant-surface.biz/"} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3DeletePaymentServiceUserConnectionFromConnectorID: + speakeasy-default-v3-delete-payment-service-user-connection-from-connector-ID: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + connectionID: "" + responses: + '202 ': + application/json: {"data": {"taskID": ""}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3UpdateLinkForPaymentServiceUserOnConnector: + speakeasy-default-v3-update-link-for-payment-service-user-on-connector: + parameters: + path: + paymentServiceUserID: "" + connectorID: "" + connectionID: "" + responses: + "201": + application/json: {"attemptID": "", "link": "https://wasteful-coordination.name"} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} examplesVersion: 1.0.0 generatedTests: {} diff --git a/pkg/client/README.md b/pkg/client/README.md index ca31f6fc0..1bfc98da6 100644 --- a/pkg/client/README.md +++ b/pkg/client/README.md @@ -221,6 +221,18 @@ func main() { * [CreatePaymentServiceUser](docs/sdks/v3/README.md#createpaymentserviceuser) - Create a formance payment service user object * [ListPaymentServiceUsers](docs/sdks/v3/README.md#listpaymentserviceusers) - List all payment service users * [GetPaymentServiceUser](docs/sdks/v3/README.md#getpaymentserviceuser) - Get a payment service user by ID +* [DeletePaymentServiceUser](docs/sdks/v3/README.md#deletepaymentserviceuser) - Delete a payment service user by ID +* [ListPaymentServiceUserConnections](docs/sdks/v3/README.md#listpaymentserviceuserconnections) - List all connections for a payment service user +* [DeletePaymentServiceUserConnector](docs/sdks/v3/README.md#deletepaymentserviceuserconnector) - Remove a payment service user from a connector, the PSU will still exist in Formance +* [ForwardPaymentServiceUserToBankBridge](docs/sdks/v3/README.md#forwardpaymentserviceusertobankbridge) - Register/forward a payment service user on/to a connector +* [CreateLinkForPaymentServiceUser](docs/sdks/v3/README.md#createlinkforpaymentserviceuser) - Create an authentication link for a payment service user on a connector, for oauth flow +* [ListPaymentServiceUserConnectionsFromConnectorID](docs/sdks/v3/README.md#listpaymentserviceuserconnectionsfromconnectorid) - List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) +* [ListPaymentServiceUserLinkAttemptsFromConnectorID](docs/sdks/v3/README.md#listpaymentserviceuserlinkattemptsfromconnectorid) - List all link attempts for a payment service user on a connector. +Allows to check if users used the link and completed the oauth flow. + +* [GetPaymentServiceUserLinkAttemptFromConnectorID](docs/sdks/v3/README.md#getpaymentserviceuserlinkattemptfromconnectorid) - Get a link attempt for a payment service user on a connector +* [DeletePaymentServiceUserConnectionFromConnectorID](docs/sdks/v3/README.md#deletepaymentserviceuserconnectionfromconnectorid) - Delete a connection for a payment service user on a connector +* [UpdateLinkForPaymentServiceUserOnConnector](docs/sdks/v3/README.md#updatelinkforpaymentserviceuseronconnector) - Update/Regenerate a link for a payment service user on a connector * [AddBankAccountToPaymentServiceUser](docs/sdks/v3/README.md#addbankaccounttopaymentserviceuser) - Add a bank account to a payment service user * [ForwardPaymentServiceUserBankAccount](docs/sdks/v3/README.md#forwardpaymentserviceuserbankaccount) - Forward a payment service user's bank account to a connector * [CreatePool](docs/sdks/v3/README.md#createpool) - Create a formance pool object diff --git a/pkg/client/docs/models/components/v3connectionstatusenum.md b/pkg/client/docs/models/components/v3connectionstatusenum.md new file mode 100644 index 000000000..37339b10e --- /dev/null +++ b/pkg/client/docs/models/components/v3connectionstatusenum.md @@ -0,0 +1,9 @@ +# V3ConnectionStatusEnum + + +## Values + +| Name | Value | +| ------------------------------ | ------------------------------ | +| `V3ConnectionStatusEnumActive` | ACTIVE | +| `V3ConnectionStatusEnumError` | ERROR | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserconnection.md b/pkg/client/docs/models/components/v3paymentserviceuserconnection.md new file mode 100644 index 000000000..99131dd5e --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserconnection.md @@ -0,0 +1,14 @@ +# V3PaymentServiceUserConnection + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ConnectionID` | *string* | :heavy_check_mark: | N/A | +| `ConnectorID` | *string* | :heavy_check_mark: | N/A | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `DataUpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `Status` | [components.V3ConnectionStatusEnum](../../models/components/v3connectionstatusenum.md) | :heavy_check_mark: | N/A | +| `Error` | **string* | :heavy_minus_sign: | N/A | +| `Metadata` | map[string]*string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponse.md new file mode 100644 index 000000000..dd0b342d4 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponse.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserConnectionsCursorResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Cursor` | [components.V3PaymentServiceUserConnectionsCursorResponseCursor](../../models/components/v3paymentserviceuserconnectionscursorresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponsecursor.md b/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponsecursor.md new file mode 100644 index 000000000..b20b0c909 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserconnectionscursorresponsecursor.md @@ -0,0 +1,12 @@ +# V3PaymentServiceUserConnectionsCursorResponseCursor + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `PageSize` | *int64* | :heavy_check_mark: | N/A | 15 | +| `HasMore` | *bool* | :heavy_check_mark: | N/A | false | +| `Previous` | **string* | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | +| `Next` | **string* | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | +| `Data` | [][components.V3PaymentServiceUserConnection](../../models/components/v3paymentserviceuserconnection.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceusercreatelinkrequest.md b/pkg/client/docs/models/components/v3paymentserviceusercreatelinkrequest.md new file mode 100644 index 000000000..957bb9129 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceusercreatelinkrequest.md @@ -0,0 +1,9 @@ +# V3PaymentServiceUserCreateLinkRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `ApplicationName` | *string* | :heavy_check_mark: | The name of the application to be displayed to the user when they click the link (depending on the open banking provider). | +| `ClientRedirectURL` | *string* | :heavy_check_mark: | The URL to redirect the user to after the link flow is completed. | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceusercreatelinkresponse.md b/pkg/client/docs/models/components/v3paymentserviceusercreatelinkresponse.md new file mode 100644 index 000000000..74fc5ea80 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceusercreatelinkresponse.md @@ -0,0 +1,9 @@ +# V3PaymentServiceUserCreateLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `AttemptID` | *string* | :heavy_check_mark: | N/A | +| `Link` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponse.md new file mode 100644 index 000000000..8ef8328f8 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponse.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteConnectionResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `Data` | [components.V3PaymentServiceUserDeleteConnectionResponseData](../../models/components/v3paymentserviceuserdeleteconnectionresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponsedata.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponsedata.md new file mode 100644 index 000000000..1844e26db --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectionresponsedata.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteConnectionResponseData + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `TaskID` | *string* | :heavy_check_mark: | Since this call is asynchronous, the response will contain the ID of the task that was created to delete the connection. You can use the task API to check the status of the task.
| \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponse.md new file mode 100644 index 000000000..3cadacf22 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponse.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteConnectorResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `Data` | [components.V3PaymentServiceUserDeleteConnectorResponseData](../../models/components/v3paymentserviceuserdeleteconnectorresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponsedata.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponsedata.md new file mode 100644 index 000000000..e50d8f56b --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteconnectorresponsedata.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteConnectorResponseData + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `TaskID` | *string* | :heavy_check_mark: | Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user on the connector. You can use the task API to check the status of the task.
| \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponse.md new file mode 100644 index 000000000..9aa6817c5 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponse.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `Data` | [components.V3PaymentServiceUserDeleteResponseData](../../models/components/v3paymentserviceuserdeleteresponsedata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponsedata.md b/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponsedata.md new file mode 100644 index 000000000..882515711 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserdeleteresponsedata.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserDeleteResponseData + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `TaskID` | *string* | :heavy_check_mark: | Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user. You can use the task API to check the status of the task.
| \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserlinkattempt.md b/pkg/client/docs/models/components/v3paymentserviceuserlinkattempt.md new file mode 100644 index 000000000..fc7e96b1e --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserlinkattempt.md @@ -0,0 +1,14 @@ +# V3PaymentServiceUserLinkAttempt + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | N/A | +| `PsuID` | *string* | :heavy_check_mark: | N/A | +| `ConnectorID` | *string* | :heavy_check_mark: | N/A | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `Status` | [components.V3PSUBankBridgeConnectionAttemptStatusEnum](../../models/components/v3psubankbridgeconnectionattemptstatusenum.md) | :heavy_check_mark: | N/A | +| `ClientRedirectURL` | *string* | :heavy_check_mark: | N/A | +| `Error` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponse.md new file mode 100644 index 000000000..fb52caacb --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponse.md @@ -0,0 +1,8 @@ +# V3PaymentServiceUserLinkAttemptsCursorResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Cursor` | [components.V3PaymentServiceUserLinkAttemptsCursorResponseCursor](../../models/components/v3paymentserviceuserlinkattemptscursorresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponsecursor.md b/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponsecursor.md new file mode 100644 index 000000000..0935c39c2 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserlinkattemptscursorresponsecursor.md @@ -0,0 +1,12 @@ +# V3PaymentServiceUserLinkAttemptsCursorResponseCursor + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `PageSize` | *int64* | :heavy_check_mark: | N/A | 15 | +| `HasMore` | *bool* | :heavy_check_mark: | N/A | false | +| `Previous` | **string* | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | +| `Next` | **string* | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | +| `Data` | [][components.V3PaymentServiceUserLinkAttempt](../../models/components/v3paymentserviceuserlinkattempt.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkrequest.md b/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkrequest.md new file mode 100644 index 000000000..e69147a14 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkrequest.md @@ -0,0 +1,9 @@ +# V3PaymentServiceUserUpdateLinkRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------- | ------------------- | ------------------- | ------------------- | +| `ApplicationName` | *string* | :heavy_check_mark: | N/A | +| `ClientRedirectURL` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkresponse.md b/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkresponse.md new file mode 100644 index 000000000..0c7cdb0d2 --- /dev/null +++ b/pkg/client/docs/models/components/v3paymentserviceuserupdatelinkresponse.md @@ -0,0 +1,9 @@ +# V3PaymentServiceUserUpdateLinkResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `AttemptID` | *string* | :heavy_check_mark: | N/A | +| `Link` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/components/v3psubankbridgeconnectionattemptstatusenum.md b/pkg/client/docs/models/components/v3psubankbridgeconnectionattemptstatusenum.md new file mode 100644 index 000000000..210b7bca7 --- /dev/null +++ b/pkg/client/docs/models/components/v3psubankbridgeconnectionattemptstatusenum.md @@ -0,0 +1,10 @@ +# V3PSUBankBridgeConnectionAttemptStatusEnum + + +## Values + +| Name | Value | +| ----------------------------------------------------- | ----------------------------------------------------- | +| `V3PSUBankBridgeConnectionAttemptStatusEnumPending` | pending | +| `V3PSUBankBridgeConnectionAttemptStatusEnumCompleted` | completed | +| `V3PSUBankBridgeConnectionAttemptStatusEnumExited` | exited | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserrequest.md b/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserrequest.md new file mode 100644 index 000000000..05c532205 --- /dev/null +++ b/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserrequest.md @@ -0,0 +1,10 @@ +# V3CreateLinkForPaymentServiceUserRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | +| `V3PaymentServiceUserCreateLinkRequest` | [*components.V3PaymentServiceUserCreateLinkRequest](../../models/components/v3paymentserviceusercreatelinkrequest.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserresponse.md b/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserresponse.md new file mode 100644 index 000000000..43e89a412 --- /dev/null +++ b/pkg/client/docs/models/operations/v3createlinkforpaymentserviceuserresponse.md @@ -0,0 +1,10 @@ +# V3CreateLinkForPaymentServiceUserResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserCreateLinkResponse` | [*components.V3PaymentServiceUserCreateLinkResponse](../../models/components/v3paymentserviceusercreatelinkresponse.md) | :heavy_minus_sign: | Created | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridrequest.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridrequest.md new file mode 100644 index 000000000..b4885fb0e --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridrequest.md @@ -0,0 +1,10 @@ +# V3DeletePaymentServiceUserConnectionFromConnectorIDRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | +| `ConnectionID` | *string* | :heavy_check_mark: | The connection ID | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridresponse.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridresponse.md new file mode 100644 index 000000000..a972b4c0d --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectionfromconnectoridresponse.md @@ -0,0 +1,10 @@ +# V3DeletePaymentServiceUserConnectionFromConnectorIDResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserDeleteConnectionResponse` | [*components.V3PaymentServiceUserDeleteConnectionResponse](../../models/components/v3paymentserviceuserdeleteconnectionresponse.md) | :heavy_minus_sign: | Accepted | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorrequest.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorrequest.md new file mode 100644 index 000000000..93214f0dc --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorrequest.md @@ -0,0 +1,9 @@ +# V3DeletePaymentServiceUserConnectorRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorresponse.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorresponse.md new file mode 100644 index 000000000..713c81ca5 --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserconnectorresponse.md @@ -0,0 +1,10 @@ +# V3DeletePaymentServiceUserConnectorResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserDeleteConnectorResponse` | [*components.V3PaymentServiceUserDeleteConnectorResponse](../../models/components/v3paymentserviceuserdeleteconnectorresponse.md) | :heavy_minus_sign: | Accepted | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserrequest.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserrequest.md new file mode 100644 index 000000000..84c0ccf81 --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserrequest.md @@ -0,0 +1,8 @@ +# V3DeletePaymentServiceUserRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3deletepaymentserviceuserresponse.md b/pkg/client/docs/models/operations/v3deletepaymentserviceuserresponse.md new file mode 100644 index 000000000..2e96b2446 --- /dev/null +++ b/pkg/client/docs/models/operations/v3deletepaymentserviceuserresponse.md @@ -0,0 +1,10 @@ +# V3DeletePaymentServiceUserResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserDeleteResponse` | [*components.V3PaymentServiceUserDeleteResponse](../../models/components/v3paymentserviceuserdeleteresponse.md) | :heavy_minus_sign: | Accepted | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgerequest.md b/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgerequest.md new file mode 100644 index 000000000..7602bb34b --- /dev/null +++ b/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgerequest.md @@ -0,0 +1,9 @@ +# V3ForwardPaymentServiceUserToBankBridgeRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgeresponse.md b/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgeresponse.md new file mode 100644 index 000000000..cc065e1b1 --- /dev/null +++ b/pkg/client/docs/models/operations/v3forwardpaymentserviceusertobankbridgeresponse.md @@ -0,0 +1,9 @@ +# V3ForwardPaymentServiceUserToBankBridgeResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridrequest.md b/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridrequest.md new file mode 100644 index 000000000..ef99aa8c2 --- /dev/null +++ b/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridrequest.md @@ -0,0 +1,10 @@ +# V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | +| `AttemptID` | *string* | :heavy_check_mark: | The attempt ID | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridresponse.md b/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridresponse.md new file mode 100644 index 000000000..dbccad9d1 --- /dev/null +++ b/pkg/client/docs/models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridresponse.md @@ -0,0 +1,10 @@ +# V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserLinkAttempt` | [*components.V3PaymentServiceUserLinkAttempt](../../models/components/v3paymentserviceuserlinkattempt.md) | :heavy_minus_sign: | OK | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridrequest.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridrequest.md new file mode 100644 index 000000000..346e95aa0 --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridrequest.md @@ -0,0 +1,12 @@ +# V3ListPaymentServiceUserConnectionsFromConnectorIDRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | | +| `PageSize` | **int64* | :heavy_minus_sign: | The number of items to return | 100 | +| `Cursor` | **string* | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `RequestBody` | map[string]*any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridresponse.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridresponse.md new file mode 100644 index 000000000..19da5c26d --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsfromconnectoridresponse.md @@ -0,0 +1,10 @@ +# V3ListPaymentServiceUserConnectionsFromConnectorIDResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserConnectionsCursorResponse` | [*components.V3PaymentServiceUserConnectionsCursorResponse](../../models/components/v3paymentserviceuserconnectionscursorresponse.md) | :heavy_minus_sign: | OK | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsrequest.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsrequest.md new file mode 100644 index 000000000..5c61c1d49 --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsrequest.md @@ -0,0 +1,11 @@ +# V3ListPaymentServiceUserConnectionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | | +| `PageSize` | **int64* | :heavy_minus_sign: | The number of items to return | 100 | +| `Cursor` | **string* | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `RequestBody` | map[string]*any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsresponse.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsresponse.md new file mode 100644 index 000000000..ea77b1a6f --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserconnectionsresponse.md @@ -0,0 +1,10 @@ +# V3ListPaymentServiceUserConnectionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserConnectionsCursorResponse` | [*components.V3PaymentServiceUserConnectionsCursorResponse](../../models/components/v3paymentserviceuserconnectionscursorresponse.md) | :heavy_minus_sign: | OK | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridrequest.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridrequest.md new file mode 100644 index 000000000..dcec7dee5 --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridrequest.md @@ -0,0 +1,12 @@ +# V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | | +| `PageSize` | **int64* | :heavy_minus_sign: | The number of items to return | 100 | +| `Cursor` | **string* | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `RequestBody` | map[string]*any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridresponse.md b/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridresponse.md new file mode 100644 index 000000000..b71111906 --- /dev/null +++ b/pkg/client/docs/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridresponse.md @@ -0,0 +1,10 @@ +# V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserLinkAttemptsCursorResponse` | [*components.V3PaymentServiceUserLinkAttemptsCursorResponse](../../models/components/v3paymentserviceuserlinkattemptscursorresponse.md) | :heavy_minus_sign: | OK | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorrequest.md b/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorrequest.md new file mode 100644 index 000000000..d8170e03f --- /dev/null +++ b/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorrequest.md @@ -0,0 +1,11 @@ +# V3UpdateLinkForPaymentServiceUserOnConnectorRequest + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `PaymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `ConnectorID` | *string* | :heavy_check_mark: | The connector ID | +| `ConnectionID` | *string* | :heavy_check_mark: | The connection ID | +| `V3PaymentServiceUserUpdateLinkRequest` | [*components.V3PaymentServiceUserUpdateLinkRequest](../../models/components/v3paymentserviceuserupdatelinkrequest.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorresponse.md b/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorresponse.md new file mode 100644 index 000000000..40f3fba01 --- /dev/null +++ b/pkg/client/docs/models/operations/v3updatelinkforpaymentserviceuseronconnectorresponse.md @@ -0,0 +1,10 @@ +# V3UpdateLinkForPaymentServiceUserOnConnectorResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `V3PaymentServiceUserUpdateLinkResponse` | [*components.V3PaymentServiceUserUpdateLinkResponse](../../models/components/v3paymentserviceuserupdatelinkresponse.md) | :heavy_minus_sign: | Created | +| `V3ErrorResponse` | [*components.V3ErrorResponse](../../models/components/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/client/docs/sdks/v3/README.md b/pkg/client/docs/sdks/v3/README.md index 435f40cba..47588d4d4 100644 --- a/pkg/client/docs/sdks/v3/README.md +++ b/pkg/client/docs/sdks/v3/README.md @@ -44,6 +44,18 @@ * [CreatePaymentServiceUser](#createpaymentserviceuser) - Create a formance payment service user object * [ListPaymentServiceUsers](#listpaymentserviceusers) - List all payment service users * [GetPaymentServiceUser](#getpaymentserviceuser) - Get a payment service user by ID +* [DeletePaymentServiceUser](#deletepaymentserviceuser) - Delete a payment service user by ID +* [ListPaymentServiceUserConnections](#listpaymentserviceuserconnections) - List all connections for a payment service user +* [DeletePaymentServiceUserConnector](#deletepaymentserviceuserconnector) - Remove a payment service user from a connector, the PSU will still exist in Formance +* [ForwardPaymentServiceUserToBankBridge](#forwardpaymentserviceusertobankbridge) - Register/forward a payment service user on/to a connector +* [CreateLinkForPaymentServiceUser](#createlinkforpaymentserviceuser) - Create an authentication link for a payment service user on a connector, for oauth flow +* [ListPaymentServiceUserConnectionsFromConnectorID](#listpaymentserviceuserconnectionsfromconnectorid) - List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) +* [ListPaymentServiceUserLinkAttemptsFromConnectorID](#listpaymentserviceuserlinkattemptsfromconnectorid) - List all link attempts for a payment service user on a connector. +Allows to check if users used the link and completed the oauth flow. + +* [GetPaymentServiceUserLinkAttemptFromConnectorID](#getpaymentserviceuserlinkattemptfromconnectorid) - Get a link attempt for a payment service user on a connector +* [DeletePaymentServiceUserConnectionFromConnectorID](#deletepaymentserviceuserconnectionfromconnectorid) - Delete a connection for a payment service user on a connector +* [UpdateLinkForPaymentServiceUserOnConnector](#updatelinkforpaymentserviceuseronconnector) - Update/Regenerate a link for a payment service user on a connector * [AddBankAccountToPaymentServiceUser](#addbankaccounttopaymentserviceuser) - Add a bank account to a payment service user * [ForwardPaymentServiceUserBankAccount](#forwardpaymentserviceuserbankaccount) - Forward a payment service user's bank account to a connector * [CreatePool](#createpool) - Create a formance pool object @@ -1967,6 +1979,554 @@ func main() { | ------------------ | ------------------ | ------------------ | | sdkerrors.SDKError | 4XX, 5XX | \*/\* | +## DeletePaymentServiceUser + +Delete a payment service user by ID + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.DeletePaymentServiceUser(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserDeleteResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3DeletePaymentServiceUserResponse](../../models/operations/v3deletepaymentserviceuserresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ListPaymentServiceUserConnections + +List all connections for a payment service user + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.ListPaymentServiceUserConnections(ctx, "", client.Int64(100), client.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="), nil) + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserConnectionsCursorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | | +| `pageSize` | **int64* | :heavy_minus_sign: | The number of items to return | 100 | +| `cursor` | **string* | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `requestBody` | map[string]*any* | :heavy_minus_sign: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.V3ListPaymentServiceUserConnectionsResponse](../../models/operations/v3listpaymentserviceuserconnectionsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## DeletePaymentServiceUserConnector + +Remove a payment service user from a connector, the PSU will still exist in Formance + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.DeletePaymentServiceUserConnector(ctx, "", "") + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserDeleteConnectorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3DeletePaymentServiceUserConnectorResponse](../../models/operations/v3deletepaymentserviceuserconnectorresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ForwardPaymentServiceUserToBankBridge + +Register/forward a payment service user on/to a connector + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.ForwardPaymentServiceUserToBankBridge(ctx, "", "") + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3ForwardPaymentServiceUserToBankBridgeResponse](../../models/operations/v3forwardpaymentserviceusertobankbridgeresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## CreateLinkForPaymentServiceUser + +Create an authentication link for a payment service user on a connector, for oauth flow + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.CreateLinkForPaymentServiceUser(ctx, "", "", nil) + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserCreateLinkResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `v3PaymentServiceUserCreateLinkRequest` | [*components.V3PaymentServiceUserCreateLinkRequest](../../models/components/v3paymentserviceusercreatelinkrequest.md) | :heavy_minus_sign: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3CreateLinkForPaymentServiceUserResponse](../../models/operations/v3createlinkforpaymentserviceuserresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ListPaymentServiceUserConnectionsFromConnectorID + +List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "github.com/formancehq/payments/pkg/client/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.ListPaymentServiceUserConnectionsFromConnectorID(ctx, operations.V3ListPaymentServiceUserConnectionsFromConnectorIDRequest{ + PaymentServiceUserID: "", + ConnectorID: "", + PageSize: client.Int64(100), + Cursor: client.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="), + }) + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserConnectionsCursorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3ListPaymentServiceUserConnectionsFromConnectorIDRequest](../../models/operations/v3listpaymentserviceuserconnectionsfromconnectoridrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3ListPaymentServiceUserConnectionsFromConnectorIDResponse](../../models/operations/v3listpaymentserviceuserconnectionsfromconnectoridresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ListPaymentServiceUserLinkAttemptsFromConnectorID + +List all link attempts for a payment service user on a connector. +Allows to check if users used the link and completed the oauth flow. + + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "github.com/formancehq/payments/pkg/client/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.ListPaymentServiceUserLinkAttemptsFromConnectorID(ctx, operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest{ + PaymentServiceUserID: "", + ConnectorID: "", + PageSize: client.Int64(100), + Cursor: client.String("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="), + }) + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserLinkAttemptsCursorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest](../../models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse](../../models/operations/v3listpaymentserviceuserlinkattemptsfromconnectoridresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## GetPaymentServiceUserLinkAttemptFromConnectorID + +Get a link attempt for a payment service user on a connector + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.GetPaymentServiceUserLinkAttemptFromConnectorID(ctx, "", "", "") + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserLinkAttempt != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `attemptID` | *string* | :heavy_check_mark: | The attempt ID | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse](../../models/operations/v3getpaymentserviceuserlinkattemptfromconnectoridresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## DeletePaymentServiceUserConnectionFromConnectorID + +Delete a connection for a payment service user on a connector + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.DeletePaymentServiceUserConnectionFromConnectorID(ctx, "", "", "") + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserDeleteConnectionResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `connectionID` | *string* | :heavy_check_mark: | The connection ID | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3DeletePaymentServiceUserConnectionFromConnectorIDResponse](../../models/operations/v3deletepaymentserviceuserconnectionfromconnectoridresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## UpdateLinkForPaymentServiceUserOnConnector + +Update/Regenerate a link for a payment service user on a connector + +### Example Usage + +```go +package main + +import( + "context" + "github.com/formancehq/payments/pkg/client" + "os" + "log" +) + +func main() { + ctx := context.Background() + + s := client.New( + "https://api.example.com", + client.WithSecurity(os.Getenv("FORMANCE_AUTHORIZATION")), + ) + + res, err := s.Payments.V3.UpdateLinkForPaymentServiceUserOnConnector(ctx, "", "", "", nil) + if err != nil { + log.Fatal(err) + } + if res.V3PaymentServiceUserUpdateLinkResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `paymentServiceUserID` | *string* | :heavy_check_mark: | The payment service user ID | +| `connectorID` | *string* | :heavy_check_mark: | The connector ID | +| `connectionID` | *string* | :heavy_check_mark: | The connection ID | +| `v3PaymentServiceUserUpdateLinkRequest` | [*components.V3PaymentServiceUserUpdateLinkRequest](../../models/components/v3paymentserviceuserupdatelinkrequest.md) | :heavy_minus_sign: | N/A | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3UpdateLinkForPaymentServiceUserOnConnectorResponse](../../models/operations/v3updatelinkforpaymentserviceuseronconnectorresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + ## AddBankAccountToPaymentServiceUser Add a bank account to a payment service user diff --git a/pkg/client/models/components/v3connectionstatusenum.go b/pkg/client/models/components/v3connectionstatusenum.go new file mode 100644 index 000000000..400941ac0 --- /dev/null +++ b/pkg/client/models/components/v3connectionstatusenum.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type V3ConnectionStatusEnum string + +const ( + V3ConnectionStatusEnumActive V3ConnectionStatusEnum = "ACTIVE" + V3ConnectionStatusEnumError V3ConnectionStatusEnum = "ERROR" +) + +func (e V3ConnectionStatusEnum) ToPointer() *V3ConnectionStatusEnum { + return &e +} +func (e *V3ConnectionStatusEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "ACTIVE": + fallthrough + case "ERROR": + *e = V3ConnectionStatusEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3ConnectionStatusEnum: %v", v) + } +} diff --git a/pkg/client/models/components/v3paymentserviceuserconnection.go b/pkg/client/models/components/v3paymentserviceuserconnection.go new file mode 100644 index 000000000..73e8621df --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserconnection.go @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/formancehq/payments/pkg/client/internal/utils" + "time" +) + +type V3PaymentServiceUserConnection struct { + ConnectionID string `json:"connectionID"` + ConnectorID string `json:"connectorID"` + CreatedAt time.Time `json:"createdAt"` + DataUpdatedAt time.Time `json:"dataUpdatedAt"` + Status V3ConnectionStatusEnum `json:"status"` + Error *string `json:"error,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` +} + +func (v V3PaymentServiceUserConnection) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V3PaymentServiceUserConnection) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, false); err != nil { + return err + } + return nil +} + +func (o *V3PaymentServiceUserConnection) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *V3PaymentServiceUserConnection) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3PaymentServiceUserConnection) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *V3PaymentServiceUserConnection) GetDataUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.DataUpdatedAt +} + +func (o *V3PaymentServiceUserConnection) GetStatus() V3ConnectionStatusEnum { + if o == nil { + return V3ConnectionStatusEnum("") + } + return o.Status +} + +func (o *V3PaymentServiceUserConnection) GetError() *string { + if o == nil { + return nil + } + return o.Error +} + +func (o *V3PaymentServiceUserConnection) GetMetadata() map[string]string { + if o == nil { + return nil + } + return o.Metadata +} diff --git a/pkg/client/models/components/v3paymentserviceuserconnectionscursorresponse.go b/pkg/client/models/components/v3paymentserviceuserconnectionscursorresponse.go new file mode 100644 index 000000000..64b6f7fb6 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserconnectionscursorresponse.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserConnectionsCursorResponseCursor struct { + PageSize int64 `json:"pageSize"` + HasMore bool `json:"hasMore"` + Previous *string `json:"previous,omitempty"` + Next *string `json:"next,omitempty"` + Data []V3PaymentServiceUserConnection `json:"data"` +} + +func (o *V3PaymentServiceUserConnectionsCursorResponseCursor) GetPageSize() int64 { + if o == nil { + return 0 + } + return o.PageSize +} + +func (o *V3PaymentServiceUserConnectionsCursorResponseCursor) GetHasMore() bool { + if o == nil { + return false + } + return o.HasMore +} + +func (o *V3PaymentServiceUserConnectionsCursorResponseCursor) GetPrevious() *string { + if o == nil { + return nil + } + return o.Previous +} + +func (o *V3PaymentServiceUserConnectionsCursorResponseCursor) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *V3PaymentServiceUserConnectionsCursorResponseCursor) GetData() []V3PaymentServiceUserConnection { + if o == nil { + return []V3PaymentServiceUserConnection{} + } + return o.Data +} + +type V3PaymentServiceUserConnectionsCursorResponse struct { + Cursor V3PaymentServiceUserConnectionsCursorResponseCursor `json:"cursor"` +} + +func (o *V3PaymentServiceUserConnectionsCursorResponse) GetCursor() V3PaymentServiceUserConnectionsCursorResponseCursor { + if o == nil { + return V3PaymentServiceUserConnectionsCursorResponseCursor{} + } + return o.Cursor +} diff --git a/pkg/client/models/components/v3paymentserviceusercreatelinkrequest.go b/pkg/client/models/components/v3paymentserviceusercreatelinkrequest.go new file mode 100644 index 000000000..1cbafaa73 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceusercreatelinkrequest.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserCreateLinkRequest struct { + // The name of the application to be displayed to the user when they click the link (depending on the open banking provider). + ApplicationName string `json:"applicationName"` + // The URL to redirect the user to after the link flow is completed. + ClientRedirectURL string `json:"clientRedirectURL"` +} + +func (o *V3PaymentServiceUserCreateLinkRequest) GetApplicationName() string { + if o == nil { + return "" + } + return o.ApplicationName +} + +func (o *V3PaymentServiceUserCreateLinkRequest) GetClientRedirectURL() string { + if o == nil { + return "" + } + return o.ClientRedirectURL +} diff --git a/pkg/client/models/components/v3paymentserviceusercreatelinkresponse.go b/pkg/client/models/components/v3paymentserviceusercreatelinkresponse.go new file mode 100644 index 000000000..2bd7bfe67 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceusercreatelinkresponse.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserCreateLinkResponse struct { + AttemptID string `json:"attemptID"` + Link string `json:"link"` +} + +func (o *V3PaymentServiceUserCreateLinkResponse) GetAttemptID() string { + if o == nil { + return "" + } + return o.AttemptID +} + +func (o *V3PaymentServiceUserCreateLinkResponse) GetLink() string { + if o == nil { + return "" + } + return o.Link +} diff --git a/pkg/client/models/components/v3paymentserviceuserdeleteconnectionresponse.go b/pkg/client/models/components/v3paymentserviceuserdeleteconnectionresponse.go new file mode 100644 index 000000000..321ec7fd4 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserdeleteconnectionresponse.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserDeleteConnectionResponseData struct { + // Since this call is asynchronous, the response will contain the ID of the task that was created to delete the connection. You can use the task API to check the status of the task. + // + TaskID string `json:"taskID"` +} + +func (o *V3PaymentServiceUserDeleteConnectionResponseData) GetTaskID() string { + if o == nil { + return "" + } + return o.TaskID +} + +type V3PaymentServiceUserDeleteConnectionResponse struct { + Data V3PaymentServiceUserDeleteConnectionResponseData `json:"data"` +} + +func (o *V3PaymentServiceUserDeleteConnectionResponse) GetData() V3PaymentServiceUserDeleteConnectionResponseData { + if o == nil { + return V3PaymentServiceUserDeleteConnectionResponseData{} + } + return o.Data +} diff --git a/pkg/client/models/components/v3paymentserviceuserdeleteconnectorresponse.go b/pkg/client/models/components/v3paymentserviceuserdeleteconnectorresponse.go new file mode 100644 index 000000000..86d93a4ac --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserdeleteconnectorresponse.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserDeleteConnectorResponseData struct { + // Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user on the connector. You can use the task API to check the status of the task. + // + TaskID string `json:"taskID"` +} + +func (o *V3PaymentServiceUserDeleteConnectorResponseData) GetTaskID() string { + if o == nil { + return "" + } + return o.TaskID +} + +type V3PaymentServiceUserDeleteConnectorResponse struct { + Data V3PaymentServiceUserDeleteConnectorResponseData `json:"data"` +} + +func (o *V3PaymentServiceUserDeleteConnectorResponse) GetData() V3PaymentServiceUserDeleteConnectorResponseData { + if o == nil { + return V3PaymentServiceUserDeleteConnectorResponseData{} + } + return o.Data +} diff --git a/pkg/client/models/components/v3paymentserviceuserdeleteresponse.go b/pkg/client/models/components/v3paymentserviceuserdeleteresponse.go new file mode 100644 index 000000000..84baa3a8b --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserdeleteresponse.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserDeleteResponseData struct { + // Since this call is asynchronous, the response will contain the ID of the task that was created to delete the payment service user. You can use the task API to check the status of the task. + // + TaskID string `json:"taskID"` +} + +func (o *V3PaymentServiceUserDeleteResponseData) GetTaskID() string { + if o == nil { + return "" + } + return o.TaskID +} + +type V3PaymentServiceUserDeleteResponse struct { + Data V3PaymentServiceUserDeleteResponseData `json:"data"` +} + +func (o *V3PaymentServiceUserDeleteResponse) GetData() V3PaymentServiceUserDeleteResponseData { + if o == nil { + return V3PaymentServiceUserDeleteResponseData{} + } + return o.Data +} diff --git a/pkg/client/models/components/v3paymentserviceuserlinkattempt.go b/pkg/client/models/components/v3paymentserviceuserlinkattempt.go new file mode 100644 index 000000000..c7d809958 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserlinkattempt.go @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/formancehq/payments/pkg/client/internal/utils" + "time" +) + +type V3PaymentServiceUserLinkAttempt struct { + ID string `json:"id"` + PsuID string `json:"psuID"` + ConnectorID string `json:"connectorID"` + CreatedAt time.Time `json:"createdAt"` + Status V3PSUBankBridgeConnectionAttemptStatusEnum `json:"status"` + ClientRedirectURL string `json:"clientRedirectURL"` + Error *string `json:"error,omitempty"` +} + +func (v V3PaymentServiceUserLinkAttempt) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V3PaymentServiceUserLinkAttempt) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, false); err != nil { + return err + } + return nil +} + +func (o *V3PaymentServiceUserLinkAttempt) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *V3PaymentServiceUserLinkAttempt) GetPsuID() string { + if o == nil { + return "" + } + return o.PsuID +} + +func (o *V3PaymentServiceUserLinkAttempt) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3PaymentServiceUserLinkAttempt) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *V3PaymentServiceUserLinkAttempt) GetStatus() V3PSUBankBridgeConnectionAttemptStatusEnum { + if o == nil { + return V3PSUBankBridgeConnectionAttemptStatusEnum("") + } + return o.Status +} + +func (o *V3PaymentServiceUserLinkAttempt) GetClientRedirectURL() string { + if o == nil { + return "" + } + return o.ClientRedirectURL +} + +func (o *V3PaymentServiceUserLinkAttempt) GetError() *string { + if o == nil { + return nil + } + return o.Error +} diff --git a/pkg/client/models/components/v3paymentserviceuserlinkattemptscursorresponse.go b/pkg/client/models/components/v3paymentserviceuserlinkattemptscursorresponse.go new file mode 100644 index 000000000..08b6853c0 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserlinkattemptscursorresponse.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserLinkAttemptsCursorResponseCursor struct { + PageSize int64 `json:"pageSize"` + HasMore bool `json:"hasMore"` + Previous *string `json:"previous,omitempty"` + Next *string `json:"next,omitempty"` + Data []V3PaymentServiceUserLinkAttempt `json:"data"` +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponseCursor) GetPageSize() int64 { + if o == nil { + return 0 + } + return o.PageSize +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponseCursor) GetHasMore() bool { + if o == nil { + return false + } + return o.HasMore +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponseCursor) GetPrevious() *string { + if o == nil { + return nil + } + return o.Previous +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponseCursor) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponseCursor) GetData() []V3PaymentServiceUserLinkAttempt { + if o == nil { + return []V3PaymentServiceUserLinkAttempt{} + } + return o.Data +} + +type V3PaymentServiceUserLinkAttemptsCursorResponse struct { + Cursor V3PaymentServiceUserLinkAttemptsCursorResponseCursor `json:"cursor"` +} + +func (o *V3PaymentServiceUserLinkAttemptsCursorResponse) GetCursor() V3PaymentServiceUserLinkAttemptsCursorResponseCursor { + if o == nil { + return V3PaymentServiceUserLinkAttemptsCursorResponseCursor{} + } + return o.Cursor +} diff --git a/pkg/client/models/components/v3paymentserviceuserupdatelinkrequest.go b/pkg/client/models/components/v3paymentserviceuserupdatelinkrequest.go new file mode 100644 index 000000000..b51360976 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserupdatelinkrequest.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserUpdateLinkRequest struct { + ApplicationName string `json:"applicationName"` + ClientRedirectURL string `json:"clientRedirectURL"` +} + +func (o *V3PaymentServiceUserUpdateLinkRequest) GetApplicationName() string { + if o == nil { + return "" + } + return o.ApplicationName +} + +func (o *V3PaymentServiceUserUpdateLinkRequest) GetClientRedirectURL() string { + if o == nil { + return "" + } + return o.ClientRedirectURL +} diff --git a/pkg/client/models/components/v3paymentserviceuserupdatelinkresponse.go b/pkg/client/models/components/v3paymentserviceuserupdatelinkresponse.go new file mode 100644 index 000000000..7fce98803 --- /dev/null +++ b/pkg/client/models/components/v3paymentserviceuserupdatelinkresponse.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type V3PaymentServiceUserUpdateLinkResponse struct { + AttemptID string `json:"attemptID"` + Link string `json:"link"` +} + +func (o *V3PaymentServiceUserUpdateLinkResponse) GetAttemptID() string { + if o == nil { + return "" + } + return o.AttemptID +} + +func (o *V3PaymentServiceUserUpdateLinkResponse) GetLink() string { + if o == nil { + return "" + } + return o.Link +} diff --git a/pkg/client/models/components/v3psubankbridgeconnectionattemptstatusenum.go b/pkg/client/models/components/v3psubankbridgeconnectionattemptstatusenum.go new file mode 100644 index 000000000..d0fba89a2 --- /dev/null +++ b/pkg/client/models/components/v3psubankbridgeconnectionattemptstatusenum.go @@ -0,0 +1,37 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type V3PSUBankBridgeConnectionAttemptStatusEnum string + +const ( + V3PSUBankBridgeConnectionAttemptStatusEnumPending V3PSUBankBridgeConnectionAttemptStatusEnum = "pending" + V3PSUBankBridgeConnectionAttemptStatusEnumCompleted V3PSUBankBridgeConnectionAttemptStatusEnum = "completed" + V3PSUBankBridgeConnectionAttemptStatusEnumExited V3PSUBankBridgeConnectionAttemptStatusEnum = "exited" +) + +func (e V3PSUBankBridgeConnectionAttemptStatusEnum) ToPointer() *V3PSUBankBridgeConnectionAttemptStatusEnum { + return &e +} +func (e *V3PSUBankBridgeConnectionAttemptStatusEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "pending": + fallthrough + case "completed": + fallthrough + case "exited": + *e = V3PSUBankBridgeConnectionAttemptStatusEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3PSUBankBridgeConnectionAttemptStatusEnum: %v", v) + } +} diff --git a/pkg/client/models/operations/v3createlinkforpaymentserviceuser.go b/pkg/client/models/operations/v3createlinkforpaymentserviceuser.go new file mode 100644 index 000000000..c513e6496 --- /dev/null +++ b/pkg/client/models/operations/v3createlinkforpaymentserviceuser.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3CreateLinkForPaymentServiceUserRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + V3PaymentServiceUserCreateLinkRequest *components.V3PaymentServiceUserCreateLinkRequest `request:"mediaType=application/json"` +} + +func (o *V3CreateLinkForPaymentServiceUserRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3CreateLinkForPaymentServiceUserRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3CreateLinkForPaymentServiceUserRequest) GetV3PaymentServiceUserCreateLinkRequest() *components.V3PaymentServiceUserCreateLinkRequest { + if o == nil { + return nil + } + return o.V3PaymentServiceUserCreateLinkRequest +} + +type V3CreateLinkForPaymentServiceUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Created + V3PaymentServiceUserCreateLinkResponse *components.V3PaymentServiceUserCreateLinkResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3CreateLinkForPaymentServiceUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3CreateLinkForPaymentServiceUserResponse) GetV3PaymentServiceUserCreateLinkResponse() *components.V3PaymentServiceUserCreateLinkResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserCreateLinkResponse +} + +func (o *V3CreateLinkForPaymentServiceUserResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3deletepaymentserviceuser.go b/pkg/client/models/operations/v3deletepaymentserviceuser.go new file mode 100644 index 000000000..7bc4d598e --- /dev/null +++ b/pkg/client/models/operations/v3deletepaymentserviceuser.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3DeletePaymentServiceUserRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` +} + +func (o *V3DeletePaymentServiceUserRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +type V3DeletePaymentServiceUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Accepted + V3PaymentServiceUserDeleteResponse *components.V3PaymentServiceUserDeleteResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3DeletePaymentServiceUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3DeletePaymentServiceUserResponse) GetV3PaymentServiceUserDeleteResponse() *components.V3PaymentServiceUserDeleteResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserDeleteResponse +} + +func (o *V3DeletePaymentServiceUserResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3deletepaymentserviceuserconnectionfromconnectorid.go b/pkg/client/models/operations/v3deletepaymentserviceuserconnectionfromconnectorid.go new file mode 100644 index 000000000..eba0fcf4c --- /dev/null +++ b/pkg/client/models/operations/v3deletepaymentserviceuserconnectionfromconnectorid.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3DeletePaymentServiceUserConnectionFromConnectorIDRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + // The connection ID + ConnectionID string `pathParam:"style=simple,explode=false,name=connectionID"` +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDRequest) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +type V3DeletePaymentServiceUserConnectionFromConnectorIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Accepted + V3PaymentServiceUserDeleteConnectionResponse *components.V3PaymentServiceUserDeleteConnectionResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDResponse) GetV3PaymentServiceUserDeleteConnectionResponse() *components.V3PaymentServiceUserDeleteConnectionResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserDeleteConnectionResponse +} + +func (o *V3DeletePaymentServiceUserConnectionFromConnectorIDResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3deletepaymentserviceuserconnector.go b/pkg/client/models/operations/v3deletepaymentserviceuserconnector.go new file mode 100644 index 000000000..af6e2f90c --- /dev/null +++ b/pkg/client/models/operations/v3deletepaymentserviceuserconnector.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3DeletePaymentServiceUserConnectorRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` +} + +func (o *V3DeletePaymentServiceUserConnectorRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3DeletePaymentServiceUserConnectorRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +type V3DeletePaymentServiceUserConnectorResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Accepted + V3PaymentServiceUserDeleteConnectorResponse *components.V3PaymentServiceUserDeleteConnectorResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3DeletePaymentServiceUserConnectorResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3DeletePaymentServiceUserConnectorResponse) GetV3PaymentServiceUserDeleteConnectorResponse() *components.V3PaymentServiceUserDeleteConnectorResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserDeleteConnectorResponse +} + +func (o *V3DeletePaymentServiceUserConnectorResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3forwardpaymentserviceusertobankbridge.go b/pkg/client/models/operations/v3forwardpaymentserviceusertobankbridge.go new file mode 100644 index 000000000..8e723f412 --- /dev/null +++ b/pkg/client/models/operations/v3forwardpaymentserviceusertobankbridge.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3ForwardPaymentServiceUserToBankBridgeRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` +} + +func (o *V3ForwardPaymentServiceUserToBankBridgeRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3ForwardPaymentServiceUserToBankBridgeRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +type V3ForwardPaymentServiceUserToBankBridgeResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3ForwardPaymentServiceUserToBankBridgeResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3ForwardPaymentServiceUserToBankBridgeResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3getpaymentserviceuserlinkattemptfromconnectorid.go b/pkg/client/models/operations/v3getpaymentserviceuserlinkattemptfromconnectorid.go new file mode 100644 index 000000000..d26f28ded --- /dev/null +++ b/pkg/client/models/operations/v3getpaymentserviceuserlinkattemptfromconnectorid.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + // The attempt ID + AttemptID string `pathParam:"style=simple,explode=false,name=attemptID"` +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest) GetAttemptID() string { + if o == nil { + return "" + } + return o.AttemptID +} + +type V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // OK + V3PaymentServiceUserLinkAttempt *components.V3PaymentServiceUserLinkAttempt + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse) GetV3PaymentServiceUserLinkAttempt() *components.V3PaymentServiceUserLinkAttempt { + if o == nil { + return nil + } + return o.V3PaymentServiceUserLinkAttempt +} + +func (o *V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3listpaymentserviceuserconnections.go b/pkg/client/models/operations/v3listpaymentserviceuserconnections.go new file mode 100644 index 000000000..06ea732f4 --- /dev/null +++ b/pkg/client/models/operations/v3listpaymentserviceuserconnections.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3ListPaymentServiceUserConnectionsRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The number of items to return + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + RequestBody map[string]any `request:"mediaType=application/json"` +} + +func (o *V3ListPaymentServiceUserConnectionsRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3ListPaymentServiceUserConnectionsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *V3ListPaymentServiceUserConnectionsRequest) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +func (o *V3ListPaymentServiceUserConnectionsRequest) GetRequestBody() map[string]any { + if o == nil { + return nil + } + return o.RequestBody +} + +type V3ListPaymentServiceUserConnectionsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // OK + V3PaymentServiceUserConnectionsCursorResponse *components.V3PaymentServiceUserConnectionsCursorResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3ListPaymentServiceUserConnectionsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3ListPaymentServiceUserConnectionsResponse) GetV3PaymentServiceUserConnectionsCursorResponse() *components.V3PaymentServiceUserConnectionsCursorResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserConnectionsCursorResponse +} + +func (o *V3ListPaymentServiceUserConnectionsResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3listpaymentserviceuserconnectionsfromconnectorid.go b/pkg/client/models/operations/v3listpaymentserviceuserconnectionsfromconnectorid.go new file mode 100644 index 000000000..7334aaf54 --- /dev/null +++ b/pkg/client/models/operations/v3listpaymentserviceuserconnectionsfromconnectorid.go @@ -0,0 +1,84 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3ListPaymentServiceUserConnectionsFromConnectorIDRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + // The number of items to return + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + RequestBody map[string]any `request:"mediaType=application/json"` +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDRequest) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDRequest) GetRequestBody() map[string]any { + if o == nil { + return nil + } + return o.RequestBody +} + +type V3ListPaymentServiceUserConnectionsFromConnectorIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // OK + V3PaymentServiceUserConnectionsCursorResponse *components.V3PaymentServiceUserConnectionsCursorResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDResponse) GetV3PaymentServiceUserConnectionsCursorResponse() *components.V3PaymentServiceUserConnectionsCursorResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserConnectionsCursorResponse +} + +func (o *V3ListPaymentServiceUserConnectionsFromConnectorIDResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectorid.go b/pkg/client/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectorid.go new file mode 100644 index 000000000..627da4043 --- /dev/null +++ b/pkg/client/models/operations/v3listpaymentserviceuserlinkattemptsfromconnectorid.go @@ -0,0 +1,84 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + // The number of items to return + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + // Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + RequestBody map[string]any `request:"mediaType=application/json"` +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest) GetRequestBody() map[string]any { + if o == nil { + return nil + } + return o.RequestBody +} + +type V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // OK + V3PaymentServiceUserLinkAttemptsCursorResponse *components.V3PaymentServiceUserLinkAttemptsCursorResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse) GetV3PaymentServiceUserLinkAttemptsCursorResponse() *components.V3PaymentServiceUserLinkAttemptsCursorResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserLinkAttemptsCursorResponse +} + +func (o *V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/models/operations/v3updatelinkforpaymentserviceuseronconnector.go b/pkg/client/models/operations/v3updatelinkforpaymentserviceuseronconnector.go new file mode 100644 index 000000000..c20cb3aa1 --- /dev/null +++ b/pkg/client/models/operations/v3updatelinkforpaymentserviceuseronconnector.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/payments/pkg/client/models/components" +) + +type V3UpdateLinkForPaymentServiceUserOnConnectorRequest struct { + // The payment service user ID + PaymentServiceUserID string `pathParam:"style=simple,explode=false,name=paymentServiceUserID"` + // The connector ID + ConnectorID string `pathParam:"style=simple,explode=false,name=connectorID"` + // The connection ID + ConnectionID string `pathParam:"style=simple,explode=false,name=connectionID"` + V3PaymentServiceUserUpdateLinkRequest *components.V3PaymentServiceUserUpdateLinkRequest `request:"mediaType=application/json"` +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorRequest) GetPaymentServiceUserID() string { + if o == nil { + return "" + } + return o.PaymentServiceUserID +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorRequest) GetConnectorID() string { + if o == nil { + return "" + } + return o.ConnectorID +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorRequest) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorRequest) GetV3PaymentServiceUserUpdateLinkRequest() *components.V3PaymentServiceUserUpdateLinkRequest { + if o == nil { + return nil + } + return o.V3PaymentServiceUserUpdateLinkRequest +} + +type V3UpdateLinkForPaymentServiceUserOnConnectorResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Created + V3PaymentServiceUserUpdateLinkResponse *components.V3PaymentServiceUserUpdateLinkResponse + // Error + V3ErrorResponse *components.V3ErrorResponse +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorResponse) GetV3PaymentServiceUserUpdateLinkResponse() *components.V3PaymentServiceUserUpdateLinkResponse { + if o == nil { + return nil + } + return o.V3PaymentServiceUserUpdateLinkResponse +} + +func (o *V3UpdateLinkForPaymentServiceUserOnConnectorResponse) GetV3ErrorResponse() *components.V3ErrorResponse { + if o == nil { + return nil + } + return o.V3ErrorResponse +} diff --git a/pkg/client/v3.go b/pkg/client/v3.go index 75051cefc..12460f0f9 100644 --- a/pkg/client/v3.go +++ b/pkg/client/v3.go @@ -8044,6 +8044,2240 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, paymentServiceUserID str } +// DeletePaymentServiceUser - Delete a payment service user by ID +func (s *V3) DeletePaymentServiceUser(ctx context.Context, paymentServiceUserID string, opts ...operations.Option) (*operations.V3DeletePaymentServiceUserResponse, error) { + request := operations.V3DeletePaymentServiceUserRequest{ + PaymentServiceUserID: paymentServiceUserID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3DeletePaymentServiceUser", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3DeletePaymentServiceUserResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 202: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserDeleteResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserDeleteResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListPaymentServiceUserConnections - List all connections for a payment service user +func (s *V3) ListPaymentServiceUserConnections(ctx context.Context, paymentServiceUserID string, pageSize *int64, cursor *string, requestBody map[string]any, opts ...operations.Option) (*operations.V3ListPaymentServiceUserConnectionsResponse, error) { + request := operations.V3ListPaymentServiceUserConnectionsRequest{ + PaymentServiceUserID: paymentServiceUserID, + PageSize: pageSize, + Cursor: cursor, + RequestBody: requestBody, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connections", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListPaymentServiceUserConnections", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListPaymentServiceUserConnectionsResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserConnectionsCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserConnectionsCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// DeletePaymentServiceUserConnector - Remove a payment service user from a connector, the PSU will still exist in Formance +func (s *V3) DeletePaymentServiceUserConnector(ctx context.Context, paymentServiceUserID string, connectorID string, opts ...operations.Option) (*operations.V3DeletePaymentServiceUserConnectorResponse, error) { + request := operations.V3DeletePaymentServiceUserConnectorRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3DeletePaymentServiceUserConnector", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3DeletePaymentServiceUserConnectorResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 202: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserDeleteConnectorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserDeleteConnectorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ForwardPaymentServiceUserToBankBridge - Register/forward a payment service user on/to a connector +func (s *V3) ForwardPaymentServiceUserToBankBridge(ctx context.Context, paymentServiceUserID string, connectorID string, opts ...operations.Option) (*operations.V3ForwardPaymentServiceUserToBankBridgeResponse, error) { + request := operations.V3ForwardPaymentServiceUserToBankBridgeRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/forward", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ForwardPaymentServiceUserToBankBridge", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ForwardPaymentServiceUserToBankBridgeResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 204: + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// CreateLinkForPaymentServiceUser - Create an authentication link for a payment service user on a connector, for oauth flow +func (s *V3) CreateLinkForPaymentServiceUser(ctx context.Context, paymentServiceUserID string, connectorID string, v3PaymentServiceUserCreateLinkRequest *components.V3PaymentServiceUserCreateLinkRequest, opts ...operations.Option) (*operations.V3CreateLinkForPaymentServiceUserResponse, error) { + request := operations.V3CreateLinkForPaymentServiceUserRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + V3PaymentServiceUserCreateLinkRequest: v3PaymentServiceUserCreateLinkRequest, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/create-link", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3CreateLinkForPaymentServiceUser", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3PaymentServiceUserCreateLinkRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3CreateLinkForPaymentServiceUserResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserCreateLinkResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserCreateLinkResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListPaymentServiceUserConnectionsFromConnectorID - List enabled connections for a payment service user on a connector (i.e. the various banks PSUser has enabled on the connector) +func (s *V3) ListPaymentServiceUserConnectionsFromConnectorID(ctx context.Context, request operations.V3ListPaymentServiceUserConnectionsFromConnectorIDRequest, opts ...operations.Option) (*operations.V3ListPaymentServiceUserConnectionsFromConnectorIDResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListPaymentServiceUserConnectionsFromConnectorID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListPaymentServiceUserConnectionsFromConnectorIDResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserConnectionsCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserConnectionsCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListPaymentServiceUserLinkAttemptsFromConnectorID - List all link attempts for a payment service user on a connector. +// Allows to check if users used the link and completed the oauth flow. +func (s *V3) ListPaymentServiceUserLinkAttemptsFromConnectorID(ctx context.Context, request operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDRequest, opts ...operations.Option) (*operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListPaymentServiceUserLinkAttemptsFromConnectorID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListPaymentServiceUserLinkAttemptsFromConnectorIDResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserLinkAttemptsCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserLinkAttemptsCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// GetPaymentServiceUserLinkAttemptFromConnectorID - Get a link attempt for a payment service user on a connector +func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context, paymentServiceUserID string, connectorID string, attemptID string, opts ...operations.Option) (*operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse, error) { + request := operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + AttemptID: attemptID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3GetPaymentServiceUserLinkAttemptFromConnectorID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserLinkAttempt + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserLinkAttempt = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// DeletePaymentServiceUserConnectionFromConnectorID - Delete a connection for a payment service user on a connector +func (s *V3) DeletePaymentServiceUserConnectionFromConnectorID(ctx context.Context, paymentServiceUserID string, connectorID string, connectionID string, opts ...operations.Option) (*operations.V3DeletePaymentServiceUserConnectionFromConnectorIDResponse, error) { + request := operations.V3DeletePaymentServiceUserConnectionFromConnectorIDRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + ConnectionID: connectionID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3DeletePaymentServiceUserConnectionFromConnectorID", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3DeletePaymentServiceUserConnectionFromConnectorIDResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 202: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserDeleteConnectionResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserDeleteConnectionResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// UpdateLinkForPaymentServiceUserOnConnector - Update/Regenerate a link for a payment service user on a connector +func (s *V3) UpdateLinkForPaymentServiceUserOnConnector(ctx context.Context, paymentServiceUserID string, connectorID string, connectionID string, v3PaymentServiceUserUpdateLinkRequest *components.V3PaymentServiceUserUpdateLinkRequest, opts ...operations.Option) (*operations.V3UpdateLinkForPaymentServiceUserOnConnectorResponse, error) { + request := operations.V3UpdateLinkForPaymentServiceUserOnConnectorRequest{ + PaymentServiceUserID: paymentServiceUserID, + ConnectorID: connectorID, + ConnectionID: connectionID, + V3PaymentServiceUserUpdateLinkRequest: v3PaymentServiceUserUpdateLinkRequest, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/connections/{connectionID}/update-link", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + BaseURL: baseURL, + Context: ctx, + OperationID: "v3UpdateLinkForPaymentServiceUserOnConnector", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3PaymentServiceUserUpdateLinkRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3UpdateLinkForPaymentServiceUserOnConnectorResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3PaymentServiceUserUpdateLinkResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3PaymentServiceUserUpdateLinkResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + // AddBankAccountToPaymentServiceUser - Add a bank account to a payment service user func (s *V3) AddBankAccountToPaymentServiceUser(ctx context.Context, paymentServiceUserID string, bankAccountID string, opts ...operations.Option) (*operations.V3AddBankAccountToPaymentServiceUserResponse, error) { request := operations.V3AddBankAccountToPaymentServiceUserRequest{