client

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 23 Imported by: 2

README

Go API client for client

PayGate is a RESTful API enabling first-party Automated Clearing House (ACH) transfers to be created without a deep understanding of a full NACHA file specification. First-party transfers initiate at an Originating Depository Financial Institution (ODFI) and are sent off to other Financial Institutions.

An organization is a value used to isolate models from each other. This can be set to a "user ID" from your authentication service or any value your system has to identify.

There are also admin endpoints for back-office operations.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://github.com/moov-io/paygate

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./client"

Documentation for API Endpoints

All URIs are relative to http://localhost:8082

Class Method HTTP request Description
ConfigurationApi GetTransferConfiguration Get /configuration/transfers Get Configuration
ConfigurationApi UpdateTransferConfiguration Put /configuration/transfers Update Configuration
MonitorApi Ping Get /ping Ping PayGate
TransfersApi AddTransfer Post /transfers Create Transfer
TransfersApi DeleteTransferByID Delete /transfers/{transferID} Delete Transfer
TransfersApi GetTransferByID Get /transfers/{transferID} Get Transfer
TransfersApi GetTransfers Get /transfers List Transfers
ValidationApi GetAccountMicroDeposits Get /accounts/{accountID}/micro-deposits Get micro-deposits for a specified accountID
ValidationApi GetMicroDeposits Get /micro-deposits/{microDepositID} Get micro-deposit information
ValidationApi InitiateMicroDeposits Post /micro-deposits Initiate micro-deposits

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	ConfigurationApi *ConfigurationApiService

	MonitorApi *MonitorApiService

	TransfersApi *TransfersApiService

	ValidationApi *ValidationApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Paygate API API vv1 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type AddTransferOpts

type AddTransferOpts struct {
	XIdempotencyKey optional.String
	XRequestID      optional.String
}

AddTransferOpts Optional parameters for the method 'AddTransfer'

type Amount added in v0.9.0

type Amount struct {
	// A 3-letter ISO 4217 currency code
	Currency string `json:"currency"`
	// Quantity in the smallest unit of the specified currency. In USD this is cents, so $12.04 is 1204 and $0.99 would be 99.
	Value int32 `json:"value"`
}

Amount struct for Amount

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type ConfigurationApiService added in v0.9.0

type ConfigurationApiService service

ConfigurationApiService ConfigurationApi service

func (*ConfigurationApiService) GetTransferConfiguration added in v0.9.0

GetTransferConfiguration Get Configuration Retrieve current config for the provided organization.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *GetTransferConfigurationOpts - Optional Parameters:
  • @param "XOrganization" (optional.String) - Value used to separate and identify models

@return OrganizationConfiguration

func (*ConfigurationApiService) UpdateTransferConfiguration added in v0.9.0

func (a *ConfigurationApiService) UpdateTransferConfiguration(ctx _context.Context, organizationConfiguration OrganizationConfiguration, localVarOptionals *UpdateTransferConfigurationOpts) (OrganizationConfiguration, *_nethttp.Response, error)

UpdateTransferConfiguration Update Configuration Update the config for the provided organization.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param organizationConfiguration
  • @param optional nil or *UpdateTransferConfigurationOpts - Optional Parameters:
  • @param "XOrganization" (optional.String) - Value used to separate and identify models

@return OrganizationConfiguration

type CreateMicroDeposits

type CreateMicroDeposits struct {
	Destination Destination `json:"destination"`
}

CreateMicroDeposits struct for CreateMicroDeposits

type CreateTransfer

type CreateTransfer struct {
	Amount      Amount      `json:"amount"`
	Source      Source      `json:"source"`
	Destination Destination `json:"destination"`
	// Brief description of the transaction, this will appear on the receiving entity’s financial statement.
	Description string `json:"description"`
	// When set to true this indicates the transfer should be processed the same day if possible.
	SameDay bool `json:"sameDay,omitempty"`
}

CreateTransfer These fields are used to initiate a Transfer between two Customer objects and their Accounts.

type DeleteTransferByIDOpts

type DeleteTransferByIDOpts struct {
	XRequestID optional.String
}

DeleteTransferByIDOpts Optional parameters for the method 'DeleteTransferByID'

type Destination

type Destination struct {
	// A customerID from the Customers service used as source for this Transfer
	CustomerID string `json:"customerID"`
	// A accountID from the Customers service under the specified Customer used for this Transfer. If the Customer only has one account this value can be left empty.
	AccountID string `json:"accountID"`
}

Destination Customer that is receiving a Transfer

type Error

type Error struct {
	// An error message describing the problem intended for humans.
	Error string `json:"error"`
}

Error struct for Error

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type GetTransferByIDOpts

type GetTransferByIDOpts struct {
	XRequestID optional.String
}

GetTransferByIDOpts Optional parameters for the method 'GetTransferByID'

type GetTransferConfigurationOpts added in v0.9.0

type GetTransferConfigurationOpts struct {
	XOrganization optional.String
}

GetTransferConfigurationOpts Optional parameters for the method 'GetTransferConfiguration'

type GetTransfersOpts

type GetTransfersOpts struct {
	Skip            optional.Int32
	Count           optional.Int32
	Status          optional.Interface
	StartDate       optional.Time
	EndDate         optional.Time
	OrganizationIDs optional.String
	CustomerIDs     optional.String
	XRequestID      optional.String
}

GetTransfersOpts Optional parameters for the method 'GetTransfers'

type MicroDeposits

type MicroDeposits struct {
	// A microDepositID to identify this set of credits to an external account
	MicroDepositID string `json:"microDepositID"`
	// An array of transferID values created from this micro-deposit
	TransferIDs []string       `json:"transferIDs"`
	Destination Destination    `json:"destination"`
	Amounts     []Amount       `json:"amounts"`
	Status      TransferStatus `json:"status"`
	ProcessedAt *time.Time     `json:"processedAt,omitempty"`
	Created     time.Time      `json:"created"`
}

MicroDeposits struct for MicroDeposits

type MonitorApiService

type MonitorApiService service

MonitorApiService MonitorApi service

func (*MonitorApiService) Ping

Ping Ping PayGate Check the Customers service to check if running

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

type OrganizationConfiguration added in v0.9.0

type OrganizationConfiguration struct {
	// This field corresponds to the CompanyIdentification value in an ACH BatchHeader record.
	CompanyIdentification string `json:"companyIdentification"`
}

OrganizationConfiguration struct for OrganizationConfiguration

type ReturnCode

type ReturnCode struct {
	// Optional NACHA return code for this Transfer
	Code string `json:"code"`
	// Short NACHA description of return code
	Reason string `json:"reason"`
	// Long form explanation of return code
	Description string `json:"description"`
}

ReturnCode struct for ReturnCode

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type Source

type Source struct {
	// A customerID from the Customers service used as the source for this Transfer
	CustomerID string `json:"customerID"`
	// A accountID from the Customers service under the specified Customer used for this Transfer. If the Customer only has one account this value can be left empty.
	AccountID string `json:"accountID"`
}

Source Customer that initiates a Transfer

type Transfer

type Transfer struct {
	// transferID to uniquely identify this Transfer
	TransferID  string      `json:"transferID"`
	Amount      Amount      `json:"amount"`
	Source      Source      `json:"source"`
	Destination Destination `json:"destination"`
	// Brief description of the transaction, this will appear on the receiving entity’s financial statement.
	Description string         `json:"description"`
	Status      TransferStatus `json:"status"`
	// When set to true this indicates the transfer should be processed the same day if possible.
	SameDay      bool        `json:"sameDay"`
	ReturnCode   *ReturnCode `json:"returnCode,omitempty"`
	ProcessedAt  *time.Time  `json:"processedAt,omitempty"`
	Created      time.Time   `json:"created"`
	TraceNumbers []string    `json:"traceNumbers"`
}

Transfer struct for Transfer

type TransferStatus

type TransferStatus string

TransferStatus Defines the state of the Transfer

const (
	CANCELED   TransferStatus = "canceled"
	FAILED     TransferStatus = "failed"
	REVIEWABLE TransferStatus = "reviewable"
	PENDING    TransferStatus = "pending"
	PROCESSED  TransferStatus = "processed"
)

List of TransferStatus

type TransfersApiService

type TransfersApiService service

TransfersApiService TransfersApi service

func (*TransfersApiService) AddTransfer

func (a *TransfersApiService) AddTransfer(ctx _context.Context, xOrganization string, createTransfer CreateTransfer, localVarOptionals *AddTransferOpts) (Transfer, *_nethttp.Response, error)

AddTransfer Create Transfer Create a new transfer between a Source and a Destination. Transfers can only be modified in the pending status.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xOrganization Value used to separate and identify models
  • @param createTransfer
  • @param optional nil or *AddTransferOpts - Optional Parameters:
  • @param "XIdempotencyKey" (optional.String) - Idempotent key in the header which expires after 24 hours. These strings should contain enough entropy for to not collide with each other in your requests.
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return Transfer

func (*TransfersApiService) DeleteTransferByID

func (a *TransfersApiService) DeleteTransferByID(ctx _context.Context, transferID string, xOrganization string, localVarOptionals *DeleteTransferByIDOpts) (*_nethttp.Response, error)

DeleteTransferByID Delete Transfer Remove a transfer for the specified organization. Its status will be updated as transfer is processed. It is only possible to delete (recall) a Transfer before it has been released from the financial institution.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param transferID transferID to delete
  • @param xOrganization Value used to separate and identify models
  • @param optional nil or *DeleteTransferByIDOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

func (*TransfersApiService) GetTransferByID

func (a *TransfersApiService) GetTransferByID(ctx _context.Context, transferID string, xOrganization string, localVarOptionals *GetTransferByIDOpts) (Transfer, *_nethttp.Response, error)

GetTransferByID Get Transfer Get a Transfer object for the supplied organization

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param transferID transferID to retrieve
  • @param xOrganization Value used to separate and identify models
  • @param optional nil or *GetTransferByIDOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return Transfer

func (*TransfersApiService) GetTransfers

func (a *TransfersApiService) GetTransfers(ctx _context.Context, xOrganization string, localVarOptionals *GetTransfersOpts) ([]Transfer, *_nethttp.Response, error)

GetTransfers List Transfers List all Transfers created for the given organization.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xOrganization Value used to separate and identify models
  • @param optional nil or *GetTransfersOpts - Optional Parameters:
  • @param "Skip" (optional.Int32) - The number of items to skip before starting to collect the result set
  • @param "Count" (optional.Int32) - The number of items to return
  • @param "Status" (optional.Interface of TransferStatus) - Return only Transfers in this TransferStatus
  • @param "StartDate" (optional.Time) - Return Transfers that are scheduled for this date or later in ISO-8601 format YYYY-MM-DD. Can optionally be used with endDate to specify a date range.
  • @param "EndDate" (optional.Time) - Return Transfers that are scheduled for this date or earlier in ISO-8601 format YYYY-MM-DD. Can optionally be used with startDate to specify a date range.
  • @param "OrganizationIDs" (optional.String) - Comma separated list of organizationID values to return Transfer objects for.
  • @param "CustomerIDs" (optional.String) - Comma separated list of customerID values to return Transfer objects for. A maximum of 25 IDs is allowed.
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return []Transfer

type UpdateTransferConfigurationOpts added in v0.9.0

type UpdateTransferConfigurationOpts struct {
	XOrganization optional.String
}

UpdateTransferConfigurationOpts Optional parameters for the method 'UpdateTransferConfiguration'

type ValidationApiService

type ValidationApiService service

ValidationApiService ValidationApi service

func (*ValidationApiService) GetAccountMicroDeposits

func (a *ValidationApiService) GetAccountMicroDeposits(ctx _context.Context, accountID string, xOrganization string) (MicroDeposits, *_nethttp.Response, error)

GetAccountMicroDeposits Get micro-deposits for a specified accountID Retrieve the micro-deposits information for a specific accountID

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param accountID accountID identifier from Customers service
  • @param xOrganization Value used to separate and identify models

@return MicroDeposits

func (*ValidationApiService) GetMicroDeposits

func (a *ValidationApiService) GetMicroDeposits(ctx _context.Context, microDepositID string, xOrganization string) (MicroDeposits, *_nethttp.Response, error)

GetMicroDeposits Get micro-deposit information Retrieve the micro-deposits information for a specific microDepositID

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param microDepositID Identifier for micro-deposits
  • @param xOrganization Value used to separate and identify models

@return MicroDeposits

func (*ValidationApiService) InitiateMicroDeposits

func (a *ValidationApiService) InitiateMicroDeposits(ctx _context.Context, xOrganization string, createMicroDeposits CreateMicroDeposits) (MicroDeposits, *_nethttp.Response, error)

InitiateMicroDeposits Initiate micro-deposits Start micro-deposits for a Destination to validate.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xOrganization Value used to separate and identify models
  • @param createMicroDeposits

@return MicroDeposits

Jump to

Keyboard shortcuts

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