diff --git a/main.go b/main.go
index ed99a00..0ab1c14 100644
--- a/main.go
+++ b/main.go
@@ -36,14 +36,29 @@ const (
/////////////////////
// SOAP STRUCTURES //
/////////////////////
+// The structures may seem repetitive and redundant, but blame WSC's inconsistent SOAP requests.
+// CheckDeviceStatus
type CDS struct {
XMLName xml.Name `xml:"Envelope"`
Version string `xml:"Body>CheckDeviceStatus>Version"`
DeviceId string `xml:"Body>CheckDeviceStatus>DeviceId"`
MessageId string `xml:"Body>CheckDeviceStatus>MessageId"`
}
+
+// NotifiedETicketsSynced
type NETS struct {
+ XMLName xml.Name `xml:"Envelope"`
+ Version string `xml:"Body>NotifiedETicketsSynced>Version"`
+ DeviceId string `xml:"Body>NotifiedETicketsSynced>DeviceId"`
+ MessageId string `xml:"Body>NotifiedETicketsSynced>MessageId"`
+}
+// ListETickets
+type LET struct {
+ XMLName xml.Name `xml:"Envelope"`
+ Version string `xml:"Body>ListETickets>Version"`
+ DeviceId string `xml:"Body>ListETickets>DeviceId"`
+ MessageId string `xml:"Body>ListETickets>MessageId"`
}
func main() {
@@ -109,10 +124,94 @@ func handler(w http.ResponseWriter, r *http.Request) {
err = xml.Unmarshal([]byte(body), &NETS)
if err != nil {
fmt.Println("...or not. Bad or incomplete request. (End processing.)")
- fmt.Fprint(w, "You need to POST some SOAP from WSC if you wanna get some, honey. ;)")
+ fmt.Fprint(w, "This is a disgusting request, but 20 dollars is 20 dollars. ;)")
fmt.Printf("error: %v", err)
return
}
+ fmt.Println(NETS)
+ fmt.Println("The request is valid! Responding...")
+ fmt.Fprintf(w, `
+
+
+
+ ` + NETS.Version + `
+ ` + NETS.DeviceId + `
+ ` + NETS.MessageId + `
+ 00000000
+ 0
+ false
+
+
+`)
+ fmt.Println("Delivered response!")
+
+ } else {
+
+ // ListETickets
+ if bytes.Contains(body, []byte("ListETickets")) {
+ fmt.Println("LET")
+ LET := LET{}
+ err = xml.Unmarshal([]byte(body), &LET)
+ if err != nil {
+ fmt.Println("...or not. Bad or incomplete request. (End processing.)")
+ fmt.Fprint(w, "This is a disgusting request, but 20 dollars is 20 dollars. ;)")
+ fmt.Printf("error: %v", err)
+ return
+ }
+ fmt.Println(LET)
+ fmt.Println("The request is valid! Responding...")
+ fmt.Fprintf(w, `
+
+
+
+ ` + LET.Version + `
+ ` + LET.DeviceId + `
+ ` + LET.MessageId + `
+ 00000000
+ 0
+ false
+ 0
+ 0
+ 00000000
+
+
+`)
+ fmt.Println("Delivered response!")
+
+ } else {
+ if bytes.Contains(body, []byte("PurchaseTitle")){
+
+ } else {
+
+ // IDENTITY AUTHENTICATION SOAP
+
+ if bytes.Contains(body, []byte("CheckRegistration")){
+
+ } else {
+
+ if bytes.Contains(body, []byte("GetRegistrationInfo")){
+
+ } else {
+
+ if bytes.Contains(body, []byte("Register")){
+
+ } else {
+
+ if bytes.Contains(body, []byte("Unregister")){
+
+ } else {
+ fmt.Println("Nothing sent?")
+ fmt.Fprintf(w, "the bathtub is empty, it needs SOAP. ;)")
+ }
+ }
+ }
+ }
+ }
+ }
}
}