Documentation ¶
Index ¶
- Constants
- Variables
- func DoInit(repoRoot string, nBitsForKeypair int, testnet bool, password string, ...) error
- func GetObjectFromIPFS(n *core.IpfsNode, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
- func GetRepoPath(isTestnet bool) (string, error)
- func MigrateUp(repoPath, dbPassword string, testnet bool) error
- func NewNotificationID() string
- func PublishObjectToIPFS(ipfsNode *core.IpfsNode, tempDir string, name string, data interface{}) (string, error)
- type BuyerDisputeExpiry
- type BuyerDisputeTimeout
- type Case
- type CaseStore
- type ChatConversation
- type ChatMessage
- type ChatRead
- type ChatStore
- type ChatTyping
- type CompletionNotification
- func (n CompletionNotification) Data() ([]byte, error)
- func (n CompletionNotification) GetID() string
- func (n CompletionNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n CompletionNotification) GetType() NotificationType
- func (n CompletionNotification) WebsocketData() ([]byte, error)
- type Config
- type ConfigurationStore
- type Coupon
- type CouponStore
- type CurrencyCode
- type Datastore
- type DisputeAcceptedNotification
- func (n DisputeAcceptedNotification) Data() ([]byte, error)
- func (n DisputeAcceptedNotification) GetID() string
- func (n DisputeAcceptedNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeAcceptedNotification) GetType() NotificationType
- func (n DisputeAcceptedNotification) WebsocketData() ([]byte, error)
- type DisputeCaseRecord
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification(createdAt time.Time) *Notification
- func (r *DisputeCaseRecord) Contract() *pb.RicardianContract
- func (r *DisputeCaseRecord) IsExpired(when time.Time) bool
- func (r *DisputeCaseRecord) IsExpiredNow() bool
- func (r *DisputeCaseRecord) ResolutionPaymentContract(ratio PayoutRatio) (contract *pb.RicardianContract)
- func (r *DisputeCaseRecord) ResolutionPaymentFeePerByte(ratio PayoutRatio, defaultFee uint64) uint64
- func (r *DisputeCaseRecord) ResolutionPaymentOutpoints(ratio PayoutRatio) (outpoints []*pb.Outpoint)
- type DisputeCloseNotification
- func (n DisputeCloseNotification) Data() ([]byte, error)
- func (n DisputeCloseNotification) GetID() string
- func (n DisputeCloseNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeCloseNotification) GetType() NotificationType
- func (n DisputeCloseNotification) WebsocketData() ([]byte, error)
- type DisputeOpenNotification
- func (n DisputeOpenNotification) Data() ([]byte, error)
- func (n DisputeOpenNotification) GetID() string
- func (n DisputeOpenNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeOpenNotification) GetType() NotificationType
- func (n DisputeOpenNotification) WebsocketData() ([]byte, error)
- type DisputeUpdateNotification
- func (n DisputeUpdateNotification) Data() ([]byte, error)
- func (n DisputeUpdateNotification) GetID() string
- func (n DisputeUpdateNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n DisputeUpdateNotification) GetType() NotificationType
- func (n DisputeUpdateNotification) WebsocketData() ([]byte, error)
- type FollowNotification
- type Follower
- type FollowerStore
- type FollowingStore
- type FulfillmentNotification
- func (n FulfillmentNotification) Data() ([]byte, error)
- func (n FulfillmentNotification) GetID() string
- func (n FulfillmentNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n FulfillmentNotification) GetType() NotificationType
- func (n FulfillmentNotification) WebsocketData() ([]byte, error)
- type GroupChatMessage
- type IncomingTransaction
- type InventoryStore
- type KeyStore
- type ListingPrice
- type Metadata
- type Migration
- type ModeratedStore
- type ModeratorAddNotification
- func (n ModeratorAddNotification) Data() ([]byte, error)
- func (n ModeratorAddNotification) GetID() string
- func (n ModeratorAddNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorAddNotification) GetType() NotificationType
- func (n ModeratorAddNotification) WebsocketData() ([]byte, error)
- type ModeratorDisputeExpiry
- func (n ModeratorDisputeExpiry) Data() ([]byte, error)
- func (n ModeratorDisputeExpiry) GetID() string
- func (n ModeratorDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorDisputeExpiry) GetType() NotificationType
- func (n ModeratorDisputeExpiry) WebsocketData() ([]byte, error)
- type ModeratorRemoveNotification
- func (n ModeratorRemoveNotification) Data() ([]byte, error)
- func (n ModeratorRemoveNotification) GetID() string
- func (n ModeratorRemoveNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ModeratorRemoveNotification) GetType() NotificationType
- func (n ModeratorRemoveNotification) WebsocketData() ([]byte, error)
- type Notification
- func (n *Notification) Data() ([]byte, error)
- func (n *Notification) GetID() string
- func (n *Notification) GetSMTPTitleAndBody() (string, string, bool)
- func (n *Notification) GetType() NotificationType
- func (n *Notification) GetTypeString() string
- func (n *Notification) GetUnixCreatedAt() int
- func (n *Notification) MarshalJSON() ([]byte, error)
- func (n *Notification) UnmarshalJSON(data []byte) error
- func (n *Notification) WebsocketData() ([]byte, error)
- type NotificationStore
- type NotificationType
- type Notifier
- type OfflineMessageStore
- type OrderCancelNotification
- func (n OrderCancelNotification) Data() ([]byte, error)
- func (n OrderCancelNotification) GetID() string
- func (n OrderCancelNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderCancelNotification) GetType() NotificationType
- func (n OrderCancelNotification) WebsocketData() ([]byte, error)
- type OrderConfirmationNotification
- func (n OrderConfirmationNotification) Data() ([]byte, error)
- func (n OrderConfirmationNotification) GetID() string
- func (n OrderConfirmationNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderConfirmationNotification) GetType() NotificationType
- func (n OrderConfirmationNotification) WebsocketData() ([]byte, error)
- type OrderDeclinedNotification
- func (n OrderDeclinedNotification) Data() ([]byte, error)
- func (n OrderDeclinedNotification) GetID() string
- func (n OrderDeclinedNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n OrderDeclinedNotification) GetType() NotificationType
- func (n OrderDeclinedNotification) WebsocketData() ([]byte, error)
- type OrderNotification
- type PaymentNotification
- type PayoutRatio
- type PointerStore
- type PremarshalledNotifier
- type ProcessingErrorNotification
- func (n ProcessingErrorNotification) Data() ([]byte, error)
- func (n ProcessingErrorNotification) GetID() string
- func (n ProcessingErrorNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ProcessingErrorNotification) GetType() NotificationType
- func (n ProcessingErrorNotification) WebsocketData() ([]byte, error)
- type Purchase
- type PurchaseRecord
- func (r *PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeExpiryLastNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeExpirySecondNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification(createdAt time.Time) *Notification
- func (r *PurchaseRecord) IsDisputeable() bool
- func (r *PurchaseRecord) IsModeratedContract() bool
- type PurchaseStore
- type Queryable
- type RefundNotification
- type SMTPSettings
- type Sale
- type SaleRecord
- type SaleStore
- type SettingsData
- type ShippingAddress
- type SpentTransactionOutputStore
- type StatusNotification
- type TestNotification
- type Thumbnail
- type TransactionMetadataStore
- type TransactionStore
- type UnfollowNotification
- type UnfundedSale
- type UnspentTransactionOutputStore
- type VendorDisputeTimeout
- type VendorFinalizedPayment
- func (n VendorFinalizedPayment) Data() ([]byte, error)
- func (n VendorFinalizedPayment) GetID() string
- func (n VendorFinalizedPayment) GetSMTPTitleAndBody() (string, string, bool)
- func (n VendorFinalizedPayment) GetType() NotificationType
- func (n VendorFinalizedPayment) WebsocketData() ([]byte, error)
- type WatchedScriptStore
Constants ¶
const ( // Number of hours after purchase before a dispute may no longer be opened DisputeOptionTimeoutHours int = 45 * 24 // Number of hours after dispute begins before it is resolved automatically DisputeTotalDurationHours int = 45 * 24 NotifierTypeBuyerDisputeTimeout NotificationType = "buyerDisputeTimeout" NotifierTypeBuyerDisputeExpiry NotificationType = "buyerDisputeExpiry" NotifierTypeChatMessage NotificationType = "chatMessage" NotifierTypeChatRead NotificationType = "chatRead" NotifierTypeChatTyping NotificationType = "chatTyping" NotifierTypeCompletionNotification NotificationType = "orderComplete" NotifierTypeDisputeAcceptedNotification NotificationType = "disputeAccepted" NotifierTypeDisputeCloseNotification NotificationType = "disputeClose" NotifierTypeDisputeOpenNotification NotificationType = "disputeOpen" NotifierTypeDisputeUpdateNotification NotificationType = "disputeUpdate" NotifierTypeFindModeratorResponse NotificationType = "findModeratorResponse" NotifierTypeFollowNotification NotificationType = "follow" NotifierTypeFulfillmentNotification NotificationType = "fulfillment" NotifierTypeIncomingTransaction NotificationType = "incomingTransaction" NotifierTypeModeratorAddNotification NotificationType = "moderatorAdd" NotifierTypeModeratorDisputeExpiry NotificationType = "moderatorDisputeExpiry" NotifierTypeModeratorRemoveNotification NotificationType = "moderatorRemove" NotifierTypeOrderCancelNotification NotificationType = "cancel" NotifierTypeOrderConfirmationNotification NotificationType = "orderConfirmation" NotifierTypeOrderDeclinedNotification NotificationType = "orderDeclined" NotifierTypeOrderNewNotification NotificationType = "order" NotifierTypePaymentNotification NotificationType = "payment" NotifierTypePremarshalledNotifier NotificationType = "premarshalledNotifier" NotifierTypeProcessingErrorNotification NotificationType = "processingError" NotifierTypeRefundNotification NotificationType = "refund" NotifierTypeStatusUpdateNotification NotificationType = "statusUpdate" NotifierTypeTestNotification NotificationType = "testNotification" NotifierTypeUnfollowNotification NotificationType = "unfollow" NotifierTypeVendorDisputeTimeout NotificationType = "vendorDisputeTimeout" NotifierTypeVendorFinalizedPayment NotificationType = "vendorFinalizedPayment" )
const ( CurrencyCodeValidMinimumLength = 3 CurrencyCodeValidMaximumLength = 4 )
const RepoVersion = "17"
Variables ¶
var ( ErrCurrencyCodeLengthInvalid = errors.New("invalid length for currency code, must be three characters or four characters and begin with a 'T'") ErrCurrencyCodeTestSymbolInvalid = errors.New("invalid test indicator for currency code, four characters must begin with a 'T'") )
var ( ModeratorDisputeExpiry_firstInterval = time.Duration(15*24) * time.Hour ModeratorDisputeExpiry_secondInterval = time.Duration(30*24) * time.Hour ModeratorDisputeExpiry_thirdInterval = time.Duration(44*24) * time.Hour ModeratorDisputeExpiry_lastInterval = time.Duration(45*24) * time.Hour )
var ( ErrUnknownSchema = errors.New("unable to migrate unknown schema") Migrations = []Migration{ migrations.Migration000{}, migrations.Migration001{}, migrations.Migration002{}, migrations.Migration003{}, migrations.Migration004{}, migrations.Migration005{}, migrations.Migration006{}, migrations.Migration007{}, migrations.Migration008{}, migrations.Migration009{}, migrations.Migration010{}, migrations.Migration011{}, migrations.Migration012{}, migrations.Migration013{}, migrations.Migration014{}, migrations.Migration015{}, migrations.Migration016{}, } )
var ( BuyerDisputeTimeout_firstInterval = time.Duration(15*24) * time.Hour BuyerDisputeTimeout_secondInterval = time.Duration(40*24) * time.Hour BuyerDisputeTimeout_thirdInterval = time.Duration(44*24) * time.Hour BuyerDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour BuyerDisputeTimeout_totalDuration = time.Duration(DisputeOptionTimeoutHours) * time.Hour BuyerDisputeExpiry_firstInterval = time.Duration(15*24) * time.Hour BuyerDisputeExpiry_secondInterval = time.Duration(40*24) * time.Hour BuyerDisputeExpiry_lastInterval = time.Duration(44*24) * time.Hour BuyerDisputeExpiry_totalDuration = time.Duration(DisputeTotalDurationHours) * time.Hour )
var ErrRepoExists = errors.New("IPFS configuration file exists. Reinitializing would overwrite your keys. Use -f to force overwrite.")
var (
VendorDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour
)
Functions ¶
func GetObjectFromIPFS ¶
func GetObjectFromIPFS(n *core.IpfsNode, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
GetObjectFromIPFS gets the requested name from ipfs or the local cache
func GetRepoPath ¶
Returns the directory to store repo data in.
It depends on the OS and whether or not we are on testnet.
func MigrateUp ¶
MigrateUp looks at the currently active migration version and will migrate all the way up (applying all up migrations).
func NewNotificationID ¶
func NewNotificationID() string
Types ¶
type BuyerDisputeExpiry ¶
type BuyerDisputeExpiry struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
BuyerDisputeExpiry represents a notification about a purchase which has an open dispute that is expiring
func (BuyerDisputeExpiry) Data ¶
func (n BuyerDisputeExpiry) Data() ([]byte, error)
func (BuyerDisputeExpiry) GetID ¶
func (n BuyerDisputeExpiry) GetID() string
func (BuyerDisputeExpiry) GetSMTPTitleAndBody ¶
func (n BuyerDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeExpiry) GetType ¶
func (n BuyerDisputeExpiry) GetType() NotificationType
func (BuyerDisputeExpiry) WebsocketData ¶
func (n BuyerDisputeExpiry) WebsocketData() ([]byte, error)
type BuyerDisputeTimeout ¶
type BuyerDisputeTimeout struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
BuyerDisputeTimeout represents a notification about a purchase which will soon be unable to dispute.
func (BuyerDisputeTimeout) Data ¶
func (n BuyerDisputeTimeout) Data() ([]byte, error)
func (BuyerDisputeTimeout) GetID ¶
func (n BuyerDisputeTimeout) GetID() string
func (BuyerDisputeTimeout) GetSMTPTitleAndBody ¶
func (n BuyerDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeTimeout) GetType ¶
func (n BuyerDisputeTimeout) GetType() NotificationType
func (BuyerDisputeTimeout) WebsocketData ¶
func (n BuyerDisputeTimeout) WebsocketData() ([]byte, error)
type Case ¶
type Case struct { CaseId string `json:"caseId"` Slug string `json:"slug"` Timestamp time.Time `json:"timestamp"` Title string `json:"title"` Thumbnail string `json:"thumbnail"` Total uint64 `json:"total"` BuyerId string `json:"buyerId"` BuyerHandle string `json:"buyerHandle"` VendorId string `json:"vendorId"` VendorHandle string `json:"vendorHandle"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` BuyerOpened bool `json:"buyerOpened"` State string `json:"state"` Read bool `json:"read"` UnreadChatMessages int `json:"unreadChatMessages"` }
type CaseStore ¶
type CaseStore interface { Queryable // Save a new case Put(caseID string, state pb.OrderState, buyerOpened bool, claim string, paymentCoin string, coinType string) error // Save a new case PutRecord(*DisputeCaseRecord) error // Update a case with the buyer info UpdateBuyerInfo(caseID string, buyerContract *pb.RicardianContract, buyerValidationErrors []string, buyerPayoutAddress string, buyerOutpoints []*pb.Outpoint) error // Update a case with the vendor info UpdateVendorInfo(caseID string, vendorContract *pb.RicardianContract, vendorValidationErrors []string, vendorPayoutAddress string, vendorOutpoints []*pb.Outpoint) error // Mark a case as read in the database MarkAsRead(caseID string) error // Mark a case as unread in the database MarkAsUnread(caseID string) error // Mark a case as closed in the database MarkAsClosed(caseID string, resolution *pb.DisputeResolution) error // Delete a case Delete(caseID string) error // Return the case metadata given a case ID GetCaseMetadata(caseID string) (buyerContract, vendorContract *pb.RicardianContract, buyerValidationErrors, vendorValidationErrors []string, state pb.OrderState, read bool, timestamp time.Time, buyerOpened bool, claim string, resolution *pb.DisputeResolution, err error) // GetByCaseID returns the dispute payout data for a case GetByCaseID(caseID string) (*DisputeCaseRecord, error) // Return the metadata for all cases given the search terms. Also returns the original size of the query. GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Case, int, error) // Return the number of cases in the database Count() int // GetDisputesForDisputeExpiryNotification returns []*DisputeCaseRecord including // each record which needs Notifications to be generated. GetDisputesForDisputeExpiryNotification() ([]*DisputeCaseRecord, error) // UpdateDisputesLastDisputeExpiryNotifiedAt accepts []*DisputeCaseRecord and updates each records lastDisputeExpiryNotifiedAt by its CaseID UpdateDisputesLastDisputeExpiryNotifiedAt([]*DisputeCaseRecord) error }
type ChatConversation ¶
type ChatMessage ¶
type ChatMessage struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` Message string `json:"message"` Read bool `json:"read"` Outgoing bool `json:"outgoing"` Timestamp time.Time `json:"timestamp"` }
func (ChatMessage) Data ¶
func (n ChatMessage) Data() ([]byte, error)
func (ChatMessage) GetID ¶
func (n ChatMessage) GetID() string
func (ChatMessage) GetSMTPTitleAndBody ¶
func (n ChatMessage) GetSMTPTitleAndBody() (string, string, bool)
func (ChatMessage) GetType ¶
func (n ChatMessage) GetType() NotificationType
func (ChatMessage) WebsocketData ¶
func (n ChatMessage) WebsocketData() ([]byte, error)
type ChatRead ¶
type ChatRead struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatRead) GetSMTPTitleAndBody ¶
func (ChatRead) GetType ¶
func (n ChatRead) GetType() NotificationType
func (ChatRead) WebsocketData ¶
type ChatStore ¶
type ChatStore interface { Queryable // Put a new chat message to the database Put(messageId string, peerId string, subject string, message string, timestamp time.Time, read bool, outgoing bool) error // Returns a list of open conversations GetConversations() []ChatConversation // A list of messages given a peer ID and a subject GetMessages(peerID string, subject string, offsetID string, limit int) []ChatMessage // Mark all chat messages for a peer as read. Returns the Id of the last seen message and // whether any messages were updated. // If message Id is specified it will only mark that message and earlier as read. MarkAsRead(peerID string, subject string, outgoing bool, messageId string) (string, bool, error) // Returns the incoming unread count for all messages of a given subject GetUnreadCount(subject string) (int, error) // Delete a message DeleteMessage(msgID string) error // Delete all messages from from a peer DeleteConversation(peerID string) error }
type ChatTyping ¶
type ChatTyping struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatTyping) Data ¶
func (n ChatTyping) Data() ([]byte, error)
func (ChatTyping) GetID ¶
func (n ChatTyping) GetID() string
func (ChatTyping) GetSMTPTitleAndBody ¶
func (n ChatTyping) GetSMTPTitleAndBody() (string, string, bool)
func (ChatTyping) GetType ¶
func (n ChatTyping) GetType() NotificationType
func (ChatTyping) WebsocketData ¶
func (n ChatTyping) WebsocketData() ([]byte, error)
type CompletionNotification ¶
type CompletionNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` }
func (CompletionNotification) Data ¶
func (n CompletionNotification) Data() ([]byte, error)
func (CompletionNotification) GetID ¶
func (n CompletionNotification) GetID() string
func (CompletionNotification) GetSMTPTitleAndBody ¶
func (n CompletionNotification) GetSMTPTitleAndBody() (string, string, bool)
func (CompletionNotification) GetType ¶
func (n CompletionNotification) GetType() NotificationType
func (CompletionNotification) WebsocketData ¶
func (n CompletionNotification) WebsocketData() ([]byte, error)
type Config ¶
type Config interface { /* Initialize the database with the node's mnemonic seed and identity key. This will be called during repo init. */ Init(mnemonic string, identityKey []byte, password string, creationDate time.Time) error // Return the mnemonic string GetMnemonic() (string, error) // Return the identity key GetIdentityKey() ([]byte, error) // Returns the date the seed was created GetCreationDate() (time.Time, error) // Returns true if the database has failed to decrypt properly ex) wrong pw IsEncrypted() bool }
type ConfigurationStore ¶
type ConfigurationStore interface { Queryable // Put settings to the database, overriding all fields Put(settings SettingsData) error // Update all non-nil fields Update(settings SettingsData) error // Return the settings object Get() (SettingsData, error) // Delete all settings data Delete() error }
type CouponStore ¶
type CurrencyCode ¶
type CurrencyCode string
func NewCurrencyCode ¶
func NewCurrencyCode(c string) (*CurrencyCode, error)
func (*CurrencyCode) String ¶
func (c *CurrencyCode) String() string
type Datastore ¶
type Datastore interface { Config() Config Followers() FollowerStore Following() FollowingStore OfflineMessages() OfflineMessageStore Pointers() PointerStore Settings() ConfigurationStore Inventory() InventoryStore Purchases() PurchaseStore Sales() SaleStore Cases() CaseStore Chat() ChatStore Notifications() NotificationStore Coupons() CouponStore TxMetadata() TransactionMetadataStore ModeratedStores() ModeratedStore Ping() error Close() }
type DisputeAcceptedNotification ¶
type DisputeAcceptedNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` OherPartyID string `json:"otherPartyId"` OtherPartyHandle string `json:"otherPartyHandle"` Buyer string `json:"buyer"` }
func (DisputeAcceptedNotification) Data ¶
func (n DisputeAcceptedNotification) Data() ([]byte, error)
func (DisputeAcceptedNotification) GetID ¶
func (n DisputeAcceptedNotification) GetID() string
func (DisputeAcceptedNotification) GetSMTPTitleAndBody ¶
func (n DisputeAcceptedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeAcceptedNotification) GetType ¶
func (n DisputeAcceptedNotification) GetType() NotificationType
func (DisputeAcceptedNotification) WebsocketData ¶
func (n DisputeAcceptedNotification) WebsocketData() ([]byte, error)
type DisputeCaseRecord ¶
type DisputeCaseRecord struct { CaseID string Claim string OrderState pb.OrderState Timestamp time.Time LastDisputeExpiryNotifiedAt time.Time BuyerContract *pb.RicardianContract BuyerOutpoints []*pb.Outpoint BuyerPayoutAddress string VendorContract *pb.RicardianContract VendorOutpoints []*pb.Outpoint VendorPayoutAddress string IsBuyerInitiated bool CoinType string PaymentCoin *CurrencyCode }
DisputeCaseRecord is a one-to-one relationship with records in the SQL datastore
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification ¶
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification ¶
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification ¶
func (r *DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification ¶
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*DisputeCaseRecord) Contract ¶
func (r *DisputeCaseRecord) Contract() *pb.RicardianContract
Contract returns the contract from the dispute if one has been supplied by either the buyer or vendor
func (*DisputeCaseRecord) IsExpired ¶
func (r *DisputeCaseRecord) IsExpired(when time.Time) bool
IsExpired returns a bool indicating whether the case is still open
func (*DisputeCaseRecord) IsExpiredNow ¶
func (r *DisputeCaseRecord) IsExpiredNow() bool
IsExpired returns a bool indicating whether the case is still open right now
func (*DisputeCaseRecord) ResolutionPaymentContract ¶
func (r *DisputeCaseRecord) ResolutionPaymentContract(ratio PayoutRatio) (contract *pb.RicardianContract)
ResolutionPaymentContract returns the preferred contract to be used when resolving a pending DisputeCaseRecord based on the provided PayoutRatio
func (*DisputeCaseRecord) ResolutionPaymentFeePerByte ¶
func (r *DisputeCaseRecord) ResolutionPaymentFeePerByte(ratio PayoutRatio, defaultFee uint64) uint64
ResolutionPaymentFeePerByte returns the preferred outpoints to be used when resolving a pending DisputeCaseResolution based on the provided PayoutRatio
func (*DisputeCaseRecord) ResolutionPaymentOutpoints ¶
func (r *DisputeCaseRecord) ResolutionPaymentOutpoints(ratio PayoutRatio) (outpoints []*pb.Outpoint)
ResolutionPaymentOutpoints returns the preferred outpoints to be used when resolving a pending DisputeCaseResolution based on the provided PayoutRatio
type DisputeCloseNotification ¶
type DisputeCloseNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` OtherPartyID string `json:"otherPartyId"` OtherPartyHandle string `json:"otherPartyHandle"` Buyer string `json:"buyer"` }
func (DisputeCloseNotification) Data ¶
func (n DisputeCloseNotification) Data() ([]byte, error)
func (DisputeCloseNotification) GetID ¶
func (n DisputeCloseNotification) GetID() string
func (DisputeCloseNotification) GetSMTPTitleAndBody ¶
func (n DisputeCloseNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeCloseNotification) GetType ¶
func (n DisputeCloseNotification) GetType() NotificationType
func (DisputeCloseNotification) WebsocketData ¶
func (n DisputeCloseNotification) WebsocketData() ([]byte, error)
type DisputeOpenNotification ¶
type DisputeOpenNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` DisputerID string `json:"disputerId"` DisputerHandle string `json:"disputerHandle"` DisputeeID string `json:"disputeeId"` DisputeeHandle string `json:"disputeeHandle"` Buyer string `json:"buyer"` }
func (DisputeOpenNotification) Data ¶
func (n DisputeOpenNotification) Data() ([]byte, error)
func (DisputeOpenNotification) GetID ¶
func (n DisputeOpenNotification) GetID() string
func (DisputeOpenNotification) GetSMTPTitleAndBody ¶
func (n DisputeOpenNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeOpenNotification) GetType ¶
func (n DisputeOpenNotification) GetType() NotificationType
func (DisputeOpenNotification) WebsocketData ¶
func (n DisputeOpenNotification) WebsocketData() ([]byte, error)
type DisputeUpdateNotification ¶
type DisputeUpdateNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` DisputerID string `json:"disputerId"` DisputerHandle string `json:"disputerHandle"` DisputeeID string `json:"disputeeId"` DisputeeHandle string `json:"disputeeHandle"` Buyer string `json:"buyer"` }
func (DisputeUpdateNotification) Data ¶
func (n DisputeUpdateNotification) Data() ([]byte, error)
func (DisputeUpdateNotification) GetID ¶
func (n DisputeUpdateNotification) GetID() string
func (DisputeUpdateNotification) GetSMTPTitleAndBody ¶
func (n DisputeUpdateNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeUpdateNotification) GetType ¶
func (n DisputeUpdateNotification) GetType() NotificationType
func (DisputeUpdateNotification) WebsocketData ¶
func (n DisputeUpdateNotification) WebsocketData() ([]byte, error)
type FollowNotification ¶
type FollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (FollowNotification) Data ¶
func (n FollowNotification) Data() ([]byte, error)
func (FollowNotification) GetID ¶
func (n FollowNotification) GetID() string
func (FollowNotification) GetSMTPTitleAndBody ¶
func (n FollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FollowNotification) GetType ¶
func (n FollowNotification) GetType() NotificationType
func (FollowNotification) WebsocketData ¶
func (n FollowNotification) WebsocketData() ([]byte, error)
type FollowerStore ¶
type FollowerStore interface { Queryable // Put a B58 encoded follower ID and proof to the database Put(follower string, proof []byte) error /* Get followers from the database. The offset and limit arguments can be used to for lazy loading. */ Get(offsetId string, limit int) ([]Follower, error) // Delete a follower from the database Delete(follower string) error // Return the number of followers in the database Count() int // Are we followed by this peer? FollowsMe(peerId string) bool }
type FollowingStore ¶
type FollowingStore interface { Queryable // Put a B58 encoded peer ID to the database Put(peer string) error /* Get a list of following peers from the database. The offset and limit arguments can be used to for lazy loading. */ Get(offsetId string, limit int) ([]string, error) // Delete a peer from the database Delete(peer string) error // Return the number of peers in the database Count() int // Am I following this peer? IsFollowing(peerId string) bool }
type FulfillmentNotification ¶
type FulfillmentNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (FulfillmentNotification) Data ¶
func (n FulfillmentNotification) Data() ([]byte, error)
func (FulfillmentNotification) GetID ¶
func (n FulfillmentNotification) GetID() string
func (FulfillmentNotification) GetSMTPTitleAndBody ¶
func (n FulfillmentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FulfillmentNotification) GetType ¶
func (n FulfillmentNotification) GetType() NotificationType
func (FulfillmentNotification) WebsocketData ¶
func (n FulfillmentNotification) WebsocketData() ([]byte, error)
type GroupChatMessage ¶
type IncomingTransaction ¶
type IncomingTransaction struct { Wallet string `json:"wallet"` Txid string `json:"txid"` Value int64 `json:"value"` Address string `json:"address"` Status string `json:"status"` Memo string `json:"memo"` Timestamp time.Time `json:"timestamp"` Confirmations int32 `json:"confirmations"` OrderId string `json:"orderId"` Thumbnail string `json:"thumbnail"` Height int32 `json:"height"` CanBumpFee bool `json:"canBumpFee"` }
func (IncomingTransaction) Data ¶
func (n IncomingTransaction) Data() ([]byte, error)
func (IncomingTransaction) GetID ¶
func (n IncomingTransaction) GetID() string
func (IncomingTransaction) GetSMTPTitleAndBody ¶
func (n IncomingTransaction) GetSMTPTitleAndBody() (string, string, bool)
func (IncomingTransaction) GetType ¶
func (n IncomingTransaction) GetType() NotificationType
func (IncomingTransaction) WebsocketData ¶
func (n IncomingTransaction) WebsocketData() ([]byte, error)
type InventoryStore ¶
type InventoryStore interface { Queryable /* Put an inventory count for a listing Override the existing count if it exists */ Put(slug string, variantIndex int, count int64) error // Return the count for a specific listing including variants GetSpecific(slug string, variantIndex int) (int64, error) // Get the count for all variants of a given listing Get(slug string) (map[int]int64, error) // Fetch all inventory maps for each slug GetAll() (map[string]map[int]int64, error) // Delete a listing and related count Delete(slug string, variant int) error // Delete all variants of a given slug DeleteAll(slug string) error }
type ListingPrice ¶
type ModeratedStore ¶
type ModeratedStore interface { Queryable // Put a B58 encoded peer ID to the database Put(peerId string) error /* Get the moderated store list from the database. The offset and limit arguments can be used to for lazy loading. */ Get(offsetId string, limit int) ([]string, error) // Delete a moderated store from the database Delete(peerId string) error }
type ModeratorAddNotification ¶
type ModeratorAddNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorAddNotification) Data ¶
func (n ModeratorAddNotification) Data() ([]byte, error)
func (ModeratorAddNotification) GetID ¶
func (n ModeratorAddNotification) GetID() string
func (ModeratorAddNotification) GetSMTPTitleAndBody ¶
func (n ModeratorAddNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorAddNotification) GetType ¶
func (n ModeratorAddNotification) GetType() NotificationType
func (ModeratorAddNotification) WebsocketData ¶
func (n ModeratorAddNotification) WebsocketData() ([]byte, error)
type ModeratorDisputeExpiry ¶
type ModeratorDisputeExpiry struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` CaseID string `json:"disputeCaseId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
ModeratorDisputeExpiry represents a notification about an open dispute which will soon be expired and automatically resolved. The Type indicates the age of the dispute case and the CaseID references the cases caseID in the database schema
func (ModeratorDisputeExpiry) Data ¶
func (n ModeratorDisputeExpiry) Data() ([]byte, error)
func (ModeratorDisputeExpiry) GetID ¶
func (n ModeratorDisputeExpiry) GetID() string
func (ModeratorDisputeExpiry) GetSMTPTitleAndBody ¶
func (n ModeratorDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorDisputeExpiry) GetType ¶
func (n ModeratorDisputeExpiry) GetType() NotificationType
func (ModeratorDisputeExpiry) WebsocketData ¶
func (n ModeratorDisputeExpiry) WebsocketData() ([]byte, error)
type ModeratorRemoveNotification ¶
type ModeratorRemoveNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorRemoveNotification) Data ¶
func (n ModeratorRemoveNotification) Data() ([]byte, error)
func (ModeratorRemoveNotification) GetID ¶
func (n ModeratorRemoveNotification) GetID() string
func (ModeratorRemoveNotification) GetSMTPTitleAndBody ¶
func (n ModeratorRemoveNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorRemoveNotification) GetType ¶
func (n ModeratorRemoveNotification) GetType() NotificationType
func (ModeratorRemoveNotification) WebsocketData ¶
func (n ModeratorRemoveNotification) WebsocketData() ([]byte, error)
type Notification ¶
type Notification struct { ID string `json:"-"` CreatedAt time.Time `json:"timestamp"` IsRead bool `json:"read"` NotifierData Notifier `json:"notification"` NotifierType NotificationType `json:"-"` }
Notification represents both a record from the Notifications Datastore as well as an unmarshalling envelope for the Notifier interface field NotifierData. NOTE: Only ID, NotifierData and NotifierType fields are valid in both contexts. This is because (*Notification).MarshalJSON only wraps the NotifierData field. NotifierData describes ID and NotifierType and will also be valid when unmarshalled. TODO: Ecapsulate the whole Notification struct inside of MarshalJSON and update persisted serializations to match in the Notifications Datastore
func NewNotification ¶
func NewNotification(n Notifier, createdAt time.Time, isRead bool) *Notification
NewNotification is a helper that returns a properly instantiated *Notification
func (*Notification) Data ¶
func (n *Notification) Data() ([]byte, error)
func (*Notification) GetID ¶
func (n *Notification) GetID() string
func (*Notification) GetSMTPTitleAndBody ¶
func (n *Notification) GetSMTPTitleAndBody() (string, string, bool)
func (*Notification) GetType ¶
func (n *Notification) GetType() NotificationType
func (*Notification) GetTypeString ¶
func (n *Notification) GetTypeString() string
func (*Notification) GetUnixCreatedAt ¶
func (n *Notification) GetUnixCreatedAt() int
func (*Notification) MarshalJSON ¶
func (n *Notification) MarshalJSON() ([]byte, error)
func (*Notification) UnmarshalJSON ¶
func (n *Notification) UnmarshalJSON(data []byte) error
func (*Notification) WebsocketData ¶
func (n *Notification) WebsocketData() ([]byte, error)
type NotificationStore ¶
type NotificationStore interface { Queryable // PutRecord persists a Notification to the database PutRecord(*Notification) error // Mark notification as read MarkAsRead(notifID string) error // Mark all notifications as read MarkAllAsRead() error // Fetch notifications from database GetAll(offsetID string, limit int, typeFilter []string) ([]*Notification, int, error) // Returns the unread count for all notifications GetUnreadCount() (int, error) // Delete a notification Delete(notifID string) error }
type NotificationType ¶
type NotificationType string
func (NotificationType) String ¶
func (t NotificationType) String() string
type Notifier ¶
type Notifier interface { // GetID returns the unique string identifier for the Notifier and is used to // uniquely persist the Notifier in the DB. Some Notifiers are not persisted. // Until we can represent this as part of the interface, the Notifiers which // do not get persisted can safely return an empty string. Notifiers which are // persisted and return a non-unique GetID() string will eventually fail the DB's // uniqueness constraints during runtime. GetID() string // GetType returns the type as a NotificationType GetType() NotificationType // GetSMTPTitleAndBody returns the title and body strings to be used // in any notification content. The bool can return false to bypass the // SMTP notification for this Notifier. GetSMTPTitleAndBody() (string, string, bool) // Data returns the marhsalled []byte suitable for transmission to the client // over the HTTP connection Data() ([]byte, error) // WebsocketData returns the marhsalled []byte suitable for transmission to the client // over the websocket connection WebsocketData() ([]byte, error) }
Notifier is an interface which is used to send data to the frontend
type OfflineMessageStore ¶
type OfflineMessageStore interface { Queryable // Put a URL from a retrieved message Put(url string) error // Does the given URL exist in the database? Has(url string) bool // Save a message with the url SetMessage(url string, message []byte) error // Get all entries with a message GetMessages() (map[string][]byte, error) // Delete the given message DeleteMessage(url string) error }
type OrderCancelNotification ¶
type OrderCancelNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` }
func (OrderCancelNotification) Data ¶
func (n OrderCancelNotification) Data() ([]byte, error)
func (OrderCancelNotification) GetID ¶
func (n OrderCancelNotification) GetID() string
func (OrderCancelNotification) GetSMTPTitleAndBody ¶
func (n OrderCancelNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderCancelNotification) GetType ¶
func (n OrderCancelNotification) GetType() NotificationType
func (OrderCancelNotification) WebsocketData ¶
func (n OrderCancelNotification) WebsocketData() ([]byte, error)
type OrderConfirmationNotification ¶
type OrderConfirmationNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (OrderConfirmationNotification) Data ¶
func (n OrderConfirmationNotification) Data() ([]byte, error)
func (OrderConfirmationNotification) GetID ¶
func (n OrderConfirmationNotification) GetID() string
func (OrderConfirmationNotification) GetSMTPTitleAndBody ¶
func (n OrderConfirmationNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderConfirmationNotification) GetType ¶
func (n OrderConfirmationNotification) GetType() NotificationType
func (OrderConfirmationNotification) WebsocketData ¶
func (n OrderConfirmationNotification) WebsocketData() ([]byte, error)
type OrderDeclinedNotification ¶
type OrderDeclinedNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (OrderDeclinedNotification) Data ¶
func (n OrderDeclinedNotification) Data() ([]byte, error)
func (OrderDeclinedNotification) GetID ¶
func (n OrderDeclinedNotification) GetID() string
func (OrderDeclinedNotification) GetSMTPTitleAndBody ¶
func (n OrderDeclinedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderDeclinedNotification) GetType ¶
func (n OrderDeclinedNotification) GetType() NotificationType
func (OrderDeclinedNotification) WebsocketData ¶
func (n OrderDeclinedNotification) WebsocketData() ([]byte, error)
type OrderNotification ¶
type OrderNotification struct { BuyerHandle string `json:"buyerHandle"` BuyerID string `json:"buyerId"` ID string `json:"notificationId"` ListingType string `json:"listingType"` OrderId string `json:"orderId"` Price ListingPrice `json:"price"` Slug string `json:"slug"` Thumbnail Thumbnail `json:"thumbnail"` Title string `json:"title"` Type NotificationType `json:"type"` }
func (OrderNotification) Data ¶
func (n OrderNotification) Data() ([]byte, error)
func (OrderNotification) GetID ¶
func (n OrderNotification) GetID() string
func (OrderNotification) GetSMTPTitleAndBody ¶
func (n OrderNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderNotification) GetType ¶
func (n OrderNotification) GetType() NotificationType
func (OrderNotification) WebsocketData ¶
func (n OrderNotification) WebsocketData() ([]byte, error)
type PaymentNotification ¶
type PaymentNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` FundingTotal uint64 `json:"fundingTotal"` CoinType string `json:"coinType"` }
func (PaymentNotification) Data ¶
func (n PaymentNotification) Data() ([]byte, error)
func (PaymentNotification) GetID ¶
func (n PaymentNotification) GetID() string
func (PaymentNotification) GetSMTPTitleAndBody ¶
func (n PaymentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (PaymentNotification) GetType ¶
func (n PaymentNotification) GetType() NotificationType
func (PaymentNotification) WebsocketData ¶
func (n PaymentNotification) WebsocketData() ([]byte, error)
type PayoutRatio ¶
type PayoutRatio struct{ Buyer, Vendor float32 }
func (PayoutRatio) BuyerAny ¶
func (r PayoutRatio) BuyerAny() bool
func (PayoutRatio) BuyerMajority ¶
func (r PayoutRatio) BuyerMajority() bool
func (PayoutRatio) EvenMajority ¶
func (r PayoutRatio) EvenMajority() bool
func (PayoutRatio) Validate ¶
func (r PayoutRatio) Validate() error
func (PayoutRatio) VendorAny ¶
func (r PayoutRatio) VendorAny() bool
func (PayoutRatio) VendorMajority ¶
func (r PayoutRatio) VendorMajority() bool
type PointerStore ¶
type PointerStore interface { Queryable // Put a pointer to the database Put(p ipfs.Pointer) error // Delete a pointer from the database Delete(id peer.ID) error // Delete all pointers of a given purpose DeleteAll(purpose ipfs.Purpose) error // Fetch a specific pointer Get(id peer.ID) (ipfs.Pointer, error) // Fetch all pointers of the given type GetByPurpose(purpose ipfs.Purpose) ([]ipfs.Pointer, error) // Fetch the entire list of pointers GetAll() ([]ipfs.Pointer, error) }
type PremarshalledNotifier ¶
type PremarshalledNotifier struct {
Payload []byte
}
PremarshalledNotifier is a hack to allow []byte data to be transferred through the Notifier interface without having to do things the right way. You should not be using this and should prefer to use an existing Notifier struct or create a new one following the pattern of the TestNotification
func (PremarshalledNotifier) Data ¶
func (n PremarshalledNotifier) Data() ([]byte, error)
func (PremarshalledNotifier) GetID ¶
func (n PremarshalledNotifier) GetID() string
func (PremarshalledNotifier) GetSMTPTitleAndBody ¶
func (n PremarshalledNotifier) GetSMTPTitleAndBody() (string, string, bool)
func (PremarshalledNotifier) GetType ¶
func (n PremarshalledNotifier) GetType() NotificationType
func (PremarshalledNotifier) WebsocketData ¶
func (n PremarshalledNotifier) WebsocketData() ([]byte, error)
type ProcessingErrorNotification ¶
type ProcessingErrorNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (ProcessingErrorNotification) Data ¶
func (n ProcessingErrorNotification) Data() ([]byte, error)
func (ProcessingErrorNotification) GetID ¶
func (n ProcessingErrorNotification) GetID() string
func (ProcessingErrorNotification) GetSMTPTitleAndBody ¶
func (n ProcessingErrorNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ProcessingErrorNotification) GetType ¶
func (n ProcessingErrorNotification) GetType() NotificationType
func (ProcessingErrorNotification) WebsocketData ¶
func (n ProcessingErrorNotification) WebsocketData() ([]byte, error)
type Purchase ¶
type Purchase struct { OrderId string `json:"orderId"` Slug string `json:"slug"` Timestamp time.Time `json:"timestamp"` Title string `json:"title"` Thumbnail string `json:"thumbnail"` Total uint64 `json:"total"` VendorId string `json:"vendorId"` VendorHandle string `json:"vendorHandle"` ShippingName string `json:"shippingName"` ShippingAddress string `json:"shippingAddress"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` State string `json:"state"` Read bool `json:"read"` Moderated bool `json:"moderated"` UnreadChatMessages int `json:"unreadChatMessages"` }
type PurchaseRecord ¶
type PurchaseRecord struct { Contract *pb.RicardianContract DisputedAt time.Time OrderID string OrderState pb.OrderState Timestamp time.Time LastDisputeTimeoutNotifiedAt time.Time LastDisputeExpiryNotifiedAt time.Time }
PurchaseRecord represents a one-to-one relationship with records in the SQL datastore
func (*PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeExpiryLastNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeExpirySecondNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutSecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification ¶
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*PurchaseRecord) IsDisputeable ¶
func (r *PurchaseRecord) IsDisputeable() bool
IsDisputeable returns whether the Purchase is in a state that it can be disputed with a third-party moderator
func (*PurchaseRecord) IsModeratedContract ¶
func (r *PurchaseRecord) IsModeratedContract() bool
IsModeratedContract returns whether the contract includes a third-party moderator
type PurchaseStore ¶
type PurchaseStore interface { Queryable // Save or update an order Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error // Mark an order as read in the database MarkAsRead(orderID string) error // Mark an order as unread in the database MarkAsUnread(orderID string) error // Update the funding level for the contract UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error // Delete an order Delete(orderID string) error // Return a purchase given the payment address GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, err error) // Return a purchase given the order ID GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, read bool, currencyCode *CurrencyCode, err error) // Return the metadata for all purchases. Also returns the original size of the query. GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Purchase, int, error) // Return the number of purchases in the database Count() int // GetPurchasesForDisputeTimeoutNotification returns []*PurchaseRecord including // each record which needs buyerDisputeTimeout Notifications to be generated. GetPurchasesForDisputeTimeoutNotification() ([]*PurchaseRecord, error) // GetPurchasesForDisputeExpiryNotification returns []*PurchaseRecord including // each record which needs buyerDisputeExpiry Notifications to be generated. GetPurchasesForDisputeExpiryNotification() ([]*PurchaseRecord, error) // UpdatePurchasesLastDisputeTimeoutNotifiedAt accepts []*PurchaseRecord and updates each records lastDisputeTimeoutNotifiedAt by its OrderID UpdatePurchasesLastDisputeTimeoutNotifiedAt([]*PurchaseRecord) error // UpdatePurchasesLastDisputeExpiryNotifiedAt accepts []*PurchaseRecord and updates each records lastDisputeExpiryNotifiedAt by its OrderID UpdatePurchasesLastDisputeExpiryNotifiedAt([]*PurchaseRecord) error }
type RefundNotification ¶
type RefundNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` Thumbnail Thumbnail `json:"thumbnail"` VendorHandle string `json:"vendorHandle"` VendorID string `json:"vendorId"` }
func (RefundNotification) Data ¶
func (n RefundNotification) Data() ([]byte, error)
func (RefundNotification) GetID ¶
func (n RefundNotification) GetID() string
func (RefundNotification) GetSMTPTitleAndBody ¶
func (n RefundNotification) GetSMTPTitleAndBody() (string, string, bool)
func (RefundNotification) GetType ¶
func (n RefundNotification) GetType() NotificationType
func (RefundNotification) WebsocketData ¶
func (n RefundNotification) WebsocketData() ([]byte, error)
type SMTPSettings ¶
type Sale ¶
type Sale struct { OrderId string `json:"orderId"` Slug string `json:"slug"` Timestamp time.Time `json:"timestamp"` Title string `json:"title"` Thumbnail string `json:"thumbnail"` Total uint64 `json:"total"` BuyerId string `json:"buyerId"` BuyerHandle string `json:"buyerHandle"` ShippingName string `json:"shippingName"` ShippingAddress string `json:"shippingAddress"` CoinType string `json:"coinType"` PaymentCoin string `json:"paymentCoin"` State string `json:"state"` Read bool `json:"read"` Moderated bool `json:"moderated"` UnreadChatMessages int `json:"unreadChatMessages"` }
type SaleRecord ¶
type SaleRecord struct { Contract *pb.RicardianContract OrderID string OrderState pb.OrderState Timestamp time.Time LastDisputeTimeoutNotifiedAt time.Time }
SaleRecord represents a one-to-one relationship with records in the SQL datastore
func (*SaleRecord) BuildVendorDisputeTimeoutLastNotification ¶
func (r *SaleRecord) BuildVendorDisputeTimeoutLastNotification(createdAt time.Time) *Notification
BuildVendorDisputeTimeoutLastNotification returns a Notification that alerts a SaleRecord is more than 45 days old and already expired
func (*SaleRecord) IsDisputeable ¶
func (r *SaleRecord) IsDisputeable() bool
IsDisputeable returns whether the Sale is in a state that it can be disputed with a third-party moderator
func (*SaleRecord) IsModeratedContract ¶
func (r *SaleRecord) IsModeratedContract() bool
IsModeratedContract indicates whether the SaleRecord has a contract which includes a third-party moderator
func (*SaleRecord) SupportsTimedEscrowRelease ¶
func (r *SaleRecord) SupportsTimedEscrowRelease() bool
SupportsTimedEscrowRelease indicates whether the underlying AcceptedCurrency supports a time-bassed release behavior. TODO: Express this from the wallet-interface instead
type SaleStore ¶
type SaleStore interface { Queryable // Save or update a sale Put(orderID string, contract pb.RicardianContract, state pb.OrderState, read bool) error // Mark an order as read in the database MarkAsRead(orderID string) error // Mark an order as unread in the database MarkAsUnread(orderID string) error // Update the funding level for the contract UpdateFunding(orderId string, funded bool, records []*wallet.TransactionRecord) error // Delete an order Delete(orderID string) error // Return a sale given the payment address GetByPaymentAddress(addr btc.Address) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, err error) // Return a sale given the order ID GetByOrderId(orderId string) (contract *pb.RicardianContract, state pb.OrderState, funded bool, records []*wallet.TransactionRecord, read bool, currencyCode *CurrencyCode, err error) // Return the metadata for all sales. Also returns the original size of the query. GetAll(stateFilter []pb.OrderState, searchTerm string, sortByAscending bool, sortByRead bool, limit int, exclude []string) ([]Sale, int, error) // Return unfunded orders which failed to detect funding because the chain was synced passed the block containing the transaction when the order was recorded. GetNeedsResync() ([]UnfundedSale, error) // Set whether the given order needs a blockchain resync SetNeedsResync(orderID string, needsResync bool) error // Return the number of sales in the database Count() int // GetSalesForDisputeTimeoutNotification returns []*SaleRecord including // each record which needs Notifications to be generated. GetSalesForDisputeTimeoutNotification() ([]*SaleRecord, error) // UpdateSalesLastDisputeTimeoutNotifiedAt accepts []*SaleRecord and updates each records lastDisputeTimeoutNotifiedAt by its CaseID UpdateSalesLastDisputeTimeoutNotifiedAt([]*SaleRecord) error }
type SettingsData ¶
type SettingsData struct { PaymentDataInQR *bool `json:"paymentDataInQR"` ShowNotifications *bool `json:"showNotifications"` ShowNsfw *bool `json:"showNsfw"` ShippingAddresses *[]ShippingAddress `json:"shippingAddresses"` LocalCurrency *string `json:"localCurrency"` Country *string `json:"country"` TermsAndConditions *string `json:"termsAndConditions"` RefundPolicy *string `json:"refundPolicy"` BlockedNodes *[]string `json:"blockedNodes"` StoreModerators *[]string `json:"storeModerators"` MisPaymentBuffer *float32 `json:"mispaymentBuffer"` SMTPSettings *SMTPSettings `json:"smtpSettings"` Version *string `json:"version"` PreferredCurrencies *[]string `json:"preferredCurrencies"` }
type ShippingAddress ¶
type ShippingAddress struct { Name string `json:"name"` Company string `json:"company"` AddressLineOne string `json:"addressLineOne"` AddressLineTwo string `json:"addressLineTwo"` City string `json:"city"` State string `json:"state"` Country string `json:"country"` PostalCode string `json:"postalCode"` AddressNotes string `json:"addressNotes"` }
type SpentTransactionOutputStore ¶
type SpentTransactionOutputStore interface { Queryable wallet.Stxos }
type StatusNotification ¶
type StatusNotification struct {
Status string `json:"status"`
}
func (StatusNotification) Data ¶
func (n StatusNotification) Data() ([]byte, error)
func (StatusNotification) GetID ¶
func (n StatusNotification) GetID() string
func (StatusNotification) GetSMTPTitleAndBody ¶
func (n StatusNotification) GetSMTPTitleAndBody() (string, string, bool)
func (StatusNotification) GetType ¶
func (n StatusNotification) GetType() NotificationType
func (StatusNotification) WebsocketData ¶
func (n StatusNotification) WebsocketData() ([]byte, error)
type TestNotification ¶
type TestNotification struct{}
func (TestNotification) Data ¶
func (TestNotification) Data() ([]byte, error)
func (TestNotification) GetID ¶
func (TestNotification) GetID() string
func (TestNotification) GetSMTPTitleAndBody ¶
func (TestNotification) GetSMTPTitleAndBody() (string, string, bool)
func (TestNotification) GetType ¶
func (TestNotification) GetType() NotificationType
func (TestNotification) WebsocketData ¶
func (n TestNotification) WebsocketData() ([]byte, error)
type TransactionMetadataStore ¶
type TransactionMetadataStore interface { Queryable // Put metadata for a transaction to the db Put(m Metadata) error // Get the metadata given the txid Get(txid string) (Metadata, error) // Get a map of the txid to each metadata object GetAll() (map[string]Metadata, error) // Delete a metadata entry Delete(txid string) error }
type TransactionStore ¶
type TransactionStore interface { Queryable wallet.Txns }
type UnfollowNotification ¶
type UnfollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (UnfollowNotification) Data ¶
func (n UnfollowNotification) Data() ([]byte, error)
func (UnfollowNotification) GetID ¶
func (n UnfollowNotification) GetID() string
func (UnfollowNotification) GetSMTPTitleAndBody ¶
func (n UnfollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (UnfollowNotification) GetType ¶
func (n UnfollowNotification) GetType() NotificationType
func (UnfollowNotification) WebsocketData ¶
func (n UnfollowNotification) WebsocketData() ([]byte, error)
type UnfundedSale ¶
type UnspentTransactionOutputStore ¶
type UnspentTransactionOutputStore interface { Queryable wallet.Utxos }
type VendorDisputeTimeout ¶
type VendorDisputeTimeout struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"purchaseOrderId"` ExpiresIn uint `json:"expiresIn"` Thumbnail Thumbnail `json:"thumbnail"` }
VendorDisputeTimeout represents a notification about a sale which will soon be unable to dispute. The Type indicates the age of the purchase and OrderID references the purchases orderID in the database schema
func (VendorDisputeTimeout) Data ¶
func (n VendorDisputeTimeout) Data() ([]byte, error)
func (VendorDisputeTimeout) GetID ¶
func (n VendorDisputeTimeout) GetID() string
func (VendorDisputeTimeout) GetSMTPTitleAndBody ¶
func (n VendorDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (VendorDisputeTimeout) GetType ¶
func (n VendorDisputeTimeout) GetType() NotificationType
func (VendorDisputeTimeout) WebsocketData ¶
func (n VendorDisputeTimeout) WebsocketData() ([]byte, error)
type VendorFinalizedPayment ¶
type VendorFinalizedPayment struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderID string `json:"orderId"` }
VendorFinalizedPayment represents a notification about a purchase which will soon be unable to dispute.
func (VendorFinalizedPayment) Data ¶
func (n VendorFinalizedPayment) Data() ([]byte, error)
func (VendorFinalizedPayment) GetID ¶
func (n VendorFinalizedPayment) GetID() string
func (VendorFinalizedPayment) GetSMTPTitleAndBody ¶
func (n VendorFinalizedPayment) GetSMTPTitleAndBody() (string, string, bool)
func (VendorFinalizedPayment) GetType ¶
func (n VendorFinalizedPayment) GetType() NotificationType
func (VendorFinalizedPayment) WebsocketData ¶
func (n VendorFinalizedPayment) WebsocketData() ([]byte, error)
type WatchedScriptStore ¶
type WatchedScriptStore interface { Queryable wallet.WatchedScripts }