dwolla

package module
v0.0.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: MIT Imports: 13 Imported by: 0

README

dwolla-go

Golang SDK for Dwolla

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoID = errors.New("unable to extract ID")

ErrNoID ...

Functions

func ExtractIDFromLocation added in v0.0.8

func ExtractIDFromLocation(location string) (string, error)

ExtractIDFromLocation takes an HREF link and returns the ID at the end of the HREF. This is useful for processing webhooks where you have an HREF, but need to make calls using this SDK, which expects bare IDs.

If the input HREF is malformed, or this function is unable to extract the ID, ErrNoID will be returned.

func MassPaymentHandler added in v0.0.8

func MassPaymentHandler(paymentConfig *customer) *customer

MassPaymentHandler is used to create/update mass payment requests

Types

type AboutLink struct {
	About Link `json:"about"`
}

type AccountDetailsResponse

type AccountDetailsResponse struct {
	Links struct {
		Self           Link `json:"self"`
		Receive        Link `json:"receive"`
		FundingSources Link `json:"funding-sources"`
		Transfers      Link `json:"transfers"`
		Customers      Link `json:"customers"`
		Send           Link `json:"send"`
	} `json:"_links"`
	Id   string `json:"id"`
	Name string `json:"name"`
}
type AccountLink struct {
	Account Link `json:"account"`
}

type Address added in v0.0.9

type Address struct {
	Address1            string `json:"address1"`
	Address2            string `json:"address2,omitempty"`
	Address3            string `json:"address3,omitempty"`
	City                string `json:"city"`
	StateProvinceRegion string `json:"stateProvinceRegion"`
	PostalCode          string `json:"postalCode,omitempty"`
	Country             string `json:"country"`
}

Address represents a street address

type AllFailureReasons added in v0.0.23

type AllFailureReasons struct {
	Reason      string `json:"reason"`
	Description string `json:"description"`
}

type Amount added in v0.0.7

type Amount struct {
	Value    string   `json:"value"`
	Currency Currency `json:"currency"`
}

Amount stores the amount object required by dwolla

type BeneficialOwner added in v0.0.17

type BeneficialOwner struct {
	Links              SelfLink `json:"_links"`
	ID                 string   `json:"id"`
	FirstName          string   `json:"firstName"`
	LastName           string   `json:"lastName"`
	Address            Address  `json:"address"`
	Passport           Passport `json:"passport"`
	VerificationStatus string   `json:"verificationStatus"`
	Created            string   `json:"created"`
}

type BeneficialOwnerRequest added in v0.0.17

type BeneficialOwnerRequest struct {
	ID          string    `json:"id,omitempty"`
	FirstName   string    `json:"firstName,omitempty"`
	LastName    string    `json:"lastName,omitempty"`
	DateOfBirth string    `json:"dateOfBirth,omitempty"`
	SSN         string    `json:"ssn,omitempty"`
	Address     Address   `json:"address,omitempty"`
	Passport    *Passport `json:"passport,omitempty"`
	Location    string    `json:"location,omitempty"`
}

type BeneficialOwnersResponse added in v0.0.17

type BeneficialOwnersResponse struct {
	Links    SelfLink `json:"_links"`
	Embedded struct {
		BeneficialOwners []BeneficialOwner `json:"beneficial-owners"`
	} `json:"_embedded"`
	Total int `json:"total"`
}

type BeneficialOwnershipStatusResponse added in v0.0.17

type BeneficialOwnershipStatusResponse struct {
	Links  SelfLink `json:"_links"`
	Status string   `json:"status"`
}

type BusinessClassification added in v0.0.7

type BusinessClassification struct {
	Name     string `json:"name"`
	DwollaID string `json:"id"`
	Embedded struct {
		IndustryClassifications []IndustryClassification `json:"industry-classifications"`
	} `json:"_embedded"`
}

type BusinessClassificationsResponse added in v0.0.7

type BusinessClassificationsResponse struct {
	Embedded struct {
		BusinessClassifications []BusinessClassification `json:"business-classifications"`
	} `json:"_embedded"`
}

type BusinessType added in v0.0.8

type BusinessType string

BusinessType is the type of business setup

const (
	LLC                BusinessType = "llc"
	Patnership         BusinessType = "partnership"
	Corporation        BusinessType = "corporation"
	SoleProprietorship BusinessType = "soleProprietorship"
)

type CertifyBeneficialOwnershipReq added in v0.0.17

type CertifyBeneficialOwnershipReq struct {
	Status string `json:"status"`
}

type Client

type Client struct {
	Auth                 *auth
	Customer             *customer
	Account              *account
	Business             *business
	Payment              *massPayment
	WebhookSubscriptions *webhook
	Transfer             *transfer
	FundingSource        *fundingSource
}

Client is the dwolla client

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient setups a new dwolla client

type Config

type Config struct {
	ClientKey    string
	ClientSecret string
	Enviorment   string
}

Config ...

type Controller added in v0.0.9

type Controller struct {
	FirstName   string   `json:"firstName,omitempty"`
	LastName    string   `json:"lastName,omitempty"`
	Title       string   `json:"title,omitempty"`
	DateOfBirth string   `json:"dateOfBirth,omitempty"`
	SSN         string   `json:"ssn,omitempty"`
	Address     Address  `json:"address,omitempty"`
	Passport    Passport `json:"passport,omitempty"`
}

Controller is a controller of a business

type ControllerRequest added in v0.0.9

type ControllerRequest struct {
	FirstName   string    `json:"firstName,omitempty"`
	LastName    string    `json:"lastName,omitempty"`
	Title       string    `json:"title,omitempty"`
	DateOfBirth string    `json:"dateOfBirth,omitempty"`
	SSN         string    `json:"ssn,omitempty"`
	Address     Address   `json:"address,omitempty"`
	Passport    *Passport `json:"passport,omitempty"`
}

ControllerRequest is a controller of a business create/update request

type Currency added in v0.0.8

type Currency string

Currency represents the monetary currency

const (
	// USD is U.S. dollars
	USD Currency = "USD"
)

type Customer

type Customer struct {
	Links         Links        `json:"_links"`
	ID            string       `json:"id"`
	CorrelationID string       `json:"correlationId"`
	Location      string       `json:"location"`
	FirstName     string       `json:"firstName"`
	LastName      string       `json:"lastName"`
	Email         string       `json:"email"`
	Type          CustomerType `json:"type"`
	Status        string       `json:"status"`
	Created       string       `json:"created"`
	BusinessName  string       `json:"businessName"`
}

Customer is a dwolla customer

type CustomerRequest added in v0.0.9

type CustomerRequest struct {
	FirstName              string             `json:"firstName,omitempty"`
	LastName               string             `json:"lastName,omitempty"`
	Email                  string             `json:"email,omitempty"`
	CorrelationID          string             `json:"correlationId"`
	IPAddress              string             `json:"ipAddress,omitempty"`
	Type                   CustomerType       `json:"type,omitempty"`
	Status                 CustomerStatus     `json:"status,omitempty"`
	DateOfBirth            string             `json:"dateOfBirth,omitempty"`
	SSN                    string             `json:"ssn,omitempty"`
	Phone                  string             `json:"phone,omitempty"`
	Address1               string             `json:"address1,omitempty"`
	Address2               string             `json:"address2,omitempty"`
	City                   string             `json:"city,omitempty"`
	State                  string             `json:"state,omitempty"`
	PostalCode             string             `json:"postalCode,omitempty"`
	BusinessClassification string             `json:"businessClassification,omitempty"`
	BusinessType           BusinessType       `json:"businessType,omitempty"`
	BusinessName           string             `json:"businessName,omitempty"`
	DoingBusinessAs        string             `json:"doingBusinessAs,omitempty"`
	EIN                    string             `json:"ein,omitempty"`
	Website                string             `json:"website,omitempty"`
	Controller             *ControllerRequest `json:"controller,omitempty"`
}

CustomerRequest is a customer create/update request

type CustomerStatus added in v0.0.9

type CustomerStatus string

CustomerStatus is the customer's status

const (
	// CustomerStatusDeactivated is when the customer has been deactivated
	CustomerStatusDeactivated CustomerStatus = "deactivated"
	// CustomerStatusDocument is when the customer needs verification document
	CustomerStatusDocument CustomerStatus = "document"
	// CustomerStatusReactivated is when a deactivated customer is reactivated
	CustomerStatusReactivated CustomerStatus = "reactivated"
	// CustomerStatusRetry is when the customer needs to retry verification
	CustomerStatusRetry CustomerStatus = "retry"
	// CustomerStatusSuspended is when the customer has been suspended
	CustomerStatusSuspended CustomerStatus = "suspended"
	// CustomerStatusUnverified is when the customer is unverified
	CustomerStatusUnverified CustomerStatus = "unverified"
	// CustomerStatusVerified is when the customer is verified
	CustomerStatusVerified CustomerStatus = "verified"
)

type CustomerType added in v0.0.8

type CustomerType string

CustomerType is the customer's type

const (
	// CustomerTypeBusiness is when the customer is a business
	CustomerTypeBusiness CustomerType = "business"
	// CustomerTypePersonal is when the customer is an individual
	CustomerTypePersonal CustomerType = "personal"
	// CustomerTypeReceiveOnly is when the customer can only receive funds
	CustomerTypeReceiveOnly CustomerType = "receive-only"
	// CustomerTypeUnverified is when the customer is unverified
	CustomerTypeUnverified CustomerType = "unverified"
)

type CustomersResponse

type CustomersResponse struct {
	Embedded struct {
		Customers []Customer `json:"customers"`
	} `json:"_embedded"`
}
type DestinationLink struct {
	Destination Link `json:"destination"`
}

type Document added in v0.0.20

type Document struct {
	ID                string              `json:"id"`
	Status            string              `json:"status"`
	Type              string              `json:"type"`
	Created           string              `json:"created"`
	FailureReason     string              `json:"failureReason"`
	AllFailureReasons []AllFailureReasons `json:"allFailureReasons"`
}

type Embedded added in v0.0.8

type Embedded struct {
	Errors []HALError `json:"errors"`
}

Embedded is a hal embedded resource

type FileRequest added in v0.0.17

type FileRequest struct {
	File       multipart.File        `json:"file"`
	FileHeader *multipart.FileHeader `json:"fileHeader"`
}

type Funding

type Funding struct {
	ID              string   `json:"id"`
	Name            string   `json:"name"`
	Status          string   `json:"status"`
	Type            string   `json:"type"`
	BankAccountType string   `json:"bankAccountType"`
	Created         string   `json:"created"`
	Removed         bool     `json:"removed"`
	Channels        []string `json:"channels"`
	BankName        string   `json:"bankName"`
}

type FundingSource added in v0.0.8

type FundingSource struct {
	Resource
	ID              string                       `json:"id"`
	Status          FundingSourceStatus          `json:"status"`
	Type            FundingSourceType            `json:"type"`
	BankAccountType FundingSourceBankAccountType `json:"bankAccountType"`
	Name            string                       `json:"name"`
	Created         string                       `json:"created"`
	Balance         Amount                       `json:"balance"`
	Removed         bool                         `json:"removed"`
	Channels        []string                     `json:"channels"`
	BankName        string                       `json:"bankName"`
	Fingerprint     string                       `json:"fingerprint"`
}

FundingSource is a dwolla funding source

type FundingSourceBalance added in v0.0.8

type FundingSourceBalance struct {
	Balance     Amount `json:"balance"`
	LastUpdated string `json:"lastUpdated"`
}

FundingSourceBalance is a funding source balance

type FundingSourceBankAccountType added in v0.0.8

type FundingSourceBankAccountType string

FundingSourceBankAccountType is a dwolla bank account type enum

const (
	// FundingSourceBankAccountTypeChecking is a checking bank account
	FundingSourceBankAccountTypeChecking FundingSourceBankAccountType = "checking"
	// FundingSourceBankAccountTypeSavings is a savings bank account
	FundingSourceBankAccountTypeSavings FundingSourceBankAccountType = "savings"
)

type FundingSourceRequest added in v0.0.6

type FundingSourceRequest struct {
	RoutingNumber   string                       `json:"routingNumber"`
	AccountNumber   string                       `json:"accountNumber"`
	BankAccountType FundingSourceBankAccountType `json:"bankAccountType"`
	Name            string                       `json:"name"`
	PlaidToken      string                       `json:"plaidToken"`
}

type FundingSourceStatus added in v0.0.8

type FundingSourceStatus string

FundingSourceStatus is a funding source's status

const (
	// FundingSourceStatusUnverified is when the funding source is unverified
	FundingSourceStatusUnverified FundingSourceStatus = "unverified"
	// FundingSourceStatusVerified is when the funding source is verified
	FundingSourceStatusVerified FundingSourceStatus = "verified"
)

type FundingSourceType added in v0.0.8

type FundingSourceType string

FundingSourceType is the funding source type

const (
	// FundingSourceTypeBank is when the funding source is a bank account
	FundingSourceTypeBank FundingSourceType = "bank"
	// FundingSourceTypeBalance is when the funding source is a dwolla balance
	FundingSourceTypeBalance FundingSourceType = "balance"
)

type FundingSourcesResponse

type FundingSourcesResponse struct {
	Links    SelfLink `json:"_links"`
	Embedded struct {
		FundingSources []Funding `json:"funding-sources"`
	} `json:"_embedded"`
}

type HALError added in v0.0.8

type HALError struct {
	Code    string    `json:"code"`
	Message string    `json:"message"`
	Path    string    `json:"path"`
	Links   AboutLink `json:"_links"`
}

HALError is a hal error

func (HALError) Error added in v0.0.8

func (e HALError) Error() string

HALError implements the error interface

type Header struct {
	IdempotencyKey string
	ContentType    string
}

type IndustryClassification added in v0.0.7

type IndustryClassification struct {
	Name     string `json:"name"`
	DwollaID string `json:"id"`
}
type Link struct {
	Href         string `json:"href"`
	ResourceType string `json:"resource-type"`
	Type         string `json:"type"`
}

Link is a hal resource link

type Links map[string]Link

Links is a group of resource links

type MassPayment added in v0.0.7

type MassPayment struct {
	Links         SourceLink        `json:"_links,omitempty"`
	ID            string            `json:"id,omitempty"`
	Items         []MassPaymentItem `json:"items,omitempty"`
	Status        MassPaymentStatus `json:"status,omitempty"`
	CorrelationID string            `json:"correlationId,omitempty"`
	Metadata      interface{}       `json:"metadata,omitempty"`
	Location      string            `json:"-"`
}

MassPayment is a dwolla mass payment

type MassPaymentItem added in v0.0.8

type MassPaymentItem struct {
	Links         DestinationLink       `json:"_links,omitempty"`
	Amount        Amount                `json:"amount,omitempty"`
	Status        MassPaymentItemStatus `json:"status,omitempty"`
	Metadata      interface{}           `json:"metadata,omitempty"`
	CorrelationID string                `json:"correlationId,omitempty"`
	Embedded      Embedded              `json:"_embedded,omitempty"`
}

MassPaymentItem is a dwolla mass payment item

type MassPaymentItemStatus added in v0.0.8

type MassPaymentItemStatus string

MassPaymentItemStatus is a mass payment item status

const (
	// MassPaymentItemStatusPending is when a mass payment item is pending
	MassPaymentItemStatusPending MassPaymentItemStatus = "pending"
	// MassPaymentItemStatusSuccess is when amass payment item is successful
	MassPaymentItemStatusSuccess MassPaymentItemStatus = "success"
	// MassPaymentItemStatusFailed is when a mass payment item failed
	MassPaymentItemStatusFailed MassPaymentItemStatus = "failed"
)

type MassPaymentItems added in v0.0.14

type MassPaymentItems struct {
	Embedded map[string][]MassPaymentItem `json:"_embedded"`
	Total    int                          `json:"total"`
}

MassPaymentItems is a collection of mass payment items

type MassPaymentResponse added in v0.0.8

type MassPaymentResponse struct {
	Links    Links             `json:"_links"`
	ID       string            `json:"id"`
	Status   MassPaymentStatus `json:"status"`
	Created  string            `json:"created"`
	Metadata interface{}       `json:"metadata"`
}

type MassPaymentStatus added in v0.0.8

type MassPaymentStatus string

MassPaymentStatus is a mass payment status

const (
	// MassPaymentStatusDeferred is when a mass payment is deferred
	MassPaymentStatusDeferred MassPaymentStatus = "deferred"
	// MassPaymentStatusPending is when the mass payment is pending
	MassPaymentStatusPending MassPaymentStatus = "pending"
	// MassPaymentStatusProcessing is when the mass payment is processing
	MassPaymentStatusProcessing MassPaymentStatus = "processing"
	// MassPaymentStatusComplete is when the mass payment is complete
	MassPaymentStatusComplete MassPaymentStatus = "complete"
	// MassPaymentStatusCancelled is when the mass payment is cancelled
	MassPaymentStatusCancelled MassPaymentStatus = "cancelled"
)

type Passport added in v0.0.9

type Passport struct {
	Number  string `json:"number"`
	Country string `json:"country"`
}

Passport represents a passport

type PlaidFundingSourceRequest

type PlaidFundingSourceRequest struct {
	PlaidToken string `json:"plaidToken"`
	Name       string `json:"name"`
}

type Raw added in v0.0.10

type Raw struct {
	Endpoint   string
	Request    string
	Response   string
	Status     int
	XRequestId string
}

Raw represents the actual request and response sent/received by dwolla

type Resource added in v0.0.8

type Resource struct {
	Links Links `json:"_links,omitempty"`
}

Resource is a hal resource

type RootResponse

type RootResponse struct {
	Links AccountLink `json:"_links"`
}
type SelfLink struct {
	Self Link `json:"self"`
}
type SourceLink struct {
	Source Link `json:"source,omitempty"`
}

type Token

type Token struct {
	AccessToken string  `json:"access_token"`
	TokenType   string  `json:"token_type"`
	ExpiresIn   float64 `json:"expires_in"`
	CreatedAt   time.Time
}

Token is a dwolla auth token

func (*Token) Expired added in v0.0.8

func (t *Token) Expired() bool

Expired returns true if token has expired

type TransferResponse added in v0.0.18

type TransferResponse struct {
	Links         Links       `json:"_links"`
	ID            string      `json:"id"`
	Status        string      `json:"status"`
	Amount        Amount      `json:"amount,omitempty"`
	Created       string      `json:"created"`
	Metadata      interface{} `json:"metadata"`
	CorrelationID string      `json:"correlationId"`
}

type UpdateMassPayment added in v0.0.7

type UpdateMassPayment struct {
	Status MassPaymentStatus `json:"status"`
}

type UpdateRequest added in v0.0.15

type UpdateRequest struct {
	Paused bool `json:"paused"`
}

type ValidationError added in v0.0.8

type ValidationError struct {
	Code     string   `json:"code"`
	Message  string   `json:"message"`
	Raw      string   `json:"raw_error"`
	Embedded Embedded `json:"_embedded"`
}

ValidationError is a dwolla validation error

func (ValidationError) Error added in v0.0.8

func (v ValidationError) Error() string

Error implements the error interface

type WebhookSubscription added in v0.0.9

type WebhookSubscription struct {
	ID      string `json:"id"`
	URL     string `json:"url"`
	Created string `json:"created"`
}

type WebhookSubscriptionRequest added in v0.0.9

type WebhookSubscriptionRequest struct {
	URL    string `json:"url"`
	Secret string `json:"secret"`
}

type WebhookSubscriptionsResponse added in v0.0.9

type WebhookSubscriptionsResponse struct {
	Embedded struct {
		Subscriptions []WebhookSubscription `json:"webhook-subscriptions"`
	} `json:"_embedded"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL