dwolla

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 14 Imported by: 1

README

dwolla-v2-go

Build Status Code Coverage GoDoc MIT Go Report Card

A Go wrapper for the Dwolla API V2

Requirements

  • Go v1.11+ (uses modules)

Install

go get -u github.com/kolanos/dwolla-v2-go

Usage

To instantiate the client:

package main

import (
	"context"
	"fmt"

	"github.com/kolanos/dwolla-v2-go"
)

var ctx = context.Background()

func main() {
	client := dwolla.New("<your dwolla key here>", "<your dwolla secret here>", dwolla.Production)

	# Or if using the Dwolla sandbox
	#client := dwolla.New("<your dwolla key here>", "<your dwolla secret here>", dwolla.Sandbox)
}

To retrieve dwolla account information:

res, err := client.Account.Retrieve(ctx)

if err != nil {
	fmt.Println("Error:", err)
	return err
}

fmt.Println("Account ID:", res.ID)
fmt.Println("Account Name:", res.Name)

See the GoDoc for the full API.

License

MIT License

Documentation

Index

Constants

View Source
const (
	// Version is the version of the client
	Version string = "0.1.0"

	// Production is the production environment
	Production Environment = "production"
	// Sandbox is the sanbox environment
	Sandbox Environment = "sandbox"

	// ProductionAPIURL is the production api url
	ProductionAPIURL = "https://api.dwolla.com"
	// ProductionAuthURL is the production auth url
	ProductionAuthURL = "https://www.dwolla.com/oauth/v2/authenticate"
	// ProductionTokenURL is the production token url
	// Deprecated - use https://api.dwolla.com/token moving forward
	ProductionTokenURL = "https://accounts.dwolla.com/token"

	// SandboxAPIURL is the sandbox api url
	SandboxAPIURL = "https://api-sandbox.dwolla.com"
	// SandboxAuthURL is the sandbox auth url
	SandboxAuthURL = "https://sandbox.dwolla.com/oauth/v2/authenticate"
	// SandboxTokenURL is the sandbox token url
	// Deprecated - use https://api-sandbox.dwolla.com moving forward
	SandboxTokenURL = "https://accounts-sandbox.dwolla.com/token"
)

Variables

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

Functions

func IDFromHREF

func IDFromHREF(href string) (string, error)

IDFromHREF 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 Unmarshal

func Unmarshal(data []byte, container interface{}) error

Unmarshal unmarhsals a hal object into a struct

Types

type ACHDetails

type ACHDetails struct {
	Destination Addenda `json:"destination,omitempty"`
	Source      Addenda `json:"source,omitempty"`
}

ACHDetails contains data sent to the bank account

type Account

type Account struct {
	Resource
	ID             string  `json:"id"`
	Name           string  `json:"name"`
	TimezoneOffset float32 `json:"timezoneOffset"`
	Type           string  `json:"type"`
}

Account is a dwolla account

func (*Account) CreateFundingSource

func (a *Account) CreateFundingSource(ctx context.Context, body *FundingSourceRequest) (*FundingSource, error)

CreateFundingSource creates a funding source for the account

see: https://docsv2.dwolla.com/#create-a-funding-source-for-an-account

func (*Account) ListFundingSources

func (a *Account) ListFundingSources(ctx context.Context, removed bool) (*FundingSources, error)

ListFundingSources returns the account's funding sources

see: https://docsv2.dwolla.com/#list-funding-sources-for-an-account

func (*Account) ListMassPayments

func (a *Account) ListMassPayments(ctx context.Context, params *url.Values) (*MassPayments, error)

ListMassPayments returns mass payments for the account

see: https://docsv2.dwolla.com/#list-mass-payments-for-an-account

func (*Account) ListTransfers

func (a *Account) ListTransfers(ctx context.Context, params *url.Values) (*Transfers, error)

ListTransfers returns the account's transfers

see: https://docsv2.dwolla.com/#list-and-search-transfers-for-an-account

type AccountService

type AccountService interface {
	Retrieve(context.Context) (*Account, error)
}

AccountService is the account service interface

see: https://docsv2.dwolla.com/#accounts

type AccountServiceOp

type AccountServiceOp struct {
	// contains filtered or unexported fields
}

AccountServiceOp is an implementation of the account service interface

func (*AccountServiceOp) Retrieve

func (a *AccountServiceOp) Retrieve(ctx context.Context) (*Account, error)

Retrieve retrieves the dwolla account

see: https://docsv2.dwolla.com/#retrieve-account-details

type Addenda

type Addenda struct {
	Addenda TransferAddendaValues `json:"addenda,omitempty"`
}

Addenda is a transfer addenda

type AddendaValues

type AddendaValues struct {
	Values []string `json:"values,omitempty"`
}

AddendaValues is the addenda values

type Address

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 Amount

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

Amount is a monetary value

func (Amount) String

func (a Amount) String() string

String returns a string representation of the amount

type BeneficialOwner

type BeneficialOwner struct {
	Resource
	ID                 string                `json:"id"`
	FirstName          string                `json:"firstName"`
	LastName           string                `json:"lastName"`
	Address            Address               `json:"address"`
	Passport           Passport              `json:"passport"`
	VerificationStatus BeneficialOwnerStatus `json:"verificationStatus"`
}

BeneficialOwner is a beneficial owner

func (*BeneficialOwner) CreateDocument

func (b *BeneficialOwner) CreateDocument(ctx context.Context, body *DocumentRequest) (*Document, error)

CreateDocument uploads a document for the beneficial owner

see: https://docsv2.dwolla.com/#create-a-document-for-a-beneficial-owner

func (*BeneficialOwner) ListDocuments

func (b *BeneficialOwner) ListDocuments(ctx context.Context) (*Documents, error)

ListDocuments returns documents for beneficial owner

see: https://docsv2.dwolla.com/#list-documents-for-beneficial-owners

func (*BeneficialOwner) Remove

func (b *BeneficialOwner) Remove(ctx context.Context) error

Remove removes the beneficial owner

see: https://docsv2.dwolla.com/#remove-a-beneficial-owner

func (*BeneficialOwner) Update

Update updates the dwolla beneficial owner

see: https://docsv2.dwolla.com/#update-a-beneficial-owner

type BeneficialOwnerRequest

type BeneficialOwnerRequest struct {
	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"`
}

BeneficialOwnerRequest is a beneficial owner request

type BeneficialOwnerService

type BeneficialOwnerService interface {
	Remove(context.Context, string) error
	Retrieve(context.Context, string) (*BeneficialOwner, error)
	Update(context.Context, string, *BeneficialOwnerRequest) (*BeneficialOwner, error)
}

BeneficialOwnerService is the beneficial owner service interface

see: https://docsv2.dwolla.com/#beneficial-owners

type BeneficialOwnerServiceOp

type BeneficialOwnerServiceOp struct {
	// contains filtered or unexported fields
}

BeneficialOwnerServiceOp is an implementation of the beneficial owner service

func (*BeneficialOwnerServiceOp) Remove

Remove removes a beneficial owner matching the id

see: https://docsv2.dwolla.com/#remove-a-beneficial-owner

func (*BeneficialOwnerServiceOp) Retrieve

Retrieve retrieves a beneficial owner matching the id

see: https://docsv2.dwolla.com/#retrieve-a-beneficial-owner

func (*BeneficialOwnerServiceOp) Update

Update updates a beneficial owner matching the id

see: https://docsv2.dwolla.com/#update-a-beneficial-owner

type BeneficialOwnerStatus

type BeneficialOwnerStatus string

BeneficialOwnerStatus is the status of the beneficial owner

const (
	// BeneficialOwnerStatusDocument is when the beneficial owner needs verification document
	BeneficialOwnerStatusDocument BeneficialOwnerStatus = "document"

	// BeneficialOwnerStatusIncomplete is when the beneficial owner is incomplete
	BeneficialOwnerStatusIncomplete BeneficialOwnerStatus = "incomplete"

	// BeneficialOwnerStatusVerified is when the beneficial owner is verified
	BeneficialOwnerStatusVerified BeneficialOwnerStatus = "verified"
)

type BeneficialOwners

type BeneficialOwners struct {
	Collection
	Embedded map[string][]BeneficialOwner `json:"_embedded"`
}

BeneficialOwners is a collection of beneficial owners

type BeneficialOwnership

type BeneficialOwnership struct {
	Resource
	Status CertificationStatus `json:"status"`
}

BeneficialOwnership is the beneficial ownership status

func (*BeneficialOwnership) Certify

func (b *BeneficialOwnership) Certify(ctx context.Context) error

Certify certifies beneficial ownership

see: https://docsv2.dwolla.com/#certify-beneficial-ownership

type BeneficialOwnershipRequest

type BeneficialOwnershipRequest struct {
	Status CertificationStatus `json:"status,omitempty"`
}

BeneficialOwnershipRequest is a beneficial ownership request

type BusinessClassification

type BusinessClassification struct {
	Resource
	ID       string                              `json:"id"`
	Name     string                              `json:"name"`
	Embedded map[string][]IndustryClassification `json:"_embedded"`
}

BusinessClassification is a business industry type

type BusinessClassificationService

type BusinessClassificationService interface {
	Retrieve(context.Context, string) (*BusinessClassification, error)
	List(context.Context, *url.Values) (*BusinessClassifications, error)
}

BusinessClassificationService is the business classification interface

type BusinessClassificationServiceOp

type BusinessClassificationServiceOp struct {
	// contains filtered or unexported fields
}

BusinessClassificationServiceOp is an implementation of the business classification interface

func (*BusinessClassificationServiceOp) List

List returns a collection of business classifications

see: https://docsv2.dwolla.com/#list-business-classifications

func (*BusinessClassificationServiceOp) Retrieve

Retrieve retrieves a business classification matching the id

see: https://docsv2.dwolla.com/#retrieve-a-business-classification

type BusinessClassifications

type BusinessClassifications struct {
	Collection
	Embedded map[string][]BusinessClassification `json:"_embedded"`
}

BusinessClassifications is a business classification

type CertificationStatus

type CertificationStatus string

CertificationStatus is the beneficial ownership certification status

const (
	// CertificationStatusCertified is when the ownership status is certified
	CertificationStatusCertified CertificationStatus = "certified"

	// CertificationStatusRecertify is when the ownership status needs
	// to be recertified
	CertificationStatusRecertify CertificationStatus = "recertify"

	// CertificationStatusUncertified is when the ownership status is uncertified
	CertificationStatusUncertified CertificationStatus = "uncertified"
)

type Clearing

type Clearing struct {
	Destination string `json:"destination,omitempty"`
	Source      string `json:"source,omitempty"`
}

Clearing is a transfer clearing schedule

type Client

type Client struct {
	Key         string
	Secret      string
	Environment Environment
	HTTPClient  HTTPClient
	Token       *Token

	Account                AccountService
	BeneficialOwner        BeneficialOwnerService
	BusinessClassification BusinessClassificationService
	Customer               CustomerService
	Document               DocumentService
	Event                  EventService
	FundingSource          FundingSourceService
	KBA                    KBAService
	MassPayment            MassPaymentService
	OnDemandAuthorization  OnDemandAuthorizationService
	Transfer               TransferService
	TransferFailure        *TransferFailureServiceOp
	Webhook                WebhookService
	WebhookSubscription    WebhookSubscriptionService
	// contains filtered or unexported fields
}

Client is the dwolla client

func New

func New(key, secret string, environment Environment) *Client

New initializes a new dwolla client

func NewWithHTTPClient

func NewWithHTTPClient(key, secret string, environment Environment, httpClient HTTPClient) *Client

NewWithHTTPClient initializes the client with specified http client

func (Client) APIURL

func (c Client) APIURL() string

APIURL returns the api url for the environment

func (Client) AuthURL

func (c Client) AuthURL() string

AuthURL returns the auth url for the environment

func (Client) BuildAPIURL

func (c Client) BuildAPIURL(path string) string

BuildAPIURL builds an api url with a given path

func (*Client) CreateClientToken

func (c *Client) CreateClientToken(ctx context.Context, action string, customer *Customer) (*ClientToken, error)

CreateClientToken creates a general use client token

see: https://docsv2.dwolla.com/#create-a-client-token

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, params *url.Values, headers *http.Header) error

Delete performs a DELETE against the api

func (*Client) EnsureToken

func (c *Client) EnsureToken(ctx context.Context) error

EnsureToken ensures that a token exists for a request

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, params *url.Values, headers *http.Header, container interface{}) error

Get performs a GET against the api

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body interface{}, headers *http.Header, container interface{}) error

Post performs a POST against the api

func (*Client) RequestToken

func (c *Client) RequestToken(ctx context.Context) error

RequestToken requests a new auth token using client credentials

func (*Client) Root

func (c *Client) Root(ctx context.Context) (*Resource, error)

Root returns the dwolla root response

func (*Client) SandboxSimulations

func (c *Client) SandboxSimulations(ctx context.Context) error

SandboxSimulations simulates events within the sandbox environment

see: https://developers.dwolla.com/resources/testing.html#simulate-bank-transfer-processing

func (Client) TokenURL

func (c Client) TokenURL() string

TokenURL returns the token url for the environment

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, path string, documentType DocumentType, fileName string, file io.Reader, container interface{}) error

Upload performs a multipart file upload to the Dwolla API

type ClientToken

type ClientToken struct {
	Token string `json:"token"`
}

ClientToken is a general use client token

type ClientTokenRequest

type ClientTokenRequest struct {
	Resource
	Action string `json:"action"`
}

ClientTokenRequest is a client token request

type Collection

type Collection struct {
	Links    Links    `json:"_links"`
	Embedded Embedded `json:"_embedded"`
	Total    int      `json:"total"`
	// contains filtered or unexported fields
}

Collection is a collection of hal resources

type Controller

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

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

type Currency string

Currency represents the monetary currency

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

type Customer

type Customer struct {
	Resource
	ID           string         `json:"id"`
	FirstName    string         `json:"firstName"`
	LastName     string         `json:"lastName"`
	Email        string         `json:"email"`
	Type         CustomerType   `json:"type"`
	Status       CustomerStatus `json:"status"`
	Created      string         `json:"created"`
	Address1     string         `json:"address1"`
	Address2     string         `json:"address2"`
	City         string         `json:"city"`
	State        string         `json:"state"`
	PostalCode   string         `json:"postalCode"`
	Phone        string         `json:"phone"`
	BusinessName string         `json:"businessName"`
	BusinessType string         `json:"businessType"`
	Controller   Controller     `json:"controller"`
}

Customer is a dwolla customer

func (*Customer) CertifyBeneficialOwnership

func (c *Customer) CertifyBeneficialOwnership(ctx context.Context) error

CertifyBeneficialOwnership certifies beneficial ownership

see: https://docsv2.dwolla.com/#certify-beneficial-ownership

func (*Customer) CreateBeneficialOwner

func (c *Customer) CreateBeneficialOwner(ctx context.Context, body *BeneficialOwnerRequest) (*BeneficialOwner, error)

CreateBeneficialOwner creates a beneficial owner for the customer

see: https://docsv2.dwolla.com/#create-a-beneficial-owner

func (*Customer) CreateDocument

func (c *Customer) CreateDocument(ctx context.Context, body *DocumentRequest) (*Document, error)

CreateDocument uploads a verification document for the customer

see: https://docsv2.dwolla.com/#create-a-document

func (*Customer) CreateFundingSource

func (c *Customer) CreateFundingSource(ctx context.Context, body *FundingSourceRequest) (*FundingSource, error)

CreateFundingSource creates a funding source for the customer

see: https://docsv2.dwolla.com/#create-a-funding-source-for-a-customer

func (*Customer) CreateFundingSourceToken

func (c *Customer) CreateFundingSourceToken(ctx context.Context) (*FundingSourceToken, error)

CreateFundingSourceToken creates a funding source dwolla.js token

see: https://docs.dwolla.com/#create-a-funding-sources-token-for-dwolla-js

func (Customer) CreatedTime

func (c Customer) CreatedTime() time.Time

CreatedTime returns the created value as time.Time

func (*Customer) Deactivate

func (c *Customer) Deactivate(ctx context.Context) error

Deactivate deactivates a dwolla customer

func (*Customer) InitiateKBA

func (c *Customer) InitiateKBA(ctx context.Context) (*KBA, error)

InitiateKBA initiates a knowledge based authentication session

see: https://docs.dwolla.com/#initiate-kba-session

func (*Customer) ListBeneficialOwners

func (c *Customer) ListBeneficialOwners(ctx context.Context) (*BeneficialOwners, error)

ListBeneficialOwners returns the customer's beneficial owners

see: https://docsv2.dwolla.com/#list-beneficial-owners

func (*Customer) ListDocuments

func (c *Customer) ListDocuments(ctx context.Context) (*Documents, error)

ListDocuments returns documents for customer

see: https://docsv2.dwolla.com/#list-documents

func (*Customer) ListFundingSources

func (c *Customer) ListFundingSources(ctx context.Context, removed bool) (*FundingSources, error)

ListFundingSources returns the customer's funding sources

see: https://docsv2.dwolla.com/#list-funding-sources-for-a-customer

func (*Customer) ListMassPayments

func (c *Customer) ListMassPayments(ctx context.Context, params *url.Values) (*MassPayments, error)

ListMassPayments returns the customer's mass payments

see: https://docsv2.dwolla.com/#list-mass-payments-for-a-customer

func (*Customer) ListTransfers

func (c *Customer) ListTransfers(ctx context.Context, params *url.Values) (*Transfers, error)

ListTransfers returns the customer's transfers

see: https://docsv2.dwolla.com/#list-and-search-transfers-for-a-customer

func (*Customer) Reactivate

func (c *Customer) Reactivate(ctx context.Context) error

Reactivate reactivates a deactivated dwolla customer

func (*Customer) Receive

func (c *Customer) Receive() bool

Receive returns true if customer can receive transfers

func (*Customer) RetrieveBeneficialOwnership

func (c *Customer) RetrieveBeneficialOwnership(ctx context.Context) (*BeneficialOwnership, error)

RetrieveBeneficialOwnership retrieves the customer's beneficial ownership status

func (*Customer) RetrieveIAVToken

func (c *Customer) RetrieveIAVToken(ctx context.Context) (*IAVToken, error)

RetrieveIAVToken retrieves an instant account activation token

func (*Customer) RetryVerification

func (c *Customer) RetryVerification() bool

RetryVerification returns true if customer needs to retry verification

func (*Customer) Send

func (c *Customer) Send() bool

Send returns true if customer can send transfers

func (*Customer) Suspend

func (c *Customer) Suspend(ctx context.Context) error

Suspend suspends a dwolla customer

func (*Customer) Update

func (c *Customer) Update(ctx context.Context, body *CustomerRequest) error

Update updates a dwolla customer

see: https://docsv2.dwolla.com/#update-a-customer

func (*Customer) VerifyBeneficialOwners

func (c *Customer) VerifyBeneficialOwners() bool

VerifyBeneficialOwners returns true if beneficial owners needed

func (*Customer) VerifyBusiness

func (c *Customer) VerifyBusiness() bool

VerifyBusiness returns true if business needs verification document

func (*Customer) VerifyController

func (c *Customer) VerifyController() bool

VerifyController returns true if controller needs verification document

func (*Customer) VerifyControllerAndBusiness

func (c *Customer) VerifyControllerAndBusiness() bool

VerifyControllerAndBusiness returns true if controller and business need verification document

type CustomerRequest

type CustomerRequest struct {
	FirstName              string             `json:"firstName,omitempty"`
	LastName               string             `json:"lastName,omitempty"`
	Email                  string             `json:"email,omitempty"`
	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           string             `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

We don't just use the Customer struct here because there are fields that are not returned by the Dwolla API. As such, we don't want fields to be unset during marshaling.

type CustomerService

type CustomerService interface {
	Create(context.Context, *CustomerRequest) (*Customer, error)
	List(context.Context, *url.Values) (*Customers, error)
	Retrieve(context.Context, string) (*Customer, error)
	Update(context.Context, string, *CustomerRequest) (*Customer, error)
}

CustomerService is the customer service interface

see: https://docsv2.dwolla.com/#customers

type CustomerServiceOp

type CustomerServiceOp struct {
	// contains filtered or unexported fields
}

CustomerServiceOp is an implementation of the customer service interface

func (*CustomerServiceOp) Create

func (c *CustomerServiceOp) Create(ctx context.Context, body *CustomerRequest) (*Customer, error)

Create creates a dwolla customer

func (*CustomerServiceOp) List

func (c *CustomerServiceOp) List(ctx context.Context, params *url.Values) (*Customers, error)

List returns a collection of customers

see: https://docsv2.dwolla.com/#list-and-search-customers

func (*CustomerServiceOp) Retrieve

func (c *CustomerServiceOp) Retrieve(ctx context.Context, id string) (*Customer, error)

Retrieve retrieves a customer matching the id

see: https://docsv2.dwolla.com/#retrieve-a-customer

func (*CustomerServiceOp) Update

func (c *CustomerServiceOp) Update(ctx context.Context, id string, body *CustomerRequest) (*Customer, error)

Update updates a dwolla customer matching the id

see: https://docsv2.dwolla.com/#update-a-customer

type CustomerStatus

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

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 Customers

type Customers struct {
	Collection
	Embedded map[string][]Customer `json:"_embedded"`
}

Customers is a collection of customers

type Document

type Document struct {
	Resource
	ID            string                `json:"id"`
	Status        DocumentStatus        `json:"status"`
	Type          DocumentType          `json:"type"`
	Created       string                `json:"created"`
	FailureReason DocumentFailureReason `json:"failureReason"`
}

Document is a dwolla verification document

type DocumentFailureReason

type DocumentFailureReason string

DocumentFailureReason is the reason document verification failed

const (
	// DocumentScanIDTypeNotSupported is when the scanned I.D. type is not
	// supported
	DocumentScanIDTypeNotSupported DocumentFailureReason = "ScanIdTypeNotSupported"
	// DocumentNameMismatch is when the scanned document name does not match
	DocumentScanNameMismatch DocumentFailureReason = "ScanNameMismatch"
	// DocumentScanNotReadable is when the scanned document is not readable
	DocumentScanNotReadable DocumentFailureReason = "ScanNotReadable"
	// DocumentScanNotUploaded is when the scanned document failed to upload
	DocumentScanNotUploaded DocumentFailureReason = "ScanNotUploaded"
	// DocumentScanFailedOther is when the scanned document was rejected for
	// another reason
	DocumentScanFailedOther DocumentFailureReason = "ScanFailedOther"
	// DocumentFailedOther is when the document was rejected for another
	// reason
	DocumentFailedOther DocumentFailureReason = "FailedOther"
)

type DocumentRequest

type DocumentRequest struct {
	Type     DocumentType
	FileName string
	File     io.Reader
}

DocumentRequest is a verification document request

type DocumentService

type DocumentService interface {
	Retrieve(context.Context, string) (*Document, error)
}

DocumentService is the document service interface

see: https://docsv2.dwolla.com/#documents

type DocumentServiceOp

type DocumentServiceOp struct {
	// contains filtered or unexported fields
}

DocumentServiceOp is an implementation of the document service

func (*DocumentServiceOp) Retrieve

func (d *DocumentServiceOp) Retrieve(ctx context.Context, id string) (*Document, error)

Retrieve retrieves a document matching the id

type DocumentStatus

type DocumentStatus string

DocumentStatus is the status of the document

const (
	// DocumentStatusPending is when the document is pending review
	DocumentStatusPending DocumentStatus = "pending"
	// DocumentStatusReviewed is when the document has been reviewed
	DocumentStatusReviewed DocumentStatus = "reviewed"
)

type DocumentType

type DocumentType string

DocumentType is the type of document

const (
	// DocumentTypePassport is a passport
	DocumentTypePassport DocumentType = "passport"
	// DocumentTypeLicense is a state-issued driver's license
	DocumentTypeLicense DocumentType = "license"
	// DocumentTypeIDCard is a U.S. government issued photo I.D. card
	DocumentTypeIDCard DocumentType = "idCard"
	// DocumentTypeOther is an EIN Letter / IRS-issued SS4 Confirmation Letter
	DocumentTypeOther DocumentType = "other"
)

type Documents

type Documents struct {
	Collection
	Embedded map[string][]Document `json:"_embedded"`
}

Documents is a collection of dwolla documents

type Embedded

type Embedded map[string][]Resource

Embedded is a hal embedded resource

type Environment

type Environment string

Environment is a supported dwolla environment

type Event

type Event struct {
	Resource
	ID         string     `json:"id"`
	Created    string     `json:"created"`
	Topic      EventTopic `json:"topic"`
	ResourceID string     `json:"resourceId"`
}

Event is a dwolla event

type EventService

type EventService interface {
	List(context.Context, *url.Values) (*Events, error)
	Retrieve(context.Context, string) (*Event, error)
}

EventService is the event service interface

see: https://docsv2.dwolla.com/#events

type EventServiceOp

type EventServiceOp struct {
	// contains filtered or unexported fields
}

EventServiceOp is an implementation of the event service interface

func (*EventServiceOp) List

func (e *EventServiceOp) List(ctx context.Context, params *url.Values) (*Events, error)

List returns a collection of events

see: https://docsv2.dwolla.com/#list-events

func (*EventServiceOp) Retrieve

func (e *EventServiceOp) Retrieve(ctx context.Context, id string) (*Event, error)

Retrieve retrieves the event matching the id

see: https://docsv2.dwolla.com/#retrieve-an-event

type EventTopic

type EventTopic string

EventTopic is an event topic

type Events

type Events struct {
	Collection

	Embedded map[string][]Event `json:"_embedded"`
	// contains filtered or unexported fields
}

Events is a collection of dwolla events

type FundingSource

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

func (*FundingSource) Customer

func (f *FundingSource) Customer(ctx context.Context) (*Customer, error)

Customer returns the funding source's customer

func (*FundingSource) FailedVerificationMicroDeposits

func (f *FundingSource) FailedVerificationMicroDeposits() bool

FailedVerificationMicroDeposits returns true if micro deposit verificationfailed

func (*FundingSource) InitiateMicroDeposits

func (f *FundingSource) InitiateMicroDeposits(ctx context.Context) (*MicroDeposit, error)

InitiateMicroDeposits initiates micro deposit verification

see: https://docsv2.dwolla.com/#initiate-micro-deposits

func (*FundingSource) Remove

func (f *FundingSource) Remove(ctx context.Context) error

Remove removes the funding source

see: https://docsv2.dwolla.com/#remove-a-funding-source

func (*FundingSource) RetrieveBalance

func (f *FundingSource) RetrieveBalance(ctx context.Context) (*FundingSourceBalance, error)

RetrieveBalance retrieves the funding source balance

see: https://docsv2.dwolla.com/#retrieve-a-funding-source-balance

func (*FundingSource) RetrieveMicroDeposits

func (f *FundingSource) RetrieveMicroDeposits(ctx context.Context) (*MicroDeposit, error)

RetrieveMicroDeposits retrieves funding source micro deposits

see: https://docsv2.dwolla.com/#retrieve-micro-deposits-details

func (*FundingSource) TransferFromBalance

func (f *FundingSource) TransferFromBalance() bool

TransferFromBalance returns true if funding source can transfer from balance

func (*FundingSource) TransferReceive

func (f *FundingSource) TransferReceive() bool

TransferReceive returns true if funding source can receive transfers

func (*FundingSource) TransferSend

func (f *FundingSource) TransferSend() bool

TransferSend returns true if funding source can send transfers

func (*FundingSource) TransferToBalance

func (f *FundingSource) TransferToBalance() bool

TransferToBalance returns true if funding source can transfer to balance

func (*FundingSource) Update

func (f *FundingSource) Update(ctx context.Context, body *FundingSourceRequest) error

Update updates the funding source

see: https://docsv2.dwolla.com/#update-a-funding-source

func (*FundingSource) VerifyMicroDeposits

func (f *FundingSource) VerifyMicroDeposits(ctx context.Context, body *MicroDepositRequest) error

VerifyMicroDeposits verifies micro deposit amounts

see: https://docsv2.dwolla.com/#verify-micro-deposits

type FundingSourceBalance

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

FundingSourceBalance is a funding source balance

type FundingSourceBankAccountType

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

type FundingSourceRequest struct {
	Resource
	RoutingNumber   string                       `json:"routingNumber,omitempty"`
	AccountNumber   string                       `json:"accountNumber,omitempty"`
	BankAccountType FundingSourceBankAccountType `json:"bankAccountType,omitempty"`
	Name            string                       `json:"name,omitempty"`
	Channels        []string                     `json:"channels,omitempty"`
	Removed         bool                         `json:"removed,omitempty"`
	PlaidToken      string                       `json:"plaidToken,omitempty"`
}

FundingSourceRequest is a funding source request

type FundingSourceService

type FundingSourceService interface {
	Retrieve(context.Context, string) (*FundingSource, error)
	Update(context.Context, string, *FundingSourceRequest) (*FundingSource, error)
	Remove(context.Context, string) error
}

FundingSourceService is the funding source service interface

see: https://docsv2.dwolla.com/#funding-sources

type FundingSourceServiceOp

type FundingSourceServiceOp struct {
	// contains filtered or unexported fields
}

FundingSourceServiceOp is an implementation of the funding source interface

func (*FundingSourceServiceOp) Remove

func (f *FundingSourceServiceOp) Remove(ctx context.Context, id string) error

Remove removes a funding source matching the id

see: https://docsv2.dwolla.com/#remove-a-funding-source

func (*FundingSourceServiceOp) Retrieve

Retrieve retrieves a funding source with the matching id

see: https://docsv2.dwolla.com/#retrieve-a-funding-source

func (*FundingSourceServiceOp) Update

Update updates the funding source with matching id

see: https://docsv2.dwolla.com/#update-a-funding-source

type FundingSourceStatus

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 FundingSourceToken

type FundingSourceToken struct {
	Resource
	Token string `json:"token"`
}

FundingSourceToken is a funding source dwolla.js token

type FundingSourceType

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 FundingSources

type FundingSources struct {
	Collection
	Embedded map[string][]FundingSource `json:"_embedded"`
}

FundingSources is a collection of funding sources

type HALError

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

HALError is a hal error

func (HALError) Error

func (e HALError) Error() string

HALError implements the error interface

type HALErrors

type HALErrors map[string][]HALError

HALErrors is an array of embedded hal errors

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the http client interface

type IAVToken

type IAVToken struct {
	Resource
	Token string `json:"token"`
}

IAVToken is a instant account verification token

type IndustryClassification

type IndustryClassification struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

IndustryClassification is a industry subclassification

type KBA

type KBA struct {
	Resource
	ID        string        `json:"id"`
	Questions []KBAQuestion `json:"questions"`
}

KBA is a knowledge based authentication resource

func (*KBA) Verify

func (k *KBA) Verify(ctx context.Context, body *KBARequest) error

Verify attempts a knowledge based authentication verification

see: https://docs.dwolla.com/#verify-kba-questions

type KBAAnswer

type KBAAnswer struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

KBAAnswer is a knowledge based authentication answer

type KBAQuestion

type KBAQuestion struct {
	ID      string      `json:"id"`
	Text    string      `json:"text"`
	Answers []KBAAnswer `json:"answers"`
}

KBAQuestion is a knowledge based authentication question

type KBAQuestionAnswer

type KBAQuestionAnswer struct {
	QuestionID string `json:"questionId"`
	AnswerID   string `json:"answerId"`
}

KBAQuestionAnswer is a knowledge based authentication question and answer

type KBARequest

type KBARequest struct {
	Answers []KBAQuestionAnswer `json:"answers"`
}

KBARequest is a knowledge based authentication verification request

type KBAService

type KBAService interface {
	Retrieve(context.Context, string) (*KBA, error)
}

KBAService is the kba service interface

see: https://docs.dwolla.com/#knowledge-based-authentication-kba

type KBAServiceOp

type KBAServiceOp struct {
	// contains filtered or unexported fields
}

KBAServiceOp is an implementation of the kba service interface

func (*KBAServiceOp) Retrieve

func (k *KBAServiceOp) Retrieve(ctx context.Context, id string) (*KBA, error)

Retrieve retrieves a knowledge based authentication session

see: https://docs.dwolla.com/#retrieve-kba-questions

type Link struct {
	Href         string `json:"href"`
	ResourceType string `json:"resource-type,omitempty"`
	Type         string `json:"type,omitempty"`
}

Link is a hal resource link

type Links map[string]Link

Links is a group of resource links

type MassPayment

type MassPayment struct {
	Resource
	ID            string                       `json:"id,omitempty"`
	Status        MassPaymentStatus            `json:"status,omitempty"`
	ACHDetails    *ACHDetails                  `json:"achDetails,omitempty"`
	Clearing      *Clearing                    `json:"clearing,omitempty"`
	Items         []MassPaymentItem            `json:"items,omitempty"`
	Embedded      map[string][]MassPaymentItem `json:"_embedded,omitempty"`
	Created       string                       `json:"created,omitempty"`
	MetaData      MetaData                     `json:"metadata,omitempty"`
	Total         Amount                       `json:"total,omitempty"`
	TotalFees     Amount                       `json:"totalFees,omitempty"`
	CorrelationID string                       `json:"correlationId,omitempty"`
}

MassPayment is a dwolla mass payment

func (*MassPayment) ListItems

func (m *MassPayment) ListItems(ctx context.Context, params *url.Values) (*MassPaymentItems, error)

ListItems returns a collection of items for the mass payment

see: https://docsv2.dwolla.com/#list-items-for-a-mass-payment

func (*MassPayment) RetrieveItem

func (m *MassPayment) RetrieveItem(ctx context.Context, id string) (*MassPaymentItem, error)

RetrieveItem returns a mass payment item matching id

see: https://docsv2.dwolla.com/#retrieve-a-mass-payment-item

func (*MassPayment) RetrieveSource

func (m *MassPayment) RetrieveSource(ctx context.Context) (*FundingSource, error)

RetrieveSource retrieves the mass payment funding source

type MassPaymentItem

type MassPaymentItem struct {
	Resource
	ID            string                `json:"id,omitempty"`
	Status        MassPaymentItemStatus `json:"status,omitempty"`
	Amount        Amount                `json:"amount,omitempty"`
	MetaData      MetaData              `json:"metadata,omitempty"`
	CorrelationID string                `json:"correlationId,omitempty"`
	Embedded      HALErrors             `json:"_embedded,omitempty"`
}

MassPaymentItem is a dwolla mass payment item

func (*MassPaymentItem) RetrieveDestination

func (m *MassPaymentItem) RetrieveDestination(ctx context.Context) (*Customer, error)

RetrieveDestination retrieves the destination for the item

func (*MassPaymentItem) RetrieveMassPayment

func (m *MassPaymentItem) RetrieveMassPayment(ctx context.Context) (*MassPayment, error)

RetrieveMassPayment retrieves the mass payment for the item

func (*MassPaymentItem) RetrieveTransfer

func (m *MassPaymentItem) RetrieveTransfer(ctx context.Context) (*Transfer, error)

RetrieveTransfer retrieves the transfer for the item

type MassPaymentItemStatus

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

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

MassPaymentItems is a collection of mass payment items

type MassPaymentService

type MassPaymentService interface {
	Create(context.Context, *MassPayment) (*MassPayment, error)
	Retrieve(context.Context, string) (*MassPayment, error)
	Update(context.Context, string, MassPaymentStatus) (*MassPayment, error)
}

MassPaymentService is the mass payment service interface

see: https://docsv2.dwolla.com/#mass-payments

type MassPaymentServiceOp

type MassPaymentServiceOp struct {
	// contains filtered or unexported fields
}

MassPaymentServiceOp is an implementation of the mass payment interface

func (*MassPaymentServiceOp) Create

Create initiates a mass payment

see: https://docsv2.dwolla.com/#initiate-a-mass-payment

func (*MassPaymentServiceOp) Retrieve

func (m *MassPaymentServiceOp) Retrieve(ctx context.Context, id string) (*MassPayment, error)

Retrieve retrieves the mass payment matching the id

see: https://docsv2.dwolla.com/#retrieve-a-mass-payment

func (*MassPaymentServiceOp) Update

Update updates a mass payment's status

see: https://docsv2.dwolla.com/#update-a-mass-payment

type MassPaymentStatus

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 MassPayments

type MassPayments struct {
	Collection
	Embedded map[string][]MassPayment `json:"_embedded"`
}

MassPayments is a collection of mass payments

type MetaData

type MetaData map[string]interface{}

MetaData represents key/value meta data

type MicroDeposit

type MicroDeposit struct {
	Resource
	Created string              `json:"created"`
	Status  MicroDepositStatus  `json:"status"`
	Failure MicroDepositFailure `json:"failure"`
}

MicroDeposit is a dwolla micro deposit

type MicroDepositFailure

type MicroDepositFailure struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

MicroDepositFailure is detail about a micro deposit failure

type MicroDepositRequest

type MicroDepositRequest struct {
	Amount1 Amount `json:"amount1,omitempty"`
	Amount2 Amount `json:"amount2,omitempty"`
}

MicroDepositRequest is a micro deposit verification request

type MicroDepositStatus

type MicroDepositStatus string

MicroDepositStatus is the status of the micro deposit

const (
	// MicroDepositStatusPending is when the micro deposit is pending
	// processing
	MicroDepositStatusPending MicroDepositStatus = "pending"
	// MicroDepositStatusProcessed is when the micro deposit is processed
	MicroDepositStatusProcessed MicroDepositStatus = "processed"
)

type OnDemandAuthorization

type OnDemandAuthorization struct {
	Resource
	BodyText   string `json:"bodyText"`
	ButtonText string `json:"buttonText"`
}

OnDemandAuthorization is a dwolla on-demand transfer authorization

type OnDemandAuthorizationService

type OnDemandAuthorizationService interface {
	Create(context.Context) (*OnDemandAuthorization, error)
	Retrieve(context.Context, string) (*OnDemandAuthorization, error)
}

OnDemandAuthorizationService is the on-demand authorization interface

see: https://docsv2.dwolla.com/#create-an-on-demand-transfer-authorization

type OnDemandAuthorizationServiceOp

type OnDemandAuthorizationServiceOp struct {
	// contains filtered or unexported fields
}

OnDemandAuthorizationServiceOp is an implementation of the on-demand authorization interface

func (*OnDemandAuthorizationServiceOp) Create

Create creates an on-demand transfer authorization

func (*OnDemandAuthorizationServiceOp) Retrieve

Retrieve returns a on-demand authorization matching the id

type Passport

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

Passport represents a passport

type Resource

type Resource struct {
	Links Links `json:"_links,omitempty"`
	// contains filtered or unexported fields
}

Resource is a hal resource

func NewResource

func NewResource(links Links, client *Client) *Resource

NewResource is constructor for Resource

type Token

type Token struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	TokenType        string `json:"token_type"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	// contains filtered or unexported fields
}

Token is a dwolla auth token

func (*Token) Expired

func (t *Token) Expired() bool

Expired returns true if token has expired

type Transfer

type Transfer struct {
	Resource
	ID              string         `json:"id"`
	Status          TransferStatus `json:"status"`
	Amount          Amount         `json:"amount"`
	Created         string         `json:"created"`
	MetaData        MetaData       `json:"metadata"`
	Clearing        Clearing       `json:"clearing"`
	CorrelationID   string         `json:"correlationId"`
	IndividualACHID string         `json:"individualAchId"`
}

Transfer is a dwolla transfer

func (*Transfer) Cancel

func (t *Transfer) Cancel(ctx context.Context) error

Cancel cancels the transfer

see: https://docsv2.dwolla.com/#cancel-a-transfer

func (*Transfer) Destination

func (t *Transfer) Destination(ctx context.Context) (*Customer, error)

Destination returns the customer transfer destination

func (*Transfer) DestinationFundingSource

func (t *Transfer) DestinationFundingSource(ctx context.Context) (*FundingSource, error)

DestinationFundingSource returns the transfer funding source destination

func (Transfer) DestinationFundingSourceString

func (t Transfer) DestinationFundingSourceString() string

DestinationFundingSourceString returns the funding source destination id

func (Transfer) DestinationString

func (t Transfer) DestinationString() string

DestinationString returns the customer transfer destination id

func (*Transfer) ListFees

func (t *Transfer) ListFees(ctx context.Context) (*TransferFees, error)

ListFees returns the fees associated with the transfer

see: https://docsv2.dwolla.com/#list-fees-for-a-transfer

func (*Transfer) RetrieveFailureReason

func (t *Transfer) RetrieveFailureReason(ctx context.Context) (*TransferFailureReason, error)

RetrieveFailureReason returns the transfer's failure reason

see: https://docsv2.dwolla.com/#retrieve-a-transfer-failure-reason

func (*Transfer) Source

func (t *Transfer) Source(ctx context.Context) (*Customer, error)

Source returns the customer transfer source

func (*Transfer) SourceFundingSource

func (t *Transfer) SourceFundingSource(ctx context.Context) (*FundingSource, error)

SourceFundingSource returns the transfer funding source

func (Transfer) SourceFundingSourceString

func (t Transfer) SourceFundingSourceString() string

SourceFundingSourceString returns the transfer funding source

func (Transfer) SourceString

func (t Transfer) SourceString() string

SourceString returns the customer transfer source id

type TransferACHDetails

type TransferACHDetails = ACHDetails

TransferACHDetails is an alias of ACHDetails for backwards compatibility

type TransferAddenda

type TransferAddenda = Addenda

TransferAddenda is an alias of Addenda for backwards compatibility

type TransferAddendaValues

type TransferAddendaValues = AddendaValues

TransferAddendaValues is an alias of AddendaValues for backwards compatibility

type TransferClearing

type TransferClearing = Clearing

TransferClearing is an alias of Clearing for backwards compatiblity

type TransferFailure

type TransferFailure struct {
	Resource
	Code        TransferFailureCode `json:"code"`
	Description string              `json:"description"`
	Explanation string              `json:"explanation"`
}

TransferFailure is a dwolla transfer

type TransferFailureCode

type TransferFailureCode string
const (
	TransferFailureCodeInsufficientFunds                     TransferFailureCode = "R01"
	TransferFailureCodeBankAccountClosed                     TransferFailureCode = "R02"
	TransferFailureCodeNoAccount                             TransferFailureCode = "R03"
	TransferFailureCodeInvalidBankAccountNumberStructure     TransferFailureCode = "R04"
	TransferFailureCodeUnauthorizedDebitToConsumerAccount    TransferFailureCode = "R05"
	TransferFailureCodeReturnedPerODFIRequest                TransferFailureCode = "R06"
	TransferFailureCodeAuthorizationRevokedByCustomer        TransferFailureCode = "R07"
	TransferFailureCodePaymentStopped                        TransferFailureCode = "R08"
	TransferFailureCodeUncollectedFunds                      TransferFailureCode = "R09"
	TransferFailureCodeCustomerAdvisesNotAuthorized          TransferFailureCode = "R10"
	TransferFailureCodeBankAccountFrozen                     TransferFailureCode = "R16"
	TransferFailureCodeNonTransactionAccount                 TransferFailureCode = "R20"
	TransferFailureCodeCreditEntryRefusedByReceiver          TransferFailureCode = "R23"
	TransferFailureCodeCorporateCustomerAdvisesNotAuthorized TransferFailureCode = "R29"
)

type TransferFailureReason

type TransferFailureReason struct {
	Resource
	Code        string `json:"code"`
	Description string `json:"description"`
}

TransferFailureReason contains details about a failed transfer

type TransferFailureService

type TransferFailureService interface {
	Retrieve(ctx context.Context, transferID string) (*TransferFailure, error)
}

TransferFailureService is the transfer service interface

see: https://docsv2.dwolla.com/#transfers

type TransferFailureServiceOp

type TransferFailureServiceOp struct {
	// contains filtered or unexported fields
}

TransferFailureServiceOp is an implementation of the transfer service interface

func (TransferFailureServiceOp) Retrieve

func (t TransferFailureServiceOp) Retrieve(ctx context.Context, transferID string) (*TransferFailure, error)

type TransferFee

type TransferFee struct {
	Resource
	Amount Amount `json:"amount"`
}

TransferFee is a transfer fee

type TransferFees

type TransferFees struct {
	Transactions []Transfer `json:"transactions"`
	Total        int        `json:"total"`
}

TransferFees contains fees related to a transfer

type TransferRequest

type TransferRequest struct {
	Resource
	Status         TransferStatus `json:"status,omitempty"`
	Amount         Amount         `json:"amount,omitempty"`
	MetaData       MetaData       `json:"metadata,omitempty"`
	Fees           []TransferFee  `json:"fees,omitempty"`
	Clearing       Clearing       `json:"clearing,omitempty"`
	CorrelationID  string         `json:"correlationId,omitempty"`
	ACHDetails     *ACHDetails    `json:"achDetails,omitempty"`
	IdempotencyKey string         `json:"-"`
}

TransferRequest is a transfer request

type TransferService

type TransferService interface {
	Create(context.Context, *TransferRequest) (*Transfer, error)
	Retrieve(context.Context, string) (*Transfer, error)
}

TransferService is the transfer service interface

see: https://docsv2.dwolla.com/#transfers

type TransferServiceOp

type TransferServiceOp struct {
	// contains filtered or unexported fields
}

TransferServiceOp is an implementation of the transfer service interface

func (*TransferServiceOp) Create

func (t *TransferServiceOp) Create(ctx context.Context, body *TransferRequest) (*Transfer, error)

Create initiates a transfer

see: https://docsv2.dwolla.com/#initiate-a-transfer

func (*TransferServiceOp) Retrieve

func (t *TransferServiceOp) Retrieve(ctx context.Context, id string) (*Transfer, error)

Retrieve returns the transfer matching the id

see: https://docsv2.dwolla.com/#retrieve-a-transfer

type TransferStatus

type TransferStatus string

TransferStatus is a transfer's status

const (
	// TransferStatusCancelled is when the transfer has been cancelled
	TransferStatusCancelled TransferStatus = "cancelled"
	// TransferStatusFailed is when the transfer failed
	TransferStatusFailed TransferStatus = "failed"
	// TransferStatusPending is when the transfer is pending
	TransferStatusPending TransferStatus = "pending"
	// TransferStatusProcessed is when the transfer is processed
	TransferStatusProcessed TransferStatus = "processed"
	// TransferStatusReclaimed is when the transfer is reclaimed
	TransferStatusReclaimed TransferStatus = "reclaimed"
)

type Transfers

type Transfers struct {
	Collection
	Embedded map[string][]Transfer `json:"_embedded"`
}

Transfers is a collection of dwolla transfers

type ValidationError

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

ValidationError is a dwolla validation error

func (ValidationError) Error

func (v ValidationError) Error() string

Error implements the error interface

type Webhook

type Webhook struct {
	Resource
	ID             string           `json:"id"`
	Topic          EventTopic       `json:"topic"`
	AccountID      string           `json:"accountId"`
	EventID        string           `json:"eventId"`
	SubscriptionID string           `json:"subscriptionId"`
	Attempts       []WebhookAttempt `json:"attempts"`
}

Webhook is a dwolla webhook

func (*Webhook) ListRetries

func (w *Webhook) ListRetries(ctx context.Context) (*WebhookRetries, error)

ListRetries returns a collection of retries for this webhook

see: https://docsv2.dwolla.com/#list-retries-for-a-webhook

func (*Webhook) RetrieveEvent

func (w *Webhook) RetrieveEvent(ctx context.Context) (*Event, error)

RetrieveEvent retrieves the event for the webhook

func (*Webhook) RetrieveWebhookSubscription

func (w *Webhook) RetrieveWebhookSubscription(ctx context.Context) (*WebhookSubscription, error)

RetrieveWebhookSubscription returns the subscription for the webhoook

func (*Webhook) RetrieveWebhooks

func (w *Webhook) RetrieveWebhooks(ctx context.Context) (*Webhooks, error)

RetrieveWebhooks returns webhooks for this webhook subscription

func (*Webhook) Retry

func (w *Webhook) Retry(ctx context.Context) (*WebhookRetry, error)

Retry retries the webhook

see: https://docsv2.dwolla.com/#retry-a-webhook

type WebhookAttempt

type WebhookAttempt struct {
	ID       string          `json:"id"`
	Request  WebhookRequest  `json:"request"`
	Response WebhookResponse `json:"response"`
}

WebhookAttempt is a webhook attempt

type WebhookHeader

type WebhookHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

WebhookHeader is a webhook request/response header

type WebhookRequest

type WebhookRequest struct {
	Timestamp string          `json:"timestamp"`
	UrL       string          `json:"url"`
	Headers   []WebhookHeader `json:"headers"`
	Body      string          `json:"body"`
}

WebhookRequest is a webhook request

type WebhookResponse

type WebhookResponse struct {
	Timestamp  string          `json:"timestamp"`
	Headers    []WebhookHeader `json:"headers"`
	StatusCode int             `json:"statusCode"`
	Body       string          `json:"body"`
}

WebhookResponse is a webhook response

type WebhookRetries

type WebhookRetries struct {
	Collection
	Embedded map[string][]WebhookRetry `json:"_embedded"`
	Total    int                       `json:"total"`
}

WebhookRetries is a collection of webhook retries

type WebhookRetry

type WebhookRetry struct {
	Resource
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
}

WebhookRetry is a webhook retry

type WebhookService

type WebhookService interface {
	Retrieve(context.Context, string) (*Webhook, error)
}

WebhookService is the webhook service interface

see: https://docsv2.dwolla.com/#webhooks

type WebhookServiceOp

type WebhookServiceOp struct {
	// contains filtered or unexported fields
}

WebhookServiceOp is an implementation of the webhook service interface

func (*WebhookServiceOp) Retrieve

func (w *WebhookServiceOp) Retrieve(ctx context.Context, id string) (*Webhook, error)

Retrieve retrieves the webhook with matching id

see: https://docsv2.dwolla.com/#retrieve-a-webhook

type WebhookSubscription

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

WebhookSubscription is a webhook subscription

func (*WebhookSubscription) Pause

func (w *WebhookSubscription) Pause(ctx context.Context) error

Pause pauses the webhook subscription

func (*WebhookSubscription) Remove

func (w *WebhookSubscription) Remove(ctx context.Context) error

Remove removes the webhook subscription

func (*WebhookSubscription) Unpause

func (w *WebhookSubscription) Unpause(ctx context.Context) error

Unpause unpauses the webhook subscription

type WebhookSubscriptionRequest

type WebhookSubscriptionRequest struct {
	URL    string `json:"url,omitempty"`
	Secret string `json:"secret,omitempty"`
	Paused bool   `json:"paused"`
}

WebhookSubscriptionRequest is a webhook subscription request

type WebhookSubscriptionService

WebhookSubscriptionService is the webhook subscription service interface

see: https://docsv2.dwolla.com/#webhook-subscriptions

type WebhookSubscriptionServiceOp

type WebhookSubscriptionServiceOp struct {
	// contains filtered or unexported fields
}

WebhookSubscriptionServiceOp is an implementation of the webhook subscription service interface

func (*WebhookSubscriptionServiceOp) Create

Create creates a webhook subscription

func (*WebhookSubscriptionServiceOp) List

List returns a list of webhook subscriptions

func (*WebhookSubscriptionServiceOp) Remove

Remove removes the webhook subscription matching the id

func (*WebhookSubscriptionServiceOp) Retrieve

Retrieve retrieves the webhook subscription matching id

type WebhookSubscriptions

type WebhookSubscriptions struct {
	Collection
	Embedded map[string][]WebhookSubscription `json:"_embedded"`
	Total    int                              `json:"total"`
}

WebhookSubscriptions is a collection of webhook subscriptions

type Webhooks

type Webhooks struct {
	Collection
	Embedded map[string][]Webhook `json:"_embedded"`
	Total    int                  `json:"total"`
}

Webhooks is a collection of webhooks

Jump to

Keyboard shortcuts

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