diff --git a/roqqio/POSLog_test.go b/roqqio/POSLog_test.go index 87e6bdf..8b9b0ff 100644 --- a/roqqio/POSLog_test.go +++ b/roqqio/POSLog_test.go @@ -117,6 +117,33 @@ func TestRetoureWithLinkXml(t *testing.T) { assertThat(t, lineItems[0].Sale.TransactionLink.BusinessDayDate, "2024-10-15") } +func TestPosStorno(t *testing.T) { + posLog := handleXmlFile(t, "testdata/sale_with_posStorno.xml") + assertNil(t, posLog.Transaction.RetailTransaction.Customer) + assertNil(t, posLog.GetCustomer()) + assertNil(t, posLog.GetLoyaltyAccount()) + + assertNotNil(t, posLog.GetLineItems()) + assertThat(t, len(*posLog.GetLineItems()), 3) + + lineItems := *posLog.GetLineItems() + assertThat(t, lineItems[0].GetType(), LineTypeSale) + assertThat(t, lineItems[0].IsSale(), true) + assertThat(t, lineItems[0].IsTender(), false) + assertThat(t, lineItems[0].IsTenderChange(), false) + + assertThat(t, lineItems[1].GetType(), LineTypeSale) + assertThat(t, lineItems[1].IsSale(), true) + assertThat(t, lineItems[1].IsTender(), false) + assertThat(t, lineItems[1].IsTenderChange(), false) + + assertThat(t, lineItems[2].GetType(), LineTypeTender) + assertThat(t, lineItems[2].IsSale(), false) + assertThat(t, lineItems[2].IsTender(), true) + assertThat(t, lineItems[2].IsTenderChange(), false) + assertThat(t, lineItems[2].Tender.TypeCode, TenderTypeCodeSale) +} + func assertNotNil[C any](t *testing.T, a *C) { t.Helper() if a == nil { diff --git a/roqqio/testdata/retoure_with_link.xml b/roqqio/testdata/retoure_with_link.xml index 463cfae..98cb7ff 100755 --- a/roqqio/testdata/retoure_with_link.xml +++ b/roqqio/testdata/retoure_with_link.xml @@ -78,6 +78,6 @@ 2024-10-15 2024-10-15T09:26:27.433Z 2024-10-15T09:27:02.649Z - LNK/S2/V6:3569/ba39f79318d327b4e732eef6444a4c2122c89ac7fd36a2c05b44e41abdd50a6a6cab9d6a586922c4fa6d932cbbfb91dfe20b6e99ca3a949e304d81ee80ffa5f6 + LNK/S2/V6:3569/[invalid] diff --git a/roqqio/testdata/sale_with_posStorno.xml b/roqqio/testdata/sale_with_posStorno.xml new file mode 100755 index 0000000..5d5058f --- /dev/null +++ b/roqqio/testdata/sale_with_posStorno.xml @@ -0,0 +1,69 @@ + + + + + 100 + + 10001 + 3617 + 2024-10-15T14:11:12.214 + 0 + 2024-10-15T14:11:12.214 + 3617 + + + + 4022847518216 + 1.490 + 1.490 + 1.490 + 0 + 1.0000 + 0.000 + MODE_NORMAL + ITEM_SALE + - + MEHRFARBIGES MOTIV + 011 + 8091115 + + 11 + + + + 4022847522022 + 1.290 + 1.290 + 1.290 + 0 + 1.0000 + 0.000 + MODE_NORMAL + ITEM_SALE + - + MEHRFARBIGES MOTIV + 011 + 8091115 + + 12 + + + + 2.780 + 0.000 + 1 + Bar + + 14 + + 2.780 + 2.330 + 0.440 + 2.780 + + 2024-10-15 + 2024-10-15T12:09:02.775Z + 2024-10-15T12:11:12.214Z + LNK/S2/V6:3616/[invalid] + +