Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mleone10/artspeople
Arts People Line Item Reconciliation Report parser library
https://github.com/mleone10/artspeople
arts-people csv line-item-reconciliation-report parser theater
Last synced: 11 days ago
JSON representation
Arts People Line Item Reconciliation Report parser library
- Host: GitHub
- URL: https://github.com/mleone10/artspeople
- Owner: mleone10
- License: mit
- Created: 2021-01-16T20:00:40.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T04:54:30.000Z (almost 4 years ago)
- Last Synced: 2024-11-09T23:12:56.610Z (2 months ago)
- Topics: arts-people, csv, line-item-reconciliation-report, parser, theater
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Arts People Line Item Reconciliation Report Parser
This package provides a parser for the [Arts People](https://www.arts-people.com/) Line Item Reconciliation report.
```
package artspeople // import "github.com/mleone10/artspeople"Package artspeople provides a parser for the Arts People Line Item
Reconciliation Report. To create an instantiated LineItemReconReport struct,
provide the text of the report's CSV representation into the
NewLineItemReconReport() function.TYPES
type Currency int64
A Currency is a representation of money within Arts People. Since we're
parsing these from strings, we have some flexibility around how we represent
these values.func NewCurrencyFromString(s string) (Currency, error)
NewCurrencyFromString converts a string into a cents-only representation of
a USD monetary amount. This is apparently "Martin Fowler's method".type LineItem struct {
OrderID int
DateTime time.Time
ItemName string
Customer string
Price Currency
Fees Currency
PurchaseTotal Currency
PaymentMethod string
GCUsed string // Maybe not used?
Username string
// Has unexported fields.
}
A LineItem represents a single piece of an order, such as a ticket,
membership, donation, or payment.func NewLineItem(rawLine []string) (*LineItem, error)
NewLineItem accepts an array of strings read in from the original CSV and
returns an initiatlized LineItem.func (li *LineItem) IsPayment() bool
IsPayment returns true if the given LineItem pertains to a payment.type LineItemReconReport struct {
Orders map[int]*Order
// Has unexported fields.
}
A LineItemReconReport is a parsed and type-normalized version of the Line
Item Reconciliation Report downloaded from Arts People.func NewLineItemReconReport(reportCsv io.Reader) (*LineItemReconReport, error)
NewLineItemReconReport accepts an Arts People Line Item Reconciliation
Report as an io.Reader and returns a fully parsed and type-normalized
LineItemReconReport.func (l *LineItemReconReport) GetCustomers() []string
GetCustomers returns a slice of all unique customers who have an order in
the report.func (l *LineItemReconReport) GetItems() []string
GetItems returns a slice of all item names mentioned in the report.type Order struct {
LineItems []*LineItem
}
An Order represents all details of a single interaction with a customer,
including all items purchased and the payment method. TODO: Consider
converting from a struct to a type alias ([]*LineItem)func NewOrder() *Order
NewOrder returns an instantiated Order.func (o *Order) AddLineItem(li *LineItem)
AddLineItem appends a LineItem to the given Order.func (o *Order) GetCustomer() string
GetCustomer returns the customer whose name is attached to the items in this
order. Sample data suggests that, while each LineItem has its own customer
field, they are all identical.func (o *Order) GetItems() []string
GetItems returns a slice of all items contained within the order, excluding
payments.
```