diff --git a/main.go b/main.go
index 2c3209a..b093af0 100644
--- a/main.go
+++ b/main.go
@@ -24,6 +24,7 @@ import (
"io/ioutil"
"log"
"net/http"
+ "strconv"
"time"
)
@@ -77,6 +78,7 @@ type CR struct {
Version string `xml:"Body>CheckRegistration>Version"`
DeviceId string `xml:"Body>CheckRegistration>DeviceId"`
MessageId string `xml:"Body>CheckRegistration>MessageId"`
+ SerialNo string `xml:"Body>CheckRegistration>SerialNumber"`
}
// GetRegistrationInfo
@@ -85,6 +87,8 @@ type GRI struct {
Version string `xml:"Body>GetRegistrationInfo>Version"`
DeviceId string `xml:"Body>GetRegistrationInfo>DeviceId"`
MessageId string `xml:"Body>GetRegistrationInfo>MessageId"`
+ AccountId string `xml:"Body>GetRegistrationInfo>AccountId"`
+ Country string `xml:"Body>GetRegistrationInfo>Country"`
}
// Register
@@ -102,6 +106,13 @@ func main() {
}
func handler(w http.ResponseWriter, r *http.Request) {
+
+ // Get a sexy new timestamp to use.
+ timestampnano := strconv.FormatInt(time.Now().UTC().Unix(), 10)
+ fmt.Println(timestampnano)
+ timestamp := timestampnano + "000"
+ fmt.Println(timestamp)
+
fmt.Println("-=Incoming request!=-")
body, err := ioutil.ReadAll(r.Body)
if err != nil {
@@ -131,10 +142,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- 2.0
+ `+CDS.Version+`
`+CDS.DeviceId+`
`+CDS.MessageId+`
- 00000000
+ `+timestamp+`
0
false
@@ -142,8 +153,8 @@ func handler(w http.ResponseWriter, r *http.Request) {
POINTS
0
- 00000000
- 00000000
+ `+timestamp+`
+ `+timestamp+`
`)
@@ -173,7 +184,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
`+NETS.Version+`
`+NETS.DeviceId+`
`+NETS.MessageId+`
- 00000000
+ `+timestamp+`
0
false
@@ -205,12 +216,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
`+LET.Version+`
`+LET.DeviceId+`
`+LET.MessageId+`
- 00000000
+ `+timestamp+`
0
false
0
- 0
- 00000000
+ `+timestamp+`
+ `+timestamp+`
`)
@@ -238,7 +249,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
`+PT.Version+`
`+PT.DeviceId+`
`+PT.MessageId+`
- 00000000
+ `+timestamp+`
0
false
@@ -247,10 +258,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
00000000
- `+time.RFC3339+`
+ `+timestamp+`
PURCHGAME
- 00000000
+ `+timestamp+`
00000000
00000000
00000000
@@ -284,11 +295,11 @@ func handler(w http.ResponseWriter, r *http.Request) {
`+CR.Version+`
`+CR.DeviceId+`
`+CR.DeviceId+`
- 00000000
+ `+timestamp+`
0
false
-
- $DeviceStatus
+ `+CR.SerialNo+`
+ R
`)
@@ -307,7 +318,29 @@ func handler(w http.ResponseWriter, r *http.Request) {
}
fmt.Println(GRI)
fmt.Println("The request is valid! Responding...")
- fmt.Fprintf(w, ``)
+ fmt.Fprintf(w, `
+
+
+
+ `+GRI.Version+`
+ `+GRI.DeviceId+`
+ `+GRI.MessageId+`
+ `+timestamp+`
+ 0
+ false
+ `+GRI.AccountId+`
+ 00000000
+ false
+ `+GRI.Country+`
+
+ 0000000000000000
+ R
+ POINTS
+
+
+`)
} else {