Documentation ¶
Index ¶
- Constants
- Variables
- func CreateSlugFor(slugName string) string
- func DoInit(repoRoot string, nBitsForKeypair int, testnet bool, password string, ...) error
- func ExtractIDFromListing(data []byte) (*pb.ID, error)
- func ExtractVersionFromSignedListing(data []byte) (uint, error)
- func GenerateSlug(title, repoPath string, isTestnet bool, dStore *Datastore) (string, error)
- func GetListingFromSlug(slug, repoPath string, isTestnet bool, dStore *Datastore) (*pb.SignedListing, error)
- func GetObjectFromIPFS(n *core.IpfsNode, p peer.ID, name string, maxCacheLen time.Duration) ([]byte, error)
- func GetPathForListingSlug(slug, repoPath string, isTestnet bool) (string, error)
- func GetRepoPath(isTestnet bool, repoPath string) (string, error)
- func MigrateUp(repoPath, dbPassword string, testnet bool) error
- func NewNotificationID() string
- func ToHtmlEntities(str string) string
- func ToV5Dispute(dispute *pb.Dispute) *pb.Dispute
- func ToV5DisputeResolution(disputeResolution *pb.DisputeResolution) *pb.DisputeResolution
- func ToV5Order(order *pb.Order, ...) (*pb.Order, error)
- func ToV5OrderConfirmation(orderConfirmation *pb.OrderConfirmation) *pb.OrderConfirmation
- func ToV5OrderFulfillment(orderFulfillment *pb.OrderFulfillment) *pb.OrderFulfillment
- func ToV5Refund(refund *pb.Refund) *pb.Refund
- func ValidateListingOptions(listingItemOptions []*pb.Listing_Item_Option, itemOptions []option) ([]*pb.Order_Item_Option, error)
- func ValidateShippingRegion(shippingOption *pb.Listing_ShippingOption) error
- type APITime
- type BuyerDisputeExpiry
- type BuyerDisputeTimeout
- type Case
- type CaseStore
- type ChatConversation
- type ChatMessage
- type ChatMessageNotification
- func (n ChatMessageNotification) Data() ([]byte, error)
- func (n ChatMessageNotification) GetID() string
- func (n ChatMessageNotification) GetSMTPTitleAndBody() (string, string, bool)
- func (n ChatMessageNotification) GetType() NotificationType
- func (n ChatMessageNotification) WebsocketData() ([]byte, error)
- 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 CurrencyConverter
- type CurrencyDefinition
- type CurrencyDictionary
- type CurrencyDictionaryProcessingError
- type CurrencyValue
- func NewCurrencyValue(amount string, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromBigInt(amt *big.Int, def CurrencyDefinition) *CurrencyValue
- func NewCurrencyValueFromInt(amount int64, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromProtobuf(amount string, currency *pb.CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueFromUint(amount uint64, currency CurrencyDefinition) (*CurrencyValue, error)
- func NewCurrencyValueWithLookup(amount, currencyCode string) (*CurrencyValue, error)
- func (c *CurrencyValue) AddBigFloatProduct(factor *big.Float) *CurrencyValue
- func (c *CurrencyValue) AddBigInt(addend *big.Int) *CurrencyValue
- func (c *CurrencyValue) AdjustDivisibility(div uint) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) AmountBigInt() *big.Int
- func (c *CurrencyValue) AmountInt64() (int64, error)
- func (c *CurrencyValue) AmountString() string
- func (c *CurrencyValue) AmountUint64() (uint64, error)
- func (c *CurrencyValue) Cmp(other *CurrencyValue) (int, error)
- func (c *CurrencyValue) ConvertTo(final CurrencyDefinition, reserveConverter *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) ConvertUsingProtobufDef(convertTo *pb.CurrencyDefinition, reserve *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
- func (c *CurrencyValue) Equal(other *CurrencyValue) bool
- func (c *CurrencyValue) IsNegative() bool
- func (c *CurrencyValue) IsPositive() bool
- func (c *CurrencyValue) IsZero() bool
- func (c *CurrencyValue) MarshalJSON() ([]byte, error)
- func (c *CurrencyValue) MulBigFloat(factor *big.Float) (*CurrencyValue, big.Accuracy)
- func (c *CurrencyValue) MulBigInt(factor *big.Int) *CurrencyValue
- func (c *CurrencyValue) Normalize() (*CurrencyValue, error)
- func (c *CurrencyValue) String() string
- func (c *CurrencyValue) SubBigInt(subtrahend *big.Int) *CurrencyValue
- func (c *CurrencyValue) UnmarshalJSON(b []byte) error
- func (c *CurrencyValue) Valid() error
- 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 big.Int) *big.Int
- 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 ErrCryptocurrencyListingIllegalField
- type ErrCryptocurrencyPurchaseIllegalField
- type ErrMarketPriceListingIllegalField
- type ErrPriceModifierOutOfRange
- 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 IndividualListingContainer
- type InventoryStore
- type Item
- type KeyStore
- type Listing
- func CreateListing(r []byte, isTestnet bool, dstore *Datastore, repoPath string) (Listing, error)
- func NewListingFromProtobuf(l *pb.Listing) (*Listing, error)
- func UnmarshalJSONListing(data []byte) (*Listing, error)
- func UpdateListing(r []byte, isTestnet bool, dstore *Datastore, repoPath string) (Listing, error)
- func (l *Listing) GetAcceptedCurrencies() []string
- func (l *Listing) GetCategories() []string
- func (l *Listing) GetCondition() string
- func (l *Listing) GetContractType() string
- func (l *Listing) GetCoupons() (ListingCoupons, error)
- func (l *Listing) GetCryptoCurrencyCode() string
- func (l *Listing) GetCryptoDivisibility() uint32
- func (l *Listing) GetDescription() string
- func (l *Listing) GetEscrowTimeoutHours() uint32
- func (l *Listing) GetFormat() string
- func (l *Listing) GetImages() []*ListingImage
- func (l *Listing) GetInventory() (map[int]*big.Int, error)
- func (l *Listing) GetLanguage() string
- func (l *Listing) GetModerators() []string
- func (l *Listing) GetNsfw() bool
- func (l *Listing) GetPrice() (*CurrencyValue, error)
- func (l *Listing) GetPriceModifier() float32
- func (l *Listing) GetProcessingTime() string
- func (l *Listing) GetProtobuf() *pb.Listing
- func (l *Listing) GetRefundPolicy() string
- func (l *Listing) GetShippingOptions() ([]*pb.Listing_ShippingOption, error)
- func (l *Listing) GetShippingRegions() ([]string, []string)
- func (l *Listing) GetShortDescription() string
- func (l *Listing) GetSkus() ([]*pb.Listing_Item_Sku, error)
- func (l *Listing) GetSlug() string
- func (l *Listing) GetTags() []string
- func (l *Listing) GetTaxes() ListingTaxes
- func (l *Listing) GetTermsAndConditions() string
- func (l *Listing) GetTitle() string
- func (l *Listing) GetVendorID() *PeerInfo
- func (l *Listing) GetVersion() uint32
- func (l *Listing) GetWeightGrams() float32
- func (l *Listing) MarshalJSON() ([]byte, error)
- func (l *Listing) MarshalProtobuf() ([]byte, error)
- func (l *Listing) Normalize() (*Listing, error)
- func (*Listing) ProtoMessage()
- func (l *Listing) Reset()
- func (l *Listing) SetAcceptedCurrencies(codes ...string) error
- func (l *Listing) SetCryptocurrencyListingDefaults() error
- func (l *Listing) SetModerators(mods []string) error
- func (l *Listing) Sign(n listingSigner) (*SignedListing, error)
- func (l *Listing) String() string
- func (l *Listing) UpdateCouponsFromDatastore(cdb couponGetter) error
- func (l *Listing) ValidateCryptoListing() error
- func (l *Listing) ValidateListing(testnet bool) (err error)
- func (l *Listing) ValidatePurchaseItemOptions(itemOptions []option) error
- func (l *Listing) ValidateSkus() error
- type ListingCoupon
- func (c *ListingCoupon) GetAmountOff() *CurrencyValue
- func (c *ListingCoupon) GetListingSlug() string
- func (c *ListingCoupon) GetPercentOff() float32
- func (c *ListingCoupon) GetRedemptionCode() (string, error)
- func (c *ListingCoupon) GetRedemptionHash() (string, error)
- func (c *ListingCoupon) GetTitle() string
- func (c *ListingCoupon) SetRedemptionCode(code string) error
- type ListingCoupons
- type ListingImage
- func (i *ListingImage) GetFilename() string
- func (i *ListingImage) GetLarge() string
- func (i *ListingImage) GetMedium() string
- func (i *ListingImage) GetOriginal() string
- func (i *ListingImage) GetSmall() string
- func (i *ListingImage) GetTiny() string
- func (i *ListingImage) SetLarge(cid string) error
- func (i *ListingImage) SetMedium(cid string) error
- func (i *ListingImage) SetOriginal(cid string) error
- func (i *ListingImage) SetSmall(cid string) error
- func (i *ListingImage) SetTiny(cid string) error
- func (i *ListingImage) String() string
- type ListingIndexData
- type ListingMetadata
- type ListingTax
- type ListingTaxes
- type ListingThumbnail
- type Message
- type MessageStore
- 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 OrderMessage
- type OrderNotification
- type PaymentNotification
- type PayoutRatio
- type PeerInfo
- func (p *PeerInfo) BitcoinKey() []byte
- func (p *PeerInfo) BitcoinSignature() []byte
- func (p *PeerInfo) Equal(other *PeerInfo) bool
- func (p *PeerInfo) GeneratePeerIDFromIdentityKey() (string, error)
- func (p *PeerInfo) Handle() string
- func (p *PeerInfo) Hash() (string, error)
- func (p *PeerInfo) IdentityKey() (ipfs.PubKey, error)
- func (p *PeerInfo) IdentityKeyBytes() []byte
- func (p *PeerInfo) Protobuf() *pb.ID
- func (p *PeerInfo) String() string
- func (p *PeerInfo) Valid() error
- func (p *PeerInfo) VerifyBitcoinSignature() error
- func (p *PeerInfo) VerifyIdentity() error
- type PeerKeychain
- 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 Profile
- func (p *Profile) DisableModeration() error
- func (p *Profile) GetModeratedFixedFee() (*CurrencyValue, error)
- func (p *Profile) GetProtobuf() *pb.Profile
- func (p *Profile) GetVersion() uint32
- func (p *Profile) IsModerationEnabled() bool
- func (p *Profile) NormalizeDataForAllSchemas() *Profile
- func (p *Profile) SetModeratorFixedFee(fee *CurrencyValue) error
- func (p *Profile) SetModeratorFixedPlusPercentageFee(fee *CurrencyValue, percentage float32) error
- func (p *Profile) SetModeratorPercentageFee(percentage float32) error
- func (p *Profile) Valid() error
- type Purchase
- type PurchaseData
- 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 SignedListing
- func (l SignedListing) GetAcceptedCurrencies() []string
- func (l SignedListing) GetCryptoCurrencyCode() string
- func (l SignedListing) GetCryptoDivisibility() uint32
- func (l SignedListing) GetListing() *Listing
- func (l SignedListing) GetListingSigProtobuf() *pb.Signature
- func (l SignedListing) GetPrice() (*CurrencyValue, error)
- func (l SignedListing) GetSignature() []byte
- func (l SignedListing) GetSlug() string
- func (l SignedListing) GetTitle() string
- func (l SignedListing) GetVendorID() *PeerInfo
- func (l SignedListing) GetVersion() uint32
- func (l SignedListing) MarshalJSON() ([]byte, error)
- func (l *SignedListing) Normalize() error
- func (*SignedListing) ProtoMessage()
- func (l *SignedListing) Reset()
- func (l *SignedListing) String() string
- func (l SignedListing) ValidateListing(isTestnet bool) error
- func (l SignedListing) VerifySignature() error
- type SpentTransactionOutputStore
- type StatusNotification
- type TestNotification
- type Thumbnail
- type TransactionMetadataStore
- type TransactionStore
- type UnfollowNotification
- type UnfundedOrder
- 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 ( Fiat = "fiat" Crypto = "crypto" DefaultCryptoDivisibility = 8 NilCurrencyCode = CurrencyCode("") DefaultBlockTime = 10 * time.Minute )
const ( // ListingVersion - current listing version ListingVersion = 5 // TitleMaxCharacters - max size for title TitleMaxCharacters = 140 // ShortDescriptionLength - min length for description ShortDescriptionLength = 160 // DescriptionMaxCharacters - max length for description DescriptionMaxCharacters = 50000 // MaxTags - max permitted tags MaxTags = 10 // MaxCategories - max permitted categories MaxCategories = 10 // MaxListItems - max items in a listing MaxListItems = 30 // FilenameMaxCharacters - max filename size FilenameMaxCharacters = 255 // CodeMaxCharacters - max chars for a code CodeMaxCharacters = 20 // WordMaxCharacters - max chars for word WordMaxCharacters = 40 // SentenceMaxCharacters - max chars for sentence SentenceMaxCharacters = 70 // CouponTitleMaxCharacters - max length of a coupon title CouponTitleMaxCharacters = 70 // PolicyMaxCharacters - max length for policy PolicyMaxCharacters = 10000 // AboutMaxCharacters - max length for about AboutMaxCharacters = 10000 // URLMaxCharacters - max length for URL URLMaxCharacters = 2000 // MaxCountryCodes - max country codes MaxCountryCodes = 255 // DefaultEscrowTimeout - escrow timeout in hours DefaultEscrowTimeout = 1080 // SlugBuffer - buffer size for slug SlugBuffer = 5 // PriceModifierMin - min price modifier PriceModifierMin = -99.99 // PriceModifierMax = max price modifier PriceModifierMax = 1000.00 )
const JSONAPITimeFormat = `"2006-01-02T15:04:05.999999999Z07:00"` // time.RFC3339Nano
const RepoVersion = "34"
Variables ¶
var ( ErrCurrencyValueInsufficientPrecision = errors.New("unable to accurately represent value as int64") ErrCurrencyValueNegativeRate = errors.New("conversion rate must be greater than zero") ErrCurrencyValueAmountInvalid = errors.New("invalid amount") ErrCurrencyValueDefinitionInvalid = errors.New("invalid currency definition") ErrCurrencyValueInvalidCmpDifferentCurrencies = errors.New("unable to compare two different currencies") )
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'") ErrCurrencyDefinitionUndefined = errors.New("unknown currency") ErrCurrencyTypeInvalid = errors.New("currency type must be crypto or fiat") ErrCurrencyDivisibilityNonPositive = errors.New("currency divisibility most be greater than zero") ErrDictionaryIndexMismatchedCode = errors.New("dictionary index mismatched with definition currency code") ErrDictionaryCurrencyCodeCollision = errors.New("currency code is used by more than one currency") NilCurrencyDefinition = CurrencyDefinition{Name: "", Code: NilCurrencyCode, Divisibility: 0, CurrencyType: "", BlockTime: 0 * time.Second} )
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 ( // ErrCryptocurrencySkuQuantityInvalid - invalid sku qty err ErrCryptocurrencySkuQuantityInvalid = errors.New("cryptocurrency listing quantity must be a non-negative integer") // ErrListingCryptoDivisibilityInvalid indicates the given divisibility doesn't match the default ErrListingCryptoDivisibilityInvalid = errors.New("invalid cryptocurrency divisibility") // ErrListingCryptoCurrencyCodeInvalid indicates the given code isn't valid or known ErrListingCryptoCurrencyCodeInvalid = errors.New("invalid cryptocurrency code") ErrShippingRegionMustBeSet = errors.New("shipping region must be set") ErrShippingRegionUndefined = errors.New("undefined shipping region") ErrShippingRegionMustNotBeContinent = errors.New("cannot specify continent as shipping region") // ErrListingDoesNotExist - non-existent listing err ErrListingDoesNotExist = errors.New("listing doesn't exist") // ErrListingAlreadyExists - duplicate listing err ErrListingAlreadyExists = errors.New("listing already exists") )
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{}, migrations.Migration017{}, migrations.Migration018{}, migrations.Migration019{}, migrations.Migration020{}, migrations.Migration021{}, migrations.Migration022{}, migrations.Migration023{}, migrations.Migration024{}, migrations.Migration025{}, migrations.Migration026{}, migrations.Migration027{}, migrations.Migration028{}, migrations.Migration029{}, migrations.Migration030{}, migrations.Migration031{}, migrations.Migration032{}, migrations.Migration033{}, } )
var ( ErrInvalidInlinePeerID = errors.New("inline hash does not match produced hash") ErrPeerInfoIsNil = errors.New("peer info is nil") )
var ( // ErrModeratorInfoMissing indicates when the moderator information is // missing while also indicating they are a moderator ErrModeratorInfoMissing = errors.New("moderator is enabled but information is missing") // ErrMissingModeratorFee indicates the fee schedule is missing ErrMissingModeratorFee = errors.New("moderator info is missing fee schedule") // ErrUnknownModeratorFeeType indicates the feeType is unknown ErrUnknownModeratorFeeType = errors.New("moderator fee type is unknown") // ErrModeratorFeeHasNegativePercentage indicates when the percentage is non-positive but should be ErrModeratorFeeHasNegativePercentage = errors.New("percentage moderator fee should not be negative") // ErrFixedFeeHasNonZeroPercentage indicates when the percentage is not zero but should be ErrFixedFeeHasNonZeroPercentage = errors.New("fixed moderator fee should have a zero percentage amount") // ErrPercentageFeeHasFixedFee indicates that a fixed fee is included when there should not be ErrPercentageFeeHasFixedFee = fmt.Errorf("percentage moderator fee should not include a fixed fee or should use (%s) feeType", pb.Moderator_Fee_FIXED_PLUS_PERCENTAGE.String()) // ErrModeratorFixedFeeIsMissing indicates when the fixed fee is missing ErrModeratorFixedFeeIsMissing = fmt.Errorf("fixed moderator fee is missing or should use (%s) feeType", pb.Moderator_Fee_PERCENTAGE.String()) // ErrModeratorFixedFeeAmountIsEmpty indicates the fee is defined with an empty amount ErrModeratorFixedFeeAmountIsEmpty = errors.New("fixed moderator fee amount is missing or not a parseable number") // ErrModeratorFixedFeeIsNegative indicates that the fixed fee is non-positive ErrModeratorFixedFeeIsNegative = errors.New("fixed moderator fee is negative or not a parsable number") )
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 ( // ErrPriceCalculationRequiresExchangeRates - exchange rates dependency err ErrPriceCalculationRequiresExchangeRates = errors.New("can't calculate price with exchange rates disabled") )
var ErrRepoExists = errors.New("IPFS configuration file exists. Reinitializing would overwrite your keys. Use -f to force overwrite.")
var ErrUnknownAPITimeFormat = errors.New("unknown api time format")
var ErrUnknownMessage = errors.New("unknown or invalid message")
ErrUnknownMessage - notify an invalid message
var (
VendorDisputeTimeout_lastInterval = time.Duration(45*24) * time.Hour
)
Functions ¶
func CreateSlugFor ¶
CreateSlugFor Create a slug from a multi-lang string
func ExtractIDFromListing ¶
ExtractIDFromListing returns pb.ID of the listing
func ExtractVersionFromSignedListing ¶
ExtractVersion returns the version of the listing
func GenerateSlug ¶
GenerateSlug - slugify the title of the listing
func GetListingFromSlug ¶
func GetListingFromSlug(slug, repoPath string, isTestnet bool, dStore *Datastore) (*pb.SignedListing, error)
GetListingFromSlug - fetch listing for the specified slug
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 GetPathForListingSlug ¶
func GetRepoPath ¶
GetRepoPath returns the directory to store repo data in.
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
func ToHtmlEntities ¶
func ToV5Dispute ¶
ToV5Dispute scans through the dispute looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5DisputeResolution ¶
func ToV5DisputeResolution(disputeResolution *pb.DisputeResolution) *pb.DisputeResolution
ToV5DisputeResolution scans through the dispute resolution looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5Order ¶
func ToV5Order(order *pb.Order, lookupFunc func(currencyCode string) (CurrencyDefinition, error)) (*pb.Order, error)
ToV5Order scans through the order looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5OrderConfirmation ¶
func ToV5OrderConfirmation(orderConfirmation *pb.OrderConfirmation) *pb.OrderConfirmation
ToV5OrderConfirmation scans through the order confirmation looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5OrderFulfillment ¶
func ToV5OrderFulfillment(orderFulfillment *pb.OrderFulfillment) *pb.OrderFulfillment
ToV5OrderFulfillment scans through the order fulfillment looking for any deprecated fields and turns them into their v5 counterpart.
func ToV5Refund ¶
ToV5Refund scans through the refund looking for any deprecated fields and turns them into their v5 counterpart.
func ValidateListingOptions ¶
func ValidateListingOptions(listingItemOptions []*pb.Listing_Item_Option, itemOptions []option) ([]*pb.Order_Item_Option, error)
ValidateListingOptions is a helper to ensure item options are valid
func ValidateShippingRegion ¶
func ValidateShippingRegion(shippingOption *pb.Listing_ShippingOption) error
ValidateShippingRegion ensures shipping options are valid
Types ¶
type APITime ¶
func NewAPITime ¶
NewAPITime returns a pointer to a new APITime instance
func (APITime) MarshalJSON ¶
func (*APITime) UnmarshalJSON ¶
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 CurrencyValue `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 ChatMessageNotification ¶
type ChatMessageNotification ChatMessage
ChatMessageNotification handles serialization of ChatMessages for notifications
func (ChatMessageNotification) Data ¶
func (n ChatMessageNotification) Data() ([]byte, error)
func (ChatMessageNotification) GetID ¶
func (n ChatMessageNotification) GetID() string
func (ChatMessageNotification) GetSMTPTitleAndBody ¶
func (n ChatMessageNotification) GetSMTPTitleAndBody() (string, string, bool)
func (ChatMessageNotification) GetType ¶
func (n ChatMessageNotification) GetType() NotificationType
func (ChatMessageNotification) WebsocketData ¶
func (n ChatMessageNotification) 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
CurrencyCode is a string-based currency symbol
func (CurrencyCode) String ¶
func (c CurrencyCode) String() string
String returns a readable representation of CurrencyCode
type CurrencyConverter ¶
type CurrencyConverter struct {
// contains filtered or unexported fields
}
CurrencyConverter is suitable for converting a currency from one CurrencyDefinition to another, accounting for their differing divisibility as well as their differing exchange rate as provided by the rater. The rater can represent all rates for the reserve currency code provided.
func NewCurrencyConverter ¶
func NewCurrencyConverter(reserveCode string, rater rater) (*CurrencyConverter, error)
NewCurrencyConverter returns a valid CurrencyConverter. The rater is verified by ensuring the rate of its reserveCode is 1.0 (ensuring it is equivalent to itself).
func NewEquivalentConverter ¶
func NewEquivalentConverter() *CurrencyConverter
NewEquivalentConverter returns a currency converter where all rates are always returns as 1.0 making all currencies equivalent to one another
func (CurrencyConverter) GetFinalPrice ¶
func (c CurrencyConverter) GetFinalPrice(originAmount *CurrencyValue, resultCurrency CurrencyDefinition) (*CurrencyValue, big.Accuracy, error)
GetFinalPrice returns the resulting CurrencyValue after converting the amount and divisibility of the originAmount to the target currency
type CurrencyDefinition ¶
type CurrencyDefinition struct { // Name describes the colloquial term for the currency Name string `json:"name,omitempty"` // Code describes the currency as an uppercase string similar to ISO 4217 Code CurrencyCode `json:"code"` // Divisibility indicates the number of decimal places the currency can be divided in // base10. Ex: 8 suggests a maximum divisibility of 0.00000001 Divisibility uint `json:"divisibility"` // CurrencyType indicates whether the currency is "fiat" or "crypto" currency CurrencyType string `json:"currencyType,omitempty"` // BlockTime is the general/approximate duration for a block to be mined BlockTime time.Duration `json:"-"` }
CurrencyDefinition defines the characteristics of a currency
func NewUnknownCryptoDefinition ¶
func NewUnknownCryptoDefinition(code string, div uint) CurrencyDefinition
NewUnknownCryptoDefinition returns a suitable crypto definition when one does not already exist in local dictionaries
func (CurrencyDefinition) ConfirmationsPerHour ¶
func (c CurrencyDefinition) ConfirmationsPerHour() uint32
ConfirmationsPerHour will calculate the no of confirmations in 1 hr this is valid only for a crypto
func (CurrencyDefinition) CurrencyCode ¶
func (c CurrencyDefinition) CurrencyCode() CurrencyCode
CurrencyCode returns the CurrencyCode of the definition
func (CurrencyDefinition) Equal ¶
func (c CurrencyDefinition) Equal(other CurrencyDefinition) bool
Equal indicates if the receiver and other have the same code and divisibility
func (CurrencyDefinition) String ¶
func (c CurrencyDefinition) String() string
String returns a readable representation of CurrencyDefinition
func (CurrencyDefinition) Valid ¶
func (c CurrencyDefinition) Valid() error
Valid asserts that the CurrencyDefinition is either valid or has at least one error
type CurrencyDictionary ¶
type CurrencyDictionary struct {
// contains filtered or unexported fields
}
CurrencyDictionary represents a collection of CurrencyDefinitions keyed by their CurrencyCode in string form
func AllCurrencies ¶
func AllCurrencies() *CurrencyDictionary
AllCurrencies returns the singleton representing all known currency definitions
func FiatCurrencies ¶
func FiatCurrencies() *CurrencyDictionary
FiatCurrencies returns the mainnet crypto currency definition singleton
func MainnetCurrencies ¶
func MainnetCurrencies() *CurrencyDictionary
MainnetCurrencies returns the mainnet crypto currency definition singleton
func NewCurrencyDictionary ¶
func NewCurrencyDictionary(defs map[string]CurrencyDefinition) (*CurrencyDictionary, error)
NewCurrencyDictionary returns a CurrencyDictionary for managing CurrencyDefinitions
func TestnetCurrencies ¶
func TestnetCurrencies() *CurrencyDictionary
TestnetCurrencies returns the mainnet crypto currency definition singleton
func (CurrencyDictionary) AsMap ¶
func (c CurrencyDictionary) AsMap() map[string]CurrencyDefinition
AsMap returns a cloned map of all known the definitions
func (CurrencyDictionary) Lookup ¶
func (c CurrencyDictionary) Lookup(code string) (CurrencyDefinition, error)
Lookup returns the CurrencyDefinition out of the loaded dictionary. Lookup normalizes the code before lookup and recommends using CurrencyDefinition.CurrencyCode().String() from the response as a normalized code.
type CurrencyDictionaryProcessingError ¶
CurrencyDictionaryProcessingError represents a list of errors after processing a CurrencyDictionary
func (CurrencyDictionaryProcessingError) All ¶
func (c CurrencyDictionaryProcessingError) All() []string
func (CurrencyDictionaryProcessingError) Error ¶
func (c CurrencyDictionaryProcessingError) Error() string
Error satisfies the Error interface without needing the process the set of errors
type CurrencyValue ¶
type CurrencyValue struct { Amount *big.Int Currency CurrencyDefinition }
CurrencyValue represents the amount and variety of currency
func NewCurrencyValue ¶
func NewCurrencyValue(amount string, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValue accepts string amounts and currency codes, and creates a valid CurrencyValue
func NewCurrencyValueFromBigInt ¶
func NewCurrencyValueFromBigInt(amt *big.Int, def CurrencyDefinition) *CurrencyValue
NewCurrencyValueFromBigInt is a convenience function which converts a big.Int and CurrencyDefinition into a new CurrencyValue
func NewCurrencyValueFromInt ¶
func NewCurrencyValueFromInt(amount int64, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromInt is a convenience function which converts an int64 into a string and passes the arguments to NewCurrencyValue
func NewCurrencyValueFromProtobuf ¶
func NewCurrencyValueFromProtobuf(amount string, currency *pb.CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromProtobuf consumes the string and pb.CurrencyDefinition objects from parsed Listings and converts them into CurrencyValue objects
func NewCurrencyValueFromUint ¶
func NewCurrencyValueFromUint(amount uint64, currency CurrencyDefinition) (*CurrencyValue, error)
NewCurrencyValueFromUint is a convenience function which converts an int64 into a string and passes the arguments to NewCurrencyValue
func NewCurrencyValueWithLookup ¶
func NewCurrencyValueWithLookup(amount, currencyCode string) (*CurrencyValue, error)
NewCurrencyValueWithLookup accepts a string value as a base10 integer and uses the currency code to lookup the CurrencyDefinition
func (*CurrencyValue) AddBigFloatProduct ¶
func (c *CurrencyValue) AddBigFloatProduct(factor *big.Float) *CurrencyValue
AddBigFloatProduct will add to itself the product of itself and the float argument and return the result
func (*CurrencyValue) AddBigInt ¶
func (c *CurrencyValue) AddBigInt(addend *big.Int) *CurrencyValue
AddBigInt will add the addend to the amount and return the value sum
func (*CurrencyValue) AdjustDivisibility ¶
func (c *CurrencyValue) AdjustDivisibility(div uint) (*CurrencyValue, big.Accuracy, error)
AdjustDivisibility updates the Currency.Divisibility and adjusts the Amount to match the new value. An error will be returned if the new divisibility is invalid or produces an unreliable result. This is a helper function which is equivalent to ConvertTo using a copy of the CurrencyDefinition using the updated divisibility and an exchangeRatio of 1.0
func (*CurrencyValue) AmountBigInt ¶
func (c *CurrencyValue) AmountBigInt() *big.Int
AmountBigInt returns the big.Int representation of the amount
func (*CurrencyValue) AmountInt64 ¶
func (c *CurrencyValue) AmountInt64() (int64, error)
AmountInt64 returns a valid int64 or an error
func (*CurrencyValue) AmountString ¶
func (c *CurrencyValue) AmountString() string
AmountString returns the string representation of the amount
func (*CurrencyValue) AmountUint64 ¶
func (c *CurrencyValue) AmountUint64() (uint64, error)
AmountUint64 returns a valid int64 or an error
func (*CurrencyValue) Cmp ¶
func (c *CurrencyValue) Cmp(other *CurrencyValue) (int, error)
Cmp exposes the (*big.Int).Cmp behavior after verifying currency and adjusting for different currency divisibilities.
func (*CurrencyValue) ConvertTo ¶
func (c *CurrencyValue) ConvertTo(final CurrencyDefinition, reserveConverter *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
ConvertTo will convert c.Amount into the final CurrencyDefinition through the reserve CurrencyConverter. As long as the provided reserveConverter has rates between the reserve currency and the current and final CurrencyDefintions, it will provide the result. Errors are raised if any rate is unavailable. The accuracy indicates if decimal values were trimmed when converting the value back to integer.
func (*CurrencyValue) ConvertUsingProtobufDef ¶
func (c *CurrencyValue) ConvertUsingProtobufDef(convertTo *pb.CurrencyDefinition, reserve *CurrencyConverter) (*CurrencyValue, big.Accuracy, error)
ConvertUsingProtobufDef will use the currency code provided in pb.CurrencyDefinition to find the locally defined currency and exchange rate and will convert the amount into target currency. If the divisibility provided by the pb.CurrencyDefinition is different than the one provided for the exchange rate, the converted amount will be adjusted to match the provided divisibility.
func (*CurrencyValue) Equal ¶
func (c *CurrencyValue) Equal(other *CurrencyValue) bool
Equal indicates if the amount and variety of currency is equivalent
func (*CurrencyValue) IsNegative ¶
func (c *CurrencyValue) IsNegative() bool
IsNegative returns true if Amount is valid and less-than zero
func (*CurrencyValue) IsPositive ¶
func (c *CurrencyValue) IsPositive() bool
IsPositive returns true if Amount is valid and greater-than zero
func (*CurrencyValue) IsZero ¶
func (c *CurrencyValue) IsZero() bool
IsZero returns true if Amount is valid and equal to zero
func (*CurrencyValue) MarshalJSON ¶
func (c *CurrencyValue) MarshalJSON() ([]byte, error)
func (*CurrencyValue) MulBigFloat ¶
func (c *CurrencyValue) MulBigFloat(factor *big.Float) (*CurrencyValue, big.Accuracy)
MulBigFloat will multiple the amount and the factor and return the product result cast to a big.Int along with the big.Accuracy of the cast
func (*CurrencyValue) MulBigInt ¶
func (c *CurrencyValue) MulBigInt(factor *big.Int) *CurrencyValue
MulBigInt will multiply the amount and the factor and return the product result
func (*CurrencyValue) Normalize ¶
func (c *CurrencyValue) Normalize() (*CurrencyValue, error)
Normalize updates the CurrencyValue to match the divisibility of the locally defined CurrencyDefinition
func (*CurrencyValue) String ¶
func (c *CurrencyValue) String() string
String returns a string representation of a CurrencyValue
func (*CurrencyValue) SubBigInt ¶
func (c *CurrencyValue) SubBigInt(subtrahend *big.Int) *CurrencyValue
SubBigInt will subtract the subtrahend from the amount and return the value difference
func (*CurrencyValue) UnmarshalJSON ¶
func (c *CurrencyValue) UnmarshalJSON(b []byte) error
func (*CurrencyValue) Valid ¶
func (c *CurrencyValue) Valid() error
Valid returns an error if the CurrencyValue is invalid
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 Messages() MessageStore 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 big.Int) *big.Int
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 ErrCryptocurrencyListingIllegalField ¶
type ErrCryptocurrencyListingIllegalField string
ErrCryptocurrencyListingIllegalField - invalid field err
func (ErrCryptocurrencyListingIllegalField) Error ¶
func (e ErrCryptocurrencyListingIllegalField) Error() string
type ErrCryptocurrencyPurchaseIllegalField ¶
type ErrCryptocurrencyPurchaseIllegalField string
ErrCryptocurrencyPurchaseIllegalField - invalid purchase field err
func (ErrCryptocurrencyPurchaseIllegalField) Error ¶
func (e ErrCryptocurrencyPurchaseIllegalField) Error() string
type ErrMarketPriceListingIllegalField ¶
type ErrMarketPriceListingIllegalField string
ErrMarketPriceListingIllegalField - invalid listing field err
func (ErrMarketPriceListingIllegalField) Error ¶
func (e ErrMarketPriceListingIllegalField) Error() string
type ErrPriceModifierOutOfRange ¶
ErrPriceModifierOutOfRange - customize limits for price modifier
func (ErrPriceModifierOutOfRange) Error ¶
func (e ErrPriceModifierOutOfRange) Error() string
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 { Txid string `json:"txid"` Value *CurrencyValue `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 IndividualListingContainer ¶
type IndividualListingContainer struct {
Listing `json:"listing"`
}
IndividualListingContainer is a wrapper for a single listing
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 *big.Int) error // Return the count for a specific listing including variants GetSpecific(slug string, variantIndex int) (*big.Int, error) // Get the count for all variants of a given listing Get(slug string) (map[int]*big.Int, error) // Fetch all inventory maps for each slug GetAll() (map[string]map[int]*big.Int, 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 Item ¶
type Item struct { ListingHash string `json:"listingHash"` Quantity string `json:"bigQuantity"` Options options `json:"options"` Shipping shippingOption `json:"shipping"` Memo string `json:"memo"` Coupons []string `json:"coupons"` PaymentAddress string `json:"paymentAddress"` }
Item represents a purchased item
type Listing ¶
Listing represents a trade offer which can be accepted by another party on the developertask network
func CreateListing ¶
CreateListing will create a pb Listing
func NewListingFromProtobuf ¶
NewListingFromProtobuf - return Listing from pb.Listing
func UnmarshalJSONListing ¶
UnmarshalJSONListing - unmarshal listing
func UpdateListing ¶
UpdateListing will update a pb Listing
func (*Listing) GetAcceptedCurrencies ¶
GetAcceptedCurrencies returns the listing's list of accepted currency codes
func (*Listing) GetCategories ¶
GetCategories returns a list of categories for the listing
func (*Listing) GetCondition ¶
GetCondition returns listing item condition
func (*Listing) GetContractType ¶
GetContractType returns listing's contract type
func (*Listing) GetCoupons ¶
func (l *Listing) GetCoupons() (ListingCoupons, error)
GetCoupons returns listing coupons with discount amount normalized as a CurrencyValue
func (*Listing) GetCryptoCurrencyCode ¶
GetCryptoCurrencyCode returns the listing crypto currency code
func (*Listing) GetCryptoDivisibility ¶
GetCryptoDivisibility returns the listing crypto divisibility
func (*Listing) GetDescription ¶
GetDescription returns item description
func (*Listing) GetEscrowTimeoutHours ¶
GetEscrowTimeout return listing's escrow timeout in hours
func (*Listing) GetImages ¶
func (l *Listing) GetImages() []*ListingImage
GetImages return set of listing item images
func (*Listing) GetInventory ¶
GetInventory - returns a map of skus and quantityies
func (*Listing) GetLanguage ¶
GetLanguage return listing's language
func (*Listing) GetModerators ¶
GetModerators returns accepted moderators for the listing
func (*Listing) GetNsfw ¶
GetNSFW returns whether the listing is marked as inappropriate for general viewing or otherwise "Not Safe For Work"
func (*Listing) GetPrice ¶
func (l *Listing) GetPrice() (*CurrencyValue, error)
GetPrice returns the listing price. For CRYPTOCURRENCY listings, this value would be zero in the denomination of the cryptocurrency being traded and the item value in all other cases. In the event that the shema version or contract type are unrecognizable, an error is returned.
func (*Listing) GetPriceModifier ¶
GetPriceModifier return listing's price modifier
func (*Listing) GetProcessingTime ¶
GetProcessingTime returns the expected time for vendor to process listing fulfillment
func (*Listing) GetProtobuf ¶
GetProtobuf returns the current state of pb.Listing managed by Listing
func (*Listing) GetRefundPolicy ¶
GetRefundPolicy return the refund policy for the listing
func (*Listing) GetShippingOptions ¶
func (l *Listing) GetShippingOptions() ([]*pb.Listing_ShippingOption, error)
GetShippingOptions returns all shipping options
func (*Listing) GetShippingRegions ¶
GetShippingRegions returns all region strings for the defined shipping services
func (*Listing) GetShortDescription ¶
GetShortDescription returns the item description truncated down to the ShortDescriptionLength maximum
func (*Listing) GetSkus ¶
func (l *Listing) GetSkus() ([]*pb.Listing_Item_Sku, error)
GetSkus returns the listing SKUs
func (*Listing) GetTaxes ¶
func (l *Listing) GetTaxes() ListingTaxes
GetTaxes returns listing tax information
func (*Listing) GetTermsAndConditions ¶
GetTermsAndConditions return the terms for the listings purchase contract
func (*Listing) GetVendorID ¶
GetVendorID returns the vendor peer ID
func (*Listing) GetVersion ¶
GetVersion returns the schema version of the Listing
func (*Listing) GetWeightGrams ¶
GetGrams returns listing item weight in grams
func (*Listing) MarshalJSON ¶
MarshalJSON returns the json serialization of the underlying protobuf
func (*Listing) MarshalProtobuf ¶
MarshalProtobuf returns the byte serialization of the underlying protobuf
func (*Listing) Normalize ¶
Normalize converts legacy schema listing data from other users on the network to fit the latest schema for consumption via the API for local use. NOTE: Legacy nodes do not understand the latest schema. As such, normalized listings must not be used as part of the RicardianContract and must be serialized and used as they were provided by the originating node.
func (*Listing) ProtoMessage ¶
func (*Listing) ProtoMessage()
func (*Listing) SetAcceptedCurrencies ¶
SetAcceptedCurrencies the listing's accepted currency codes. Assumes the node serving the listing has already validated the wallet supports the currencies.
func (*Listing) SetCryptocurrencyListingDefaults ¶
SetCryptocurrencyListingDefaults ensures appropriate defaults are set for Crypto listings
func (*Listing) SetModerators ¶
SetModerators updates the listing's accepted moderators
func (*Listing) Sign ¶
func (l *Listing) Sign(n listingSigner) (*SignedListing, error)
Sign verifies the Listing and returns a SignedListing
func (*Listing) UpdateCouponsFromDatastore ¶
UpdateCouponsFromDatastore will get all coupons from the datastore and update the internal protobuf with the codes that match the coupon's hash, if any.
func (*Listing) ValidateCryptoListing ¶
func (*Listing) ValidateListing ¶
ValidateListing ensures all listing state is valid
func (*Listing) ValidatePurchaseItemOptions ¶
ValidatePurchaseItemOptions ensures item options are valid
func (*Listing) ValidateSkus ¶
ValidateSkus ensures valid SKU state
type ListingCoupon ¶
type ListingCoupon struct {
// contains filtered or unexported fields
}
ListingCoupon represents an coupon which can be applied to a listing for a discount
func (*ListingCoupon) GetAmountOff ¶
func (c *ListingCoupon) GetAmountOff() *CurrencyValue
GetAmountOff returns the value to reduce listing by
func (*ListingCoupon) GetListingSlug ¶
func (c *ListingCoupon) GetListingSlug() string
GetListingSlug returns the slug for the coupon's listing
func (*ListingCoupon) GetPercentOff ¶
func (c *ListingCoupon) GetPercentOff() float32
GetPercentOff returns the percentage amount to reduce listing by
func (*ListingCoupon) GetRedemptionCode ¶
func (c *ListingCoupon) GetRedemptionCode() (string, error)
GetRedemptionCode returns the coupon redemption code
func (*ListingCoupon) GetRedemptionHash ¶
func (c *ListingCoupon) GetRedemptionHash() (string, error)
GetRedemptionHash returns the hashed representation of the code
func (*ListingCoupon) GetTitle ¶
func (c *ListingCoupon) GetTitle() string
GetTitle returns the coupon's title
func (*ListingCoupon) SetRedemptionCode ¶
func (c *ListingCoupon) SetRedemptionCode(code string) error
SetRedemptionCode sets the coupon's redemption code
type ListingCoupons ¶
type ListingCoupons []*ListingCoupon
ListingCoupons is a set of listing coupons
func (ListingCoupons) GetProtobuf ¶
func (cs ListingCoupons) GetProtobuf() []*pb.Listing_Coupon
GetProtobuf converts ListingCoupons into its protobuf representation
type ListingImage ¶
type ListingImage struct {
// contains filtered or unexported fields
}
ListingImage represents the underlying protobuf image
func (*ListingImage) GetFilename ¶
func (i *ListingImage) GetFilename() string
GetFilename returns the image filename
func (*ListingImage) GetLarge ¶
func (i *ListingImage) GetLarge() string
GetLarge returns the image's large size
func (*ListingImage) GetMedium ¶
func (i *ListingImage) GetMedium() string
GetMedium returns the image's medium size
func (*ListingImage) GetOriginal ¶
func (i *ListingImage) GetOriginal() string
GetOriginal returns the image's original size
func (*ListingImage) GetSmall ¶
func (i *ListingImage) GetSmall() string
GetSmall returns the image's small size
func (*ListingImage) GetTiny ¶
func (i *ListingImage) GetTiny() string
GetTiny returns the image's tiny size
func (*ListingImage) SetLarge ¶
func (i *ListingImage) SetLarge(cid string) error
SetLarge updates CID for the large image
func (*ListingImage) SetMedium ¶
func (i *ListingImage) SetMedium(cid string) error
SetMedium updates CID for the medium image
func (*ListingImage) SetOriginal ¶
func (i *ListingImage) SetOriginal(cid string) error
SetOriginal updates CID for the original image
func (*ListingImage) SetSmall ¶
func (i *ListingImage) SetSmall(cid string) error
SetSmall updates CID for the small image
func (*ListingImage) SetTiny ¶
func (i *ListingImage) SetTiny(cid string) error
SetTiny updates CID for the tiny image
func (*ListingImage) String ¶
func (i *ListingImage) String() string
String satisfies Stringer and returns the image filename
type ListingIndexData ¶
type ListingIndexData struct { Hash string `json:"hash"` Slug string `json:"slug"` Title string `json:"title"` Categories []string `json:"categories"` NSFW bool `json:"nsfw"` ContractType string `json:"contractType"` Description string `json:"description"` Thumbnail ListingThumbnail `json:"thumbnail"` Price *CurrencyValue `json:"price"` Modifier float32 `json:"modifier"` ShipsTo []string `json:"shipsTo"` FreeShipping []string `json:"freeShipping"` Language string `json:"language"` AverageRating float32 `json:"averageRating"` RatingCount uint32 `json:"ratingCount"` ModeratorIDs []string `json:"moderators"` AcceptedCurrencies []string `json:"acceptedCurrencies"` CryptoCurrencyCode string `json:"coinType"` }
ListingIndexData reprents a single node in the Listing index
func UnmarshalJSONSignedListingIndex ¶
func UnmarshalJSONSignedListingIndex(data []byte) ([]ListingIndexData, error)
UnmarshalJSONSignedListingIndex consumes a []byte payload of JSON representing a list of SignedListings and returns a parsed instance or an error if the payload cannot be successfully parsed
type ListingMetadata ¶
type ListingMetadata struct {
Version uint `json:"version"`
}
ListingMetadata -
type ListingTax ¶
type ListingTax struct {
// contains filtered or unexported fields
}
ListingTax describes how a listing is taxed in each region
func (ListingTax) GetApplicableRegions ¶
func (t ListingTax) GetApplicableRegions() []string
GetApplicableRegions returns the regions affected by the tax
func (ListingTax) GetTaxableShipping ¶
func (t ListingTax) GetTaxableShipping() bool
GetTaxableShipping indicates whether the shipping is subject to the tax
type ListingThumbnail ¶
type Message ¶
Message - wrapper for pb.Message
func (*Message) GetMessageType ¶
func (m *Message) GetMessageType() pb.Message_MessageType
GetMessageType - return the pb.Message messageType
func (*Message) GetPayload ¶
GetPayload - return the pb.Message payload
func (*Message) MarshalJSON ¶
MarshalJSON - invoke the pb.Message marshaller
func (*Message) UnmarshalJSON ¶
UnmarshalJSON - invoke the pb.Message unmarshaller
type MessageStore ¶
type MessageStore interface { Queryable // Save a new message Put(messageID, orderID string, mType pb.Message_MessageType, peerID string, msg Message, err string, receivedAt int64, pubkey []byte) error // GetByOrderIDType returns the message for specified order and type GetByOrderIDType(orderID string, mType pb.Message_MessageType) (*Message, string, error) // GetAllErrored returns the all messages with error GetAllErrored() ([]OrderMessage, error) // MarkAsResolved sets the message as resolved and will no longer return // with GetAllErrored MarkAsResolved(OrderMessage) error }
MessageStore is the messages table interface
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 *APITime `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 OrderMessage ¶
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 *CurrencyValue `json:"price"` PriceModifier float32 `json:"priceModifier"` 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 *CurrencyValue `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 PeerInfo ¶
type PeerInfo struct {
// contains filtered or unexported fields
}
PeerInfo represents a signed identity on developertask
func NewPeerInfoFromProtobuf ¶
NewPeerInfoFromProtobuf translates a pb.ID protobuf into a PeerInfo
func (*PeerInfo) BitcoinKey ¶
func (*PeerInfo) BitcoinSignature ¶
func (*PeerInfo) GeneratePeerIDFromIdentityKey ¶
func (*PeerInfo) Hash ¶
Hash returns the public hash based on the PeerKeychain.Identity key material
func (*PeerInfo) IdentityKeyBytes ¶
func (*PeerInfo) VerifyBitcoinSignature ¶
VerifyBitcoinSignature checks that the bitcoin key and the peer id both agree
func (*PeerInfo) VerifyIdentity ¶
VerifyIdentity checks that the peer id, identity key both agree
type PeerKeychain ¶
type PeerKeychain struct {
// contains filtered or unexported fields
}
PeerKeychain holds bytes representing key material suitable for extracting with libp2p-crypto
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 Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile presents the user's metadata. The profile state is maintained within a *pb.Profile internally which captures all state changes suitable to be persisted via marshaling to JSON. This struct should ensure the integrity of *pb.Profile to its data as indicated by the set schema version.
func NewProfileFromProtobuf ¶
NewProfileFromProtobuf returns a Profile wrapped around a profile protobuf
func UnmarshalJSONProfile ¶
UnmarshalJSONProfile consumes a JSON byte slice and returns a Profile-wrapped unmarshaled protobuf
func (*Profile) DisableModeration ¶
DisableModeration sets the profile so moderationr is disabled and all fee schedules are removed
func (*Profile) GetModeratedFixedFee ¶
func (p *Profile) GetModeratedFixedFee() (*CurrencyValue, error)
GetModeratedFixedFee returns the fixed CurrencyValue for moderator services currently set on the Profile
func (*Profile) GetProtobuf ¶
GetProtobuf returns the underlying protobuf which represents the persistable state of the profile. (Note: This method is a shim to access data which isn't represented in this package's Profile methods. Consider adding missing getters and setters which repsect the schema version instead of using the protobuf directly for manipulation.)
func (*Profile) GetVersion ¶
GetVersion returns the schema version for the profile protobuf
func (*Profile) IsModerationEnabled ¶
IsModerationEnabled checks if the Moderator flag and info are present
func (*Profile) NormalizeDataForAllSchemas ¶
NormalizeDataForAllSchemas converts existing data from its current schema into legacy schema. This does not guarantee success as legacy schema that was abandoned due to unacceptable constraints will not be able to fulfill the full capability of the newer schema. (Ex: FixedFee.BigAmount can support full precision, whereas FixedFee.Amount is limited to math.MaxInt64
func (*Profile) SetModeratorFixedFee ¶
func (p *Profile) SetModeratorFixedFee(fee *CurrencyValue) error
SetModeratorFixedFee sets the profile to be a moderator with a fixed fee schedule
func (*Profile) SetModeratorFixedPlusPercentageFee ¶
func (p *Profile) SetModeratorFixedPlusPercentageFee(fee *CurrencyValue, percentage float32) error
SetModeratorFixedPlusPercentageFee sets the profile to be a moderator with a fixed fee plus percentage schedule
func (*Profile) SetModeratorPercentageFee ¶
SetModeratorPercentageFee sets the profile to be a moderator with a percentage fee schedule
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 CurrencyValue `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 PurchaseData ¶
type PurchaseData struct { ShipTo string `json:"shipTo"` Address string `json:"address"` City string `json:"city"` State string `json:"state"` PostalCode string `json:"postalCode"` CountryCode string `json:"countryCode"` AddressNotes string `json:"addressNotes"` Moderator string `json:"moderator"` Items []Item `json:"items"` AlternateContactInfo string `json:"alternateContactInfo"` RefundAddress *string `json:"refundAddress"` //optional, can be left out of json PaymentCoin string `json:"paymentCoin"` }
PurchaseData represents purchase request metadata
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 unfunded orders. GetUnfunded() ([]UnfundedOrder, 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 CurrencyValue `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. GetUnfunded() ([]UnfundedOrder, 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 SignedListing ¶
SignedListing represents a finalized listing which has been signed by the vendor
func NewSignedListingFromProtobuf ¶
func NewSignedListingFromProtobuf(sl *pb.SignedListing) SignedListing
func UnmarshalJSONSignedListing ¶
func UnmarshalJSONSignedListing(data []byte) (SignedListing, error)
UnmarshalJSONSignedListing extracts a SignedListing from marshaled JSON
func (SignedListing) GetAcceptedCurrencies ¶
func (l SignedListing) GetAcceptedCurrencies() []string
GetAcceptedCurrencies returns the list of currencies which the listing may be purchased with
func (SignedListing) GetCryptoCurrencyCode ¶
func (l SignedListing) GetCryptoCurrencyCode() string
GetCryptoCurrencyCode returns the currency code of the sold cryptocurrency listing
func (SignedListing) GetCryptoDivisibility ¶
func (l SignedListing) GetCryptoDivisibility() uint32
GetCryptoDivisibility returns the divisibility of a cryptocurrency's listing sold inventory
func (SignedListing) GetListing ¶
func (l SignedListing) GetListing() *Listing
GetListing returns the underlying repo.Listing object
func (SignedListing) GetListingSigProtobuf ¶
func (l SignedListing) GetListingSigProtobuf() *pb.Signature
GetListingSigProtobuf returns the protobuf signature suitable for attaching to a pb.RicardianContract
func (SignedListing) GetPrice ¶
func (l SignedListing) GetPrice() (*CurrencyValue, error)
GetPrice returns the price
func (SignedListing) GetSignature ¶
func (l SignedListing) GetSignature() []byte
GetSignature returns the signature on the listing
func (SignedListing) GetVendorID ¶
func (l SignedListing) GetVendorID() *PeerInfo
GetVendorID returns the PeerInfo for the listing
func (SignedListing) GetVersion ¶
func (l SignedListing) GetVersion() uint32
GetVersion returns the schema version
func (SignedListing) MarshalJSON ¶
func (l SignedListing) MarshalJSON() ([]byte, error)
func (*SignedListing) Normalize ¶
func (l *SignedListing) Normalize() error
Normalize is a helper method which will mutate the listing protobuf in-place but maintain the original signature for external verification purposes.
func (*SignedListing) ProtoMessage ¶
func (*SignedListing) ProtoMessage()
func (*SignedListing) Reset ¶
func (l *SignedListing) Reset()
func (*SignedListing) String ¶
func (l *SignedListing) String() string
func (SignedListing) ValidateListing ¶
func (l SignedListing) ValidateListing(isTestnet bool) error
ValidateListing ensures all listing state is valid
func (SignedListing) VerifySignature ¶
func (l SignedListing) VerifySignature() error
VerifySignature checks the listings signature was produced by the vendor's Identity key and that the key was derived from the vendor's peerID
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 UnfundedOrder ¶
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 }
Source Files ¶
- api_time.go
- buyer_order.go
- chat_message.go
- constants.go
- currency.go
- currency_converter.go
- currency_definition.go
- datastore.go
- dispute.go
- dispute_case_record.go
- dispute_resolution.go
- errors.go
- init.go
- ipfs_keystore.go
- listing.go
- listing_index.go
- message.go
- migration.go
- models.go
- notification.go
- order_confirmation.go
- order_fulfillment.go
- payout_ratio.go
- peer_info.go
- profile.go
- purchase_record.go
- refund.go
- sale_record.go
- signed_listing.go