diff --git a/cas.go b/cas.go index c1f02ea..1dde934 100644 --- a/cas.go +++ b/cas.go @@ -31,12 +31,12 @@ func listItems(e *Envelope) { Prices: Prices{ ItemId: 0, Price: Price{ - Amount: 100, + // Not sure about WSC, but must match the price for the title you are purchasing in Wii no Ma. + Amount: 0, Currency: "POINTS", }, - // Literally every Limit except for PR works - Limits: LimitStruct(TR), - LicenseKind: "RENTAL", + Limits: LimitStruct(DR), + LicenseKind: RENTAL, }, }) } diff --git a/constants.go b/constants.go index f814d37..b90e8c2 100644 --- a/constants.go +++ b/constants.go @@ -13,6 +13,18 @@ const ( AT = 10000 ) +// LicenceKinds represents the various rights a user has to a title. +type LicenceKinds string + +const ( + PERMANENT LicenceKinds = "PERMANENT" + DEMO LicenceKinds = "DEMO" + TRIAL LicenceKinds = "TRIAL" + RENTAL LicenceKinds = "RENTAL" + SUBSCRIPT LicenceKinds = "SUBSCRIPT" + SERVICE LicenceKinds = "SERVICE" +) + // LimitStruct returns a Limits struct filled for the given kind. func LimitStruct(kind LimitKinds) Limits { names := map[LimitKinds]string{ diff --git a/structure.go b/structure.go index bd7a023..5c49266 100644 --- a/structure.go +++ b/structure.go @@ -104,7 +104,7 @@ type Balance struct { // Limits represents a common XML structure for transaction information. type Limits struct { XMLName xml.Name `xml:"Limits"` - Limits LimitKinds `xml:"Limits,omitempty"` + Limits LimitKinds `xml:"Limits"` LimitKind string `xml:"LimitKind,omitempty"` } @@ -161,8 +161,8 @@ type Price struct { type Prices struct { ItemId int `xml:"ItemId"` Price Price - Limits Limits `xml:"Limits"` - LicenseKind string `xml:"LicenseKind"` + Limits Limits `xml:"Limits"` + LicenseKind LicenceKinds `xml:"LicenseKind"` } // Items allows specifying an overview of a title's contents. @@ -181,4 +181,5 @@ type Ratings struct { Name string `xml:"Name"` Rating int `xml:"Rating"` Age int `xml:"Age"` + // There is also a `Descriptors` field } diff --git a/utils.go b/utils.go index 96f2e42..a3fc945 100644 --- a/utils.go +++ b/utils.go @@ -35,7 +35,7 @@ import ( var namespaceParse = regexp.MustCompile(`^urn:(.{3})\.wsapi\.broadon\.com/(.*)$`) // parseAction interprets contents along the lines of "urn:ecs.wsapi.broadon.com/CheckDeviceStatus", -//where "CheckDeviceStatus" is the action to be performed. +// where "CheckDeviceStatus" is the action to be performed. func parseAction(original string) (string, string) { // Intended to return the original string, the service's name and the name of the action. matches := namespaceParse.FindStringSubmatch(original)