From 58f96124295b34f69d0a76b471ec0b4424855ee4 Mon Sep 17 00:00:00 2001 From: Sketch <75850871+SketchMaster2001@users.noreply.github.com> Date: Thu, 20 Oct 2022 13:16:28 -0400 Subject: [PATCH] Properly handle ListPurchaseHistory --- ecs.go | 27 +++++++++++++++++---------- structure.go | 17 ++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ecs.go b/ecs.go index b6eda55..3ad07ae 100644 --- a/ecs.go +++ b/ecs.go @@ -167,20 +167,27 @@ func purchaseTitle(e *Envelope) { } func listPurchaseHistory(e *Envelope) { + // TODO(SketchMaster2001) Query database for transactions e.AddCustomType([]Transactions{ { TransactionId: "00000000", - Date: e.Timestamp(), - Type: string(SERVICE), - TotalPaid: 0, - Currency: "POINTS", - ItemId: 0, - TitleId: "000100014843494A", - ItemPricing: []Limits{ - LimitStruct(DR), + // Is timestamp in milliseconds, placeholder one is Wed Oct 19 2022 18:02:46 + Date: "1666202566218", + Type: "PURCHGAME", + TotalPaid: 0, + Currency: "POINTS", + ItemId: 0, + ItemPricing: Prices{ + ItemId: 0, + Price: Price{ + Amount: 0, + Currency: "POINTS", + }, + Limits: LimitStruct(PR), + LicenseKind: PERMANENT, }, - ReferenceId: "01234567890123456789012345678912", - ReferenceValue: 1, + TitleId: "000101006843494A", + ReferenceId: "01234567890123456789012345678912", }, }) diff --git a/structure.go b/structure.go index 26abff7..177b865 100644 --- a/structure.go +++ b/structure.go @@ -110,15 +110,14 @@ type Limits struct { // Transactions represents a common XML structure. type Transactions struct { - XMLName xml.Name `xml:"Transactions"` - TransactionId string `xml:"TransactionId"` - Date string `xml:"Date"` - Type string `xml:"Type"` - TotalPaid int `xml:"TotalPaid"` - Currency string `xml:"Currency"` - ItemId int `xml:"ItemId"` - // TODO: Is this correct? getComplex is called and then limits are queried - ItemPricing []Limits `xml:"ItemPricing"` + XMLName xml.Name `xml:"Transactions"` + TransactionId string `xml:"TransactionId"` + Date string `xml:"Date"` + Type string `xml:"Type"` + TotalPaid int `xml:"TotalPaid"` + Currency string `xml:"Currency"` + ItemId int `xml:"ItemId"` + ItemPricing Prices `xml:"ItemPricing"` TitleId string `xml:"TitleId,omitempty"` ItemCode int `xml:"ItemCode,omitempty"` ReferenceId string `xml:"ReferenceId,omitempty"`