Documentation
¶
Overview ¶
Package govenmo provides a Venmo client. Use it to retrieve payments, fetch account infromation, make payments, complete charges, and list Venmo friends. You must provide your own OAuth tokens.
Index ¶
- Constants
- Variables
- func EnableLogging(newLogger *log.Logger)
- type Account
- func (a *Account) CompletePayment(paymentId, action string) (updatedPayment Payment, err error)
- func (account *Account) FetchFriends() (friends []User, err error)
- func (a *Account) PayOrCharge(target Target, amount float64, note string, audience string) (sentPayment Payment, err error)
- func (a *Account) PaymentsSince(updatedSince time.Time) (payments []Payment, err error)
- func (a *Account) Refresh() error
- func (a *Account) RefreshPayment(payment *Payment) error
- type Error
- type Pagination
- type Payment
- type Target
- type Time
- type User
Constants ¶
const VenmoTimeFormat = "2006-01-02T15:04:05"
Variables ¶
var Environment string = "production"
var MaxPayment *float64 = nil
Functions ¶
func EnableLogging ¶
Call EnableLogging to start logging. If you pass nil, a default logger will be used. Or, you can pass a Logger instance.
Types ¶
type Account ¶
type Account struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` Balance float64 `json:"balance,string"` ExpiresIn int64 `json:"expires_in"` TokenType string `json:"bearer"` User `json:"user"` }
Account is the basic type used for all API calls in govenmo. To make an API call you should create and Account with valid OAuth tokens. Account includes User.
func (*Account) CompletePayment ¶
CompletePayment allows you to 'approve', 'deny', or 'cancel' a pending charge request.
func (*Account) FetchFriends ¶
FetchFriends retrieves all Venmo friends for an Account. It follows 'next' links.
func (*Account) PayOrCharge ¶
func (a *Account) PayOrCharge(target Target, amount float64, note string, audience string) (sentPayment Payment, err error)
PayOrCharge creates a Venmo payment with the Account as a Actor.
func (*Account) PaymentsSince ¶
PaymentsSince fetches payments for an Account updated since a Time. Note that Venmo's 'updated at' logic is somewhat imprecise. There is currently no way to specify a limit, and PaymentsSince will follow 'next' links to retrieve the entire result set.
func (*Account) Refresh ¶
Refresh retrieves account information, including balance and biographical info from the Venmo api.
func (*Account) RefreshPayment ¶
RefreshPayment updates a Payment object with the most current state from the Venmo API. For multiple requests using PaymentsSince would be advisable.
type Pagination ¶
type Pagination struct {
Next string
}
Pagination stores the 'next' link that indicates a continuation of the Venmo response. This may be incorrect when retrieved from the sandbox environments. This is used internally.
type Payment ¶
type Payment struct { Id string Status string Action string Actor User Amount float64 Audience string DateCompleted *Time `json:"date_completed"` DateCreated *Time `json:"date_created"` Note string Target Target Fee *float64 Refund *string Medium string }
Payment stores a payment retrieved from the Venmo API. See the Venmo API docs.
type Time ¶
Venmo use a time format that's not compatible with Go's default. The custom Time type allows parsing their time format. It is also designed to be insertable into a Postgres DB (see Scan).
func (*Time) UnmarshalJSON ¶
type User ¶
type User struct { Username string `json:"username"` Id string `json:"id"` Email *string `json:"email"` DisplayName string `json:"display_name"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Phone *string `json:"phone"` About string `json:"about"` ProfilePictureUrl string `json:"profile_picture_url"` FriendsCount int64 `json:"friends_count"` IsFriend *bool `json:"is_friend"` DateJoined Time `json:"date_joined"` }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package local_sandbox emulates the Venmo sandbox API for posting payments and charges.
|
Package local_sandbox emulates the Venmo sandbox API for posting payments and charges. |