@leaddreamer/pricinglogic v0.1.0-beta.3
@leaddreamer/ESBusiness
Business Logic for the Events Services system, wrapped around FirebaseWrapper, to be shared between Back and Front End. This particular library only provides the business "logic" - not browser services.
Modules
ESBusiness
Business Logic for the Event Services system, wrapped around FirebaseWrapper, to be shared between Back and Front End. This particular library only provides the business "logic" - not browser services.
- ESBusiness
- static
- .databasePromise(firebase, config, thisLogger) ⇒ Promise.Firebase
- inner
- ~FirebaseConfigObject : object
- static
ESBusiness.databasePromise(firebase, config, thisLogger) ⇒ Promise.Firebase
all-in-one wrapper for a solid subset of CLIENT-SIDE Firebase functions, with a consistent interface. There is a parallel set for ADMIN-SIDE functions as well. Call/initialize with Firebase Configuration settings in an object as described below
Kind: static method of ESBusiness
| Param | Type | Description |
|---|---|---|
| firebase | Firebase | |
| config | FirebaseConfigObject | Firebase Admin object |
| thisLogger | callback |
Example
//this specifically loads ALL the subsections, specifically for
//the Browser. See later (tbd) notes for NodeJS
import FirebaseWrapper from "@leaddreamer/firebase-wrapper";
FirebaseWrapper(config); //see below
export * from "@leaddreamer/firebase-wrapper";ESBusiness~FirebaseConfigObject : object
only authDomain, databaseURL and storageBucket are present when called from a cloud environment
Kind: inner typedef of ESBusiness
Properties
| Name | Type | Description |
|---|---|---|
| apiKey | string | required api Key from Firebase Console, |
| appId | string | required app ID from Firebase Console |
| projectId | string | required Firebase projectID from Firebase console |
| authDomain | string | (optional) auth domain from Firebase Console |
| databaseURL | string | (optional) Firestore database URL from Firebase console |
| storageBucket: | string | (optional) URL of Firestore Storage Bucket |
| messagingSenderId: | string | (optional) ID for Messaing service from Firebase Console |
| measurementId: | string | (optional) Analytics/Measurement ID from Firebase Console |
| mapsAPIKey | string | (optional) App ID for Google Maps API, from Google |
PricingLogic
A collection of Business logic and database functions. Sahred between ReactJS frontEnd and NodeJS BackEnd
Commodities
Typedefs, constants, support functions and database operations related to Commodity Matrials users
- Commodities
- static
- .createCommodity ⇒ Promise.Commodity
- .deleteCommodity(commodity, person) ⇒ Promise.<void>
- .deleteCommodityById(commodity, person) ⇒ Promise.<void>
- .updateCommodityByID(commodity, person) ⇒ promise.Commodity
- .updateCommodity(commodity, person) ⇒ promise.Commodity
- .knownCommodity(Id, person) ⇒ Promise.boolean
- .fetchCommodities(person) ⇒ Array.Commodity
- .fetchCommoditiesPaginated(limit, person) ⇒ PaginatedFetch
- .fetchCommodity(commodityId, person) ⇒ Promise.Commodity
- .fetchCommodityName(commodityId, person) ⇒ Promise.string
- .summarizeCommodity(commodity) ⇒ string
- inner
- ~CommodityDefault : Commodity
- ~CommodityDefaultForm : Commodity
- ~Commodity : object
- ~PaginatedFetch : object
- static
Commodities.createCommodity ⇒ Promise.Commodity
Kind: static constant of Commodities
| Param | Type | Description |
|---|---|---|
| commodity | Commodity | minimal record of user account |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.deleteCommodity(commodity, person) ⇒ Promise.<void>
Kind: static method of Commodities
| Param | Type | Description |
|---|---|---|
| commodity | CommodityDefault | |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.deleteCommodityById(commodity, person) ⇒ Promise.<void>
Kind: static method of Commodities
| Param | Type | Description |
|---|---|---|
| commodity | CommodityDefault | minimal record of user account |
| commodity.Id | string | record Id of account |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.updateCommodityByID(commodity, person) ⇒ promise.Commodity
writes record back to database. Assumes only Id is valid
Kind: static method of Commodities
Returns: promise.Commodity - a copy of the data written
| Param | Type | Description |
|---|---|---|
| commodity | Commodity | a partially-populated commodity record for updates |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.updateCommodity(commodity, person) ⇒ promise.Commodity
writes record back to database. Assumes only Id is valid
Kind: static method of Commodities
Returns: promise.Commodity - a copy of the data written
| Param | Type | Description |
|---|---|---|
| commodity | Commodity | a partially-populated commodity record for updates |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.knownCommodity(Id, person) ⇒ Promise.boolean
Checks if this is a known Commodity Id
Kind: static method of Commodities
Returns: Promise.boolean - true is this Id is in database
| Param | Type | Description |
|---|---|---|
| Id | string | Id value to check |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.fetchCommodities(person) ⇒ Array.Commodity
Fetches ALL Commodity records. Not very useful
Kind: static method of Commodities
| Param | Type | Description |
|---|---|---|
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.fetchCommoditiesPaginated(limit, person) ⇒ PaginatedFetch
Fetchs an object to fetch pages of commodity data, ascending by name, "limit" at a time
Kind: static method of Commodities
Returns: PaginatedFetch - object with pagination methods
| Param | Type | Description |
|---|---|---|
| limit | number | |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.fetchCommodity(commodityId, person) ⇒ Promise.Commodity
Fetches a single Commodity record by Id
Kind: static method of Commodities
| Param | Type | Description |
|---|---|---|
| commodityId | string | |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.fetchCommodityName(commodityId, person) ⇒ Promise.string
Fetches and returns the summarized name from a Commodity record
Kind: static method of Commodities
Returns: Promise.string - the summarized name from the record
| Param | Type | Description |
|---|---|---|
| commodityId | string | |
| person | Person | minimal record of person this commodity belongs to (if any) |
Commodities.summarizeCommodity(commodity) ⇒ string
Returns a standardized formatted name string
Kind: static method of Commodities
Returns: string - formatted name string
| Param | Type |
|---|---|
| commodity | Commodity |
Commodities~CommodityDefault : Commodity
Kind: inner constant of Commodities
Default: {"Id":null,"refPath":null,"description":null,"unit":null,"rate":0,"HighValue":true,"image":null}
Read only: true
Commodities~CommodityDefaultForm : Commodity
Kind: inner constant of Commodities
Default: {"description":"text","unit":"lookup:units","rate":"number","HighValue":"boolean","image":"url"}
Read only: true
Commodities~Commodity : object
a record
Kind: inner typedef of Commodities
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | Id of document (redundant for convenience) |
| refPath | string | if from database, full path to document |
| description | string | description, e.g. "Wire, Silver, Sterling, 20ga" |
| unit | string | usage/measurement unit (for unit conversion) |
| rate | number | the per unit cost of this commodity |
| HighValue | boolean | boolean flag to indicate "High Value" (lower markup) commodities |
| image | url | a reference image for the commodity |
Commodities~PaginatedFetch : object
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of Commodities
Properties
| Name | Type | Description |
|---|---|---|
| Query | Query | that forms basis for the table read |
| limit | number | page size |
| snapshot | QuerySnapshot | last successful snapshot/page fetched |
| status | enum | status of pagination object |
| PageForward | method | pages the fetch forward |
| PageBack | method | pages the fetch backward |
LineItems
Typedefs, constants, support functions and database operations related to LineItem Matrials users
- LineItems
- static
- .createLineItem ⇒ Promise.LineItem
- .deleteLineItem(lineItem) ⇒ Promise.<void>
- .deleteLineItemById(lineItem, minimal) ⇒ Promise.<void>
- .updateLineItemByID(lineItem, product) ⇒ promise.LineItem
- .updateLineItem(lineItem, product) ⇒ promise.LineItem
- .knownLineItem(Id, product) ⇒ Promise.boolean
- .fetchLineItems() ⇒ Array.LineItem
- .fetchProductLineItems(product, stage) ⇒ Array.LineItem
- .paginateProductLineItems(product, stage, limit) ⇒ PaginatedFetch
- .fetchLineItem(lineItemId, product) ⇒ Promise.LineItem
- .fetchLineItemName(lineItemId, product) ⇒ Promise.string
- .summarizeLineItem(lineItem) ⇒ string
- inner
- ~LineItemDefault : LineItem
- ~LineItemDefaultForm : LineItem
- ~LineItem : object
- ~PaginatedFetch : object
- static
LineItems.createLineItem ⇒ Promise.LineItem
Kind: static constant of LineItems
| Param | Type | Description |
|---|---|---|
| lineItem | LineItem | minimal record of user account |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.deleteLineItem(lineItem) ⇒ Promise.<void>
Kind: static method of LineItems
| Param | Type |
|---|---|
| lineItem | LineItemDefault |
LineItems.deleteLineItemById(lineItem, minimal) ⇒ Promise.<void>
Kind: static method of LineItems
| Param | Type | Description |
|---|---|---|
| lineItem | LineItemDefault | minimal record of lineItem in question |
| lineItem.Id | string | record Id of account |
| minimal | Product | record of product this lineItem belongs to |
LineItems.updateLineItemByID(lineItem, product) ⇒ promise.LineItem
writes record back to database. Assumes only Id is valid
Kind: static method of LineItems
Returns: promise.LineItem - a copy of the data written
| Param | Type | Description |
|---|---|---|
| lineItem | LineItem | a minimal lineItem record for updates |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.updateLineItem(lineItem, product) ⇒ promise.LineItem
writes record back to database. Assumes only Id is valid
Kind: static method of LineItems
Returns: promise.LineItem - a copy of the data written
| Param | Type | Description |
|---|---|---|
| lineItem | LineItem | a partially-populated lineItem record for updates |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.knownLineItem(Id, product) ⇒ Promise.boolean
Checks if this is a known LineItem Id
Kind: static method of LineItems
Returns: Promise.boolean - true is this Id is in database
| Param | Type | Description |
|---|---|---|
| Id | string | Id value to check |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.fetchLineItems() ⇒ Array.LineItem
Fetches ALL LineItem records. Not very useful
Kind: static method of LineItems
LineItems.fetchProductLineItems(product, stage) ⇒ Array.LineItem
Fetches ALL LineItem records for a specific product. Not very useful
Kind: static method of LineItems
| Param | Type | Description |
|---|---|---|
| product | Product | minimal record of product this lineItem belongs to |
| stage | Stage | optional stage selection, to get a subset of the line items |
LineItems.paginateProductLineItems(product, stage, limit) ⇒ PaginatedFetch
Fetchs an object to fetch pages of lineItem data, ascending by name, "limit" at a time
Kind: static method of LineItems
Returns: PaginatedFetch - object with pagination methods
| Param | Type | Description |
|---|---|---|
| product | Product | |
| stage | Stage | optional stage selection, to get a subset of the line items |
| limit | number |
LineItems.fetchLineItem(lineItemId, product) ⇒ Promise.LineItem
Fetches a single LineItem record by Id
Kind: static method of LineItems
| Param | Type | Description |
|---|---|---|
| lineItemId | string | |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.fetchLineItemName(lineItemId, product) ⇒ Promise.string
Fetches and returns the summarized name from a LineItem record
Kind: static method of LineItems
Returns: Promise.string - the summarized name from the record
| Param | Type | Description |
|---|---|---|
| lineItemId | string | |
| product | Product | minimal record of product this lineItem belongs to |
LineItems.summarizeLineItem(lineItem) ⇒ string
Returns a standardized formatted name string
Kind: static method of LineItems
Returns: string - formatted name string
| Param | Type |
|---|---|
| lineItem | LineItem |
LineItems~LineItemDefault : LineItem
Kind: inner constant of LineItems
Default: {"Id":null,"refPath":null,"stage":"fabrication","commodity":null,"description":null,"unit":null,"rate":0,"amount":0,"HighValue":true,"image":null}
Read only: true
LineItems~LineItemDefaultForm : LineItem
Kind: inner constant of LineItems
Default: {"product":"lookup","stage":"lookup","commodity":"lookupLink","description":"text","unit":"lookup:units","rate":"number","amount":"number","HighValue":"boolean","image":"url"}
Read only: true
LineItems~LineItem : object
a record
Kind: inner typedef of LineItems
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | Id of document (redundant for convenience) |
| refPath | string | if from database, full path to document |
| stage | string | "fabrication", "wholesale", or other to be defined |
| commodity | null | string | Id of a commodity item/material (optional) |
| description | string | null | description, e.g. "Wire, Silver, Sterling, 20ga" |
| unit | string | null | usage/measurement unit (for unit conversion) |
| rate | number | the per unit cost of this lineItem |
| amount | number | amount of material/item useed |
| HighValue | boolean | boolean flag to indicate "High Value" (lower markup) commodities |
| timestamp | datetime | initial time of creation for sorting |
| image | url | null | a reference image for the lineItem |
LineItems~PaginatedFetch : object
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of LineItems
Properties
| Name | Type | Description |
|---|---|---|
| Query | Query | that forms basis for the table read |
| limit | number | page size |
| snapshot | QuerySnapshot | last successful snapshot/page fetched |
| status | enum | status of pagination object |
| PageForward | method | pages the fetch forward |
| PageBack | method | pages the fetch backward |
Payment
"Payment Descriptor" handling operations. These descriptors represent paymentMethods, each tied to an individual user. These do not particularly represent a paymentProvider - they are meant as an abstraction above a specific payment processor.
- Payment
- static
- .ERROR_TYPES : Object
- .PaymentDefault : PaymentData
- .paymentDescriptor : PaymentDescriptorType
- .receiptDefault : ReceiptType
- .createPaymentRecord(account, batch) ⇒ Promise.<(WriteBatch|Transaction|void)>
- .savePaymentData(paymentData)
- .fetchPayment(account, paymentData)
- .fetchPaymentByPerson(accountId, type, paymentData)
- .addPaymentDescriptor(account, descriptor, batch) ⇒ Promise.PaymentDescriptorType
- .savePaymentDescriptor(descriptor) ⇒ Promise.PaymentDescriptorType
- .removePaymentDescriptor(account, descriptor) ⇒ Promise.<void>
- .fetchPaymentDescriptors(account) ⇒ Promise.Array.PaymentDescriptor
- .listPDSummaries(account) ⇒ Promise.Array.PDSummary
- .fetchLatestPDSummary(account) ⇒ Promise.PaymentDescriptorType
- .fetchPDByFingerprint(account, fingerprint) ⇒ Promise.<PDSummary>
- .fetchPDByOwnerType(accountId, type, fingerprint) ⇒ Promise.<PDSummary>
- .replaceDefaultPDSummary(account, PDSummary) ⇒ Promise.AccountObject
- .saveReceiptRecord(account, receipt, batch) ⇒ Promise.ReceiptType
- .updateReceipt(receipt) ⇒ Promise.ReceiptType
- .saveReceiptRecordByOwnerType(ownerId, type, receipt, batch) ⇒ Promise.ReceiptType
- .anyReceiptsByMonthStamp(account, monthStamp) ⇒ Promise.Array.ReceiptType
- .saveReceiptRecordByChild(child, receipt, batch) ⇒ Promise.ReceiptType
- .fetchReceiptsFiltered(account, filterArray, sortArray, limit) ⇒ Promise.Array.ReceiptType
- .fetchProblemReceipts(account) ⇒ Promise.Array.ReceiptType
- .fetchPledgeTicketReceipt(pledgeTicket) ⇒ Promise.ReceiptType
- .markReceiptFromPledgeTicket(pledgeTicket, label) ⇒ Promise.ReceiptType
- .markReceipt(receipt, label) ⇒ Promise.ReceiptType
- inner
- ~fetchReceipt(account, receiptId) ⇒ Promise.ReceiptType
- ~PaymentData : object
- ~PaymentDescriptorType : object
- ~PDSummary : object
- ~ReceiptType : object
- ~AccountObject : OrganizationType | PersonObject
- static
Payment.ERROR_TYPES : Object
Kind: static constant of Payment
Payment.PaymentDefault : PaymentData
Kind: static constant of Payment
Payment.paymentDescriptor : PaymentDescriptorType
Kind: static constant of Payment
Payment.receiptDefault : ReceiptType
Kind: static constant of Payment
Payment.createPaymentRecord(account, batch) ⇒ Promise.<(WriteBatch|Transaction|void)>
Creates the Organization Payment information document
Kind: static method of Payment
Returns: Promise.<(WriteBatch|Transaction|void)> - WriteBatch, Transaction or Void
| Param | Type | Description |
|---|---|---|
| account | AccountObject | |
| batch | WriteBatch | Transaction | batching object. Transaction will be added to the batch |
Payment.savePaymentData(paymentData)
Saves a payment data record to a given account (organization or person) ALL OF fans, artists and venues save the payment data in the same collection name under the parent, with the SAME Id as the parent PaymentData COMES FROM payement processor, and should INCLUDE the record Id and refPath
Kind: static method of Payment
| Param | Type |
|---|---|
| paymentData | PaymentDataRecord |
Payment.fetchPayment(account, paymentData)
fetches a paymentData record from the database for an account ALL OF fans, artists and venues, etc save the payment data in the same collection name under the parent, with the SAME Id as the parent
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| paymentData | Promise.PaymentData |
Payment.fetchPaymentByPerson(accountId, type, paymentData)
fetches a paymentData record from the database for an account when only accountID and type are known ALL OF fans, artists and venues save the payment data in the same collection name under the parent, with the SAME Id as the parent
Kind: static method of Payment
| Param | Type |
|---|---|
| accountId | string |
| type | string |
| paymentData | Promise.PaymentData |
Payment.addPaymentDescriptor(account, descriptor, batch) ⇒ Promise.PaymentDescriptorType
Adds a specific paymentDescriptor to an account payment data
Kind: static method of Payment
| Param | Type | Description |
|---|---|---|
| account | AccountType | |
| account.Id | string | |
| account.refPath | string | |
| descriptor | PaymentDescriptorType | |
| descriptor.paymentMethod | string | |
| descriptor.fingerprint | string | |
| descriptor.label | string | |
| batch | WriteBatch | Transaction | batching object. Transaction will be added to the batch |
Payment.savePaymentDescriptor(descriptor) ⇒ Promise.PaymentDescriptorType
Saves a modified paymentDescriptor back to the database
Kind: static method of Payment
| Param | Type |
|---|---|
| descriptor | PaymentDescriptorType |
| descriptor.Id | string |
| descriptor.refPath | string |
Payment.removePaymentDescriptor(account, descriptor) ⇒ Promise.<void>
Removes a paymentDescriptor from an account's paymentData
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| descriptor | PaymentDescriptorType |
Payment.fetchPaymentDescriptors(account) ⇒ Promise.Array.PaymentDescriptor
fetch all customer card records IN OUR DATABASE (not payment database)
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| account.refPath | string |
Payment.listPDSummaries(account) ⇒ Promise.Array.PDSummary
fetch the front-end list of paymentDescriptors
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| account.Id | string |
| account.refPath | string |
Payment.fetchLatestPDSummary(account) ⇒ Promise.PaymentDescriptorType
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| account.Id | string |
| account.refPath | string |
Payment.fetchPDByFingerprint(account, fingerprint) ⇒ Promise.<PDSummary>
retreives a PD, given the account Id and Type
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| fingerprint | string |
Payment.fetchPDByOwnerType(accountId, type, fingerprint) ⇒ Promise.<PDSummary>
retreives a PD, given the account Id and Type
Kind: static method of Payment
| Param | Type |
|---|---|
| accountId | string |
| type | string |
| fingerprint | string |
Payment.replaceDefaultPDSummary(account, PDSummary) ⇒ Promise.AccountObject
Copies a PDSummary tobe the new default (convenience function)
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountType |
| PDSummary | PDSummary |
Payment.saveReceiptRecord(account, receipt, batch) ⇒ Promise.ReceiptType
Savess a Receipt to an account
Kind: static method of Payment
| Param | Type | Description |
|---|---|---|
| account | AccountType | |
| receipt | ReceiptType | |
| batch | WriteBatch | Transaction | batching object. Transaction will be added to the batch |
Payment.updateReceipt(receipt) ⇒ Promise.ReceiptType
Updates a (changed?) Receipt record
Kind: static method of Payment
| Param | Type |
|---|---|
| receipt | ReceiptType |
Payment.saveReceiptRecordByOwnerType(ownerId, type, receipt, batch) ⇒ Promise.ReceiptType
Saves a new receipt to an account referrred by ID and type
Kind: static method of Payment
| Param | Type | Description |
|---|---|---|
| ownerId | string | |
| type | string | either ORGANIZATIONS or PEOPLE |
| receipt | ReceiptType | |
| batch | WriteBatch | Transaction | batching object. Transaction will be added to the batch |
Payment.anyReceiptsByMonthStamp(account, monthStamp) ⇒ Promise.Array.ReceiptType
Fetches an array of receipts in any particular month by monthStampt
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountObject |
| monthStamp | dateString |
Payment.saveReceiptRecordByChild(child, receipt, batch) ⇒ Promise.ReceiptType
Saves a receipt by a child record reference
Kind: static method of Payment
| Param | Type | Description |
|---|---|---|
| child | RecordDocument | |
| receipt | ReceiptType | |
| batch | WriteBatch | Transaction | batching object. Transaction will be added to the batch |
Payment.fetchReceiptsFiltered(account, filterArray, sortArray, limit) ⇒ Promise.Array.ReceiptType
Fetches receipts based on a filter set
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountObject |
| account.refPath | string |
| filterArray | Array.filterObject |
| sortArray | Array.sortObject |
| limit | number |
Payment.fetchProblemReceipts(account) ⇒ Promise.Array.ReceiptType
Kind: static method of Payment
| Param | Type |
|---|---|
| account | AccountObject |
| account.refPath | string |
Payment.fetchPledgeTicketReceipt(pledgeTicket) ⇒ Promise.ReceiptType
Fetches the receipt for a pledgeTicket
Kind: static method of Payment
| Param | Type |
|---|---|
| pledgeTicket | PledgeTicket |
Payment.markReceiptFromPledgeTicket(pledgeTicket, label) ⇒ Promise.ReceiptType
Changes the paidQ label on a receipt associated with a pledgeTicket
Kind: static method of Payment
| Param | Type |
|---|---|
| pledgeTicket | pledgeTicketType |
| label | string |
Payment.markReceipt(receipt, label) ⇒ Promise.ReceiptType
Changes the paidQ label on a receipt associated with a pledgeTicket
Kind: static method of Payment
| Param | Type |
|---|---|
| receipt | receiptType |
| label | string |
Payment~fetchReceipt(account, receiptId) ⇒ Promise.ReceiptType
Kind: inner method of Payment
| Param | Type |
|---|---|
| account | AccountObject |
| account.refPath | string |
| receiptId | string |
Payment~PaymentData : object
Kind: inner typedef of Payment
Properties
| Name | Type |
|---|---|
| Id | string |
| payment_gateway | string |
| status | string |
Payment~PaymentDescriptorType : object
Kind: inner typedef of Payment
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | document Id of this Card Descriptor (same as fingerprint) |
| paymentMethod | string | Id of payment system card item |
| fingerprint | string | Unique hash of card info - for checking uniqueness |
| label | string | Brand & last4, or other descriptive |
| expiry | string | expiry date of payment method (if any) |
| timestamp | timestamp | last create or modify server time |
Payment~PDSummary : object
Kind: inner typedef of Payment
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | document Id of this Card Descriptor |
| label | string | Brand & last4, or other descriptive |
Payment~ReceiptType : object
Kind: inner typedef of Payment
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | same Id as the associated pledgeTicket |
| amount | number | |
| payment | object | |
| link | string | Id of associated payment_intent |
| paidQ | string | string describing status |
| description | string | supplemental information |
Payment~AccountObject : OrganizationType | PersonObject
Kind: inner typedef of Payment
People
Typedefs, constants, support functions and database operations related to individual users
- People
- static
- .createPerson ⇒ Promise.PersonObject
- .deletePerson(person) ⇒ Promise.<void>
- .deletePersonById(person) ⇒ Promise.<void>
- .buildPersonRecords(user) ⇒ Promise.<void>
- .updatePersonByID(person) ⇒ promise.PeopleObject
- .updatePerson(person) ⇒ promise.PeopleObject
- .knownPerson(Id) ⇒ Promise.boolean
- .fetchPeople() ⇒ Array.PeopleObject
- .fetchPeoplePaginated(limit) ⇒ PaginatedFetch
- .fetchAnonymousPaginated(limit) ⇒ PaginatedFetch
- .fetchPerson(personId) ⇒ Promise.PeopleObject
- .fetchPersonName(personId) ⇒ Promise.string
- .fetchPersonEmail(personId) ⇒ Promise.string
- .fetchPersonPaymentById(personId) ⇒ Promise.PaymentData
- .fetchUserByEmail(email) ⇒ Promise.PeopleObject
- .fetchFullPerson(personIdentifier) ⇒ Promise.PeopleObject
- .summarizePerson(person) ⇒ string
- .fetchPersonFromChild(child) ⇒ Promise.PeopleObject
- .personFromId(personId) ⇒ PeopleObject
- inner
- ~PeopleDefault : PersonObject
- ~PeopleDefaultForm : PersonObject
- ~PersonObject : object
- ~PaginatedFetch : object
- static
People.createPerson ⇒ Promise.PersonObject
Kind: static constant of People
| Param | Type | Description |
|---|---|---|
| person | PersonObject | minimal record of user account |
People.deletePerson(person) ⇒ Promise.<void>
Kind: static method of People
| Param | Type |
|---|---|
| person | PersonObject |
People.deletePersonById(person) ⇒ Promise.<void>
Kind: static method of People
| Param | Type | Description |
|---|---|---|
| person | PersonObject | minimal record of user account |
| person.Id | string | record Id of account |
People.buildPersonRecords(user) ⇒ Promise.<void>
Builds a Person record from the authentication "user" data
Kind: static method of People
| Param | Type |
|---|---|
| user | User |
| user.isAnonymous | boolean |
| user.displayName | string |
| user.photoURL | string |
| user.email | string |
| user.phoneNumber | string |
People.updatePersonByID(person) ⇒ promise.PeopleObject
writes record back to database. Assumes only Id is valid
Kind: static method of People
Returns: promise.PeopleObject - a copy of the data written
| Param | Type | Description |
|---|---|---|
| person | PeopleObject | a partially-populated people record for updates |
People.updatePerson(person) ⇒ promise.PeopleObject
writes record back to database. Assumes only Id is valid
Kind: static method of People
Returns: promise.PeopleObject - a copy of the data written
| Param | Type | Description |
|---|---|---|
| person | PeopleObject | a partially-populated people record for updates |
People.knownPerson(Id) ⇒ Promise.boolean
Checks if this is a known PersonObject Id
Kind: static method of People
Returns: Promise.boolean - true is this Id is in database
| Param | Type | Description |
|---|---|---|
| Id | string | Id value to check |
People.fetchPeople() ⇒ Array.PeopleObject
Fecthes ALL people records. Not very useful
Kind: static method of People
People.fetchPeoplePaginated(limit) ⇒ PaginatedFetch
Fetchs an object to fetch pages of people data, ascending by name, "limit" at a time
Kind: static method of People
Returns: PaginatedFetch - object with pagination methods
| Param | Type |
|---|---|
| limit | number |
People.fetchAnonymousPaginated(limit) ⇒ PaginatedFetch
Fetchs an object to fetch pages of anonymous people data, ascending by name, "limit" at a time
Kind: static method of People
Returns: PaginatedFetch - object with pagination methods
| Param | Type |
|---|---|
| limit | number |
People.fetchPerson(personId) ⇒ Promise.PeopleObject
Fetches a single PeopleObject record by Id
Kind: static method of People
| Param | Type |
|---|---|
| personId | string |
People.fetchPersonName(personId) ⇒ Promise.string
Fetches and returns the summarized name from a PeopleObject record
Kind: static method of People
Returns: Promise.string - the summarized name from the record
| Param | Type |
|---|---|
| personId | string |
People.fetchPersonEmail(personId) ⇒ Promise.string
Fetches and returns the email from a PeopleObject record
Kind: static method of People
Returns: Promise.string - the email from the record
| Param | Type |
|---|---|
| personId | string |
People.fetchPersonPaymentById(personId) ⇒ Promise.PaymentData
Fetches the PaymentRecord for a person using just the ID
Kind: static method of People
| Param | Type |
|---|---|
| personId | string |
People.fetchUserByEmail(email) ⇒ Promise.PeopleObject
Fetch a People record by their email
Kind: static method of People
| Param | Type |
|---|---|
| string |
People.fetchFullPerson(personIdentifier) ⇒ Promise.PeopleObject
fetches a full person object (address, payment, private, etc) given EITHER just the Id, OR a PersonObject
Kind: static method of People
| Param | Type |
|---|---|
| personIdentifier | string | PersonObject |
| personIdentifier.Id | string |
People.summarizePerson(person) ⇒ string
Returns a standardized formatted name string
Kind: static method of People
Returns: string - formatted name string
| Param | Type |
|---|---|
| person | PeopleObject |
People.fetchPersonFromChild(child) ⇒ Promise.PeopleObject
Fetches a PersonObject from any child record in any branch
Kind: static method of People
| Param | Type |
|---|---|
| child | RecordDocument |
People.personFromId(personId) ⇒ PeopleObject
builds a minimal PeopleObject from an Id
Kind: static method of People
| Param | Type |
|---|---|
| personId | string |
People~PeopleDefault : PersonObject
Kind: inner constant of People
Default: {"Id":null,"refPath":null,"name":null,"email":null,"tel":null,"isAnonymous":true,"payment_method":null,"admin_status":null}
Read only: true
People~PeopleDefaultForm : PersonObject
Kind: inner constant of People
Default: {"name":"text","email":"email","tel":"tel"}
Read only: true
People~PersonObject : object
Kind: inner typedef of People
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | Id of document from storage |
| refPath | string | if from database, full path to document |
| first_name | string | could be "Anonymous" |
| last_name | string | |
| isAnonymous | boolean | flag indicating auto-generated Anonymous user account |
| image | url | URL (possibly in app storage) of User image |
| region | string | User home region, from fixed list |
| social_links | url | array of user social account links |
| bio | string | user-maintained biography |
| website | url | URL to user personal website |
| payment_method | string | summary string of user payment method. Not secure, not source-of-truth |
| payment | PaymentData | when "full account" |
People~PaginatedFetch : object
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of People
Properties
| Name | Type | Description |
|---|---|---|
| Query | Query | that forms basis for the table read |
| limit | number | page size |
| snapshot | QuerySnapshot | last successful snapshot/page fetched |
| status | enum | status of pagination object |
| PageForward | method | pages the fetch forward |
| PageBack | method | pages the fetch backward |
Product
Typedefs, constants, support functions and database operations related to Products
- Product
- static
- .saveProduct(person) ⇒ Promise.<void>
- inner
- ~ProductDefault : Product
- ~ProductDefaultForm : Product
- ~Product : object
- static
Product.saveProduct(person) ⇒ Promise.<void>
Saves a Product object to the database
Kind: static method of Product
| Param | Type | Description |
|---|---|---|
| person | Person | minimal record of person this commodity belongs to (if any) |
Properties
| Name | Type |
|---|---|
| product | Product |
Product~ProductDefault : Product
Kind: inner constant of Product
Default: {"Id":null,"refPath":null,"name":""}
Read only: true
Product~ProductDefaultForm : Product
Kind: inner constant of Product
Default: {"name":"text"}
Read only: true
Product~Product : object
a record
Kind: inner typedef of Product
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | Id of document (redundant for convenience) |
| refPath | string | if from database, full path to document |
| name | number | name for the Product |
Stages
Typedefs, constants, support functions and database operations related to product creation stages users
- Stages
- static
- .saveStage(parent) ⇒ Promise.<void>
- inner
- ~StageDefault : Stage
- ~StageDefaultForm : Stage
- ~Stage : object
- static
Stages.saveStage(parent) ⇒ Promise.<void>
Saves a default Stage Settings object to the database
Kind: static method of Stages
| Param | Type | Description |
|---|---|---|
| parent | Person | Product | minimal record of person this commodity belongs to (if any) |
Properties
| Name | Type |
|---|---|
| stage | Stage |
Stages~StageDefault : Stage
Kind: inner constant of Stages
Default: {"Id":null,"refPath":null,"base":2.5,"highValue":1.5,"overhead":5,"rate":20,"unit":"hour","hours":0,"minutes":0,"stage":"fabrication"}
Read only: true
Stages~StageDefaultForm : Stage
Kind: inner constant of Stages
Default: {"base":"number","highValue":"number","overhead":"number","rate":"number","unit":"lookup","hours":"number","minutes":"number","stage":"lookup"}
Read only: true
Stages~Stage : object
a record
Kind: inner typedef of Stages
Properties
| Name | Type | Description |
|---|---|---|
| Id | string | Id of document (redundant for convenience) |
| refPath | string | if from database, full path to document |
| base | number | Multiplier/Markup from this stage to the next |
| highValue | number | Multiplier/Markup for hgih value materials/items from this stage to the next |
| overhead | number | unit charge for business overhead |
| rate | number | unit charge for direct labor expenses |
| unit | string | lookup unit of measure for overhead and rate |
| hours | number | actual hours of labor at this stage |
| minutes | number | actual minutes of labor at this stage |
| stage | number | lookup name of corresponding production stage |
Boilerplate
Shared constants and symbols
Boilerplate.recordByIdAndType ⇒ AccountType
creates and returns a minimal record from an Id and type
Kind: static constant of Boilerplate
| Param | Type |
|---|---|
| Id | string |
| Type | string |
© 2020-2023 Tracy Hall / Dreams and Logic Inc / SaltSweetSpirits
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
9 months ago
9 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago