bff dev upgrde

This commit is contained in:
Stephan D
2026-01-30 16:39:12 +01:00
parent 51f5b0804a
commit e1f58b0982
22 changed files with 969 additions and 185 deletions

View File

@@ -5,6 +5,7 @@ package ledger.v1;
option go_package = "github.com/tech/sendico/pkg/proto/ledger/v1;ledgerv1";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "common/describable/v1/describable.proto";
import "common/money/v1/money.proto";
@@ -43,6 +44,21 @@ enum AccountStatus {
ACCOUNT_STATUS_FROZEN = 2;
}
enum AccountRole {
ACCOUNT_ROLE_UNSPECIFIED = 0;
ACCOUNT_ROLE_OPERATING = 1;
ACCOUNT_ROLE_HOLD = 2;
ACCOUNT_ROLE_TRANSIT = 3;
ACCOUNT_ROLE_SETTLEMENT = 4;
ACCOUNT_ROLE_CLEARING = 5;
ACCOUNT_ROLE_PENDING = 6;
ACCOUNT_ROLE_RESERVE = 7;
ACCOUNT_ROLE_LIQUIDITY = 8;
ACCOUNT_ROLE_FEE = 9;
ACCOUNT_ROLE_CHARGEBACK = 10;
ACCOUNT_ROLE_ADJUSTMENT = 11;
}
// LedgerAccount captures the canonical representation of an account resource.
message LedgerAccount {
string ledger_account_ref = 1;
@@ -52,12 +68,14 @@ message LedgerAccount {
string currency = 5;
AccountStatus status = 6;
bool allow_negative = 7;
bool is_settlement = 8;
reserved 8;
reserved "is_settlement";
map<string, string> metadata = 9;
google.protobuf.Timestamp created_at = 10;
google.protobuf.Timestamp updated_at = 11;
common.describable.v1.Describable describable = 12;
string owner_ref = 13;
AccountRole role = 14;
}
// A single posting line (mirrors your PostingLine model)
@@ -78,9 +96,11 @@ message CreateAccountRequest {
string currency = 5;
AccountStatus status = 6;
bool allow_negative = 7;
bool is_settlement = 8;
reserved 8;
reserved "is_settlement";
map<string, string> metadata = 9;
common.describable.v1.Describable describable = 10;
AccountRole role = 11;
}
message CreateAccountResponse {
@@ -98,6 +118,7 @@ message PostCreditRequest {
map<string, string> metadata = 7;
google.protobuf.Timestamp event_time = 8;
string contra_ledger_account_ref = 9; // optional override for settlement/contra account
AccountRole role = 10; // optional: assert target account has this role
}
message PostDebitRequest {
@@ -110,6 +131,7 @@ message PostDebitRequest {
map<string, string> metadata = 7;
google.protobuf.Timestamp event_time = 8;
string contra_ledger_account_ref = 9; // optional override for settlement/contra account
AccountRole role = 10; // optional: assert target account has this role
}
message TransferRequest {
@@ -122,6 +144,8 @@ message TransferRequest {
repeated PostingLine charges = 7; // optional FEE/SPREAD lines
map<string, string> metadata = 8;
google.protobuf.Timestamp event_time = 9;
AccountRole from_role = 10;
AccountRole to_role = 11;
}
message FXRequest {
@@ -188,8 +212,35 @@ message StatementResponse {
message ListAccountsRequest {
string organization_ref = 1;
// Optional owner filter with 3-state semantics:
// - not set: return all accounts within organization
// - set to empty string: return accounts where owner_ref is null/empty
// - set to a value: return accounts where owner_ref matches
google.protobuf.StringValue owner_ref_filter = 2;
}
message ListAccountsResponse {
repeated LedgerAccount accounts = 1;
}
// ---- Account status mutations ----
message BlockAccountRequest {
string ledger_account_ref = 1;
string organization_ref = 2;
AccountRole role = 3; // optional: assert account has this role before blocking
}
message BlockAccountResponse {
LedgerAccount account = 1;
}
message UnblockAccountRequest {
string ledger_account_ref = 1;
string organization_ref = 2;
AccountRole role = 3; // optional: assert account has this role before unblocking
}
message UnblockAccountResponse {
LedgerAccount account = 1;
}