Documentation ¶
Index ¶
- Constants
- Variables
- func SendInvitationMessage(ctx context.Context, messengerClient message.MessengerClient, ...) error
- func SetupAssetsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, ...) error
- func SetupWalletsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, ...) error
- type AssetsNetworkByPlatformMapType
- type AssetsNetworkMapType
- type CircleDistributionAccountService
- type CircleReconciliationService
- type CircleReconciliationServiceInterface
- 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 DistributionAccountService
- type DistributionAccountServiceInterface
- type DistributionAccountServiceOptions
- 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 PaymentToSubmitterServiceOptions
- type ReadyPaymentsCancellationService
- type ReadyPaymentsCancellationServiceInterface
- type SendInvitationMessageOptions
- type SendReceiverWalletInviteService
- type SendReceiverWalletInviteServiceInterface
- type StellarDistributionAccountService
- 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 AssetsNetworkByPlatformMap = AssetsNetworkByPlatformMapType{ schema.StellarPlatform: StellarAssetsNetworkMap, schema.CirclePlatform: CircleAssetsNetworkMap, }
var CircleAssetsNetworkMap = AssetsNetworkMapType{ utils.PubnetNetworkType: []data.Asset{assets.EURCAssetPubnet, assets.USDCAssetPubnet}, utils.TestnetNetworkType: []data.Asset{assets.EURCAssetTestnet, assets.USDCAssetTestnet}, }
var DefaultWalletsNetworkMap = WalletsNetworkMapType{ utils.PubnetNetworkType: wallets.PubnetWallets, utils.TestnetNetworkType: wallets.TestnetWallets, }
var StellarAssetsNetworkMap = AssetsNetworkMapType{ utils.PubnetNetworkType: []data.Asset{assets.EURCAssetPubnet, assets.USDCAssetPubnet, assets.XLMAsset}, utils.TestnetNetworkType: []data.Asset{assets.EURCAssetTestnet, assets.USDCAssetTestnet, assets.XLMAsset}, }
Functions ¶
func SendInvitationMessage ¶
func SendInvitationMessage(ctx context.Context, messengerClient message.MessengerClient, models *data.Models, opts SendInvitationMessageOptions) error
func SetupAssetsForProperNetwork ¶
func SetupAssetsForProperNetwork(ctx context.Context, dbConnectionPool db.DBConnectionPool, network utils.NetworkType, distAccPlatform schema.Platform) 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 AssetsNetworkByPlatformMapType ¶
type AssetsNetworkByPlatformMapType map[schema.Platform]AssetsNetworkMapType
type AssetsNetworkMapType ¶
type AssetsNetworkMapType map[utils.NetworkType][]data.Asset
type CircleDistributionAccountService ¶
type CircleDistributionAccountService struct { CircleService circle.ServiceInterface NetworkType utils.NetworkType }
func (*CircleDistributionAccountService) GetBalance ¶
func (s *CircleDistributionAccountService) GetBalance(ctx context.Context, account *schema.TransactionAccount, asset data.Asset) (float64, error)
func (*CircleDistributionAccountService) GetBalances ¶
func (s *CircleDistributionAccountService) GetBalances(ctx context.Context, account *schema.TransactionAccount) (map[data.Asset]float64, error)
type CircleReconciliationService ¶
type CircleReconciliationService struct { Models *data.Models CircleService circle.ServiceInterface DistAccountResolver signing.DistributionAccountResolver }
func (*CircleReconciliationService) Reconcile ¶
func (s *CircleReconciliationService) Reconcile(ctx context.Context) error
Reconcile reconciles the pending Circle transfer requests for the tenant in the context. It fetches the rows from circte_transfer_request where status is set to pending, and then fetches the transfer details from Circle API. It updates the status of the transfer request in the DB based on the status of the transfer in Circle. If the transfer reached a successful/failure status, it updates the payment status in the DB as well to reflect that.
type DisbursementManagementService ¶
type DisbursementManagementService struct { Models *data.Models EventProducer events.Producer AuthManager auth.AuthManager CrashTrackerClient crashtracker.CrashTrackerClient DistributionAccountService DistributionAccountServiceInterface }
DisbursementManagementService is a service for managing disbursements.
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, distributionAccount *schema.TransactionAccount) 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 DistributionAccountService ¶
type DistributionAccountService struct {
// contains filtered or unexported fields
}
func NewDistributionAccountService ¶
func NewDistributionAccountService(opts DistributionAccountServiceOptions) (*DistributionAccountService, error)
func (*DistributionAccountService) GetBalance ¶
func (s *DistributionAccountService) GetBalance(ctx context.Context, account *schema.TransactionAccount, asset data.Asset) (float64, error)
func (*DistributionAccountService) GetBalances ¶
func (s *DistributionAccountService) GetBalances(ctx context.Context, account *schema.TransactionAccount) (map[data.Asset]float64, error)
type DistributionAccountServiceOptions ¶
type DistributionAccountServiceOptions struct { HorizonClient horizonclient.ClientInterface CircleService circle.ServiceInterface NetworkType utils.NetworkType }
func (DistributionAccountServiceOptions) Validate ¶
func (opts DistributionAccountServiceOptions) Validate() error
type InsufficientBalanceError ¶
type InsufficientBalanceError struct { DistributionAddress string 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(opts PaymentToSubmitterServiceOptions) *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 PaymentToSubmitterServiceOptions ¶
type PaymentToSubmitterServiceOptions struct { Models *data.Models DistAccountResolver signing.DistributionAccountResolver PaymentDispatcher paymentdispatchers.PaymentDispatcherInterface }
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 SendInvitationMessageOptions ¶
type SendInvitationMessageOptions struct { FirstName string Email string Role string UIBaseURL string }
func (SendInvitationMessageOptions) Validate ¶
func (o SendInvitationMessageOptions) Validate() error
type SendReceiverWalletInviteService ¶
type SendReceiverWalletInviteService struct { Models *data.Models // contains filtered or unexported fields }
func NewSendReceiverWalletInviteService ¶
func NewSendReceiverWalletInviteService(models *data.Models, messageDispatcher message.MessageDispatcherInterface, sep10SigningPrivateKey string, maxInvitationResendAttempts int64, crashTrackerClient crashtracker.CrashTrackerClient) (*SendReceiverWalletInviteService, error)
func (SendReceiverWalletInviteService) SendInvite ¶
func (s SendReceiverWalletInviteService) SendInvite(ctx context.Context, receiverWalletInvitationData ...schemas.EventReceiverWalletInvitationData) 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.EventReceiverWalletInvitationData) error
}
type StellarDistributionAccountService ¶
type StellarDistributionAccountService struct {
// contains filtered or unexported fields
}
func (*StellarDistributionAccountService) GetBalance ¶
func (s *StellarDistributionAccountService) GetBalance(ctx context.Context, account *schema.TransactionAccount, asset data.Asset) (float64, error)
func (*StellarDistributionAccountService) GetBalances ¶
func (s *StellarDistributionAccountService) GetBalances(_ context.Context, account *schema.TransactionAccount) (map[data.Asset]float64, 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 ¶
- circle_reconciliation_service.go
- disbursement_management_service.go
- distribution_account_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_invitation_message.go
- send_receiver_wallets_invite_service.go
- setup_assets_for_network_service.go
- setup_wallets_for_network_service.go