Documentation
¶
Index ¶
- Variables
- func Query(db *datastore.Datastore) datastore.Query
- type Document
- type KYCData
- type User
- func (u *User) AddOrganization(orgId string)
- func (u *User) AfterCreate() error
- func (u *User) AfterDelete() error
- func (u *User) AfterUpdate(prev *User) error
- func (u *User) BeforeCreate() error
- func (u *User) BeforeUpdate(prev *User) error
- func (u User) Buyer() Buyer
- func (u *User) CalculateBalances(test bool) error
- func (u User) ComparePassword(pass string) bool
- func (u User) Document() mixin.Document
- func (u *User) GetByEmail(email string) error
- func (u *User) GetByUsername(un string) error
- func (u User) HasPassword() bool
- func (u *User) InOrganization(orgId string) bool
- func (u *User) Load(ps []datastore.Property) (err error)
- func (u *User) LoadAffiliateAndPendingFees() error
- func (u *User) LoadOrders() error
- func (u *User) LoadPaymentMethods() error
- func (u *User) LoadReferrals() error
- func (u *User) LoadTokenTransactions() error
- func (u User) Name() string
- func (u *User) Save() (ps []datastore.Property, err error)
- func (u *User) SetPassword(newPassword string) error
- func (u *User) Total() currency.Cents
- func (u *User) Validator() *val.Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var IgnoreFieldMismatch = datastore.IgnoreFieldMismatch
View Source
var (
UserNotFound = errors.New("User not found.")
)
Functions ¶
Types ¶
type Document ¶
type Document struct {
mixin.DocumentSaveLoad `datastore:"-" json:"-"`
// Special Kind Facet
Kind string `search:",facet"`
Id_ string
Email string
EmailPartials string
Username string
UsernamePartials string
FirstName string
FirstNamePartials string
LastName string
LastNamePartials string
Phone string
BillingAddressName string
BillingAddressLine1 string
BillingAddressLine2 string
BillingAddressCity string
BillingAddressStateCode string
BillingAddressState string
BillingAddressCountryCode string
BillingAddressCountry string
BillingAddressPostalCode string
ShippingAddressName string
ShippingAddressLine1 string
ShippingAddressLine2 string
ShippingAddressCity string
ShippingAddressStateCode string
ShippingAddressState string
ShippingAddressCountryCode string
ShippingAddressCountry string
ShippingAddressPostalCode string
CreatedAt float64
UpdatedAt float64
StripeBalanceTransactionId string
StripeCardId string
StripeChargeId string
StripeCustomerId string
StripeLastFour string
KYCStatus string
KYCFlagged string
KYCFrozen string
KYCWalletAddresses string
KYCAddressLine1 string
KYCAddressLine2 string
KYCAddressCity string
KYCAddressStateCode string
KYCAddressState string
KYCAddressCountryCode string
KYCAddressCountry string
KYCAddressPostalCode string
KYCTaxId string
KYCPhone string
KYCGender string
KYCBirthdate string
Test string
}
type KYCData ¶
type KYCData struct {
Flagged bool `json:"flagged,omitempty"`
Frozen bool `json:"frozen,omitempty"`
DateApproved time.Time `json:"dateApproved,omitempty"`
WalletAddresses []string `json:"walletAddresses,omitempty"`
Address Address `json:"address,omitempty"`
Documents []string `json:"documents,omitempty" datastore:"-"`
Documents_ []byte `json:"-" datastore:",noindex"`
TaxId string `json:"taxId,omitempty"`
Phone string `json:"phone,omitempty"`
Birthdate time.Time `json:"birthdate,omitempty"`
Gender string `json:"gender,omitempty"`
EthereumAddress string `json:"ethereumAddress,omitempty"`
EOSPublicKey string `json:"eosPublicKey,omitempty"`
}
type User ¶
type User struct {
mixin.Model[User]
mixin.Salesforce
wallet.WalletHolder
// Crowdstart Id, found in default namespace
Cid string `json:"-"`
Username string `json:"username,omitempty"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Company string `json:"company,omitempty"`
Phone string `json:"phone,omitempty"`
BillingAddress Address `json:"billingAddress,omitempty"`
ShippingAddress Address `json:"shippingAddress,omitempty"`
Email string `json:"email"`
PaypalEmail string `json:"paypalEmail,omitempty"`
PasswordHash []byte `schema:"-" datastore:",noindex" json:"-"`
Organizations []string `json:"-" datastore:",noindex"`
StoreId string `json:"storeId,omitempty"`
WalletPassphrase string `json:"-"`
Facebook struct {
AccessToken string `facebook:"-"`
UserId string `facebook:"id"`
FirstName string `facebook:"first_name"`
LastName string `facebook:"last_name"`
MiddleName string `facebook:"middle_name"`
Name string `facebook:"name" datastore:"-"`
NameFormat string `facebook:"name_format"` // For Chinese, Japanese, and Korean names. Possibly used in the future.
Email string `facebook:"email" datastore:"-"`
Verified bool `facebook:"verified" datastore:"-"`
} `json:"-"`
KYC struct {
KYCData
Status KYCStatus `json:"status,omitempty"`
Hash string `json:"hash"`
} `json:"kyc,omitempty"`
// Account to use for new orders when customer creates new orders
Accounts accounts.Account `json:"-" datastore:",noindex"`
Enabled bool `json:"enabled"` //whether or not the user can login yet
PreApproved bool `json:"preApproved"`
Metadata Map `json:"metadata,omitempty" datastore:"-"`
Metadata_ string `json:"-" datastore:",noindex"`
Referrals []referral.Referral `json:"referrals,omitempty" datastore:"-"`
Referrers []referrer.Referrer `json:"referrers,omitempty" datastore:"-"`
Orders []order.Order `json:"orders,omitempty" datastore:"-"`
PendingFees []fee.Fee `json:"pendingFees,omitempty" datastore:"-"`
PaymentMethods []paymentmethod.PaymentMethod `json:"paymentMethods,omitempty" datastore:"-"`
Affiliate affiliate.Affiliate `json:"affiliate,omitempty" datastore:"-"`
Transactions map[currency.Type]*util.TransactionData `json:"transactions" datastore:"-"`
TokenTransactions []*tokentransaction.Transaction `json:"tokenTransactions" datastore:"-"`
ReferrerId string `json:"referrerId,omitempty"`
// Series of events that have occured relevant to this order
History []Event `json:"-,omitempty" datastore:",noindex"`
IsOwner bool `json:"owner,omitempty" datastore:"-"`
IsAffiliate bool `json:"isAffiliate,omitempty"`
AffiliateId string `json:"affiliateId,omitempty"`
FormId string `json:"formId,omitempty"`
// For Halcyon
Commission commission.Commission `json:"commission"`
Test bool `json:"test"`
}
func (*User) AddOrganization ¶
Save organization to organization slice.
func (*User) AfterCreate ¶
func (*User) AfterDelete ¶
func (*User) AfterUpdate ¶
func (*User) BeforeUpdate ¶
func (*User) CalculateBalances ¶
func (User) ComparePassword ¶
func (*User) GetByEmail ¶
Populates current entity from datastore by Email.
func (*User) GetByUsername ¶
Populates current entity from datastore by Email.
func (User) HasPassword ¶
func (*User) InOrganization ¶
Check if user is part of an organization
func (*User) LoadAffiliateAndPendingFees ¶
func (*User) LoadOrders ¶
func (*User) LoadPaymentMethods ¶
func (*User) LoadReferrals ¶
func (*User) LoadTokenTransactions ¶
func (*User) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.