Documentation ¶
Index ¶
- Constants
- Variables
- func SetupAssetsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, ...) error
- func SetupWalletsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, ...) error
- type AssetsNetworkMapType
- type CreateAuthUserService
- type DisbursementManagementService
- func (s *DisbursementManagementService) AppendUserMetadata(ctx context.Context, disbursements []*data.Disbursement) ([]*DisbursementWithUserMetadata, error)
- func (s *DisbursementManagementService) GetDisbursementReceiversWithCount(ctx context.Context, disbursementID string, queryParams *data.QueryParams) (*utils.ResultWithTotal, error)
- func (s *DisbursementManagementService) GetDisbursementsWithCount(ctx context.Context, queryParams *data.QueryParams) (*utils.ResultWithTotal, error)
- func (s *DisbursementManagementService) PauseDisbursement(ctx context.Context, disbursementID string, user *auth.User) error
- func (s *DisbursementManagementService) StartDisbursement(ctx context.Context, disbursementID string, user *auth.User, ...) error
- type DisbursementWithUserMetadata
- type InsufficientBalanceError
- type PatchAnchorPlatformTransactionCompletionService
- func (s *PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionForPaymentEvent(ctx context.Context, tx schemas.EventPaymentCompletedData) error
- func (s *PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionsForPayments(ctx context.Context) error
- func (s *PatchAnchorPlatformTransactionCompletionService) SetModels(models *data.Models)
- type PatchAnchorPlatformTransactionCompletionServiceInterface
- type PaymentFromSubmitterService
- type PaymentFromSubmitterServiceInterface
- type PaymentManagementService
- type PaymentToSubmitterService
- type PaymentToSubmitterServiceInterface
- type ReadyPaymentsCancellationService
- type ReadyPaymentsCancellationServiceInterface
- type SendReceiverWalletInviteService
- type SendReceiverWalletInviteServiceInterface
- type UserReference
- type WalletDeepLink
- type WalletsNetworkMapType
Constants ¶
const MaxErrorMessageLength = 255
Variables ¶
var ( ErrDisbursementNotFound = errors.New("disbursement not found") ErrDisbursementNotReadyToStart = errors.New("disbursement is not ready to be started") ErrDisbursementNotReadyToPause = errors.New("disbursement is not ready to be paused") ErrDisbursementWalletDisabled = errors.New("disbursement wallet is disabled") ErrDisbursementStatusCantBeChanged = errors.New("disbursement status can't be changed to the requested status") ErrDisbursementStartedByCreator = errors.New("disbursement can't be started by its creator") )
var ( ErrPaymentNotFound = errors.New("payment not found") ErrPaymentNotReadyToCancel = errors.New("payment is not ready to be canceled") ErrPaymentStatusCantBeChanged = errors.New("payment status can't be changed to the requested status") )
var DefaultAssetsNetworkMap = AssetsNetworkMapType{ utils.PubnetNetworkType: []data.Asset{assets.USDCAssetPubnet, assets.XLMAsset}, utils.TestnetNetworkType: []data.Asset{assets.USDCAssetTestnet, assets.XLMAsset}, }
var DefaultWalletsNetworkMap = WalletsNetworkMapType{ utils.PubnetNetworkType: wallets.PubnetWallets, utils.TestnetNetworkType: wallets.TestnetWallets, }
Functions ¶
func SetupAssetsForProperNetwork ¶
func SetupAssetsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, network utils.NetworkType, assetsNetworkMap AssetsNetworkMapType) error
SetupAssetsForProperNetwork updates and inserts assets for the given Network Passphrase (`network`). So it avoids the application having same asset code with multiple issuers.
func SetupWalletsForProperNetwork ¶
func SetupWalletsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, network utils.NetworkType, walletsNetworkMap WalletsNetworkMapType) error
SetupWalletsForProperNetwork updates and inserts wallets for the given Network Passphrase (`network`). So it avoids the application having wallets that doesn't support the given network.
Types ¶
type AssetsNetworkMapType ¶
type AssetsNetworkMapType map[utils.NetworkType][]data.Asset
type CreateAuthUserService ¶
type CreateAuthUserService struct {
// contains filtered or unexported fields
}
func NewCreateUserService ¶
func NewCreateUserService(models *data.Models, dbConnectionPool db.DBConnectionPool, authManager auth.AuthManager, messengerClient message.MessengerClient) *CreateAuthUserService
type DisbursementManagementService ¶
type DisbursementManagementService struct {
// contains filtered or unexported fields
}
DisbursementManagementService is a service for managing disbursements.
func NewDisbursementManagementService ¶
func NewDisbursementManagementService( models *data.Models, dbConnectionPool db.DBConnectionPool, authManager auth.AuthManager, horizonClient horizonclient.ClientInterface, eventProducer events.Producer, ) *DisbursementManagementService
NewDisbursementManagementService is a factory function for creating a new DisbursementManagementService.
func (*DisbursementManagementService) AppendUserMetadata ¶
func (s *DisbursementManagementService) AppendUserMetadata(ctx context.Context, disbursements []*data.Disbursement) ([]*DisbursementWithUserMetadata, error)
func (*DisbursementManagementService) GetDisbursementReceiversWithCount ¶
func (s *DisbursementManagementService) GetDisbursementReceiversWithCount(ctx context.Context, disbursementID string, queryParams *data.QueryParams) (*utils.ResultWithTotal, error)
func (*DisbursementManagementService) GetDisbursementsWithCount ¶
func (s *DisbursementManagementService) GetDisbursementsWithCount(ctx context.Context, queryParams *data.QueryParams) (*utils.ResultWithTotal, error)
func (*DisbursementManagementService) PauseDisbursement ¶
func (s *DisbursementManagementService) PauseDisbursement(ctx context.Context, disbursementID string, user *auth.User) error
PauseDisbursement pauses a disbursement and all its payments.
func (*DisbursementManagementService) StartDisbursement ¶
func (s *DisbursementManagementService) StartDisbursement(ctx context.Context, disbursementID string, user *auth.User, distributionPubKey string) error
StartDisbursement starts a disbursement and all its payments and receivers wallets.
type DisbursementWithUserMetadata ¶
type DisbursementWithUserMetadata struct { data.Disbursement CreatedBy UserReference `json:"created_by"` StartedBy UserReference `json:"started_by"` }
type InsufficientBalanceError ¶
type InsufficientBalanceError struct { DisbursementID string DisbursementAsset data.Asset AvailableBalance float64 DisbursementAmount float64 TotalPendingAmount float64 }
func (InsufficientBalanceError) Error ¶
func (e InsufficientBalanceError) Error() string
type PatchAnchorPlatformTransactionCompletionService ¶
type PatchAnchorPlatformTransactionCompletionService struct {
// contains filtered or unexported fields
}
func (*PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionForPaymentEvent ¶
func (s *PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionForPaymentEvent(ctx context.Context, tx schemas.EventPaymentCompletedData) error
func (*PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionsForPayments ¶
func (s *PatchAnchorPlatformTransactionCompletionService) PatchAPTransactionsForPayments(ctx context.Context) error
func (*PatchAnchorPlatformTransactionCompletionService) SetModels ¶
func (s *PatchAnchorPlatformTransactionCompletionService) SetModels(models *data.Models)
type PatchAnchorPlatformTransactionCompletionServiceInterface ¶
type PatchAnchorPlatformTransactionCompletionServiceInterface interface { PatchAPTransactionForPaymentEvent(ctx context.Context, tx schemas.EventPaymentCompletedData) error PatchAPTransactionsForPayments(ctx context.Context) error }
func NewPatchAnchorPlatformTransactionCompletionService ¶
func NewPatchAnchorPlatformTransactionCompletionService(apAPISvc anchorplatform.AnchorPlatformAPIServiceInterface, sdpModels *data.Models) (PatchAnchorPlatformTransactionCompletionServiceInterface, error)
type PaymentFromSubmitterService ¶
type PaymentFromSubmitterService struct {
// contains filtered or unexported fields
}
PaymentFromSubmitterService is a service that monitors TSS transactions that were complete and sync their completion state with the SDP payments.
func NewPaymentFromSubmitterService ¶
func NewPaymentFromSubmitterService(models *data.Models, tssDBConnectionPool db.DBConnectionPool) *PaymentFromSubmitterService
NewPaymentFromSubmitterService is a PaymentFromSubmitterService constructor.
func (PaymentFromSubmitterService) SyncBatchTransactions ¶
func (s PaymentFromSubmitterService) SyncBatchTransactions(ctx context.Context, batchSize int, tenantID string) error
SyncBatchTransactions monitors TSS transactions that were complete and sync their completion state with the SDP payments.
func (PaymentFromSubmitterService) SyncTransaction ¶
func (s PaymentFromSubmitterService) SyncTransaction(ctx context.Context, tx *schemas.EventPaymentCompletedData) error
SyncTransaction syncs the completed TSS transaction with the SDP's payment.
type PaymentManagementService ¶
type PaymentManagementService struct {
// contains filtered or unexported fields
}
PaymentManagementService is a service for managing disbursements.
func NewPaymentManagementService ¶
func NewPaymentManagementService(models *data.Models, dbConnectionPool db.DBConnectionPool) *PaymentManagementService
NewPaymentManagementService is a factory function for creating a new PaymentManagementService.
func (*PaymentManagementService) CancelPayment ¶
func (s *PaymentManagementService) CancelPayment(ctx context.Context, paymentID string) error
CancelPayment update payment to status 'canceled'
type PaymentToSubmitterService ¶
type PaymentToSubmitterService struct {
// contains filtered or unexported fields
}
PaymentToSubmitterService is a service that pushes SDP's ready-to-pay payments to the transaction submission service.
func NewPaymentToSubmitterService ¶
func NewPaymentToSubmitterService(models *data.Models, tssDBConnectionPool db.DBConnectionPool) *PaymentToSubmitterService
func (PaymentToSubmitterService) SendBatchPayments ¶
func (s PaymentToSubmitterService) SendBatchPayments(ctx context.Context, batchSize int) error
SendBatchPayments sends SDP's ready-to-pay payments (in batches) to the transaction submission service.
func (PaymentToSubmitterService) SendPaymentsReadyToPay ¶
func (s PaymentToSubmitterService) SendPaymentsReadyToPay(ctx context.Context, paymentsReadyToPay schemas.EventPaymentsReadyToPayData) error
SendPaymentsReadyToPay sends SDP's ready-to-pay payments (in batches) to the transaction submission service.
type ReadyPaymentsCancellationService ¶
type ReadyPaymentsCancellationService struct {
// contains filtered or unexported fields
}
func NewReadyPaymentsCancellationService ¶
func NewReadyPaymentsCancellationService(models *data.Models) *ReadyPaymentsCancellationService
func (ReadyPaymentsCancellationService) CancelReadyPayments ¶
func (s ReadyPaymentsCancellationService) CancelReadyPayments(ctx context.Context) error
CancelReadyPayments cancels SDP's ready-to-pay payments that are older than the specified period.
type SendReceiverWalletInviteService ¶
type SendReceiverWalletInviteService struct { Models *data.Models // contains filtered or unexported fields }
func NewSendReceiverWalletInviteService ¶
func NewSendReceiverWalletInviteService(models *data.Models, messengerClient message.MessengerClient, sep10SigningPrivateKey string, maxInvitationSMSResendAttempts int64, crashTrackerClient crashtracker.CrashTrackerClient) (*SendReceiverWalletInviteService, error)
func (SendReceiverWalletInviteService) SendInvite ¶
func (s SendReceiverWalletInviteService) SendInvite(ctx context.Context, receiverWalletInvitationData ...schemas.EventReceiverWalletSMSInvitationData) error
SendInvite sends the invitation’s deep link to the wallet’s application. The approach to sending the invitation is to send the deep link for each asset the wallet will pay based on the payment. For instance, the Wallet Foo is in two Ready Payments, one with USDC and the other with EUROC. So the receiver who has a Stellar Address pending registration (status:READY) in this wallet will receive both invites for USDC and EUROC. This would not impact the user receiving both token amounts. It's only for the registration process.
type SendReceiverWalletInviteServiceInterface ¶
type SendReceiverWalletInviteServiceInterface interface {
SendInvite(ctx context.Context, receiverWalletInvitationData ...schemas.EventReceiverWalletSMSInvitationData) error
}
type UserReference ¶
type WalletDeepLink ¶
type WalletDeepLink struct { // DeepLink is the deep link used to open the wallet invitation link. DeepLink string // Route is an optional parameter that can be used to specify the route to open in the wallet, in case it's not already present in the DeepLink. Route string // (optional) // OrganizationName is the name of the organization that is sending the invitation. OrganizationName string // AssetCode is the code of the Stellar asset that the receiver will be able to receive. AssetCode string // AssetIssuer is the issuer of the Stellar asset that the receiver will be able to receive. AssetIssuer string // TenantBaseURL is the base URL for the tenant that the receiver wallet belongs to. TenantBaseURL string }
func (WalletDeepLink) BaseURLWithRoute ¶
func (wdl WalletDeepLink) BaseURLWithRoute() (string, error)
BaseURLWithRoute returns the base URL of the deep link with the route appended.
func (WalletDeepLink) GetSignedRegistrationLink ¶
func (wdl WalletDeepLink) GetSignedRegistrationLink(stellarSecretKey string) (string, error)
GetSignedRegistrationLink will return the registration link accompanied with an extra query parameter containing the signature of the registration link, where the signature is created using the stellarSecretKey with the unsigned link as the message, keeping in mind that the insigned link query parameters were sorted in alphabetical order to generate the signature.
func (WalletDeepLink) GetUnsignedRegistrationLink ¶
func (wdl WalletDeepLink) GetUnsignedRegistrationLink() (string, error)
GetUnsignedRegistrationLink creates a deep link for the wallet registration using the format below: <deep_link></route>?<domain>&<name>&<asset>.
func (WalletDeepLink) TomlFileDomain ¶
func (wdl WalletDeepLink) TomlFileDomain() (string, error)
type WalletsNetworkMapType ¶
type WalletsNetworkMapType map[utils.NetworkType][]data.Wallet
Source Files ¶
- create_auth_user.go
- disbursement_management_service.go
- patch_anchor_platform_transactions_completion.go
- payment_from_submitter_service.go
- payment_management_service.go
- payment_to_submitter_service.go
- ready_payments_cancellation_service.go
- send_receiver_wallets_invite_service.go
- setup_assets_for_network_service.go
- setup_wallets_for_network_service.go