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 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 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
- 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 RepoVersion = "15"
Variables ¶
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 ( 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 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{}, }
var (
VendorDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour
)
Functions ¶
func GetObjectFromIPFS ¶ added in v0.12.0
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 ¶ added in v0.9.4
Returns the directory to store repo data in.
It depends on the OS and whether or not we are on testnet.
func MigrateUp ¶ added in v0.9.2
MigrateUp looks at the currently active migration version and will migrate all the way up (applying all up migrations).
func NewNotificationID ¶ added in v0.12.1
func NewNotificationID() string
Types ¶
type BuyerDisputeExpiry ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n BuyerDisputeExpiry) Data() ([]byte, error)
func (BuyerDisputeExpiry) GetID ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetID() string
func (BuyerDisputeExpiry) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeExpiry) GetType ¶ added in v0.12.1
func (n BuyerDisputeExpiry) GetType() NotificationType
func (BuyerDisputeExpiry) WebsocketData ¶ added in v0.12.1
func (n BuyerDisputeExpiry) WebsocketData() ([]byte, error)
type BuyerDisputeTimeout ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n BuyerDisputeTimeout) Data() ([]byte, error)
func (BuyerDisputeTimeout) GetID ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetID() string
func (BuyerDisputeTimeout) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (BuyerDisputeTimeout) GetType ¶ added in v0.12.1
func (n BuyerDisputeTimeout) GetType() NotificationType
func (BuyerDisputeTimeout) WebsocketData ¶ added in v0.12.1
func (n BuyerDisputeTimeout) WebsocketData() ([]byte, error)
type Case ¶ added in v0.5.1
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 ¶ added in v0.11.1
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 ¶ added in v0.3.1
type ChatMessage ¶ added in v0.3.1
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 ¶ added in v0.12.1
func (n ChatMessage) Data() ([]byte, error)
func (ChatMessage) GetID ¶ added in v0.12.1
func (n ChatMessage) GetID() string
func (ChatMessage) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ChatMessage) GetSMTPTitleAndBody() (string, string, bool)
func (ChatMessage) GetType ¶ added in v0.12.1
func (n ChatMessage) GetType() NotificationType
func (ChatMessage) WebsocketData ¶ added in v0.12.1
func (n ChatMessage) WebsocketData() ([]byte, error)
type ChatRead ¶ added in v0.12.1
type ChatRead struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatRead) GetSMTPTitleAndBody ¶ added in v0.12.1
func (ChatRead) GetType ¶ added in v0.12.1
func (n ChatRead) GetType() NotificationType
func (ChatRead) WebsocketData ¶ added in v0.12.1
type ChatStore ¶ added in v0.11.1
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 ¶ added in v0.12.1
type ChatTyping struct { MessageId string `json:"messageId"` PeerId string `json:"peerId"` Subject string `json:"subject"` }
func (ChatTyping) Data ¶ added in v0.12.1
func (n ChatTyping) Data() ([]byte, error)
func (ChatTyping) GetID ¶ added in v0.12.1
func (n ChatTyping) GetID() string
func (ChatTyping) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ChatTyping) GetSMTPTitleAndBody() (string, string, bool)
func (ChatTyping) GetType ¶ added in v0.12.1
func (n ChatTyping) GetType() NotificationType
func (ChatTyping) WebsocketData ¶ added in v0.12.1
func (n ChatTyping) WebsocketData() ([]byte, error)
type CompletionNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n CompletionNotification) Data() ([]byte, error)
func (CompletionNotification) GetID ¶ added in v0.12.1
func (n CompletionNotification) GetID() string
func (CompletionNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n CompletionNotification) GetSMTPTitleAndBody() (string, string, bool)
func (CompletionNotification) GetType ¶ added in v0.12.1
func (n CompletionNotification) GetType() NotificationType
func (CompletionNotification) WebsocketData ¶ added in v0.12.1
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 ¶ added in v0.11.1
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 ¶ added in v0.11.1
type CouponStore interface { Queryable // Put a list of coupons to the db Put(coupons []Coupon) error // Get a list of coupons given a slug Get(slug string) ([]Coupon, error) // Delete all coupons for a given slug Delete(slug string) error }
Coupons interface defines basic database operations for coupon information
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n DisputeAcceptedNotification) Data() ([]byte, error)
func (DisputeAcceptedNotification) GetID ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetID() string
func (DisputeAcceptedNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeAcceptedNotification) GetType ¶ added in v0.12.1
func (n DisputeAcceptedNotification) GetType() NotificationType
func (DisputeAcceptedNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeAcceptedNotification) WebsocketData() ([]byte, error)
type DisputeCaseRecord ¶ added in v0.12.1
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 string }
DisputeCaseRecord is a one-to-one relationship with records in the SQL datastore
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification ¶ added in v0.12.1
func (r *DisputeCaseRecord) BuildModeratorDisputeExpiryThirdNotification(createdAt time.Time) *Notification
BuildModeratorDisputeExpiryThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*DisputeCaseRecord) Contract ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (r *DisputeCaseRecord) IsExpired(when time.Time) bool
IsExpired returns a bool indicating whether the case is still open
func (*DisputeCaseRecord) IsExpiredNow ¶ added in v0.12.1
func (r *DisputeCaseRecord) IsExpiredNow() bool
IsExpired returns a bool indicating whether the case is still open right now
func (*DisputeCaseRecord) ResolutionPaymentContract ¶ added in v0.12.4
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 ¶ added in v0.12.4
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 ¶ added in v0.12.4
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n DisputeCloseNotification) Data() ([]byte, error)
func (DisputeCloseNotification) GetID ¶ added in v0.12.1
func (n DisputeCloseNotification) GetID() string
func (DisputeCloseNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeCloseNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeCloseNotification) GetType ¶ added in v0.12.1
func (n DisputeCloseNotification) GetType() NotificationType
func (DisputeCloseNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeCloseNotification) WebsocketData() ([]byte, error)
type DisputeOpenNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n DisputeOpenNotification) Data() ([]byte, error)
func (DisputeOpenNotification) GetID ¶ added in v0.12.1
func (n DisputeOpenNotification) GetID() string
func (DisputeOpenNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeOpenNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeOpenNotification) GetType ¶ added in v0.12.1
func (n DisputeOpenNotification) GetType() NotificationType
func (DisputeOpenNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeOpenNotification) WebsocketData() ([]byte, error)
type DisputeUpdateNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n DisputeUpdateNotification) Data() ([]byte, error)
func (DisputeUpdateNotification) GetID ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetID() string
func (DisputeUpdateNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetSMTPTitleAndBody() (string, string, bool)
func (DisputeUpdateNotification) GetType ¶ added in v0.12.1
func (n DisputeUpdateNotification) GetType() NotificationType
func (DisputeUpdateNotification) WebsocketData ¶ added in v0.12.1
func (n DisputeUpdateNotification) WebsocketData() ([]byte, error)
type FollowNotification ¶ added in v0.12.1
type FollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (FollowNotification) Data ¶ added in v0.12.1
func (n FollowNotification) Data() ([]byte, error)
func (FollowNotification) GetID ¶ added in v0.12.1
func (n FollowNotification) GetID() string
func (FollowNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n FollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FollowNotification) GetType ¶ added in v0.12.1
func (n FollowNotification) GetType() NotificationType
func (FollowNotification) WebsocketData ¶ added in v0.12.1
func (n FollowNotification) WebsocketData() ([]byte, error)
type FollowerStore ¶ added in v0.11.1
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 ¶ added in v0.11.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n FulfillmentNotification) Data() ([]byte, error)
func (FulfillmentNotification) GetID ¶ added in v0.12.1
func (n FulfillmentNotification) GetID() string
func (FulfillmentNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n FulfillmentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (FulfillmentNotification) GetType ¶ added in v0.12.1
func (n FulfillmentNotification) GetType() NotificationType
func (FulfillmentNotification) WebsocketData ¶ added in v0.12.1
func (n FulfillmentNotification) WebsocketData() ([]byte, error)
type GroupChatMessage ¶ added in v0.6.0
type IncomingTransaction ¶ added in v0.12.1
type IncomingTransaction struct { 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 ¶ added in v0.12.1
func (n IncomingTransaction) Data() ([]byte, error)
func (IncomingTransaction) GetID ¶ added in v0.12.1
func (n IncomingTransaction) GetID() string
func (IncomingTransaction) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n IncomingTransaction) GetSMTPTitleAndBody() (string, string, bool)
func (IncomingTransaction) GetType ¶ added in v0.12.1
func (n IncomingTransaction) GetType() NotificationType
func (IncomingTransaction) WebsocketData ¶ added in v0.12.1
func (n IncomingTransaction) WebsocketData() ([]byte, error)
type InventoryStore ¶ added in v0.11.1
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 ModeratedStore ¶ added in v0.11.1
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 }
ModeratedStores interface defines basic database operations for moderated stores
type ModeratorAddNotification ¶ added in v0.12.1
type ModeratorAddNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorAddNotification) Data ¶ added in v0.12.1
func (n ModeratorAddNotification) Data() ([]byte, error)
func (ModeratorAddNotification) GetID ¶ added in v0.12.1
func (n ModeratorAddNotification) GetID() string
func (ModeratorAddNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorAddNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorAddNotification) GetType ¶ added in v0.12.1
func (n ModeratorAddNotification) GetType() NotificationType
func (ModeratorAddNotification) WebsocketData ¶ added in v0.12.1
func (n ModeratorAddNotification) WebsocketData() ([]byte, error)
type ModeratorDisputeExpiry ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) Data() ([]byte, error)
func (ModeratorDisputeExpiry) GetID ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetID() string
func (ModeratorDisputeExpiry) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorDisputeExpiry) GetType ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) GetType() NotificationType
func (ModeratorDisputeExpiry) WebsocketData ¶ added in v0.12.1
func (n ModeratorDisputeExpiry) WebsocketData() ([]byte, error)
type ModeratorRemoveNotification ¶ added in v0.12.1
type ModeratorRemoveNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (ModeratorRemoveNotification) Data ¶ added in v0.12.1
func (n ModeratorRemoveNotification) Data() ([]byte, error)
func (ModeratorRemoveNotification) GetID ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetID() string
func (ModeratorRemoveNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ModeratorRemoveNotification) GetType ¶ added in v0.12.1
func (n ModeratorRemoveNotification) GetType() NotificationType
func (ModeratorRemoveNotification) WebsocketData ¶ added in v0.12.1
func (n ModeratorRemoveNotification) WebsocketData() ([]byte, error)
type Notification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func NewNotification(n Notifier, createdAt time.Time, isRead bool) *Notification
NewNotification is a helper that returns a properly instantiated *Notification
func (*Notification) Data ¶ added in v0.12.1
func (n *Notification) Data() ([]byte, error)
func (*Notification) GetID ¶ added in v0.12.1
func (n *Notification) GetID() string
func (*Notification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n *Notification) GetSMTPTitleAndBody() (string, string, bool)
func (*Notification) GetType ¶ added in v0.12.1
func (n *Notification) GetType() NotificationType
func (*Notification) GetTypeString ¶ added in v0.12.1
func (n *Notification) GetTypeString() string
func (*Notification) GetUnixCreatedAt ¶ added in v0.12.1
func (n *Notification) GetUnixCreatedAt() int
func (*Notification) MarshalJSON ¶ added in v0.12.1
func (n *Notification) MarshalJSON() ([]byte, error)
func (*Notification) UnmarshalJSON ¶ added in v0.12.1
func (n *Notification) UnmarshalJSON(data []byte) error
func (*Notification) WebsocketData ¶ added in v0.12.1
func (n *Notification) WebsocketData() ([]byte, error)
type NotificationStore ¶ added in v0.11.1
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 }
Notifications interface defines basic database operations for notification information
type NotificationType ¶ added in v0.12.1
type NotificationType string
func (NotificationType) String ¶ added in v0.12.1
func (t NotificationType) String() string
type Notifier ¶ added in v0.12.1
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 contraints 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 ¶ added in v0.11.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n OrderCancelNotification) Data() ([]byte, error)
func (OrderCancelNotification) GetID ¶ added in v0.12.1
func (n OrderCancelNotification) GetID() string
func (OrderCancelNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderCancelNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderCancelNotification) GetType ¶ added in v0.12.1
func (n OrderCancelNotification) GetType() NotificationType
func (OrderCancelNotification) WebsocketData ¶ added in v0.12.1
func (n OrderCancelNotification) WebsocketData() ([]byte, error)
type OrderConfirmationNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n OrderConfirmationNotification) Data() ([]byte, error)
func (OrderConfirmationNotification) GetID ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetID() string
func (OrderConfirmationNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderConfirmationNotification) GetType ¶ added in v0.12.1
func (n OrderConfirmationNotification) GetType() NotificationType
func (OrderConfirmationNotification) WebsocketData ¶ added in v0.12.1
func (n OrderConfirmationNotification) WebsocketData() ([]byte, error)
type OrderDeclinedNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n OrderDeclinedNotification) Data() ([]byte, error)
func (OrderDeclinedNotification) GetID ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetID() string
func (OrderDeclinedNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderDeclinedNotification) GetType ¶ added in v0.12.1
func (n OrderDeclinedNotification) GetType() NotificationType
func (OrderDeclinedNotification) WebsocketData ¶ added in v0.12.1
func (n OrderDeclinedNotification) WebsocketData() ([]byte, error)
type OrderNotification ¶ added in v0.12.1
type OrderNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` Title string `json:"title"` BuyerID string `json:"buyerId"` BuyerHandle string `json:"buyerHandle"` Thumbnail Thumbnail `json:"thumbnail"` OrderId string `json:"orderId"` Slug string `json:"slug"` }
func (OrderNotification) Data ¶ added in v0.12.1
func (n OrderNotification) Data() ([]byte, error)
func (OrderNotification) GetID ¶ added in v0.12.1
func (n OrderNotification) GetID() string
func (OrderNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n OrderNotification) GetSMTPTitleAndBody() (string, string, bool)
func (OrderNotification) GetType ¶ added in v0.12.1
func (n OrderNotification) GetType() NotificationType
func (OrderNotification) WebsocketData ¶ added in v0.12.1
func (n OrderNotification) WebsocketData() ([]byte, error)
type PaymentNotification ¶ added in v0.12.1
type PaymentNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` OrderId string `json:"orderId"` FundingTotal uint64 `json:"fundingTotal"` }
func (PaymentNotification) Data ¶ added in v0.12.1
func (n PaymentNotification) Data() ([]byte, error)
func (PaymentNotification) GetID ¶ added in v0.12.1
func (n PaymentNotification) GetID() string
func (PaymentNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n PaymentNotification) GetSMTPTitleAndBody() (string, string, bool)
func (PaymentNotification) GetType ¶ added in v0.12.1
func (n PaymentNotification) GetType() NotificationType
func (PaymentNotification) WebsocketData ¶ added in v0.12.1
func (n PaymentNotification) WebsocketData() ([]byte, error)
type PayoutRatio ¶ added in v0.12.4
type PayoutRatio struct{ Buyer, Vendor float32 }
func (PayoutRatio) BuyerAny ¶ added in v0.12.4
func (r PayoutRatio) BuyerAny() bool
func (PayoutRatio) BuyerMajority ¶ added in v0.12.4
func (r PayoutRatio) BuyerMajority() bool
func (PayoutRatio) EvenMajority ¶ added in v0.12.4
func (r PayoutRatio) EvenMajority() bool
func (PayoutRatio) Validate ¶ added in v0.12.4
func (r PayoutRatio) Validate() error
func (PayoutRatio) VendorAny ¶ added in v0.12.4
func (r PayoutRatio) VendorAny() bool
func (PayoutRatio) VendorMajority ¶ added in v0.12.4
func (r PayoutRatio) VendorMajority() bool
type PointerStore ¶ added in v0.11.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n PremarshalledNotifier) Data() ([]byte, error)
func (PremarshalledNotifier) GetID ¶ added in v0.12.1
func (n PremarshalledNotifier) GetID() string
func (PremarshalledNotifier) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n PremarshalledNotifier) GetSMTPTitleAndBody() (string, string, bool)
func (PremarshalledNotifier) GetType ¶ added in v0.12.1
func (n PremarshalledNotifier) GetType() NotificationType
func (PremarshalledNotifier) WebsocketData ¶ added in v0.12.1
func (n PremarshalledNotifier) WebsocketData() ([]byte, error)
type ProcessingErrorNotification ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n ProcessingErrorNotification) Data() ([]byte, error)
func (ProcessingErrorNotification) GetID ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetID() string
func (ProcessingErrorNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ProcessingErrorNotification) GetType ¶ added in v0.12.1
func (n ProcessingErrorNotification) GetType() NotificationType
func (ProcessingErrorNotification) WebsocketData ¶ added in v0.12.1
func (n ProcessingErrorNotification) WebsocketData() ([]byte, error)
type Purchase ¶ added in v0.5.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpiryFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeExpiryLastNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpiryLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpiryLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeExpirySecondNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeExpirySecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeExpirySecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutFirstNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutFirstNotification returns a Notification with ExpiresIn set for the First Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutLastNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutLastNotification returns a Notification with ExpiresIn set for the Last Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutSecondNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutSecondNotification returns a Notification with ExpiresIn set for the Second Interval
func (*PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification ¶ added in v0.12.1
func (r *PurchaseRecord) BuildBuyerDisputeTimeoutThirdNotification(createdAt time.Time) *Notification
BuildBuyerDisputeTimeoutThirdNotification returns a Notification with ExpiresIn set for the Third Interval
func (*PurchaseRecord) IsDisputeable ¶ added in v0.12.1
func (r *PurchaseRecord) IsDisputeable() bool
type PurchaseStore ¶ added in v0.11.1
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, 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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n RefundNotification) Data() ([]byte, error)
func (RefundNotification) GetID ¶ added in v0.12.1
func (n RefundNotification) GetID() string
func (RefundNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n RefundNotification) GetSMTPTitleAndBody() (string, string, bool)
func (RefundNotification) GetType ¶ added in v0.12.1
func (n RefundNotification) GetType() NotificationType
func (RefundNotification) WebsocketData ¶ added in v0.12.1
func (n RefundNotification) WebsocketData() ([]byte, error)
type SMTPSettings ¶
type Sale ¶ added in v0.5.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (r *SaleRecord) IsModeratedContract() bool
IsModeratedContract indicates whether the SaleRecord has a contract which includes a third-party moderator
func (*SaleRecord) SupportsTimedEscrowRelease ¶ added in v0.12.1
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 ¶ added in v0.11.1
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, 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"` }
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 ¶ added in v0.11.1
type SpentTransactionOutputStore interface { Queryable wallet.Stxos }
type StatusNotification ¶ added in v0.12.1
type StatusNotification struct {
Status string `json:"status"`
}
func (StatusNotification) Data ¶ added in v0.12.1
func (n StatusNotification) Data() ([]byte, error)
func (StatusNotification) GetID ¶ added in v0.12.1
func (n StatusNotification) GetID() string
func (StatusNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n StatusNotification) GetSMTPTitleAndBody() (string, string, bool)
func (StatusNotification) GetType ¶ added in v0.12.1
func (n StatusNotification) GetType() NotificationType
func (StatusNotification) WebsocketData ¶ added in v0.12.1
func (n StatusNotification) WebsocketData() ([]byte, error)
type TestNotification ¶ added in v0.12.1
type TestNotification struct{}
func (TestNotification) Data ¶ added in v0.12.1
func (TestNotification) Data() ([]byte, error)
func (TestNotification) GetID ¶ added in v0.12.1
func (TestNotification) GetID() string
func (TestNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (TestNotification) GetSMTPTitleAndBody() (string, string, bool)
func (TestNotification) GetType ¶ added in v0.12.1
func (TestNotification) GetType() NotificationType
func (TestNotification) WebsocketData ¶ added in v0.12.1
func (n TestNotification) WebsocketData() ([]byte, error)
type TransactionMetadataStore ¶ added in v0.11.1
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 }
TxMetadata interface defines basic database operations for transaction metadata
type TransactionStore ¶ added in v0.11.1
type TransactionStore interface { Queryable wallet.Txns }
type UnfollowNotification ¶ added in v0.12.1
type UnfollowNotification struct { ID string `json:"notificationId"` Type NotificationType `json:"type"` PeerId string `json:"peerId"` }
func (UnfollowNotification) Data ¶ added in v0.12.1
func (n UnfollowNotification) Data() ([]byte, error)
func (UnfollowNotification) GetID ¶ added in v0.12.1
func (n UnfollowNotification) GetID() string
func (UnfollowNotification) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n UnfollowNotification) GetSMTPTitleAndBody() (string, string, bool)
func (UnfollowNotification) GetType ¶ added in v0.12.1
func (n UnfollowNotification) GetType() NotificationType
func (UnfollowNotification) WebsocketData ¶ added in v0.12.1
func (n UnfollowNotification) WebsocketData() ([]byte, error)
type UnfundedSale ¶ added in v0.9.4
type UnspentTransactionOutputStore ¶ added in v0.11.1
type UnspentTransactionOutputStore interface { Queryable wallet.Utxos }
type VendorDisputeTimeout ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n VendorDisputeTimeout) Data() ([]byte, error)
func (VendorDisputeTimeout) GetID ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetID() string
func (VendorDisputeTimeout) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetSMTPTitleAndBody() (string, string, bool)
func (VendorDisputeTimeout) GetType ¶ added in v0.12.1
func (n VendorDisputeTimeout) GetType() NotificationType
func (VendorDisputeTimeout) WebsocketData ¶ added in v0.12.1
func (n VendorDisputeTimeout) WebsocketData() ([]byte, error)
type VendorFinalizedPayment ¶ added in v0.12.1
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 ¶ added in v0.12.1
func (n VendorFinalizedPayment) Data() ([]byte, error)
func (VendorFinalizedPayment) GetID ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetID() string
func (VendorFinalizedPayment) GetSMTPTitleAndBody ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetSMTPTitleAndBody() (string, string, bool)
func (VendorFinalizedPayment) GetType ¶ added in v0.12.1
func (n VendorFinalizedPayment) GetType() NotificationType
func (VendorFinalizedPayment) WebsocketData ¶ added in v0.12.1
func (n VendorFinalizedPayment) WebsocketData() ([]byte, error)
type WatchedScriptStore ¶ added in v0.11.1
type WatchedScriptStore interface { Queryable wallet.WatchedScripts }