Fix bug in official Gocardless API definition

The official Gocardless API definition indicates that transactions are
directly output to an array.

Instead, they are wrapped in a transactions key.

This made the code fail to retrieve transactions, because they could not
be correctly serialized.

This is now fixed in the API definition, and the API code is also
regenerated.

Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
Jacob Kiers 2024-10-04 20:34:27 +02:00
parent f0b8df90b9
commit 80849a9eef
8 changed files with 71 additions and 11 deletions

View File

@ -12,6 +12,7 @@ docs/AgreementsApi.md
docs/BalanceAmountSchema.md docs/BalanceAmountSchema.md
docs/BalanceSchema.md docs/BalanceSchema.md
docs/BankTransaction.md docs/BankTransaction.md
docs/BankTransactions.md
docs/CurrencyExchangeSchema.md docs/CurrencyExchangeSchema.md
docs/DetailSchema.md docs/DetailSchema.md
docs/EndUserAgreement.md docs/EndUserAgreement.md
@ -52,6 +53,7 @@ src/models/account_schema.rs
src/models/balance_amount_schema.rs src/models/balance_amount_schema.rs
src/models/balance_schema.rs src/models/balance_schema.rs
src/models/bank_transaction.rs src/models/bank_transaction.rs
src/models/bank_transactions.rs
src/models/currency_exchange_schema.rs src/models/currency_exchange_schema.rs
src/models/detail_schema.rs src/models/detail_schema.rs
src/models/end_user_agreement.rs src/models/end_user_agreement.rs

View File

@ -54,6 +54,7 @@ Class | Method | HTTP request | Description
- [BalanceAmountSchema](docs/BalanceAmountSchema.md) - [BalanceAmountSchema](docs/BalanceAmountSchema.md)
- [BalanceSchema](docs/BalanceSchema.md) - [BalanceSchema](docs/BalanceSchema.md)
- [BankTransaction](docs/BankTransaction.md) - [BankTransaction](docs/BankTransaction.md)
- [BankTransactions](docs/BankTransactions.md)
- [CurrencyExchangeSchema](docs/CurrencyExchangeSchema.md) - [CurrencyExchangeSchema](docs/CurrencyExchangeSchema.md)
- [DetailSchema](docs/DetailSchema.md) - [DetailSchema](docs/DetailSchema.md)
- [EndUserAgreement](docs/EndUserAgreement.md) - [EndUserAgreement](docs/EndUserAgreement.md)

View File

@ -103,7 +103,7 @@ Name | Type | Description | Required | Notes
## retrieve_account_transactions ## retrieve_account_transactions
> models::BankTransaction retrieve_account_transactions(id, date_from, date_to) > models::BankTransactions retrieve_account_transactions(id, date_from, date_to)
Access account transactions. Transactions will be returned in Berlin Group PSD2 format. Access account transactions. Transactions will be returned in Berlin Group PSD2 format.
@ -119,7 +119,7 @@ Name | Type | Description | Required | Notes
### Return type ### Return type
[**models::BankTransaction**](BankTransaction.md) [**models::BankTransactions**](BankTransactions.md)
### Authorization ### Authorization

View File

@ -0,0 +1,11 @@
# BankTransactions
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**transactions** | Option<[**models::BankTransaction**](BankTransaction.md)> | BankTransaction | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -166,7 +166,7 @@ pub async fn retrieve_account_metadata(configuration: &configuration::Configurat
} }
/// Access account transactions. Transactions will be returned in Berlin Group PSD2 format. /// Access account transactions. Transactions will be returned in Berlin Group PSD2 format.
pub async fn retrieve_account_transactions(configuration: &configuration::Configuration, id: &str, date_from: Option<String>, date_to: Option<String>) -> Result<models::BankTransaction, Error<RetrieveAccountTransactionsError>> { pub async fn retrieve_account_transactions(configuration: &configuration::Configuration, id: &str, date_from: Option<String>, date_to: Option<String>) -> Result<models::BankTransactions, Error<RetrieveAccountTransactionsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;

View File

@ -0,0 +1,30 @@
/*
* GoCardless Bank Account Data API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 2.0 (v2)
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// BankTransactions : BankTransactions.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BankTransactions {
/// BankTransaction
#[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
pub transactions: Option<models::BankTransaction>,
}
impl BankTransactions {
/// BankTransactions.
pub fn new() -> BankTransactions {
BankTransactions {
transactions: None,
}
}
}

View File

@ -12,6 +12,8 @@ pub mod balance_schema;
pub use self::balance_schema::BalanceSchema; pub use self::balance_schema::BalanceSchema;
pub mod bank_transaction; pub mod bank_transaction;
pub use self::bank_transaction::BankTransaction; pub use self::bank_transaction::BankTransaction;
pub mod bank_transactions;
pub use self::bank_transactions::BankTransactions;
pub mod currency_exchange_schema; pub mod currency_exchange_schema;
pub use self::currency_exchange_schema::CurrencyExchangeSchema; pub use self::currency_exchange_schema::CurrencyExchangeSchema;
pub mod detail_schema; pub mod detail_schema;

View File

@ -396,8 +396,8 @@
"AccountStateError": { "AccountStateError": {
"value": { "value": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2024-10-04 18:06:13.681544+00:00", "created": "2024-10-04 17:15:14.926423+00:00",
"last_accessed": "2024-10-04 18:06:13.681558+00:00", "last_accessed": "2024-10-04 17:15:14.926442+00:00",
"iban": "string", "iban": "string",
"aspsp_identifier": "string", "aspsp_identifier": "string",
"status": "ERROR" "status": "ERROR"
@ -703,8 +703,8 @@
"AccountStateError": { "AccountStateError": {
"value": { "value": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2024-10-04 18:06:13.681544+00:00", "created": "2024-10-04 17:15:14.926423+00:00",
"last_accessed": "2024-10-04 18:06:13.681558+00:00", "last_accessed": "2024-10-04 17:15:14.926442+00:00",
"iban": "string", "iban": "string",
"aspsp_identifier": "string", "aspsp_identifier": "string",
"status": "ERROR" "status": "ERROR"
@ -804,7 +804,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/BankTransaction" "$ref": "#/components/schemas/BankTransactions"
}, },
"examples": { "examples": {
"RetrieveAccountTransactions": { "RetrieveAccountTransactions": {
@ -1080,8 +1080,8 @@
"AccountStateError": { "AccountStateError": {
"value": { "value": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2024-10-04 18:06:13.681544+00:00", "created": "2024-10-04 17:15:14.926423+00:00",
"last_accessed": "2024-10-04 18:06:13.681558+00:00", "last_accessed": "2024-10-04 17:15:14.926442+00:00",
"iban": "string", "iban": "string",
"aspsp_identifier": "string", "aspsp_identifier": "string",
"status": "ERROR" "status": "ERROR"
@ -1329,7 +1329,7 @@
}, },
{ {
"summary": "Unsupported access scope selected.", "summary": "Unsupported access scope selected.",
"detail": "The access scopes supported by the institution are ['transactions']. The following scopes are not supported: ['details', 'balances']" "detail": "The access scopes supported by the institution are ['transactions']. The following scopes are not supported: ['balances', 'details']"
}, },
{ {
"summary": "Field 'access_scope' may not be an empty list.", "summary": "Field 'access_scope' may not be an empty list.",
@ -3684,6 +3684,20 @@
"balanceType" "balanceType"
] ]
}, },
"BankTransactions": {
"type": "object",
"description": "BankTransactions.",
"properties": {
"transactions": {
"allOf": [
{
"$ref": "#/components/schemas/BankTransaction"
}
],
"description": "BankTransaction"
}
}
},
"BankTransaction": { "BankTransaction": {
"type": "object", "type": "object",
"description": "BankTransactionSerializer.", "description": "BankTransactionSerializer.",