This repository has been archived by the owner on Sep 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
templates.go
74 lines (71 loc) · 2.39 KB
/
templates.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package eqip
// Due to optional location fields, do not execute template with "missingkey=error"
const userTemplate = `
{{- $ssn := .Identification.ApplicantSSN.props.ssn.props}}
{{- $name := .Identification.ApplicantName.props.Name.props }}
{{- $date := .Identification.ApplicantBirthDate.props.Date.props}}
{{- $location := .Identification.ApplicantBirthPlace.props.Location.props}}
<key>
<pseudoSsn>false</pseudoSsn>
<ssn>{{$ssn.first}}{{$ssn.middle}}{{$ssn.last}}</ssn>
</key>
<demographicData>
<birth>
<date>
<day>{{$date.day}}</day>
<month>{{$date.month}}</month>
<year>{{$date.year}}</year>
</date>
<place>
<city>{{$location.city}}</city>
<country>{{$location.country}}</country>
{{with $location.state}}
<state>{{$location.state}}</state>
{{end}}
{{with $location.county}}
<county>{{$location.county}}</county>
{{end}}
</place>
</birth>
<fullName>
<first>{{$name.first}}</first>
<middle>{{$name.middle}}</middle>
<last>{{$name.last}}</last>
</fullName>
<email></email>
<telephone></telephone>
</demographicData>
`
const importRequestTemplate = `
<ns2:importRequest xmlns:ns2="http://webservice.ws.eqip.opm.gov/">
<arg0 xmlns="">
<agency>
<agencyId>{{.CallerInfo.AgencyID}}</agencyId>
</agency>
<agencyUser>
<pseudoSsn>{{.CallerInfo.AgencyUser.PseudoSSN}}</pseudoSsn>
<ssn>{{.CallerInfo.AgencyUser.SSN}}</ssn>
</agencyUser>
<callerIpAddress></callerIpAddress>
</arg0>
<arg1 xmlns="">
{{.Applicant}}
</arg1>
<arg2 xmlns="">
<agencyId>{{.AgencyID}}</agencyId>
</arg2>
<arg3 xmlns="">
<groupId>{{.AgencyGroupID}}</groupId>
</arg3>
<arg4>{{- .Content -}}</arg4>
</ns2:importRequest>
`
const isAliveTemplate = `
<ns2:isAlive xmlns:ns2="http://webservice.ws.eqip.opm.gov/" />
`
const envelopeTemplate = `
<?xml version="1.0"?>
<eapp>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><eqipws-auth:Authentication xmlns:eqipws-auth="urn:gov.opm.eqip.ws/Authentication"><UnencryptedSecurityToken xmlns="">{{- .Unsigned -}}</UnencryptedSecurityToken><EncryptedSecurityToken xmlns="">{{- .Signed -}}</EncryptedSecurityToken></eqipws-auth:Authentication></SOAP-ENV:Header><S:Body xmlns:ns2="http://webservice.ws.eqip.opm.gov/">{{- .RequestBody.XML -}}</S:Body></S:Envelope>
</eapp>
`