feat embed wallets and add withdrawal records

This commit is contained in:
david
2026-07-29 15:29:49 +08:00
parent 0c94c8033a
commit a7d318a013
7 changed files with 102 additions and 32 deletions

View File

@@ -35,6 +35,12 @@ func platformMenuAllowsRequest(menus []platformbase.Menu, requestPath, method st
(menuIdentity == "gasorder_contract" || resource == "user_address") {
return true
}
if method == "GET" && relative == "wallet_basic" &&
(menu.Identity == "gas_basic" || menu.Identity == "delivery_basic" ||
menu.Identity == "staff" || menu.Identity == "user_account" ||
menu.Identity == "wallet_apply_cash") {
return true
}
}
return false
}

View File

@@ -46,6 +46,18 @@ func TestCreateOrderPermissionIsSeparateFromOrderManagement(t *testing.T) {
}
}
func TestOwnerMenusCanReadEmbeddedWallets(t *testing.T) {
for _, identity := range []string{"gas_basic", "delivery_basic", "staff", "user_account", "wallet_apply_cash"} {
menus := []platformbase.Menu{{Identity: identity}}
if !platformMenuAllowsRequest(menus, "/heqi/platform/v1/wallet_basic", "GET") {
t.Fatalf("%s could not read its embedded wallet", identity)
}
if platformMenuAllowsRequest(menus, "/heqi/platform/v1/wallet_basic/owner/user/test", "GET") {
t.Fatalf("%s unexpectedly received wallet creation access", identity)
}
}
}
func TestLocationScopeValuesAreExplicit(t *testing.T) {
if !validLocationScope("standard") || !validLocationScope("precise") {
t.Fatal("supported location scopes were rejected")