Documentation
¶
Index ¶
- Variables
- func CreateAccounts(ctx context.Context, client *client.Client, orgID, ledgerID string) (*models.Account, *models.Account, *models.Account, *models.Account, error)
- func CreateAsset(ctx context.Context, client *client.Client, orgID, ledgerID string) error
- func CreateDepositInput(description string, amount int64, sourceAccountID, destinationAccountID string) *models.CreateTransactionInput
- func CreateLedger(ctx context.Context, client *client.Client, orgID string) (string, error)
- func CreateOrganization(ctx context.Context, client *client.Client) (string, error)
- func CreatePortfolio(ctx context.Context, client *client.Client, orgID, ledgerID string) (string, error)
- func CreateSegments(ctx context.Context, client *client.Client, orgID, ledgerID string) error
- func CreateTransferInput(description string, amount int64, fromAccountID, toAccountID string, index int) *models.CreateTransactionInput
- func DemonstrateTransactionHelpers(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteConcurrentTransactions(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteCustomerToMerchantConcurrent(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteInitialDeposit(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteInsufficientFundsTransactions(ctx context.Context, client *client.Client, orgID, ledgerID string, ...)
- func ExecuteMerchantToCustomerConcurrent(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteMultipleDeposits(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteMultipleTransfers(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteSingleTransfer(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteTransactions(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func ExecuteWithdrawals(ctx context.Context, client *client.Client, orgID, ledgerID string, ...) error
- func GenerateUniqueIdempotencyKey(prefix string, index int) string
- func ListAccounts(ctx context.Context, client *client.Client, orgID, ledgerID string) error
- func RetrieveOrganization(ctx context.Context, client *client.Client, orgID string) error
- func RunCompleteWorkflow(ctx context.Context, entity *sdkentities.Entity, ...) error
- func UpdateOrganization(ctx context.Context, client *client.Client, orgID string) error
Constants ¶
This section is empty.
Variables ¶
var ( TestGetMethods func(ctx context.Context, client *client.Client, orgID, ledgerID, accountID string, portfolioID string) error TestListMethods func(ctx context.Context, client *client.Client, orgID, ledgerID string) error TestDeleteMethods func(ctx context.Context, client *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 CreateAccounts ¶
func CreateAccounts(ctx context.Context, client *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 CreateAsset ¶
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 CreateDepositInput ¶
func CreateDepositInput(description string, amount int64, sourceAccountID, destinationAccountID string) *models.CreateTransactionInput
CreateDepositInput is a helper function to create a deposit transaction input
Parameters:
- description: The description of the transaction
- amount: The amount of the transaction (in cents)
- sourceAccountID: The ID of the account to deposit from
- destinationAccountID: The ID of the account to deposit to
Returns:
- *models.CreateTransactionInput: The deposit transaction input
func CreateLedger ¶
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 CreateOrganization ¶
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, client *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 ¶
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 CreateTransferInput ¶
func CreateTransferInput(description string, amount int64, fromAccountID, toAccountID string, index int) *models.CreateTransactionInput
CreateTransferInput is a helper function to create a transfer transaction input
Parameters:
- description: The description of the transaction
- amount: The amount of the transaction (in cents)
- fromAccountID: The ID of the account to transfer from
- toAccountID: The ID of the account to transfer to
- index: The index of the transaction (for logging purposes)
Returns:
- *models.CreateTransactionInput: The transfer transaction input
func DemonstrateTransactionHelpers ¶
func DemonstrateTransactionHelpers(ctx context.Context, client *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, client *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, client *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 ExecuteInitialDeposit ¶
func ExecuteInitialDeposit(ctx context.Context, client *client.Client, orgID, ledgerID string, customerAccount *models.Account, externalAccountID string) error
ExecuteInitialDeposit performs the initial deposit from external account to customer account
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
- externalAccountID: The external account ID
Returns:
- error: Any error encountered during the operation
func ExecuteInsufficientFundsTransactions ¶
func ExecuteInsufficientFundsTransactions(ctx context.Context, client *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, client *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, client *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, externalAccountID string) error
ExecuteMultipleDeposits performs multiple deposits to customer and merchant accounts
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
Returns:
- error: Any error encountered during the operation
func ExecuteMultipleTransfers ¶
func ExecuteMultipleTransfers(ctx context.Context, client *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error
ExecuteMultipleTransfers performs multiple transfers between customer and merchant accounts
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 ExecuteSingleTransfer ¶
func ExecuteSingleTransfer(ctx context.Context, client *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error
ExecuteSingleTransfer performs a single transfer from customer to merchant
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 ExecuteTransactions ¶
func ExecuteTransactions(ctx context.Context, client *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account) error
ExecuteTransactions executes various transactions between accounts
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 ExecuteWithdrawals ¶
func ExecuteWithdrawals(ctx context.Context, client *client.Client, orgID, ledgerID string, customerAccount, merchantAccount *models.Account, externalAccountID string) error
ExecuteWithdrawals performs withdrawals from accounts to external account
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
Returns:
- error: Any error encountered during the operation
func GenerateUniqueIdempotencyKey ¶
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 ListAccounts ¶
ListAccounts lists all accounts in the ledger
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
- ledgerID: The ID of the ledger
Returns:
- error: Any error encountered during the operation
func RetrieveOrganization ¶
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 UpdateOrganization ¶
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.