Documentation ¶
Index ¶
- func CheckForDuplicates(transactions []Transaction) error
- func CheckPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
- func ConfirmPreparedTransaction(settlementWallet *uphold.Wallet, settlement *Transaction) error
- func ConfirmPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
- func ParseBPTSignedSettlement(jsonIn []byte) ([]string, error)
- func PrepareTransactions(wallet *uphold.Wallet, settlements []Transaction) error
- func ReadFiles(filesPaths []string) (*[]Transaction, error)
- func SubmitPreparedTransaction(settlementWallet *uphold.Wallet, settlement *Transaction) error
- func SubmitPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
- type AntifraudTransaction
- type BPTSignedSettlement
- type Config
- type ProviderInfo
- type State
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForDuplicates ¶ added in v0.3.0
func CheckForDuplicates(transactions []Transaction) error
CheckForDuplicates in a list of transactions
func CheckPreparedTransactions ¶
func CheckPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
CheckPreparedTransactions performs sanity checks on an array of signed settlements
func ConfirmPreparedTransaction ¶
func ConfirmPreparedTransaction(settlementWallet *uphold.Wallet, settlement *Transaction) error
ConfirmPreparedTransaction confirms a single settlement transaction with uphold
It is designed to be idempotent across multiple runs, in case of network outage transactions that were unable to be confirmed during an initial run can be submitted in subsequent runs.
func ConfirmPreparedTransactions ¶
func ConfirmPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
ConfirmPreparedTransactions confirms settlement transactions that have already been submitted to uphold
It is designed to be idempotent across multiple runs, in case of network outage transactions that were unable to be confirmed during an initial run can be confirmed in subsequent runs.
func ParseBPTSignedSettlement ¶
ParseBPTSignedSettlement parses the signed output from brave-payment-tools
It returns an array of base64 encoded "extracted" httpsignatures
func PrepareTransactions ¶
func PrepareTransactions(wallet *uphold.Wallet, settlements []Transaction) error
PrepareTransactions by embedding signed transactions into the settlement documents
func ReadFiles ¶ added in v0.4.0
func ReadFiles(filesPaths []string) (*[]Transaction, error)
ReadFiles reads a series of files
func SubmitPreparedTransaction ¶
func SubmitPreparedTransaction(settlementWallet *uphold.Wallet, settlement *Transaction) error
SubmitPreparedTransaction submits a single settlement transaction to uphold
It is designed to be idempotent across multiple runs, in case of network outage transactions that were unable to be submitted during an initial run can be submitted in subsequent runs.
func SubmitPreparedTransactions ¶
func SubmitPreparedTransactions(settlementWallet *uphold.Wallet, settlements []Transaction) error
SubmitPreparedTransactions by submitting them to uphold after performing sanity checks
It is designed to be idempotent across multiple runs, in case of network outage transactions that were unable to be submitted during an initial run can be submitted in subsequent runs.
Types ¶
type AntifraudTransaction ¶ added in v0.4.0
type AntifraudTransaction struct { Address string `json:"address"` BAT decimal.Decimal `json:"bat"` ChannelType string `json:"channel_type"` Fees decimal.Decimal `json:"fees"` ID string `json:"id"` Owner string `json:"owner"` OwnerState string `json:"owner_state"` PayoutReportID string `json:"payout_report_id"` Publisher string `json:"publisher"` Type string `json:"type"` URL string `json:"url"` WalletCountryCode string `json:"wallet_country_code"` WalletProvider string `json:"wallet_provider"` WalletProviderID string `json:"wallet_provider_id"` }
AntifraudTransaction a transaction object that comes from antifraud
func (AntifraudTransaction) ProviderInfo ¶ added in v0.4.0
func (at AntifraudTransaction) ProviderInfo() ProviderInfo
ProviderInfo splits apart provider info from wallet provider id
func (AntifraudTransaction) ToTransaction ¶ added in v0.4.0
func (at AntifraudTransaction) ToTransaction() Transaction
ToTransaction turns the antifraud transaction into a transaction understandable by settlement tools
type BPTSignedSettlement ¶
type BPTSignedSettlement struct { SignedTxs []struct { uphold.HTTPSignedRequest `json:"signedTx"` } `json:"signedTxs"` }
BPTSignedSettlement is a struct describing the signed output format of brave-payment-tools
type Config ¶ added in v0.4.0
Config a space for complex inputs
func ReadYamlConfig ¶ added in v0.4.0
ReadYamlConfig reads a yaml config
func (*Config) GetWalletKey ¶ added in v0.4.0
GetWalletKey accesses the wallet config
type ProviderInfo ¶ added in v0.4.0
type ProviderInfo struct { Establishment string `json:"establishment"` Type string `json:"type"` ID string `json:"id"` }
ProviderInfo holds information parsed from the wallet_provider_id
type State ¶
type State struct { WalletInfo wallet.Info `json:"walletInfo"` Transactions []Transaction `json:"transactions"` }
State contains the current state of the settlement, including wallet and transaction status
type Transaction ¶
type Transaction struct { AltCurrency *altcurrency.AltCurrency `json:"altcurrency"` Authority string `json:"authority"` Amount decimal.Decimal `json:"amount"` ExchangeFee decimal.Decimal `json:"commission"` Currency string `json:"currency"` Destination string `json:"address"` Publisher string `json:"owner"` BATPlatformFee decimal.Decimal `json:"fees"` Probi decimal.Decimal `json:"probi"` ProviderID string `json:"hash"` WalletProvider string `json:"walletProvider"` WalletProviderID string `json:"walletProviderId"` Channel string `json:"publisher"` SignedTx string `json:"signedTx"` Status string `json:"status"` SettlementID string `json:"transactionId" valid:"uuidv4"` TransferFee decimal.Decimal `json:"fee"` Type string `json:"type"` ValidUntil time.Time `json:"validUntil,omitempty"` DocumentID string `json:"documentId,omitempty"` Note string `json:"note"` }
Transaction describes a payout transaction from the settlement wallet to a publisher
func (Transaction) IsComplete ¶
func (tx Transaction) IsComplete() bool
IsComplete returns true if the transaction status is completed
func (Transaction) IsFailed ¶ added in v0.5.0
func (tx Transaction) IsFailed() bool
IsFailed returns true if the transaction status is failed
func (Transaction) TransferID ¶ added in v0.5.0
func (tx Transaction) TransferID() string
TransferID generate the transfer id