Documentation ¶
Overview ¶
package processing implements methods for invoices processing
Index ¶
- Variables
- type BlockchainService
- type Config
- type DetailedPayment
- type Input
- type PaymentInfo
- type Service
- func (s *Service) BatchCheckIncomingTransactions(ctx context.Context, transactionIDs []int64) error
- func (s *Service) BatchCheckInternalTransfers(ctx context.Context, transactionIDs []int64) error
- func (s *Service) BatchCheckWithdrawals(ctx context.Context, transactionIDs []int64) error
- func (s *Service) BatchCreateInternalTransfers(ctx context.Context, inboundBalances []*wallet.Balance) (*TransferResult, error)
- func (s *Service) BatchCreateWithdrawals(ctx context.Context, withdrawalIDs []int64) (*TransferResult, error)
- func (s *Service) BatchExpirePayments(ctx context.Context, paymentsIDs []int64) error
- func (s *Service) EnsureOutboundWallet(ctx context.Context, chain money.Blockchain) (*wallet.Wallet, bool, error)
- func (s *Service) GetDetailedPayment(ctx context.Context, merchantID, paymentID int64) (*DetailedPayment, error)
- func (s *Service) LockPaymentOptions(ctx context.Context, merchantID, paymentID int64) error
- func (s *Service) ProcessInboundTransaction(ctx context.Context, tx *transaction.Transaction, wt *wallet.Wallet, ...) error
- func (s *Service) ProcessIncomingWebhook(ctx context.Context, walletID uuid.UUID, networkID string, wh TatumWebhook) error
- func (s *Service) SetPaymentMethod(ctx context.Context, p *payment.Payment, ticker string) (*payment.Method, error)
- func (s *Service) ValidateWebhookSignature(body []byte, hash string) error
- type TatumWebhook
- type TransferResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrStatusInvalid = errors.New("payment status is invalid") ErrPaymentOptionsMissing = errors.New("payment options are not fully fulfilled") ErrSignatureVerification = errors.New("unable to verify request signature") ErrInboundWallet = errors.New("inbound wallet error") )
var ( ErrInvalidInput = errors.New("invalid incoming input") ErrTransaction = errors.New("transaction error") )
Functions ¶
This section is empty.
Types ¶
type BlockchainService ¶
type BlockchainService interface { blockchain.Resolver blockchain.Convertor blockchain.Broadcaster blockchain.FeeCalculator }
type Config ¶
type Config struct { WebhookBasePath string `` /* 143-byte string literal not displayed */ PaymentFrontendBasePath string `` /* 151-byte string literal not displayed */ PaymentFrontendSubPath string `` /* 134-byte string literal not displayed */ // DefaultServiceFee as float percentage. 1% is 0.01 DefaultServiceFee float64 `yaml:"default_service_fee" env:"PROCESSING_DEFAULT_SERVICE_FEE" env-default:"0" env-description:"Internal variable"` }
func (*Config) PaymentFrontendPath ¶
type DetailedPayment ¶
type PaymentInfo ¶
type PaymentInfo struct { Status payment.Status PaymentLink string RecipientAddress string Amount string AmountFormatted string ExpiresAt time.Time ExpirationDurationMin int64 SuccessAction *payment.SuccessAction SuccessURL *string SuccessMessage *string }
PaymentInfo represents simplified transaction information.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) BatchCheckIncomingTransactions ¶
func (*Service) BatchCheckInternalTransfers ¶
func (*Service) BatchCheckWithdrawals ¶
func (*Service) BatchCreateInternalTransfers ¶
func (s *Service) BatchCreateInternalTransfers( ctx context.Context, inboundBalances []*wallet.Balance, ) (*TransferResult, error)
BatchCreateInternalTransfers receives INBOUND balances and transfers funds to OUTBOUND ones.
func (*Service) BatchCreateWithdrawals ¶
func (s *Service) BatchCreateWithdrawals(ctx context.Context, withdrawalIDs []int64) (*TransferResult, error)
BatchCreateWithdrawals ingests list of withdrawals and creates & broadcasts transactions.
func (*Service) BatchExpirePayments ¶
func (*Service) EnsureOutboundWallet ¶
func (s *Service) EnsureOutboundWallet(ctx context.Context, chain money.Blockchain) (*wallet.Wallet, bool, error)
EnsureOutboundWallet makes sure that outbound wallet for specified blockchain exists in the database and the system is subscribed to all of selected currencies both for mainnet & testnet. Returning bool indicates whether the wallet was created or returned from db.
func (*Service) GetDetailedPayment ¶
func (*Service) LockPaymentOptions ¶
LockPaymentOptions locks payment editing. This method is used to finish payment setup by the end customer.
func (*Service) ProcessInboundTransaction ¶
func (s *Service) ProcessInboundTransaction( ctx context.Context, tx *transaction.Transaction, wt *wallet.Wallet, input Input, ) error
ProcessInboundTransaction implements correct business logic for transaction processing
func (*Service) ProcessIncomingWebhook ¶
type TatumWebhook ¶
type TatumWebhook struct { SubscriptionType string `json:"subscriptionType"` TransactionID string `json:"txId"` Address string `json:"address"` Sender string `json:"counterAddress"` // Asset coin name or token contact address or (!) token ticker e.g. USDT_TRON Asset string `json:"asset"` // Amount "0.000123" (float) instead of "123" (wei-like) Amount string `json:"amount"` BlockNumber int64 `json:"blockNumber"` // Type can be ['native', 'token', `trc20', 'fee'] or maybe any other Type string `json:"type"` // Mempool (EMV-based blockchains only) if appears and set to "true", the transaction is in the mempool; // if set to "false" or does not appear at all, the transaction has been added to a block Mempool bool `json:"mempool"` // Chain for ETH test is might be 'ethereum-goerli' or 'sepolia' Chain string `json:"chain"` }
TatumWebhook see https://apidoc.tatum.io/tag/Notification-subscriptions#operation/createSubscription
func (*TatumWebhook) CurrencyType ¶
func (w *TatumWebhook) CurrencyType() money.CryptoCurrencyType
func (*TatumWebhook) MarshalBinary ¶
func (w *TatumWebhook) MarshalBinary() ([]byte, error)
type TransferResult ¶
type TransferResult struct { CreatedTransactions []*transaction.Transaction RollbackedTransactionIDs []int64 UnhandledErrors []error // len(UnhandledErrors) + len(RollbackedTransactionIDs) TotalErrors int64 // contains filtered or unexported fields }