client

package
v0.8.0-rc5 Latest Latest
Warning

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

Go to latest
Published: May 12, 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.

Tenants are the largest grouping in PayGate and are typically a vendor who is reselling ACH services or a company making ACH payments themselves. A legal entity is linked off a Tenant as the primary Customer used to KYC and in transfers with the Tenant itself.

An Organization is a grouping within a Tenant which typically represents an entity making ACH transfers. These include clients of an ACH reseller or business accepting payments over ACH. A legal entity is linked off an Organization as the primary Customer used to KYC and in transfers with the Organization itself.

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
OrganizationsApi CreateOrganization Post /organizations Create Organization
OrganizationsApi GetOrganizations Get /organizations Get Organizations
OrganizationsApi UpdateOrganization Put /organizations/{organizationID} Update Organization
TenantsApi GetTenants Get /tenants Get Tenants
TenantsApi UpdateTenant Put /tenants/{tenantID} Update Tenant
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

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 {
	OrganizationsApi *OrganizationsApiService

	TenantsApi *TenantsApiService

	TransfersApi *TransfersApiService
	// 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 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 CreateOrganization

type CreateOrganization struct {
	// Legal name for this Organization
	Name string `json:"name"`
	// tenantID to create this Organization under
	TenantID string `json:"tenantID"`
	// A customerID from the Customers service to use in Transfers with this Organization. When transferring to or from the Organization this Customer and Account(s) are used. The Customer assigned here should represent the legal entity that manages the Organization.
	PrimaryCustomer string `json:"primaryCustomer"`
}

CreateOrganization struct for CreateOrganization

type CreateOrganizationOpts

type CreateOrganizationOpts struct {
	XRequestID optional.String
}

CreateOrganizationOpts Optional parameters for the method 'CreateOrganization'

type CreateTransfer

type CreateTransfer struct {
	// Amount of money. USD - United States.
	Amount      string      `json:"amount"`
	Source      Source      `json:"source"`
	Destination Destination `json:"destination"`
	// Brief description of the transaction, that may 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 from an Originator to a Receiver using the two Depository objects. CCDDetail, IATDetail, etc are only required according to the Standard Entry Class (SEC) code used.

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 GetOrganizationsOpts

type GetOrganizationsOpts struct {
	XRequestID optional.String
}

GetOrganizationsOpts Optional parameters for the method 'GetOrganizations'

type GetTenantsOpts

type GetTenantsOpts struct {
	XRequestID optional.String
}

GetTenantsOpts Optional parameters for the method 'GetTenants'

type GetTransferByIDOpts

type GetTransferByIDOpts struct {
	Offset     optional.Int32
	Limit      optional.Int32
	XRequestID optional.String
}

GetTransferByIDOpts Optional parameters for the method 'GetTransferByID'

type GetTransfersOpts

type GetTransfersOpts struct {
	Offset          optional.Int32
	Limit           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 Organization

type Organization struct {
	// Unique identifier for this Organization
	OrganizationID string `json:"organizationID"`
	// Legal name for this Organization
	Name string `json:"name"`
	// tenantID this Organization is created under
	TenantID string `json:"tenantID"`
	// A customerID from the Customers service to use in Transfers with this Organization. When transferring to or from the Organization this Customer and Account(s) are used. The Customer assigned here should represent the legal entity that manages the Organization.
	PrimaryCustomer string `json:"primaryCustomer"`
}

Organization struct for Organization

type OrganizationsApiService

type OrganizationsApiService service

OrganizationsApiService OrganizationsApi service

func (*OrganizationsApiService) CreateOrganization

func (a *OrganizationsApiService) CreateOrganization(ctx _context.Context, xUserID string, createOrganization CreateOrganization, localVarOptionals *CreateOrganizationOpts) (Organization, *_nethttp.Response, error)

CreateOrganization Create Organization Create a new Organization under PayGate

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param createOrganization
  • @param optional nil or *CreateOrganizationOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return Organization

func (*OrganizationsApiService) GetOrganizations

func (a *OrganizationsApiService) GetOrganizations(ctx _context.Context, xUserID string, tenantID string, localVarOptionals *GetOrganizationsOpts) ([]Organization, *_nethttp.Response, error)

GetOrganizations Get Organizations Retrieve all Organizations for the given userID

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param tenantID tenantID to create this Organization under
  • @param optional nil or *GetOrganizationsOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return []Organization

func (*OrganizationsApiService) UpdateOrganization

func (a *OrganizationsApiService) UpdateOrganization(ctx _context.Context, organizationID string, xUserID string, createOrganization CreateOrganization, localVarOptionals *UpdateOrganizationOpts) (Organization, *_nethttp.Response, error)

UpdateOrganization Update Organization Update metadata for an Organization

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param organizationID organizationID for the Organization to update
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param createOrganization
  • @param optional nil or *UpdateOrganizationOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return Organization

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 Tenant

type Tenant struct {
	// tenantID that uniquely identifies this Tenant
	TenantID string `json:"tenantID"`
	// Legal name for this Tenant
	Name string `json:"name"`
	// A customerID from the Customers service to use in Transfers with this Tenant. When transferring to or from the Tenant this Customer and Account(s) are used. The Customer assigned here should represent the legal entity that manages the Tenant.
	PrimaryCustomer string `json:"primaryCustomer"`
}

Tenant struct for Tenant

type TenantsApiService

type TenantsApiService service

TenantsApiService TenantsApi service

func (*TenantsApiService) GetTenants

func (a *TenantsApiService) GetTenants(ctx _context.Context, xUserID string, localVarOptionals *GetTenantsOpts) ([]Tenant, *_nethttp.Response, error)

GetTenants Get Tenants Retrieve all Tenants for the given userID

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param optional nil or *GetTenantsOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return []Tenant

func (*TenantsApiService) UpdateTenant

func (a *TenantsApiService) UpdateTenant(ctx _context.Context, tenantID string, xUserID string, updateTenant UpdateTenant, localVarOptionals *UpdateTenantOpts) (*_nethttp.Response, error)

UpdateTenant Update Tenant Update information for a Tenant

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param tenantID tenantID to identify which Tenant to update
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param updateTenant
  • @param optional nil or *UpdateTenantOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

type Transfer

type Transfer struct {
	// transferID to uniquely identify this Transfer
	TransferID string `json:"transferID"`
	// Amount of money. USD - United States.
	Amount      string      `json:"amount"`
	Source      Source      `json:"source"`
	Destination Destination `json:"destination"`
	// Brief description of the transaction, that may appear on the receiving entity’s financial statement. This field is put into the Entry Detail's DiscretionaryData.
	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"`
	Created    time.Time  `json:"created"`
}

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, xUserID 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 xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @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, xUserID string, localVarOptionals *DeleteTransferByIDOpts) (*_nethttp.Response, error)

DeleteTransferByID Delete Transfer Remove a transfer for the specified userID. 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 xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @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, xUserID string, localVarOptionals *GetTransferByIDOpts) (Transfer, *_nethttp.Response, error)

GetTransferByID Get Transfer Get a Transfer object for the supplied userID

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param transferID transferID to retrieve
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param optional nil or *GetTransferByIDOpts - Optional Parameters:
  • @param "Offset" (optional.Int32) - The number of items to skip before starting to collect the result set
  • @param "Limit" (optional.Int32) - The number of items to return
  • @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, xUserID string, localVarOptionals *GetTransfersOpts) ([]Transfer, *_nethttp.Response, error)

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

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Unique userID set by an auth proxy or client to identify and isolate objects.
  • @param optional nil or *GetTransfersOpts - Optional Parameters:
  • @param "Offset" (optional.Int32) - The number of items to skip before starting to collect the result set
  • @param "Limit" (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.
  • @param "XRequestID" (optional.String) - Optional requestID allows application developer to trace requests through the systems logs

@return []Transfer

type UpdateOrganizationOpts

type UpdateOrganizationOpts struct {
	XRequestID optional.String
}

UpdateOrganizationOpts Optional parameters for the method 'UpdateOrganization'

type UpdateTenant

type UpdateTenant struct {
	// Legal name for this Tenant
	Name string `json:"name"`
}

UpdateTenant struct for UpdateTenant

type UpdateTenantOpts

type UpdateTenantOpts struct {
	XRequestID optional.String
}

UpdateTenantOpts Optional parameters for the method 'UpdateTenant'

Jump to

Keyboard shortcuts

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