From 8a5be065fa93b6b65743906fbeb8d558b1ba9032 Mon Sep 17 00:00:00 2001 From: Ragot Geoffrey Date: Tue, 12 Dec 2023 19:47:14 +0100 Subject: [PATCH] feat(flows): compat with ledger v1 (#1003) --- Earthfile | 6 +- components/ledger/openapi.yaml | 36 ++++ components/ledger/openapi/v1.yaml | 46 +++++ .../activities/activity_account_get.go | 16 +- .../activity_ledger_create_transaction.go | 26 +-- .../activity_ledger_revert_transaction.go | 51 ------ .../internal/workflow/stages/send/run.go | 58 +++---- .../internal/workflow/stages/send/run_test.go | 157 +++++++++--------- ee/orchestration/openapi.yaml | 28 ---- ee/orchestration/openapi/v2.yaml | 31 +--- libs/clients/go/README.md | 14 +- libs/clients/go/accounts.go | 13 ++ .../go/docs/models/errors/errorresponse.md | 10 ++ .../go/docs/models/errors/errorsenum.md | 14 ++ .../models/operations/listaccountsmetadata.md | 9 - .../models/operations/listaccountsrequest.md | 2 +- .../operations/listtransactionsmetadata.md | 9 - .../operations/listtransactionsrequest.md | 2 +- libs/clients/go/docs/models/shared/account.md | 10 +- .../go/docs/models/shared/accountmetadata.md | 7 - .../shared/accountwithvolumesandbalances.md | 14 +- .../accountwithvolumesandbalancesmetadata.md | 7 - .../models/shared/orchestrationaccount.md | 12 +- .../shared/orchestrationv2transaction.md | 12 ++ .../docs/models/shared/orchestrationvolume.md | 10 -- .../models/shared/posttransactionscript.md | 2 +- .../shared/posttransactionscriptvars.md | 7 - libs/clients/go/docs/models/shared/script.md | 2 +- .../go/docs/models/shared/scriptvars.md | 7 - .../v2activitycreatetransactionoutput.md | 6 +- .../shared/v2activityreverttransaction.md | 9 - .../v2activityreverttransactionoutput.md | 8 - .../v2workflowinstancehistorystageinput.md | 1 - .../v2workflowinstancehistorystageoutput.md | 3 +- libs/clients/go/docs/models/shared/volume.md | 10 +- libs/clients/go/files.gen | 22 +-- .../go/pkg/models/operations/listaccounts.go | 8 +- .../pkg/models/operations/listtransactions.go | 8 +- .../go/pkg/models/sdkerrors/errorresponse.go | 20 +++ .../go/pkg/models/sdkerrors/errorsenum.go | 50 ++++++ libs/clients/go/pkg/models/shared/account.go | 11 +- .../shared/accountwithvolumesandbalances.go | 33 ++-- .../pkg/models/shared/orchestrationaccount.go | 12 +- .../shared/orchestrationv2transaction.go | 63 +++++++ .../pkg/models/shared/orchestrationvolume.go | 46 ----- .../go/pkg/models/shared/posttransaction.go | 9 +- libs/clients/go/pkg/models/shared/script.go | 9 +- .../v2activitycreatetransactionoutput.go | 6 +- .../shared/v2activityreverttransaction.go | 22 --- .../v2activityreverttransactionoutput.go | 14 -- .../v2workflowinstancehistorystageinput.go | 8 - .../v2workflowinstancehistorystageoutput.go | 8 - libs/clients/go/pkg/models/shared/volume.go | 32 +++- libs/clients/go/transactions.go | 35 ++++ .../suite/orchestration-workflows-execute.go | 10 +- 55 files changed, 555 insertions(+), 526 deletions(-) delete mode 100644 ee/orchestration/internal/workflow/activities/activity_ledger_revert_transaction.go create mode 100755 libs/clients/go/docs/models/errors/errorresponse.md create mode 100755 libs/clients/go/docs/models/errors/errorsenum.md delete mode 100755 libs/clients/go/docs/models/operations/listaccountsmetadata.md delete mode 100755 libs/clients/go/docs/models/operations/listtransactionsmetadata.md delete mode 100755 libs/clients/go/docs/models/shared/accountmetadata.md delete mode 100755 libs/clients/go/docs/models/shared/accountwithvolumesandbalancesmetadata.md create mode 100755 libs/clients/go/docs/models/shared/orchestrationv2transaction.md delete mode 100755 libs/clients/go/docs/models/shared/orchestrationvolume.md delete mode 100755 libs/clients/go/docs/models/shared/posttransactionscriptvars.md delete mode 100755 libs/clients/go/docs/models/shared/scriptvars.md delete mode 100755 libs/clients/go/docs/models/shared/v2activityreverttransaction.md delete mode 100755 libs/clients/go/docs/models/shared/v2activityreverttransactionoutput.md create mode 100755 libs/clients/go/pkg/models/sdkerrors/errorresponse.go create mode 100755 libs/clients/go/pkg/models/sdkerrors/errorsenum.go create mode 100755 libs/clients/go/pkg/models/shared/orchestrationv2transaction.go delete mode 100755 libs/clients/go/pkg/models/shared/orchestrationvolume.go delete mode 100755 libs/clients/go/pkg/models/shared/v2activityreverttransaction.go delete mode 100755 libs/clients/go/pkg/models/shared/v2activityreverttransactionoutput.go diff --git a/Earthfile b/Earthfile index afd24ebbff..4206b9c943 100644 --- a/Earthfile +++ b/Earthfile @@ -137,10 +137,10 @@ deploy-all: tests-all: LOCALLY FOR component IN $(cd ./components && ls -d */) - BUILD --pass-args ./components/${component}+tests + BUILD --pass-args ./components/${component}+tests END FOR component IN $(cd ./ee && ls -d */) - BUILD --pass-args ./ee/${component}+tests + BUILD --pass-args ./ee/${component}+tests END tests-integration: @@ -154,7 +154,7 @@ pre-commit: # Generate the final spec and run all the pre-commit hooks BUILD --pass-args ./components/${component}+pre-commit END FOR component IN $(cd ./ee && ls -d */) - BUILD --pass-args ./ee/${component}+pre-commit + BUILD --pass-args ./ee/${component}+pre-commit END pr: diff --git a/components/ledger/openapi.yaml b/components/ledger/openapi.yaml index 422b0d0a49..54a4261943 100644 --- a/components/ledger/openapi.yaml +++ b/components/ledger/openapi.yaml @@ -256,6 +256,18 @@ paths: "204": description: No Content content: {} + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + "404": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' default: description: Error content: @@ -607,6 +619,12 @@ paths: application/json: schema: $ref: '#/components/schemas/TransactionsResponse' + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' default: description: Error content: @@ -682,6 +700,18 @@ paths: "204": description: No Content content: {} + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + "404": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' default: description: Error content: @@ -724,6 +754,12 @@ paths: application/json: schema: $ref: '#/components/schemas/TransactionResponse' + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' default: description: Error content: diff --git a/components/ledger/openapi/v1.yaml b/components/ledger/openapi/v1.yaml index 20bc370282..24d975318e 100644 --- a/components/ledger/openapi/v1.yaml +++ b/components/ledger/openapi/v1.yaml @@ -256,6 +256,21 @@ paths: "204": description: No Content content: {} + + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + + "404": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + default: description: Error content: @@ -618,6 +633,14 @@ paths: application/json: schema: $ref: '#/components/schemas/TransactionsResponse' + + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + default: description: Error content: @@ -695,6 +718,21 @@ paths: "204": description: No Content content: {} + + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + + "404": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + default: description: Error content: @@ -738,6 +776,14 @@ paths: application/json: schema: $ref: '#/components/schemas/TransactionResponse' + + "400": + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + default: description: Error content: diff --git a/ee/orchestration/internal/workflow/activities/activity_account_get.go b/ee/orchestration/internal/workflow/activities/activity_account_get.go index dc7943d5d4..7aa55d3947 100644 --- a/ee/orchestration/internal/workflow/activities/activity_account_get.go +++ b/ee/orchestration/internal/workflow/activities/activity_account_get.go @@ -15,30 +15,30 @@ type GetAccountRequest struct { ID string `json:"id"` } -func (a Activities) GetAccount(ctx context.Context, request GetAccountRequest) (*shared.V2AccountResponse, error) { - response, err := a.client.Ledger.V2GetAccount( +func (a Activities) GetAccount(ctx context.Context, request GetAccountRequest) (*shared.AccountResponse, error) { + response, err := a.client.Accounts.GetAccount( ctx, - operations.V2GetAccountRequest{ + operations.GetAccountRequest{ Address: request.ID, Ledger: request.Ledger, }, ) if err != nil { switch err := err.(type) { - case *sdkerrors.V2ErrorResponse: - return nil, temporal.NewApplicationError(err.ErrorMessage, string(err.ErrorCode), err.Details) + case *sdkerrors.ErrorResponse: + return nil, temporal.NewApplicationError(*err.ErrorMessage, string(*err.ErrorCode), err.Details) default: return nil, err } } - return response.V2AccountResponse, nil + return response.AccountResponse, nil } var GetAccountActivity = Activities{}.GetAccount -func GetAccount(ctx workflow.Context, ledger, id string) (*shared.V2Account, error) { - ret := &shared.V2AccountResponse{} +func GetAccount(ctx workflow.Context, ledger, id string) (*shared.AccountWithVolumesAndBalances, error) { + ret := &shared.AccountResponse{} if err := executeActivity(ctx, GetAccountActivity, ret, GetAccountRequest{ Ledger: ledger, ID: id, diff --git a/ee/orchestration/internal/workflow/activities/activity_ledger_create_transaction.go b/ee/orchestration/internal/workflow/activities/activity_ledger_create_transaction.go index b9388a414c..9eb817f0d9 100644 --- a/ee/orchestration/internal/workflow/activities/activity_ledger_create_transaction.go +++ b/ee/orchestration/internal/workflow/activities/activity_ledger_create_transaction.go @@ -28,40 +28,40 @@ type CreateTransactionWrapper struct { } type CreateTransactionRequest struct { - Ledger string `pathParam:"style=simple,explode=false,name=ledger"` - Data shared.V2PostTransaction `request:"mediaType=application/json"` + Ledger string `pathParam:"style=simple,explode=false,name=ledger"` + Data shared.PostTransaction `request:"mediaType=application/json"` } -func (a Activities) CreateTransaction(ctx context.Context, request CreateTransactionRequest) (*shared.V2CreateTransactionResponse, error) { +func (a Activities) CreateTransaction(ctx context.Context, request CreateTransactionRequest) (*shared.TransactionsResponse, error) { - response, err := a.client.Ledger.V2CreateTransaction( + response, err := a.client.Transactions.CreateTransaction( ctx, - operations.V2CreateTransactionRequest{ - V2PostTransaction: request.Data, - Ledger: request.Ledger, + operations.CreateTransactionRequest{ + PostTransaction: request.Data, + Ledger: request.Ledger, }, ) if err != nil { switch err := err.(type) { - case *sdkerrors.V2ErrorResponse: - return nil, temporal.NewApplicationError(err.ErrorMessage, string(err.ErrorCode), err.Details) + case *sdkerrors.ErrorResponse: + return nil, temporal.NewApplicationError(*err.ErrorMessage, string(*err.ErrorCode), err.Details) default: return nil, err } } - return response.V2CreateTransactionResponse, nil + return response.TransactionsResponse, nil } var CreateTransactionActivity = Activities{}.CreateTransaction -func CreateTransaction(ctx workflow.Context, ledger string, request shared.V2PostTransaction) (*shared.V2Transaction, error) { - tx := &shared.V2CreateTransactionResponse{} +func CreateTransaction(ctx workflow.Context, ledger string, request shared.PostTransaction) (*shared.Transaction, error) { + tx := &shared.TransactionsResponse{} if err := executeActivity(ctx, CreateTransactionActivity, tx, CreateTransactionRequest{ Ledger: ledger, Data: request, }); err != nil { return nil, err } - return &tx.Data, nil + return &tx.Data[0], nil } diff --git a/ee/orchestration/internal/workflow/activities/activity_ledger_revert_transaction.go b/ee/orchestration/internal/workflow/activities/activity_ledger_revert_transaction.go deleted file mode 100644 index c4ca7f8149..0000000000 --- a/ee/orchestration/internal/workflow/activities/activity_ledger_revert_transaction.go +++ /dev/null @@ -1,51 +0,0 @@ -package activities - -import ( - "context" - "math/big" - - "github.com/formancehq/formance-sdk-go/pkg/models/operations" - "github.com/formancehq/formance-sdk-go/pkg/models/sdkerrors" - "github.com/formancehq/formance-sdk-go/pkg/models/shared" - "go.temporal.io/sdk/temporal" - "go.temporal.io/sdk/workflow" -) - -type RevertTransactionRequest struct { - Ledger string `json:"ledger"` - ID *big.Int `json:"txId"` -} - -func (a Activities) RevertTransaction(ctx context.Context, request RevertTransactionRequest) (*shared.V2Transaction, error) { - response, err := a.client.Ledger. - V2RevertTransaction( - ctx, - operations.V2RevertTransactionRequest{ - Ledger: request.Ledger, - ID: request.ID, - }, - ) - if err != nil { - switch err := err.(type) { - case *sdkerrors.V2ErrorResponse: - return nil, temporal.NewApplicationError(err.ErrorMessage, string(err.ErrorCode), err.Details) - default: - return nil, err - } - } - - return &response.V2RevertTransactionResponse.Data, nil -} - -var RevertTransactionActivity = Activities{}.RevertTransaction - -func RevertTransaction(ctx workflow.Context, ledger string, txID *big.Int) (*shared.Transaction, error) { - tx := &shared.Transaction{} - if err := executeActivity(ctx, RevertTransactionActivity, tx, RevertTransactionRequest{ - Ledger: ledger, - ID: txID, - }); err != nil { - return nil, err - } - return tx, nil -} diff --git a/ee/orchestration/internal/workflow/stages/send/run.go b/ee/orchestration/internal/workflow/stages/send/run.go index ad51997dd2..29b465f54e 100644 --- a/ee/orchestration/internal/workflow/stages/send/run.go +++ b/ee/orchestration/internal/workflow/stages/send/run.go @@ -2,12 +2,12 @@ package send import ( "fmt" + "reflect" "strings" "github.com/formancehq/formance-sdk-go/pkg/models/shared" "github.com/formancehq/orchestration/internal/workflow/activities" "github.com/formancehq/orchestration/internal/workflow/stages/internal" - "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/pkg/errors" "go.temporal.io/sdk/temporal" "go.temporal.io/sdk/workflow" @@ -19,15 +19,15 @@ const ( moveFromLedgerMetadata = "orchestration/move-from-ledger" ) -func extractFormanceAccountID(metadataKey string, metadata map[string]string) (string, error) { +func extractFormanceAccountID[V any](metadataKey string, metadata map[string]V) (string, error) { formanceAccountID, ok := metadata[metadataKey] if !ok { return "", fmt.Errorf("expected '%s' metadata containing formance account ID", metadataKey) } - if formanceAccountID == "" { + if reflect.ValueOf(formanceAccountID).IsZero() { return "", errors.New("formance account ID empty") } - return formanceAccountID, nil + return fmt.Sprint(formanceAccountID), nil } func justError[T any](v T, err error) error { @@ -92,14 +92,14 @@ func savePayment(ctx workflow.Context, paymentID string) (*shared.Payment, error return nil, errors.Wrapf(err, "retrieving payment: %s", paymentID) } reference := paymentAccountName(paymentID) - _, err = activities.CreateTransaction(internal.InfiniteRetryContext(ctx), internalLedger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + _, err = activities.CreateTransaction(internal.InfiniteRetryContext(ctx), internalLedger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: payment.InitialAmount, Asset: payment.Asset, Destination: paymentAccountName(paymentID), Source: "world", }}, - Metadata: metadata.Metadata{}, + Metadata: map[string]interface{}{}, Reference: &reference, }) if err != nil { @@ -162,7 +162,7 @@ func runWalletToWallet(ctx workflow.Context, source *WalletSource, destination * if err := justError(activities.DebitWallet(internal.InfiniteRetryContext(ctx), source.ID, &shared.DebitWalletRequest{ Amount: *amount, Balances: []string{source.Balance}, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveToLedgerMetadata: walletDestination.Ledger, }, })); err != nil { @@ -172,7 +172,7 @@ func runWalletToWallet(ctx workflow.Context, source *WalletSource, destination * return activities.CreditWallet(internal.InfiniteRetryContext(ctx), destination.ID, &shared.CreditWalletRequest{ Amount: *amount, Balance: &destination.Balance, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveFromLedgerMetadata: walletSource.Ledger, }, }) @@ -235,21 +235,21 @@ func runWalletToAccount(ctx workflow.Context, source *WalletSource, destination if err := justError(activities.DebitWallet(internal.InfiniteRetryContext(ctx), source.ID, &shared.DebitWalletRequest{ Amount: *amount, Balances: []string{source.Balance}, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveToLedgerMetadata: destination.Ledger, }, })); err != nil { return err } - return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: destination.ID, Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: wallet.Ledger, }, })) @@ -276,14 +276,14 @@ func runAccountToWallet(ctx workflow.Context, source *LedgerAccountSource, desti }) } - if err := justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + if err := justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: "world", Source: source.ID, }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: wallet.Ledger, }, })); err != nil { @@ -299,7 +299,7 @@ func runAccountToWallet(ctx workflow.Context, source *LedgerAccountSource, desti }, }}, Balance: &destination.Balance, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveFromLedgerMetadata: source.Ledger, }, }) @@ -310,37 +310,37 @@ func runAccountToAccount(ctx workflow.Context, source *LedgerAccountSource, dest return errors.New("amount must be specified") } if source.Ledger == destination.Ledger { - return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: destination.ID, Source: source.ID, }}, - Metadata: metadata.Metadata{}, + Metadata: map[string]interface{}{}, })) } - if err := justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + if err := justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: "world", Source: source.ID, }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: destination.Ledger, }, })); err != nil { return err } - return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), destination.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: destination.ID, Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: source.Ledger, }, })) @@ -371,13 +371,13 @@ func runAccountToPayment(ctx workflow.Context, connectorID *string, source *Ledg }); err != nil { return err } - return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + return justError(activities.CreateTransaction(internal.InfiniteRetryContext(ctx), source.Ledger, shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: amount.Amount, Asset: amount.Asset, Destination: "world", Source: source.ID, }}, - Metadata: metadata.Metadata{}, + Metadata: map[string]any{}, })) } diff --git a/ee/orchestration/internal/workflow/stages/send/run_test.go b/ee/orchestration/internal/workflow/stages/send/run_test.go index dbbfb890ff..5a298dd325 100644 --- a/ee/orchestration/internal/workflow/stages/send/run_test.go +++ b/ee/orchestration/internal/workflow/stages/send/run_test.go @@ -7,7 +7,6 @@ import ( "github.com/formancehq/formance-sdk-go/pkg/models/shared" "github.com/formancehq/orchestration/internal/workflow/activities" "github.com/formancehq/orchestration/internal/workflow/stages/internal/stagestesting" - "github.com/formancehq/stack/libs/go-libs/metadata" "github.com/formancehq/stack/libs/go-libs/pointer" "github.com/stretchr/testify/mock" "go.temporal.io/sdk/temporal" @@ -139,20 +138,20 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: paymentAccountName("payment1"), Source: "world", }}, Reference: pointer.For(paymentAccountName("payment1")), - Metadata: metadata.Metadata{}, + Metadata: map[string]interface{}{}, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -160,21 +159,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: paymentAccountName("payment1"), }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: "default", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -209,7 +208,7 @@ var ( Type: shared.SubjectTypeAccount, }}, Balance: pointer.For("main"), - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveFromLedgerMetadata: internalLedger, }, }, @@ -257,20 +256,20 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: paymentAccountName("payment1"), Source: "world", }}, Reference: pointer.For(paymentAccountName("payment1")), - Metadata: metadata.Metadata{}, + Metadata: map[string]any{}, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -278,21 +277,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: paymentAccountName("payment1"), }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: "default", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -300,21 +299,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "default", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "foo", Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: internalLedger, }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -357,15 +356,15 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: paymentAccountName("payment1"), Source: "world", }}, Reference: pointer.For(paymentAccountName("payment1")), - Metadata: metadata.Metadata{}, + Metadata: map[string]any{}, }, }, }, @@ -376,21 +375,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: internalLedger, - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: paymentAccountName("payment1"), }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: "default", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -398,21 +397,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "default", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "foo", Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: internalLedger, }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -439,19 +438,19 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "default", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "bar", Source: "foo", }}, - Metadata: metadata.Metadata{}, + Metadata: map[string]any{}, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -478,21 +477,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "ledger1", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: "account1", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: "ledger2", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -500,21 +499,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "ledger2", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "account2", Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: "ledger1", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -605,21 +604,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "ledger1", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: "account1", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveToLedgerMetadata: "ledger2", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, { @@ -640,7 +639,7 @@ var ( Type: shared.SubjectTypeAccount, }}, Balance: pointer.For("main"), - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveFromLedgerMetadata: "ledger1", }, }, @@ -674,10 +673,10 @@ var ( Ledger: "default", ID: "foo", }}, - Returns: []any{&shared.V2AccountResponse{ - Data: shared.V2Account{ + Returns: []any{&shared.AccountResponse{ + Data: shared.AccountWithVolumesAndBalances{ Address: "foo", - Metadata: metadata.Metadata{ + Metadata: map[string]any{ "stripeConnectID": "abcd", }, }, @@ -701,19 +700,19 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "default", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "world", Source: "foo", }}, - Metadata: metadata.Metadata{}, + Metadata: map[string]any{}, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -743,7 +742,7 @@ var ( Returns: []any{&shared.GetWalletResponse{ Data: shared.WalletWithBalances{ ID: "foo", - Metadata: metadata.Metadata{ + Metadata: map[string]string{ "stripeConnectID": "abcd", }, Ledger: "default", @@ -815,7 +814,7 @@ var ( Amount: big.NewInt(100), }, Balances: []string{"main"}, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveToLedgerMetadata: "ledger2", }, }, @@ -828,21 +827,21 @@ var ( Args: []any{ mock.Anything, activities.CreateTransactionRequest{ Ledger: "ledger2", - Data: shared.V2PostTransaction{ - Postings: []shared.V2Posting{{ + Data: shared.PostTransaction{ + Postings: []shared.Posting{{ Amount: big.NewInt(100), Asset: "USD", Destination: "account", Source: "world", }}, - Metadata: metadata.Metadata{ + Metadata: map[string]any{ moveFromLedgerMetadata: "ledger1", }, }, }, }, - Returns: []any{&shared.V2CreateTransactionResponse{ - Data: shared.V2Transaction{}, + Returns: []any{&shared.TransactionsResponse{ + Data: []shared.Transaction{{}}, }, nil}, }, }, @@ -962,7 +961,7 @@ var ( Asset: "USD", Amount: big.NewInt(100), }, - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveToLedgerMetadata: "ledger2", }, Balances: []string{"main"}, @@ -982,7 +981,7 @@ var ( Amount: big.NewInt(100), }, Balance: pointer.For("main"), - Metadata: metadata.Metadata{ + Metadata: map[string]string{ moveFromLedgerMetadata: "ledger1", }, }, @@ -1017,7 +1016,7 @@ var ( }}, Returns: []any{&shared.GetWalletResponse{ Data: shared.WalletWithBalances{ - Metadata: metadata.Metadata{ + Metadata: map[string]string{ "stripeConnectID": "abcd", }, }, diff --git a/ee/orchestration/openapi.yaml b/ee/orchestration/openapi.yaml index 1e5da1e92e..0fb8e562ec 100644 --- a/ee/orchestration/openapi.yaml +++ b/ee/orchestration/openapi.yaml @@ -1194,16 +1194,6 @@ components: type: string data: $ref: '#/components/schemas/PostTransaction' - ActivityRevertTransaction: - type: object - required: - - id - - ledger - properties: - ledger: - type: string - id: - type: string ActivityGetPayment: type: object required: @@ -1369,18 +1359,11 @@ components: type: integer format: bigint minimum: 0 - reverted: - type: boolean required: - postings - timestamp - id - metadata - - reverted - ActivityRevertTransactionOutput: - $ref: '#/components/schemas/RevertTransactionResponse' - RevertTransactionResponse: - $ref: '#/components/schemas/CreateTransactionResponse' ActivityGetPaymentOutput: $ref: '#/components/schemas/PaymentResponse' PaymentResponse: @@ -1612,8 +1595,6 @@ components: $ref: '#/components/schemas/ActivityGetAccount' CreateTransaction: $ref: '#/components/schemas/ActivityCreateTransaction' - RevertTransaction: - $ref: '#/components/schemas/ActivityRevertTransaction' StripeTransfer: $ref: '#/components/schemas/ActivityStripeTransfer' GetPayment: @@ -1635,8 +1616,6 @@ components: $ref: '#/components/schemas/ActivityGetAccountOutput' CreateTransaction: $ref: '#/components/schemas/ActivityCreateTransactionOutput' - RevertTransaction: - $ref: '#/components/schemas/ActivityRevertTransactionOutput' GetPayment: $ref: '#/components/schemas/ActivityGetPaymentOutput' DebitWallet: @@ -2485,14 +2464,11 @@ components: type: integer format: bigint minimum: 0 - reverted: - type: boolean required: - postings - timestamp - id - metadata - - reverted V2ActivityRevertTransactionOutput: $ref: '#/components/schemas/V2RevertTransactionResponse' V2RevertTransactionResponse: @@ -2728,8 +2704,6 @@ components: $ref: '#/components/schemas/V2ActivityGetAccount' CreateTransaction: $ref: '#/components/schemas/V2ActivityCreateTransaction' - RevertTransaction: - $ref: '#/components/schemas/V2ActivityRevertTransaction' StripeTransfer: $ref: '#/components/schemas/V2ActivityStripeTransfer' GetPayment: @@ -2751,8 +2725,6 @@ components: $ref: '#/components/schemas/V2ActivityGetAccountOutput' CreateTransaction: $ref: '#/components/schemas/V2ActivityCreateTransactionOutput' - RevertTransaction: - $ref: '#/components/schemas/V2ActivityRevertTransactionOutput' GetPayment: $ref: '#/components/schemas/V2ActivityGetPaymentOutput' DebitWallet: diff --git a/ee/orchestration/openapi/v2.yaml b/ee/orchestration/openapi/v2.yaml index db55283632..18181fb607 100644 --- a/ee/orchestration/openapi/v2.yaml +++ b/ee/orchestration/openapi/v2.yaml @@ -924,16 +924,6 @@ components: type: string data: $ref: '#/components/schemas/V2PostTransaction' - V2ActivityRevertTransaction: - type: object - required: - - id - - ledger - properties: - ledger: - type: string - id: - type: string V2ActivityGetPayment: type: object required: @@ -1081,7 +1071,9 @@ components: V2CreateTransactionResponse: properties: data: - $ref: '#/components/schemas/V2Transaction' + type: array + items: + $ref: '#/components/schemas/V2Transaction' type: object required: - data @@ -1101,24 +1093,15 @@ components: example: ref:001 metadata: $ref: '#/components/schemas/V2Metadata' - id: + txid: type: integer format: bigint minimum: 0 - reverted: - type: boolean required: - postings - timestamp - - id + - txid - metadata - - reverted - - V2ActivityRevertTransactionOutput: - $ref: '#/components/schemas/V2RevertTransactionResponse' - - V2RevertTransactionResponse: - $ref: '#/components/schemas/V2CreateTransactionResponse' V2ActivityGetPaymentOutput: $ref: '#/components/schemas/V2PaymentResponse' @@ -1364,8 +1347,6 @@ components: $ref: '#/components/schemas/V2ActivityGetAccount' CreateTransaction: $ref: '#/components/schemas/V2ActivityCreateTransaction' - RevertTransaction: - $ref: '#/components/schemas/V2ActivityRevertTransaction' StripeTransfer: $ref: '#/components/schemas/V2ActivityStripeTransfer' GetPayment: @@ -1387,8 +1368,6 @@ components: $ref: '#/components/schemas/V2ActivityGetAccountOutput' CreateTransaction: $ref: '#/components/schemas/V2ActivityCreateTransactionOutput' - RevertTransaction: - $ref: '#/components/schemas/V2ActivityRevertTransactionOutput' GetPayment: $ref: '#/components/schemas/V2ActivityGetPaymentOutput' DebitWallet: diff --git a/libs/clients/go/README.md b/libs/clients/go/README.md index 2a70e32c94..47005e16fc 100755 --- a/libs/clients/go/README.md +++ b/libs/clients/go/README.md @@ -281,24 +281,22 @@ import ( formancesdkgo "github.com/formancehq/formance-sdk-go" "github.com/formancehq/formance-sdk-go/pkg/models/operations" "log" - "math/big" ) func main() { s := formancesdkgo.New() ctx := context.Background() - res, err := s.Ledger.V2AddMetadataOnTransaction(ctx, operations.V2AddMetadataOnTransactionRequest{ - RequestBody: map[string]string{ - "admin": "true", + res, err := s.Accounts.AddMetadataToAccount(ctx, operations.AddMetadataToAccountRequest{ + RequestBody: map[string]interface{}{ + "key": "string", }, - DryRun: formancesdkgo.Bool(true), - ID: big.NewInt(1234), - Ledger: "ledger001", + Address: "users:001", + Ledger: "ledger001", }) if err != nil { - var e *V2ErrorResponse + var e *ErrorResponse if errors.As(err, &e) { // handle error log.Fatal(e.Error()) diff --git a/libs/clients/go/accounts.go b/libs/clients/go/accounts.go index cd72ccc7da..9c0a3c0157 100755 --- a/libs/clients/go/accounts.go +++ b/libs/clients/go/accounts.go @@ -75,6 +75,19 @@ func (s *accounts) AddMetadataToAccount(ctx context.Context, request operations. httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out sdkerrors.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: diff --git a/libs/clients/go/docs/models/errors/errorresponse.md b/libs/clients/go/docs/models/errors/errorresponse.md new file mode 100755 index 0000000000..7e16a953e9 --- /dev/null +++ b/libs/clients/go/docs/models/errors/errorresponse.md @@ -0,0 +1,10 @@ +# ErrorResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Details` | **string* | :heavy_minus_sign: | N/A | https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 | +| `ErrorCode` | [*ErrorsEnum](../../models/errors/errorsenum.md) | :heavy_minus_sign: | N/A | INSUFFICIENT_FUND | +| `ErrorMessage` | **string* | :heavy_minus_sign: | N/A | [INSUFFICIENT_FUND] account had insufficient funds | \ No newline at end of file diff --git a/libs/clients/go/docs/models/errors/errorsenum.md b/libs/clients/go/docs/models/errors/errorsenum.md new file mode 100755 index 0000000000..9bd7978bab --- /dev/null +++ b/libs/clients/go/docs/models/errors/errorsenum.md @@ -0,0 +1,14 @@ +# ErrorsEnum + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `ErrorsEnumInternal` | INTERNAL | +| `ErrorsEnumInsufficientFund` | INSUFFICIENT_FUND | +| `ErrorsEnumValidation` | VALIDATION | +| `ErrorsEnumConflict` | CONFLICT | +| `ErrorsEnumNoScript` | NO_SCRIPT | +| `ErrorsEnumCompilationFailed` | COMPILATION_FAILED | +| `ErrorsEnumMetadataOverride` | METADATA_OVERRIDE | \ No newline at end of file diff --git a/libs/clients/go/docs/models/operations/listaccountsmetadata.md b/libs/clients/go/docs/models/operations/listaccountsmetadata.md deleted file mode 100755 index 613659829d..0000000000 --- a/libs/clients/go/docs/models/operations/listaccountsmetadata.md +++ /dev/null @@ -1,9 +0,0 @@ -# ListAccountsMetadata - -Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/operations/listaccountsrequest.md b/libs/clients/go/docs/models/operations/listaccountsrequest.md index ed1d648afe..039d33e0a6 100755 --- a/libs/clients/go/docs/models/operations/listaccountsrequest.md +++ b/libs/clients/go/docs/models/operations/listaccountsrequest.md @@ -11,5 +11,5 @@ | `BalanceOperator` | [*ListAccountsBalanceOperator](../../models/operations/listaccountsbalanceoperator.md) | :heavy_minus_sign: | Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not.
| gte | | `Cursor` | **string* | :heavy_minus_sign: | Parameter used in pagination requests. Maximum page size is set to 15.
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== | | `Ledger` | *string* | :heavy_check_mark: | Name of the ledger. | ledger001 | -| `Metadata` | [*ListAccountsMetadata](../../models/operations/listaccountsmetadata.md) | :heavy_minus_sign: | Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. | | +| `Metadata` | map[string]*interface{}* | :heavy_minus_sign: | Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. | | | `PageSize` | **int64* | :heavy_minus_sign: | The maximum number of results to return per page.
| | \ No newline at end of file diff --git a/libs/clients/go/docs/models/operations/listtransactionsmetadata.md b/libs/clients/go/docs/models/operations/listtransactionsmetadata.md deleted file mode 100755 index 05efc529f0..0000000000 --- a/libs/clients/go/docs/models/operations/listtransactionsmetadata.md +++ /dev/null @@ -1,9 +0,0 @@ -# ListTransactionsMetadata - -Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/operations/listtransactionsrequest.md b/libs/clients/go/docs/models/operations/listtransactionsrequest.md index f71cff28f6..b2dd091676 100755 --- a/libs/clients/go/docs/models/operations/listtransactionsrequest.md +++ b/libs/clients/go/docs/models/operations/listtransactionsrequest.md @@ -11,7 +11,7 @@ | `Destination` | **string* | :heavy_minus_sign: | Filter transactions with postings involving given account at destination (regular expression placed between ^ and $). | users:001 | | `EndTime` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Filter transactions that occurred before this timestamp.
The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute).
| | | `Ledger` | *string* | :heavy_check_mark: | Name of the ledger. | ledger001 | -| `Metadata` | [*ListTransactionsMetadata](../../models/operations/listtransactionsmetadata.md) | :heavy_minus_sign: | Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. | | +| `Metadata` | map[string]*interface{}* | :heavy_minus_sign: | Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. | | | `PageSize` | **int64* | :heavy_minus_sign: | The maximum number of results to return per page.
| | | `Reference` | **string* | :heavy_minus_sign: | Find transactions by reference field. | ref:001 | | `Source` | **string* | :heavy_minus_sign: | Filter transactions with postings involving given account at source (regular expression placed between ^ and $). | users:001 | diff --git a/libs/clients/go/docs/models/shared/account.md b/libs/clients/go/docs/models/shared/account.md index a1833cbe75..25914598b4 100755 --- a/libs/clients/go/docs/models/shared/account.md +++ b/libs/clients/go/docs/models/shared/account.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | -| `Metadata` | [*AccountMetadata](../../models/shared/accountmetadata.md) | :heavy_minus_sign: | N/A | | -| `Type` | **string* | :heavy_minus_sign: | N/A | virtual | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | +| `Metadata` | map[string]*interface{}* | :heavy_minus_sign: | N/A | | +| `Type` | **string* | :heavy_minus_sign: | N/A | virtual | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/accountmetadata.md b/libs/clients/go/docs/models/shared/accountmetadata.md deleted file mode 100755 index f41637ba19..0000000000 --- a/libs/clients/go/docs/models/shared/accountmetadata.md +++ /dev/null @@ -1,7 +0,0 @@ -# AccountMetadata - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/accountwithvolumesandbalances.md b/libs/clients/go/docs/models/shared/accountwithvolumesandbalances.md index 4ee3890be5..4370031ae5 100755 --- a/libs/clients/go/docs/models/shared/accountwithvolumesandbalances.md +++ b/libs/clients/go/docs/models/shared/accountwithvolumesandbalances.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | -| `Balances` | map[string]*int64* | :heavy_minus_sign: | N/A | [object Object] | -| `Metadata` | [*AccountWithVolumesAndBalancesMetadata](../../models/shared/accountwithvolumesandbalancesmetadata.md) | :heavy_minus_sign: | N/A | | -| `Type` | **string* | :heavy_minus_sign: | N/A | virtual | -| `Volumes` | map[string]map[string]*int64* | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | +| `Balances` | map[string][*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | [object Object] | +| `Metadata` | map[string]*interface{}* | :heavy_minus_sign: | N/A | | +| `Type` | **string* | :heavy_minus_sign: | N/A | virtual | +| `Volumes` | map[string]map[string][*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/accountwithvolumesandbalancesmetadata.md b/libs/clients/go/docs/models/shared/accountwithvolumesandbalancesmetadata.md deleted file mode 100755 index 4a390163d0..0000000000 --- a/libs/clients/go/docs/models/shared/accountwithvolumesandbalancesmetadata.md +++ /dev/null @@ -1,7 +0,0 @@ -# AccountWithVolumesAndBalancesMetadata - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/orchestrationaccount.md b/libs/clients/go/docs/models/shared/orchestrationaccount.md index 1b90925f60..1fdae5ff02 100755 --- a/libs/clients/go/docs/models/shared/orchestrationaccount.md +++ b/libs/clients/go/docs/models/shared/orchestrationaccount.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | -| `EffectiveVolumes` | map[string][OrchestrationVolume](../../models/shared/orchestrationvolume.md) | :heavy_minus_sign: | N/A | [object Object] | -| `Metadata` | map[string]*string* | :heavy_check_mark: | N/A | [object Object] | -| `Volumes` | map[string][OrchestrationVolume](../../models/shared/orchestrationvolume.md) | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `Address` | *string* | :heavy_check_mark: | N/A | users:001 | +| `EffectiveVolumes` | map[string][Volume](../../models/shared/volume.md) | :heavy_minus_sign: | N/A | [object Object] | +| `Metadata` | map[string]*string* | :heavy_check_mark: | N/A | [object Object] | +| `Volumes` | map[string][Volume](../../models/shared/volume.md) | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/orchestrationv2transaction.md b/libs/clients/go/docs/models/shared/orchestrationv2transaction.md new file mode 100755 index 0000000000..49d8b8f6f2 --- /dev/null +++ b/libs/clients/go/docs/models/shared/orchestrationv2transaction.md @@ -0,0 +1,12 @@ +# OrchestrationV2Transaction + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| `Metadata` | map[string]*string* | :heavy_check_mark: | N/A | [object Object] | +| `Postings` | [][V2Posting](../../models/shared/v2posting.md) | :heavy_check_mark: | N/A | | +| `Reference` | **string* | :heavy_minus_sign: | N/A | ref:001 | +| `Timestamp` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | | +| `Txid` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/orchestrationvolume.md b/libs/clients/go/docs/models/shared/orchestrationvolume.md deleted file mode 100755 index 4a5cd08baf..0000000000 --- a/libs/clients/go/docs/models/shared/orchestrationvolume.md +++ /dev/null @@ -1,10 +0,0 @@ -# OrchestrationVolume - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `Balance` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | -| `Input` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | N/A | -| `Output` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/posttransactionscript.md b/libs/clients/go/docs/models/shared/posttransactionscript.md index cf9465c57d..73a35f5ef3 100755 --- a/libs/clients/go/docs/models/shared/posttransactionscript.md +++ b/libs/clients/go/docs/models/shared/posttransactionscript.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `Plain` | *string* | :heavy_check_mark: | N/A | vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
| -| `Vars` | [*PostTransactionScriptVars](../../models/shared/posttransactionscriptvars.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `Vars` | map[string]*interface{}* | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/posttransactionscriptvars.md b/libs/clients/go/docs/models/shared/posttransactionscriptvars.md deleted file mode 100755 index ef1a0de957..0000000000 --- a/libs/clients/go/docs/models/shared/posttransactionscriptvars.md +++ /dev/null @@ -1,7 +0,0 @@ -# PostTransactionScriptVars - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/script.md b/libs/clients/go/docs/models/shared/script.md index 0a3d2d262b..65391c5382 100755 --- a/libs/clients/go/docs/models/shared/script.md +++ b/libs/clients/go/docs/models/shared/script.md @@ -8,4 +8,4 @@ | `Metadata` | map[string]*interface{}* | :heavy_minus_sign: | N/A | | | `Plain` | *string* | :heavy_check_mark: | N/A | vars {
account $user
}
send [COIN 10] (
source = @world
destination = $user
)
| | `Reference` | **string* | :heavy_minus_sign: | Reference to attach to the generated transaction | order_1234 | -| `Vars` | [*ScriptVars](../../models/shared/scriptvars.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `Vars` | map[string]*interface{}* | :heavy_minus_sign: | N/A | [object Object] | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/scriptvars.md b/libs/clients/go/docs/models/shared/scriptvars.md deleted file mode 100755 index 285f3df8da..0000000000 --- a/libs/clients/go/docs/models/shared/scriptvars.md +++ /dev/null @@ -1,7 +0,0 @@ -# ScriptVars - - -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/v2activitycreatetransactionoutput.md b/libs/clients/go/docs/models/shared/v2activitycreatetransactionoutput.md index d01e7d56ec..80d5182f2d 100755 --- a/libs/clients/go/docs/models/shared/v2activitycreatetransactionoutput.md +++ b/libs/clients/go/docs/models/shared/v2activitycreatetransactionoutput.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `Data` | [V2Transaction](../../models/shared/v2transaction.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `Data` | [][OrchestrationV2Transaction](../../models/shared/orchestrationv2transaction.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/v2activityreverttransaction.md b/libs/clients/go/docs/models/shared/v2activityreverttransaction.md deleted file mode 100755 index cdbc2f46d3..0000000000 --- a/libs/clients/go/docs/models/shared/v2activityreverttransaction.md +++ /dev/null @@ -1,9 +0,0 @@ -# V2ActivityRevertTransaction - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | *string* | :heavy_check_mark: | N/A | -| `Ledger` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/v2activityreverttransactionoutput.md b/libs/clients/go/docs/models/shared/v2activityreverttransactionoutput.md deleted file mode 100755 index c38adefdcc..0000000000 --- a/libs/clients/go/docs/models/shared/v2activityreverttransactionoutput.md +++ /dev/null @@ -1,8 +0,0 @@ -# V2ActivityRevertTransactionOutput - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `Data` | [V2Transaction](../../models/shared/v2transaction.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageinput.md b/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageinput.md index 5fbac10d0b..db44fc40c8 100755 --- a/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageinput.md +++ b/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageinput.md @@ -12,6 +12,5 @@ | `GetAccount` | [*V2ActivityGetAccount](../../models/shared/v2activitygetaccount.md) | :heavy_minus_sign: | N/A | | `GetPayment` | [*V2ActivityGetPayment](../../models/shared/v2activitygetpayment.md) | :heavy_minus_sign: | N/A | | `GetWallet` | [*V2ActivityGetWallet](../../models/shared/v2activitygetwallet.md) | :heavy_minus_sign: | N/A | -| `RevertTransaction` | [*V2ActivityRevertTransaction](../../models/shared/v2activityreverttransaction.md) | :heavy_minus_sign: | N/A | | `StripeTransfer` | [*V2ActivityStripeTransfer](../../models/shared/v2activitystripetransfer.md) | :heavy_minus_sign: | N/A | | `VoidHold` | [*V2ActivityVoidHold](../../models/shared/v2activityvoidhold.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageoutput.md b/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageoutput.md index a8aa77f241..a8a02a30ed 100755 --- a/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageoutput.md +++ b/libs/clients/go/docs/models/shared/v2workflowinstancehistorystageoutput.md @@ -9,5 +9,4 @@ | `DebitWallet` | [*V2ActivityDebitWalletOutput](../../models/shared/v2activitydebitwalletoutput.md) | :heavy_minus_sign: | N/A | | `GetAccount` | [*V2ActivityGetAccountOutput](../../models/shared/v2activitygetaccountoutput.md) | :heavy_minus_sign: | N/A | | `GetPayment` | [*V2ActivityGetPaymentOutput](../../models/shared/v2activitygetpaymentoutput.md) | :heavy_minus_sign: | N/A | -| `GetWallet` | [*V2ActivityGetWalletOutput](../../models/shared/v2activitygetwalletoutput.md) | :heavy_minus_sign: | N/A | -| `RevertTransaction` | [*V2ActivityRevertTransactionOutput](../../models/shared/v2activityreverttransactionoutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `GetWallet` | [*V2ActivityGetWalletOutput](../../models/shared/v2activitygetwalletoutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/libs/clients/go/docs/models/shared/volume.md b/libs/clients/go/docs/models/shared/volume.md index 8e48cd6c50..a7e261311d 100755 --- a/libs/clients/go/docs/models/shared/volume.md +++ b/libs/clients/go/docs/models/shared/volume.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Balance` | **int64* | :heavy_minus_sign: | N/A | -| `Input` | *int64* | :heavy_check_mark: | N/A | -| `Output` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `Balance` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | +| `Input` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | N/A | +| `Output` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/libs/clients/go/files.gen b/libs/clients/go/files.gen index e9893c9280..651bf79ea6 100755 --- a/libs/clients/go/files.gen +++ b/libs/clients/go/files.gen @@ -297,7 +297,7 @@ pkg/models/shared/orchestrationpaymentmetadata.go pkg/models/shared/paymentadjustment.go pkg/models/shared/activitygetaccountoutput.go pkg/models/shared/orchestrationaccount.go -pkg/models/shared/orchestrationvolume.go +pkg/models/shared/volume.go pkg/models/shared/activitydebitwalletoutput.go pkg/models/shared/hold.go pkg/models/shared/subject.go @@ -355,7 +355,6 @@ pkg/models/shared/v2stagewaitevent.go pkg/models/shared/v2getworkflowinstancehistorystageresponse.go pkg/models/shared/v2workflowinstancehistorystage.go pkg/models/shared/v2workflowinstancehistorystageoutput.go -pkg/models/shared/v2activityreverttransactionoutput.go pkg/models/shared/v2activitygetwalletoutput.go pkg/models/shared/v2walletwithbalances.go pkg/models/shared/v2assetholder.go @@ -372,10 +371,10 @@ pkg/models/shared/v2subject.go pkg/models/shared/v2ledgeraccountsubject.go pkg/models/shared/v2walletsubject.go pkg/models/shared/v2activitycreatetransactionoutput.go +pkg/models/shared/orchestrationv2transaction.go pkg/models/shared/v2workflowinstancehistorystageinput.go pkg/models/shared/v2activityvoidhold.go pkg/models/shared/v2activitystripetransfer.go -pkg/models/shared/v2activityreverttransaction.go pkg/models/shared/v2activitygetwallet.go pkg/models/shared/v2activitygetpayment.go pkg/models/shared/v2activitygetaccount.go @@ -462,7 +461,6 @@ pkg/models/shared/reconciliationscursorresponse.go pkg/models/shared/reconciliationrequest.go pkg/models/shared/scriptresponse.go pkg/models/shared/transaction.go -pkg/models/shared/volume.go pkg/models/shared/script.go pkg/models/shared/response.go pkg/models/shared/query.go @@ -510,6 +508,8 @@ pkg/models/shared/attemptresponse.go pkg/models/shared/attempt.go pkg/models/shared/getversionsresponse.go pkg/models/shared/version.go +pkg/models/sdkerrors/errorresponse.go +pkg/models/sdkerrors/errorsenum.go pkg/models/sdkerrors/v2errorresponse.go pkg/models/sdkerrors/v2errorsenum.go pkg/models/sdkerrors/v2error.go @@ -524,7 +524,6 @@ docs/models/operations/countaccountsresponse.md docs/models/operations/getaccountrequest.md docs/models/operations/getaccountresponse.md docs/models/operations/listaccountsbalanceoperator.md -docs/models/operations/listaccountsmetadata.md docs/models/operations/listaccountsrequest.md docs/models/operations/listaccountsresponse.md docs/models/operations/createclientresponse.md @@ -757,7 +756,6 @@ docs/models/operations/createtransactionrequest.md docs/models/operations/createtransactionresponse.md docs/models/operations/gettransactionrequest.md docs/models/operations/gettransactionresponse.md -docs/models/operations/listtransactionsmetadata.md docs/models/operations/listtransactionsrequest.md docs/models/operations/listtransactionsresponse.md docs/models/operations/reverttransactionrequest.md @@ -811,11 +809,9 @@ docs/models/operations/getapiauthwellknownopenidconfigurationresponse.md docs/models/shared/errorresponse.md docs/models/shared/errorsenum.md docs/models/shared/accountresponse.md -docs/models/shared/accountwithvolumesandbalancesmetadata.md docs/models/shared/accountwithvolumesandbalances.md docs/models/shared/accountscursorresponsecursor.md docs/models/shared/accountscursorresponse.md -docs/models/shared/accountmetadata.md docs/models/shared/account.md docs/models/shared/createclientresponse.md docs/models/shared/client.md @@ -949,7 +945,7 @@ docs/models/shared/paymentadjustmentraw.md docs/models/shared/paymentadjustment.md docs/models/shared/activitygetaccountoutput.md docs/models/shared/orchestrationaccount.md -docs/models/shared/orchestrationvolume.md +docs/models/shared/volume.md docs/models/shared/activitydebitwalletoutput.md docs/models/shared/hold.md docs/models/shared/subject.md @@ -1010,7 +1006,6 @@ docs/models/shared/v2stagewaitevent.md docs/models/shared/v2getworkflowinstancehistorystageresponse.md docs/models/shared/v2workflowinstancehistorystage.md docs/models/shared/v2workflowinstancehistorystageoutput.md -docs/models/shared/v2activityreverttransactionoutput.md docs/models/shared/v2activitygetwalletoutput.md docs/models/shared/v2walletwithbalancesbalances.md docs/models/shared/v2walletwithbalances.md @@ -1032,11 +1027,11 @@ docs/models/shared/v2subject.md docs/models/shared/v2ledgeraccountsubject.md docs/models/shared/v2walletsubject.md docs/models/shared/v2activitycreatetransactionoutput.md +docs/models/shared/orchestrationv2transaction.md docs/models/shared/v2workflowinstancehistorystageinput.md docs/models/shared/v2activityvoidhold.md docs/models/shared/v2activitystripetransfermetadata.md docs/models/shared/v2activitystripetransfer.md -docs/models/shared/v2activityreverttransaction.md docs/models/shared/v2activitygetwallet.md docs/models/shared/v2activitygetpayment.md docs/models/shared/v2activitygetaccount.md @@ -1164,8 +1159,6 @@ docs/models/shared/reconciliationscursorresponse.md docs/models/shared/reconciliationrequest.md docs/models/shared/scriptresponse.md docs/models/shared/transaction.md -docs/models/shared/volume.md -docs/models/shared/scriptvars.md docs/models/shared/script.md docs/models/shared/responsecursortotal.md docs/models/shared/responsecursor.md @@ -1181,7 +1174,6 @@ docs/models/shared/stats.md docs/models/shared/transactionsresponse.md docs/models/shared/transactions.md docs/models/shared/transactiondata.md -docs/models/shared/posttransactionscriptvars.md docs/models/shared/posttransactionscript.md docs/models/shared/posttransaction.md docs/models/shared/transactionresponse.md @@ -1225,6 +1217,8 @@ docs/models/shared/attemptresponse.md docs/models/shared/attempt.md docs/models/shared/getversionsresponse.md docs/models/shared/version.md +docs/models/errors/errorresponse.md +docs/models/errors/errorsenum.md docs/models/errors/v2errorresponse.md docs/models/errors/v2errorsenum.md docs/models/errors/v2errorerrorcode.md diff --git a/libs/clients/go/pkg/models/operations/listaccounts.go b/libs/clients/go/pkg/models/operations/listaccounts.go index 572590f304..f42c0be40b 100755 --- a/libs/clients/go/pkg/models/operations/listaccounts.go +++ b/libs/clients/go/pkg/models/operations/listaccounts.go @@ -50,10 +50,6 @@ func (e *ListAccountsBalanceOperator) UnmarshalJSON(data []byte) error { } } -// ListAccountsMetadata - Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. -type ListAccountsMetadata struct { -} - type ListAccountsRequest struct { // Filter accounts by address pattern (regular expression placed between ^ and $). Address *string `queryParam:"style=form,explode=true,name=address"` @@ -73,7 +69,7 @@ type ListAccountsRequest struct { // Name of the ledger. Ledger string `pathParam:"style=simple,explode=false,name=ledger"` // Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. - Metadata *ListAccountsMetadata `queryParam:"style=deepObject,explode=true,name=metadata"` + Metadata map[string]interface{} `queryParam:"style=deepObject,explode=true,name=metadata"` // The maximum number of results to return per page. // PageSize *int64 `default:"15" queryParam:"style=form,explode=true,name=pageSize"` @@ -132,7 +128,7 @@ func (o *ListAccountsRequest) GetLedger() string { return o.Ledger } -func (o *ListAccountsRequest) GetMetadata() *ListAccountsMetadata { +func (o *ListAccountsRequest) GetMetadata() map[string]interface{} { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/operations/listtransactions.go b/libs/clients/go/pkg/models/operations/listtransactions.go index d1228e02f3..22e975e6c6 100755 --- a/libs/clients/go/pkg/models/operations/listtransactions.go +++ b/libs/clients/go/pkg/models/operations/listtransactions.go @@ -9,10 +9,6 @@ import ( "time" ) -// ListTransactionsMetadata - Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. -type ListTransactionsMetadata struct { -} - type ListTransactionsRequest struct { // Filter transactions with postings involving given account, either as source or destination (regular expression placed between ^ and $). Account *string `queryParam:"style=form,explode=true,name=account"` @@ -33,7 +29,7 @@ type ListTransactionsRequest struct { // Name of the ledger. Ledger string `pathParam:"style=simple,explode=false,name=ledger"` // Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. - Metadata *ListTransactionsMetadata `queryParam:"style=deepObject,explode=true,name=metadata"` + Metadata map[string]interface{} `queryParam:"style=deepObject,explode=true,name=metadata"` // The maximum number of results to return per page. // PageSize *int64 `default:"15" queryParam:"style=form,explode=true,name=pageSize"` @@ -100,7 +96,7 @@ func (o *ListTransactionsRequest) GetLedger() string { return o.Ledger } -func (o *ListTransactionsRequest) GetMetadata() *ListTransactionsMetadata { +func (o *ListTransactionsRequest) GetMetadata() map[string]interface{} { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/sdkerrors/errorresponse.go b/libs/clients/go/pkg/models/sdkerrors/errorresponse.go new file mode 100755 index 0000000000..66f1c54d0f --- /dev/null +++ b/libs/clients/go/pkg/models/sdkerrors/errorresponse.go @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" +) + +type ErrorResponse struct { + Details *string `json:"details,omitempty"` + ErrorCode *ErrorsEnum `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +var _ error = &ErrorResponse{} + +func (e *ErrorResponse) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/libs/clients/go/pkg/models/sdkerrors/errorsenum.go b/libs/clients/go/pkg/models/sdkerrors/errorsenum.go new file mode 100755 index 0000000000..9b47801e2b --- /dev/null +++ b/libs/clients/go/pkg/models/sdkerrors/errorsenum.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "fmt" +) + +type ErrorsEnum string + +const ( + ErrorsEnumInternal ErrorsEnum = "INTERNAL" + ErrorsEnumInsufficientFund ErrorsEnum = "INSUFFICIENT_FUND" + ErrorsEnumValidation ErrorsEnum = "VALIDATION" + ErrorsEnumConflict ErrorsEnum = "CONFLICT" + ErrorsEnumNoScript ErrorsEnum = "NO_SCRIPT" + ErrorsEnumCompilationFailed ErrorsEnum = "COMPILATION_FAILED" + ErrorsEnumMetadataOverride ErrorsEnum = "METADATA_OVERRIDE" +) + +func (e ErrorsEnum) ToPointer() *ErrorsEnum { + return &e +} + +func (e *ErrorsEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "INTERNAL": + fallthrough + case "INSUFFICIENT_FUND": + fallthrough + case "VALIDATION": + fallthrough + case "CONFLICT": + fallthrough + case "NO_SCRIPT": + fallthrough + case "COMPILATION_FAILED": + fallthrough + case "METADATA_OVERRIDE": + *e = ErrorsEnum(v) + return nil + default: + return fmt.Errorf("invalid value for ErrorsEnum: %v", v) + } +} diff --git a/libs/clients/go/pkg/models/shared/account.go b/libs/clients/go/pkg/models/shared/account.go index c9ab67bfb0..efda422b27 100755 --- a/libs/clients/go/pkg/models/shared/account.go +++ b/libs/clients/go/pkg/models/shared/account.go @@ -2,13 +2,10 @@ package shared -type AccountMetadata struct { -} - type Account struct { - Address string `json:"address"` - Metadata *AccountMetadata `json:"metadata,omitempty"` - Type *string `json:"type,omitempty"` + Address string `json:"address"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Type *string `json:"type,omitempty"` } func (o *Account) GetAddress() string { @@ -18,7 +15,7 @@ func (o *Account) GetAddress() string { return o.Address } -func (o *Account) GetMetadata() *AccountMetadata { +func (o *Account) GetMetadata() map[string]interface{} { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/shared/accountwithvolumesandbalances.go b/libs/clients/go/pkg/models/shared/accountwithvolumesandbalances.go index 16361bbd97..0ca4ad385d 100755 --- a/libs/clients/go/pkg/models/shared/accountwithvolumesandbalances.go +++ b/libs/clients/go/pkg/models/shared/accountwithvolumesandbalances.go @@ -2,15 +2,28 @@ package shared -type AccountWithVolumesAndBalancesMetadata struct { -} +import ( + "github.com/formancehq/formance-sdk-go/pkg/utils" + "math/big" +) type AccountWithVolumesAndBalances struct { - Address string `json:"address"` - Balances map[string]int64 `json:"balances,omitempty"` - Metadata *AccountWithVolumesAndBalancesMetadata `json:"metadata,omitempty"` - Type *string `json:"type,omitempty"` - Volumes map[string]map[string]int64 `json:"volumes,omitempty"` + Address string `json:"address"` + Balances map[string]*big.Int `json:"balances,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Type *string `json:"type,omitempty"` + Volumes map[string]map[string]*big.Int `json:"volumes,omitempty"` +} + +func (a AccountWithVolumesAndBalances) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountWithVolumesAndBalances) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil } func (o *AccountWithVolumesAndBalances) GetAddress() string { @@ -20,14 +33,14 @@ func (o *AccountWithVolumesAndBalances) GetAddress() string { return o.Address } -func (o *AccountWithVolumesAndBalances) GetBalances() map[string]int64 { +func (o *AccountWithVolumesAndBalances) GetBalances() map[string]*big.Int { if o == nil { return nil } return o.Balances } -func (o *AccountWithVolumesAndBalances) GetMetadata() *AccountWithVolumesAndBalancesMetadata { +func (o *AccountWithVolumesAndBalances) GetMetadata() map[string]interface{} { if o == nil { return nil } @@ -41,7 +54,7 @@ func (o *AccountWithVolumesAndBalances) GetType() *string { return o.Type } -func (o *AccountWithVolumesAndBalances) GetVolumes() map[string]map[string]int64 { +func (o *AccountWithVolumesAndBalances) GetVolumes() map[string]map[string]*big.Int { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/shared/orchestrationaccount.go b/libs/clients/go/pkg/models/shared/orchestrationaccount.go index 4b3b637087..06fb1d34d6 100755 --- a/libs/clients/go/pkg/models/shared/orchestrationaccount.go +++ b/libs/clients/go/pkg/models/shared/orchestrationaccount.go @@ -3,10 +3,10 @@ package shared type OrchestrationAccount struct { - Address string `json:"address"` - EffectiveVolumes map[string]OrchestrationVolume `json:"effectiveVolumes,omitempty"` - Metadata map[string]string `json:"metadata"` - Volumes map[string]OrchestrationVolume `json:"volumes,omitempty"` + Address string `json:"address"` + EffectiveVolumes map[string]Volume `json:"effectiveVolumes,omitempty"` + Metadata map[string]string `json:"metadata"` + Volumes map[string]Volume `json:"volumes,omitempty"` } func (o *OrchestrationAccount) GetAddress() string { @@ -16,7 +16,7 @@ func (o *OrchestrationAccount) GetAddress() string { return o.Address } -func (o *OrchestrationAccount) GetEffectiveVolumes() map[string]OrchestrationVolume { +func (o *OrchestrationAccount) GetEffectiveVolumes() map[string]Volume { if o == nil { return nil } @@ -30,7 +30,7 @@ func (o *OrchestrationAccount) GetMetadata() map[string]string { return o.Metadata } -func (o *OrchestrationAccount) GetVolumes() map[string]OrchestrationVolume { +func (o *OrchestrationAccount) GetVolumes() map[string]Volume { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/shared/orchestrationv2transaction.go b/libs/clients/go/pkg/models/shared/orchestrationv2transaction.go new file mode 100755 index 0000000000..fd0b2f30f7 --- /dev/null +++ b/libs/clients/go/pkg/models/shared/orchestrationv2transaction.go @@ -0,0 +1,63 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package shared + +import ( + "github.com/formancehq/formance-sdk-go/pkg/utils" + "math/big" + "time" +) + +type OrchestrationV2Transaction struct { + Metadata map[string]string `json:"metadata"` + Postings []V2Posting `json:"postings"` + Reference *string `json:"reference,omitempty"` + Timestamp time.Time `json:"timestamp"` + Txid *big.Int `json:"txid"` +} + +func (o OrchestrationV2Transaction) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(o, "", false) +} + +func (o *OrchestrationV2Transaction) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { + return err + } + return nil +} + +func (o *OrchestrationV2Transaction) GetMetadata() map[string]string { + if o == nil { + return map[string]string{} + } + return o.Metadata +} + +func (o *OrchestrationV2Transaction) GetPostings() []V2Posting { + if o == nil { + return []V2Posting{} + } + return o.Postings +} + +func (o *OrchestrationV2Transaction) GetReference() *string { + if o == nil { + return nil + } + return o.Reference +} + +func (o *OrchestrationV2Transaction) GetTimestamp() time.Time { + if o == nil { + return time.Time{} + } + return o.Timestamp +} + +func (o *OrchestrationV2Transaction) GetTxid() *big.Int { + if o == nil { + return big.NewInt(0) + } + return o.Txid +} diff --git a/libs/clients/go/pkg/models/shared/orchestrationvolume.go b/libs/clients/go/pkg/models/shared/orchestrationvolume.go deleted file mode 100755 index 0c69bec13b..0000000000 --- a/libs/clients/go/pkg/models/shared/orchestrationvolume.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "github.com/formancehq/formance-sdk-go/pkg/utils" - "math/big" -) - -type OrchestrationVolume struct { - Balance *big.Int `json:"balance,omitempty"` - Input *big.Int `json:"input"` - Output *big.Int `json:"output"` -} - -func (o OrchestrationVolume) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(o, "", false) -} - -func (o *OrchestrationVolume) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &o, "", false, false); err != nil { - return err - } - return nil -} - -func (o *OrchestrationVolume) GetBalance() *big.Int { - if o == nil { - return nil - } - return o.Balance -} - -func (o *OrchestrationVolume) GetInput() *big.Int { - if o == nil { - return big.NewInt(0) - } - return o.Input -} - -func (o *OrchestrationVolume) GetOutput() *big.Int { - if o == nil { - return big.NewInt(0) - } - return o.Output -} diff --git a/libs/clients/go/pkg/models/shared/posttransaction.go b/libs/clients/go/pkg/models/shared/posttransaction.go index b3c1a44c2f..f645c2c598 100755 --- a/libs/clients/go/pkg/models/shared/posttransaction.go +++ b/libs/clients/go/pkg/models/shared/posttransaction.go @@ -7,12 +7,9 @@ import ( "time" ) -type PostTransactionScriptVars struct { -} - type PostTransactionScript struct { - Plain string `json:"plain"` - Vars *PostTransactionScriptVars `json:"vars,omitempty"` + Plain string `json:"plain"` + Vars map[string]interface{} `json:"vars,omitempty"` } func (o *PostTransactionScript) GetPlain() string { @@ -22,7 +19,7 @@ func (o *PostTransactionScript) GetPlain() string { return o.Plain } -func (o *PostTransactionScript) GetVars() *PostTransactionScriptVars { +func (o *PostTransactionScript) GetVars() map[string]interface{} { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/shared/script.go b/libs/clients/go/pkg/models/shared/script.go index ec4481cba9..049473ac1f 100755 --- a/libs/clients/go/pkg/models/shared/script.go +++ b/libs/clients/go/pkg/models/shared/script.go @@ -2,15 +2,12 @@ package shared -type ScriptVars struct { -} - type Script struct { Metadata map[string]interface{} `json:"metadata,omitempty"` Plain string `json:"plain"` // Reference to attach to the generated transaction - Reference *string `json:"reference,omitempty"` - Vars *ScriptVars `json:"vars,omitempty"` + Reference *string `json:"reference,omitempty"` + Vars map[string]interface{} `json:"vars,omitempty"` } func (o *Script) GetMetadata() map[string]interface{} { @@ -34,7 +31,7 @@ func (o *Script) GetReference() *string { return o.Reference } -func (o *Script) GetVars() *ScriptVars { +func (o *Script) GetVars() map[string]interface{} { if o == nil { return nil } diff --git a/libs/clients/go/pkg/models/shared/v2activitycreatetransactionoutput.go b/libs/clients/go/pkg/models/shared/v2activitycreatetransactionoutput.go index a4d7e58225..143d421333 100755 --- a/libs/clients/go/pkg/models/shared/v2activitycreatetransactionoutput.go +++ b/libs/clients/go/pkg/models/shared/v2activitycreatetransactionoutput.go @@ -3,12 +3,12 @@ package shared type V2ActivityCreateTransactionOutput struct { - Data V2Transaction `json:"data"` + Data []OrchestrationV2Transaction `json:"data"` } -func (o *V2ActivityCreateTransactionOutput) GetData() V2Transaction { +func (o *V2ActivityCreateTransactionOutput) GetData() []OrchestrationV2Transaction { if o == nil { - return V2Transaction{} + return []OrchestrationV2Transaction{} } return o.Data } diff --git a/libs/clients/go/pkg/models/shared/v2activityreverttransaction.go b/libs/clients/go/pkg/models/shared/v2activityreverttransaction.go deleted file mode 100755 index 6c4d9d8902..0000000000 --- a/libs/clients/go/pkg/models/shared/v2activityreverttransaction.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type V2ActivityRevertTransaction struct { - ID string `json:"id"` - Ledger string `json:"ledger"` -} - -func (o *V2ActivityRevertTransaction) GetID() string { - if o == nil { - return "" - } - return o.ID -} - -func (o *V2ActivityRevertTransaction) GetLedger() string { - if o == nil { - return "" - } - return o.Ledger -} diff --git a/libs/clients/go/pkg/models/shared/v2activityreverttransactionoutput.go b/libs/clients/go/pkg/models/shared/v2activityreverttransactionoutput.go deleted file mode 100755 index bc316520d4..0000000000 --- a/libs/clients/go/pkg/models/shared/v2activityreverttransactionoutput.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type V2ActivityRevertTransactionOutput struct { - Data V2Transaction `json:"data"` -} - -func (o *V2ActivityRevertTransactionOutput) GetData() V2Transaction { - if o == nil { - return V2Transaction{} - } - return o.Data -} diff --git a/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageinput.go b/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageinput.go index b7ea7bacf8..64976ed9d3 100755 --- a/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageinput.go +++ b/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageinput.go @@ -10,7 +10,6 @@ type V2WorkflowInstanceHistoryStageInput struct { GetAccount *V2ActivityGetAccount `json:"GetAccount,omitempty"` GetPayment *V2ActivityGetPayment `json:"GetPayment,omitempty"` GetWallet *V2ActivityGetWallet `json:"GetWallet,omitempty"` - RevertTransaction *V2ActivityRevertTransaction `json:"RevertTransaction,omitempty"` StripeTransfer *V2ActivityStripeTransfer `json:"StripeTransfer,omitempty"` VoidHold *V2ActivityVoidHold `json:"VoidHold,omitempty"` } @@ -64,13 +63,6 @@ func (o *V2WorkflowInstanceHistoryStageInput) GetGetWallet() *V2ActivityGetWalle return o.GetWallet } -func (o *V2WorkflowInstanceHistoryStageInput) GetRevertTransaction() *V2ActivityRevertTransaction { - if o == nil { - return nil - } - return o.RevertTransaction -} - func (o *V2WorkflowInstanceHistoryStageInput) GetStripeTransfer() *V2ActivityStripeTransfer { if o == nil { return nil diff --git a/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageoutput.go b/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageoutput.go index ce0670ff8d..a4b5b0e600 100755 --- a/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageoutput.go +++ b/libs/clients/go/pkg/models/shared/v2workflowinstancehistorystageoutput.go @@ -8,7 +8,6 @@ type V2WorkflowInstanceHistoryStageOutput struct { GetAccount *V2ActivityGetAccountOutput `json:"GetAccount,omitempty"` GetPayment *V2ActivityGetPaymentOutput `json:"GetPayment,omitempty"` GetWallet *V2ActivityGetWalletOutput `json:"GetWallet,omitempty"` - RevertTransaction *V2ActivityRevertTransactionOutput `json:"RevertTransaction,omitempty"` } func (o *V2WorkflowInstanceHistoryStageOutput) GetCreateTransaction() *V2ActivityCreateTransactionOutput { @@ -45,10 +44,3 @@ func (o *V2WorkflowInstanceHistoryStageOutput) GetGetWallet() *V2ActivityGetWall } return o.GetWallet } - -func (o *V2WorkflowInstanceHistoryStageOutput) GetRevertTransaction() *V2ActivityRevertTransactionOutput { - if o == nil { - return nil - } - return o.RevertTransaction -} diff --git a/libs/clients/go/pkg/models/shared/volume.go b/libs/clients/go/pkg/models/shared/volume.go index 8307f5121d..54460ca963 100755 --- a/libs/clients/go/pkg/models/shared/volume.go +++ b/libs/clients/go/pkg/models/shared/volume.go @@ -2,29 +2,45 @@ package shared +import ( + "github.com/formancehq/formance-sdk-go/pkg/utils" + "math/big" +) + type Volume struct { - Balance *int64 `json:"balance,omitempty"` - Input int64 `json:"input"` - Output int64 `json:"output"` + Balance *big.Int `json:"balance,omitempty"` + Input *big.Int `json:"input"` + Output *big.Int `json:"output"` +} + +func (v Volume) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *Volume) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, false); err != nil { + return err + } + return nil } -func (o *Volume) GetBalance() *int64 { +func (o *Volume) GetBalance() *big.Int { if o == nil { return nil } return o.Balance } -func (o *Volume) GetInput() int64 { +func (o *Volume) GetInput() *big.Int { if o == nil { - return 0 + return big.NewInt(0) } return o.Input } -func (o *Volume) GetOutput() int64 { +func (o *Volume) GetOutput() *big.Int { if o == nil { - return 0 + return big.NewInt(0) } return o.Output } diff --git a/libs/clients/go/transactions.go b/libs/clients/go/transactions.go index 97b70efb10..15f070e4b1 100755 --- a/libs/clients/go/transactions.go +++ b/libs/clients/go/transactions.go @@ -155,6 +155,19 @@ func (s *transactions) AddMetadataOnTransaction(ctx context.Context, request ope httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out sdkerrors.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: @@ -310,6 +323,17 @@ func (s *transactions) CreateTransaction(ctx context.Context, request operations default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out sdkerrors.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: @@ -538,6 +562,17 @@ func (s *transactions) RevertTransaction(ctx context.Context, request operations default: return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out sdkerrors.ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + return nil, &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: diff --git a/tests/integration/suite/orchestration-workflows-execute.go b/tests/integration/suite/orchestration-workflows-execute.go index 01a8aa7d2e..885d72112b 100644 --- a/tests/integration/suite/orchestration-workflows-execute.go +++ b/tests/integration/suite/orchestration-workflows-execute.go @@ -221,16 +221,16 @@ var _ = WithModules([]*Module{modules.Orchestration, modules.Auth, modules.Ledge Expect(getWorkflowInstanceHistoryStageResponse.Data[0].StartedAt).NotTo(BeZero()) Expect(getWorkflowInstanceHistoryStageResponse.Data[0].Attempt).To(Equal(int64(1))) Expect(getWorkflowInstanceHistoryStageResponse.Data[0].NextExecution).To(BeNil()) - Expect(getWorkflowInstanceHistoryStageResponse.Data[0].Output.CreateTransaction.Data.Timestamp). + Expect(getWorkflowInstanceHistoryStageResponse.Data[0].Output.CreateTransaction.Data[0].Timestamp). NotTo(BeZero()) - getWorkflowInstanceHistoryStageResponse.Data[0].Output.CreateTransaction.Data.Timestamp = time.Time{} + getWorkflowInstanceHistoryStageResponse.Data[0].Output.CreateTransaction.Data[0].Timestamp = time.Time{} Expect(getWorkflowInstanceHistoryStageResponse.Data[0].Output).To(Equal(&shared.V2WorkflowInstanceHistoryStageOutput{ CreateTransaction: &shared.V2ActivityCreateTransactionOutput{ - Data: shared.V2Transaction{ - ID: big.NewInt(0), + Data: []shared.OrchestrationV2Transaction{{ + Txid: big.NewInt(0), Postings: postings, Metadata: map[string]string{}, - }, + }}, }, })) })