Skip to content

ReadTransaction always returns an empty result — wrong response type #63

Description

@mkoziy

TransactionsAPIService.ReadTransaction (GET /users/{user_guid}/transactions/{transaction_guid}) is typed to return TransactionsResponseBodyIncludes, but the endpoint responds with a singular transaction object. The SDK unmarshals into a struct that only maps the plural transactions key, so the payload is silently dropped and the returned value is always empty — with no error.

Version

v1.13.0 (latest). Also present on master HEAD.

Actual API response

{
  "transaction": {
    "guid": "TRN-...",
    ...
  }
}

SDK type used

ReadTransactionExecute returns *TransactionsResponseBodyIncludes (api_transactions.go#L1834), whose only relevant field is:

Transactions []TransactionIncludesResponse json:"transactions,omitempty"

json.Unmarshal ignores the unknown transaction key, leaves Transactions nil, and returns no error. Callers see an empty list for a transaction that actually exists.

Reproduce

resp, httpResp, err := client.TransactionsAPI.
    ReadTransaction(ctx, userGUID, transactionGUID).
    Includes("merchants,classifications,geolocations,repeating_transactions").
    Execute()

// err == nil, httpResp.StatusCode == 200
// resp.GetTransactions() -> [] (empty), despite the transaction existing

Expected

ReadTransaction should deserialize the transaction object and expose it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions