unique ids
Some checks failed
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Failing after 4s
Build and Publish / BuildAndDeployArm64 (push) Failing after 2s

This commit is contained in:
matst80
2025-11-18 21:30:50 +01:00
parent 0994c4f484
commit c4c116fc43
2 changed files with 10 additions and 0 deletions

View File

@@ -24,8 +24,10 @@ func UpsertSubscriptionDetails(g *CartGrain, m *messages.UpsertSubscriptionDetai
}
id := MustNewCartId().String()
g.SubscriptionDetails[id] = &SubscriptionDetails{
Id: id,
Version: 1,
OfferingCode: m.OfferingCode,
SigningType: m.SigningType,
Meta: meta,
@@ -38,11 +40,14 @@ func UpsertSubscriptionDetails(g *CartGrain, m *messages.UpsertSubscriptionDetai
if !ok {
return fmt.Errorf("subscription details not found")
}
changed := false
if m.OfferingCode != "" {
existing.OfferingCode = m.OfferingCode
changed = true
}
if m.SigningType != "" {
existing.SigningType = m.SigningType
changed = true
}
if m.Data != nil {
// Only validate & assign if there is content; empty -> leave as-is.
@@ -51,7 +56,11 @@ func UpsertSubscriptionDetails(g *CartGrain, m *messages.UpsertSubscriptionDetai
return fmt.Errorf("subscription details invalid json")
}
existing.Meta = m.Data.Value
changed = true
}
}
if changed {
existing.Version++
}
return nil
}