eqip

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: CC0-1.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSOAPEnvelopeTemplate

func NewSOAPEnvelopeTemplate(action RequestBody, unsigned, signed string) (io.Reader, error)

NewSOAPEnvelopeTemplate populates the envelope element for a SOAP request

Types

type AgencyKey

type AgencyKey struct {
	AgencyID int `xml:"agencyId"`
}

AgencyKey represents the identifier for an Agency in e-QIP

<xs:complexType name="agencyKey">
	<xs:sequence>
		<xs:element name="agencyId" type="xs:int"/>
	</xs:sequence>
</xs:complexType>

type AgencyUser

type AgencyUser struct {
	PseudoSSN bool
	SSN       string
}

AgencyUser represents the Agency User making this call

type Attachment

type Attachment struct {
	AttachmentBytes       string         `xml:"attachmentBytes"`
	AttachmentDescription string         `xml:"attachmentDescription"`
	AttachmentFileName    string         `xml:"attachmentFileName"`
	AttachmentKey         *AttachmentKey `xml:"attachmentKey"`
	DocumentType          string         `xml:"documentType"`
	MethodOfTransmission  string         `xml:"methodOfTransmission"`
}

Attachment represents a document that is attached to an e-QIP investigation request

  <xs:complexType name="attachment">*/
	  <xs:sequence>
		  <xs:element name="attachmentBytes" type="xs:base64Binary" minOccurs="0"/>
		  <xs:element name="attachmentDescription" type="xs:string" minOccurs="0"/>
		  <xs:element name="attachmentFileName" type="xs:string" minOccurs="0"/>
		  <xs:element name="attachmentKey" type="tns:attachmentKey" minOccurs="0"/>
		  <xs:element name="documentType" type="tns:documentType" minOccurs="0"/>
		  <xs:element name="methodOfTransmission" type="tns:attachmentTransmissionMethod" minOccurs="0"/>
	  </xs:sequence>
  </xs:complexType>

type AttachmentKey

type AttachmentKey struct {
	AttachmentID int `xml:"attachmentId"`
}

AttachmentKey represents an identifier for an attachment within the e-QIP system

  <xs:complexType name="attachmentKey">
	  <xs:sequence>
		  <xs:element name="attachmentId" type="xs:int"/>
	  </xs:sequence>
  </xs:complexType>

type Base64Content

type Base64Content string

Base64Content is a string that can compress and convert itself to base64

func (*Base64Content) Compress

func (b *Base64Content) Compress(content string) error

Compress the `Base64Content` using zlib.

type Body

type Body interface {
	SetResponseBody([]byte)
}

Body is used for the contents of a SOAP body

type CallerInfo

type CallerInfo struct {
	AgencyID   string
	AgencyUser AgencyUser
}

CallerInfo represents the agency and agency user making the web service call

func NewCallerInfo

func NewCallerInfo(agencyID string, psuedoSSN bool, ssn string) CallerInfo

NewCallerInfo creates a CallerInfo struct based on agency id and ssn values

type Client

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

Client is a webservice client used to interact with eqip webservice

func NewClient

func NewClient(endpointURL, privateKeyPath string) *Client

NewClient creates a new Client that interacts with the eqip webservice. This client requires the endpoint URL to send data to and the path to the private key file that is used for signing security tokens.

func (*Client) ImportRequest

func (c *Client) ImportRequest(r *ImportRequest) (*ImportSOAPResponse, error)

ImportRequest is used to import applicant information into eqip. Based on the documentation, error responses possible with this service call include EqipWSException and CharacterEncodingException.

func (*Client) IsAlive

func (c *Client) IsAlive() error

IsAlive checks if the webservice API is available

func (*Client) Send

func (c *Client) Send(action RequestBody, response Body) error

Send prepares the SOAP envelope and request body and fires off the request

type ErrEqipWSException

type ErrEqipWSException struct {
	Message       string   `xml:"message"`
	ErrorMessages []string `xml:"errorMessages"`
}

ErrEqipWSException describes a generic error condition in the e-QIP Web Service Interface. This struct implements the Error interface so that it can be handled like typical golang errors.

func (ErrEqipWSException) Error

func (e ErrEqipWSException) Error() string

Error returns the message associated to the webservice exception.

type ImportRequest

type ImportRequest struct {
	CallerInfo    CallerInfo
	Applicant     UserTemplate
	AgencyID      int
	AgencyGroupID int
	Content       Base64Content
}

ImportRequest contains information for executing an eqip importRequest

func NewImportRequest

func NewImportRequest(ci CallerInfo, agencyID, agencyGroupID int, app map[string]interface{}, xmlContent string) (*ImportRequest, error)

NewImportRequest creates an import request to be sent to the webservice. This is a helper func that properly sets up the user demographic data, compresses and encodes the xml content and fills in the agency ids

func (ImportRequest) XML

func (a ImportRequest) XML() string

XML returns an xml representation of an ImportRequest

type ImportRequestResponse

type ImportRequestResponse struct {
	Return *Request `xml:"return"`
}

ImportRequestResponse is the response returned when a request is successful

<xs:complexType name="importRequestResponse">
	<xs:sequence>
		<xs:element name="return" type="tns:request" minOccurs="0"/>
	</xs:sequence>
</xs:complexType>

func (*ImportRequestResponse) Bytes

func (response *ImportRequestResponse) Bytes() []byte

Bytes converts the response to a byte array.

func (*ImportRequestResponse) Keys

func (response *ImportRequestResponse) Keys() (int, string)

Keys returns the agency and request keys from the response.

type ImportSOAPResponse

type ImportSOAPResponse struct {
	SOAPFault
	ImportRequestResponse *ImportRequestResponse `xml:"Body>importRequestResponse"`
	ResponseBody          []byte
}

ImportSOAPResponse is a wrapper struct containing success and failure information

func (*ImportSOAPResponse) SetResponseBody

func (r *ImportSOAPResponse) SetResponseBody(b []byte)

SetResponseBody sets the responses body value.

type IsAlive

type IsAlive struct{}

IsAlive is a no-op method that allows for testing that the e-QIP Agency Web Service Interface is available and operating <xs:complexType name="isAlive"><xs:sequence/>

func (IsAlive) XML

func (a IsAlive) XML() string

XML returns the xml representation of IsAlive

type IsAliveSOAPResponse

type IsAliveSOAPResponse struct {
	SOAPFault
	ResponseBody []byte
}

IsAliveSOAPResponse is a wrapper struct containing success and failure information

func (*IsAliveSOAPResponse) SetResponseBody

func (r *IsAliveSOAPResponse) SetResponseBody(b []byte)

SetResponseBody sets the responses body value.

type Request

type Request struct {
	XMLName           xml.Name
	InitiatingAgency  *AgencyKey  `xml:"initiatingAgency"`
	RequestKey        *RequestKey `xml:"requestKey"`
	UserAleadyExisted bool        `xml:"userAlreadyExisted"`
}

Request contains information for an ImportRequestResponse

<xs:complexType name="request">
	<xs:sequence>
		<xs:element name="initiatingAgency" type="tns:agencyKey" minOccurs="0"/>
		<xs:element name="requestKey" type="tns:requestKey" minOccurs="0"/>
		<xs:element name="userAlreadyExisted" type="xs:boolean"/>
	</xs:sequence>
</xs:complexType>

type RequestBody

type RequestBody interface {
	XML() string
}

RequestBody are objects that return XML representations of themselves

type RequestKey

type RequestKey struct {
	RequestID string `xml:"requestId"`
}

RequestKey uniquely identifies an Investigation Request within the e-QIP system

<xs:complexType name="requestKey">
	<xs:sequence>
		<xs:element name="requestId" type="xs:string" minOccurs="0"/>
	</xs:sequence>
</xs:complexType>

type SOAPFault

type SOAPFault struct {
	EqipWSException           *ErrEqipWSException `xml:"Body>Fault>detail>EqipWSException"`
	CharacerEncodingException *ErrEqipWSException `xml:"Body>Fault>detail>CharacterEncodingException"`
}

SOAPFault contains information about a webservice error. The general structure for SOAP 1.1 fault is the following: <xs:complexType name="Fault" final="extension">

  <xs:sequence>
	  <xs:element name="faultcode" type="xs:QName"/>
	  <xs:element name="faultstring" type="xs:string"/>
	  <xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
	  <xs:element name="detail" type="tns:detail" minOccurs="0">
  </xs:sequence>

</xs:complexType> The application specific error information is placed in the <detail /> element which is why we extract those values directly with this struct. For instance:

<S:Fault>
    <detail>
        <ns2:EqipWSException>
            <message>This is an error message</message>
            <errorMessages>Error1</errorMessages>
            <errorMessages>Error2</errorMessages>
        </ns2:EqipWSException>
    </detail>
</S:Fault>

The response schema can contain two possible exceptions:

   EqipWSException
	   Represents a generic error condition in the e-QIP Web Service Interface.
   CharacerEncodingException
	   Represents an error state due to an invalid String character encoding.

Both exceptions contain the same structure but only one instance of it will ever be returned (if any errors exist).

func (SOAPFault) Error

func (f SOAPFault) Error() error

Error returns the appropriate error that contains the error information if any exist

type UserTemplate

type UserTemplate string

UserTemplate stores an applicants demographic information

func (*UserTemplate) Load

func (t *UserTemplate) Load(app map[string]interface{}) error

Load will use the application data in the user template.

Jump to

Keyboard shortcuts

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