workflows

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestGetMethods    func(ctx context.Context, midazClient *client.Client, orgID, ledgerID, accountID string, portfolioID string) error
	TestListMethods   func(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error
	TestDeleteMethods func(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error
)

Function declarations to satisfy the compiler These are placeholder functions that will be implemented in separate files

Functions

func CreateAccountType

func CreateAccountType(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) (*models.AccountType, error)

CreateAccountType creates a new account type in the specified organization and ledger

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID where the account type will be created
  • ledgerID: The ledger ID where the account type will be created

Returns:

  • *models.AccountType: The created account type object
  • error: Any error encountered during the operation

func CreateAccounts

func CreateAccounts(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) (*models.Account, *models.Account, *models.Account, *models.Account, error)

CreateAccounts creates customer and merchant accounts and returns their models

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • *models.Account: The customer account model
  • *models.Account: The merchant account model
  • *models.Account: The dummy 1 account model
  • *models.Account: The dummy 2 account model
  • error: Any error encountered during the operation

func CreateAccountsWithType

func CreateAccountsWithType(ctx context.Context, midazClient *client.Client, orgID, ledgerID, accountTypeID string) (*models.Account, *models.Account, *models.Account, *models.Account, error)

CreateAccountsWithType creates customer and merchant accounts with specified account type and returns their models

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • client: The initialized Midaz SDK client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • accountTypeID: The ID of the account type to associate with accounts

Returns:

  • *models.Account: The customer account model
  • *models.Account: The merchant account model
  • *models.Account: The dummy 1 account model
  • *models.Account: The dummy 2 account model
  • error: Any error encountered during the operation

func CreateAsset

func CreateAsset(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error

CreateAsset creates a new USD asset

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • error: Any error encountered during the operation

func CreateLedger

func CreateLedger(ctx context.Context, midazClient *client.Client, orgID string) (string, error)

CreateLedger creates a ledger in the organization

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • cfg: The configuration object
  • client: The initialized Midaz SDK client
  • orgID: The ID of the organization

Returns:

  • string: The ID of the created ledger
  • error: Any error encountered during the operation

func CreateMockTransactionRoutes

func CreateMockTransactionRoutes(orgID, ledgerID string) (*models.TransactionRoute, *models.TransactionRoute)

CreateMockTransactionRoutes creates mock transaction routes when server API is not available

func CreateOperationRoutes

func CreateOperationRoutes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, accountType *models.AccountType) (*models.OperationRoute, *models.OperationRoute, error)

CreateOperationRoutes creates multiple operation routes and returns their models

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • client: The initialized Midaz SDK client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • accountType: The account type to associate with operation routes

Returns:

  • *models.OperationRoute: The source operation route model
  • *models.OperationRoute: The destination operation route model
  • error: Any error encountered during the operation

func CreateOrganization

func CreateOrganization(ctx context.Context, midazClient *client.Client) (string, error)

CreateOrganization creates a new organization and returns its ID

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • client: The initialized Midaz SDK client

Returns:

  • string: The ID of the created organization
  • error: Any error encountered during the operation

func CreatePortfolio

func CreatePortfolio(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) (string, error)

CreatePortfolio creates a portfolio

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • string: The ID of the created portfolio
  • error: Any error encountered during the operation

func CreateSegments

func CreateSegments(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error

CreateSegments creates segments within a ledger

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • error: Any error encountered during the operation

func CreateTransactionRoutes

func CreateTransactionRoutes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) (*models.TransactionRoute, *models.TransactionRoute, error)

CreateTransactionRoutes creates multiple transaction routes and returns their models

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • client: The initialized Midaz SDK client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • *models.TransactionRoute: The payment transaction route model
  • *models.TransactionRoute: The refund transaction route model
  • error: Any error encountered during the operation

func CreateTransactionRoutesWithOperationRoutes

func CreateTransactionRoutesWithOperationRoutes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, sourceOperationRoute, destinationOperationRoute *models.OperationRoute) (*models.TransactionRoute, *models.TransactionRoute, error)

CreateTransactionRoutesWithOperationRoutes creates multiple transaction routes linked to operation routes

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • client: The initialized Midaz SDK client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • sourceOperationRoute: The source operation route (can be nil)
  • destinationOperationRoute: The destination operation route (can be nil)

Returns:

  • *models.TransactionRoute: The payment transaction route model
  • *models.TransactionRoute: The refund transaction route model
  • error: Any error encountered during the operation

func CreateTransferInput

func CreateTransferInput(description string, amount string, fromAccountID, toAccountID string, index int) *models.CreateTransactionInput

CreateTransferInput creates a transfer transaction input

func DeleteAccountType

func DeleteAccountType(ctx context.Context, midazClient *client.Client, orgID, ledgerID, accountTypeID string) error

DeleteAccountType deletes an account type

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • accountTypeID: The account type ID to delete

Returns:

  • error: Any error encountered during the operation

func DeleteOperationRoute

func DeleteOperationRoute(ctx context.Context, midazClient *client.Client, orgID, ledgerID, operationRouteID string) error

DeleteOperationRoute deletes an operation route

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • operationRouteID: The operation route ID to delete

Returns:

  • error: Any error encountered during the operation

func DemonstrateTransactionHelpers

func DemonstrateTransactionHelpers(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount, dummyOneAccount, dummyTwoAccount *models.Account) error

DemonstrateTransactionHelpers showcases the transaction helpers in the SDK

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • customerAccount: The customer account model
  • merchantAccount: The merchant account model
  • dummyOneAccount: The dummy 1 account model
  • dummyTwoAccount: The dummy 2 account model

Returns:

  • error: Any error encountered during the operation

func ExecuteConcurrentTransactions

func ExecuteConcurrentTransactions(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *midazmodels.Account) error

ExecuteConcurrentTransactions performs concurrent transactions between accounts to test TPS

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • customerAccount: The customer account model
  • merchantAccount: The merchant account model

Returns:

  • error: Any error encountered during the operation

func ExecuteCustomerToMerchantConcurrent

func ExecuteCustomerToMerchantConcurrent(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *midazmodels.Account, count int) error

ExecuteCustomerToMerchantConcurrent executes concurrent transactions from customer to merchant using the SDK's concurrency helpers

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • customerAccount: The customer account model
  • merchantAccount: The merchant account model
  • count: The number of concurrent transactions to execute

Returns:

  • error: Any error encountered during the operation

func ExecuteInsufficientFundsTransactions

func ExecuteInsufficientFundsTransactions(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, externalAccountID string)

ExecuteInsufficientFundsTransactions attempts transactions that should fail due to insufficient funds

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • customerAccount: The customer account model
  • merchantAccount: The merchant account model
  • externalAccountID: The external account ID

func ExecuteMerchantToCustomerConcurrent

func ExecuteMerchantToCustomerConcurrent(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *midazmodels.Account, count int) error

ExecuteMerchantToCustomerConcurrent executes concurrent transactions from merchant to customer using the SDK's concurrency helpers

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger
  • customerAccount: The customer account model
  • merchantAccount: The merchant account model
  • count: The number of concurrent transactions to execute

Returns:

  • error: Any error encountered during the operation

func ExecuteMultipleDeposits

func ExecuteMultipleDeposits(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, externalAccountID string) error

ExecuteMultipleDeposits - simplified placeholder

func ExecuteMultipleTransfers

func ExecuteMultipleTransfers(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error

ExecuteMultipleTransfers - simplified placeholder

func ExecuteSingleTransfer

func ExecuteSingleTransfer(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error

ExecuteSingleTransfer - simplified placeholder

func ExecuteTransactions

func ExecuteTransactions(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error

ExecuteTransactions executes various transactions between accounts

func ExecuteTransactionsWithRoutes

func ExecuteTransactionsWithRoutes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, sourceOperationRoute, destinationOperationRoute *models.OperationRoute, paymentTransactionRoute, refundTransactionRoute *models.TransactionRoute) error

ExecuteTransactionsWithRoutes executes transactions using routes

func ExecuteWithdrawals

func ExecuteWithdrawals(ctx context.Context, midazClient *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, externalAccountID string) error

ExecuteWithdrawals - simplified placeholder

func GenerateUniqueIdempotencyKey

func GenerateUniqueIdempotencyKey(prefix string, index int) string

GenerateUniqueIdempotencyKey generates a truly unique idempotency key by combining multiple sources of uniqueness

Parameters:

  • prefix: A prefix to identify the source of the key (e.g., "c2m" for customer to merchant)
  • index: An index to identify the specific transaction

Returns:

  • string: A unique idempotency key

func GetAccountType

func GetAccountType(ctx context.Context, midazClient *client.Client, orgID, ledgerID, accountTypeID string) error

GetAccountType retrieves a specific account type by ID

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • accountTypeID: The account type ID to retrieve

Returns:

  • error: Any error encountered during the operation

func GetOperationRoute

func GetOperationRoute(ctx context.Context, midazClient *client.Client, orgID, ledgerID, operationRouteID string) (*models.OperationRoute, error)

GetOperationRoute retrieves a specific operation route by ID

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • operationRouteID: The operation route ID to retrieve

Returns:

  • *models.OperationRoute: The retrieved operation route
  • error: Any error encountered during the operation

func ListAccountTypes

func ListAccountTypes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error

ListAccountTypes lists all account types in the specified organization and ledger

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID

Returns:

  • error: Any error encountered during the operation

func ListAccounts

func ListAccounts(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) error

ListAccounts lists all accounts in the ledger with advanced demonstrations

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • midazClient: The initialized Midaz SDK client
  • orgID: The ID of the organization
  • ledgerID: The ID of the ledger

Returns:

  • error: Any error encountered during the operation

func ListOperationRoutes

func ListOperationRoutes(ctx context.Context, midazClient *client.Client, orgID, ledgerID string) (*models.ListResponse[models.OperationRoute], error)

ListOperationRoutes lists all operation routes in the specified organization and ledger

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID

Returns:

  • *models.ListResponse[models.OperationRoute]: The list of operation routes
  • error: Any error encountered during the operation

func RetrieveOrganization

func RetrieveOrganization(ctx context.Context, midazClient *client.Client, orgID string) error

RetrieveOrganization retrieves the organization by ID

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization

Returns:

  • error: Any error encountered during the operation

func RunCompleteWorkflow

func RunCompleteWorkflow(ctx context.Context, entity *sdkentities.Entity, customerToMerchantTxs, merchantToCustomerTxs int) error

RunCompleteWorkflow runs a complete workflow demonstrating all the features of the Midaz SDK

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • customerToMerchantTxs: Number of customer to merchant transactions to execute
  • merchantToCustomerTxs: Number of merchant to customer transactions to execute

Returns:

  • error: Any error encountered during the operation

func UpdateAccountType

func UpdateAccountType(ctx context.Context, midazClient *client.Client, orgID, ledgerID, accountTypeID string) error

UpdateAccountType updates an existing account type

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • accountTypeID: The account type ID to update

Returns:

  • error: Any error encountered during the operation

func UpdateOperationRoute

func UpdateOperationRoute(ctx context.Context, midazClient *client.Client, orgID, ledgerID, operationRouteID, title, description string, accountTypes []string) (*models.OperationRoute, error)

UpdateOperationRoute updates an existing operation route

Parameters:

  • ctx: The context for the operation
  • client: The initialized Midaz SDK client
  • orgID: The organization ID
  • ledgerID: The ledger ID
  • operationRouteID: The operation route ID to update
  • title: New title for the operation route
  • description: New description for the operation route
  • accountTypes: New account types for validation

Returns:

  • *models.OperationRoute: The updated operation route
  • error: Any error encountered during the operation

func UpdateOrganization

func UpdateOrganization(ctx context.Context, midazClient *client.Client, orgID string) error

UpdateOrganization updates the organization metadata

Parameters:

  • ctx: The context for the operation, which can be used for cancellation
  • entity: The initialized Midaz SDK entity client
  • orgID: The ID of the organization

Returns:

  • error: Any error encountered during the operation

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL