ration/pkg/pb/gateway/gateway_grpc.pb.go
caelum0x c3236f0bca feat(card-issuance,gateway,cli): add CloseCard — issued cards could never be shut off
CARD_STATUS_SUSPENDED/CLOSED have existed in common.proto since the
original build, and the Airwallex client package even defined
CardStatusSuspended/CardStatusClosed constants, but nothing in this
repo ever transitioned a stored card into either state: card-issuance's
airwallex.Client interface only exposed IssueCard/GetCard/
SetCardControls (limit/controls only, never status), so a leaked
credential, an offboarded cardholder's card, or any card that should
stop spending forever had no real operator path to close — only
"adjust-limit" to a smaller (but still nonzero-possible, still active)
limit.

Adds card_issuance.proto/gateway.proto's CloseCard RPC, a real
airwallex.Client.CloseCard on both Mock and Live (POST
/api/v1/issuing/cards/{id}/close), cardsvc.Service.CloseCard (releases
the card's full remaining ledger HOLD back to the tenant's available
balance, idempotent on an already-closed card), the gateway fan-out,
and `ration card close --card <id>`. AdjustCardLimit now rejects a
closed card instead of silently reopening a zombie hold.

tenantauth/ratelimit needed zero changes: both resolve card_id via
reflection, so CloseCardRequest's card_id field is automatically
tenant-scoped and rate-limited the same way GetCard/AdjustCardLimit
already are.

Verified live against the real bare-metal 7-service stack
(scripts/run-demo.sh): issued a real card (Held 1,000.00 USD), closed
it (status CLOSED, Held back to 0.00, Available back to 7,500.00),
re-closed it (idempotent — Available unchanged, no double-release),
confirmed adjust-limit on the closed card is rejected, and confirmed
closing an unknown card_id surfaces the same NotFound-wrapped error
GetCard/AdjustCardLimit already do. verify-chain: intact (5 records).
`go build`/`go vet` clean across every Go module (gateway,
card-issuance, cli, tui, auth, tenant-registry, webhook-ingestion,
agent, audit-log, sdk/go/ration), full `make build` (Rust+Go+SDK)
clean, 0 regressions.
2026-10-29 11:35:23 +03:00

468 lines
19 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v6.33.4
// source: gateway.proto
package gateway
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Gateway_IssueCard_FullMethodName = "/ration.gateway.v1.Gateway/IssueCard"
Gateway_AdjustCardLimit_FullMethodName = "/ration.gateway.v1.Gateway/AdjustCardLimit"
Gateway_GetCard_FullMethodName = "/ration.gateway.v1.Gateway/GetCard"
Gateway_ListCards_FullMethodName = "/ration.gateway.v1.Gateway/ListCards"
Gateway_CloseCard_FullMethodName = "/ration.gateway.v1.Gateway/CloseCard"
Gateway_RationBridgeFunding_FullMethodName = "/ration.gateway.v1.Gateway/RationBridgeFunding"
Gateway_SimulateDeposit_FullMethodName = "/ration.gateway.v1.Gateway/SimulateDeposit"
Gateway_StreamActivity_FullMethodName = "/ration.gateway.v1.Gateway/StreamActivity"
Gateway_GetDashboardSnapshot_FullMethodName = "/ration.gateway.v1.Gateway/GetDashboardSnapshot"
)
// GatewayClient is the client API for Gateway service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Gateway is the Go service that owns the Airwallex integration
// (Issuing API, Global Accounts, webhooks) and fronts LedgerCore for
// the TUI, CLI and Agent. It never stores money state itself — every
// balance-affecting call is proxied to LedgerCore so there is one
// source of truth.
type GatewayClient interface {
IssueCard(ctx context.Context, in *IssueCardRequest, opts ...grpc.CallOption) (*Card, error)
AdjustCardLimit(ctx context.Context, in *AdjustCardLimitRequest, opts ...grpc.CallOption) (*Card, error)
GetCard(ctx context.Context, in *GetCardRequest, opts ...grpc.CallOption) (*Card, error)
ListCards(ctx context.Context, in *ListCardsRequest, opts ...grpc.CallOption) (*ListCardsResponse, error)
// CloseCard permanently closes a card — see card_issuance.proto's
// identical RPC, which this is a direct fan-out to (docs/adr/0004).
CloseCard(ctx context.Context, in *CloseCardRequest, opts ...grpc.CallOption) (*Card, error)
RationBridgeFunding(ctx context.Context, in *RationBridgeFundingRequest, opts ...grpc.CallOption) (*RationBridgeFundingResponse, error)
SimulateDeposit(ctx context.Context, in *SimulateDepositRequest, opts ...grpc.CallOption) (*SimulateDepositResponse, error)
StreamActivity(ctx context.Context, in *StreamActivityRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ActivityEvent], error)
// GetDashboardSnapshot is the one aggregate read the judge-facing web
// dashboard (services/gateway/internal/httpapi's "/v1/dashboard"
// routes) polls: every tenant's reserve-floor headroom in one round
// trip, plus the most recent agent decisions (rationale and
// policy_snapshot_json included) across every tenant, newest first.
// Nothing here is new business logic — it's the same ListTenants/
// GetBalance/CheckReserveFloor/ListAgentDecisions data
// services/tui/internal/client already fetches per-tenant over
// separate gRPC calls, aggregated server-side into one response so a
// browser polling this endpoint doesn't need N+1 round trips per
// refresh.
GetDashboardSnapshot(ctx context.Context, in *GetDashboardSnapshotRequest, opts ...grpc.CallOption) (*GetDashboardSnapshotResponse, error)
}
type gatewayClient struct {
cc grpc.ClientConnInterface
}
func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient {
return &gatewayClient{cc}
}
func (c *gatewayClient) IssueCard(ctx context.Context, in *IssueCardRequest, opts ...grpc.CallOption) (*Card, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Card)
err := c.cc.Invoke(ctx, Gateway_IssueCard_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) AdjustCardLimit(ctx context.Context, in *AdjustCardLimitRequest, opts ...grpc.CallOption) (*Card, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Card)
err := c.cc.Invoke(ctx, Gateway_AdjustCardLimit_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) GetCard(ctx context.Context, in *GetCardRequest, opts ...grpc.CallOption) (*Card, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Card)
err := c.cc.Invoke(ctx, Gateway_GetCard_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) ListCards(ctx context.Context, in *ListCardsRequest, opts ...grpc.CallOption) (*ListCardsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListCardsResponse)
err := c.cc.Invoke(ctx, Gateway_ListCards_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) CloseCard(ctx context.Context, in *CloseCardRequest, opts ...grpc.CallOption) (*Card, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Card)
err := c.cc.Invoke(ctx, Gateway_CloseCard_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) RationBridgeFunding(ctx context.Context, in *RationBridgeFundingRequest, opts ...grpc.CallOption) (*RationBridgeFundingResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RationBridgeFundingResponse)
err := c.cc.Invoke(ctx, Gateway_RationBridgeFunding_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) SimulateDeposit(ctx context.Context, in *SimulateDepositRequest, opts ...grpc.CallOption) (*SimulateDepositResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SimulateDepositResponse)
err := c.cc.Invoke(ctx, Gateway_SimulateDeposit_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gatewayClient) StreamActivity(ctx context.Context, in *StreamActivityRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ActivityEvent], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], Gateway_StreamActivity_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[StreamActivityRequest, ActivityEvent]{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Gateway_StreamActivityClient = grpc.ServerStreamingClient[ActivityEvent]
func (c *gatewayClient) GetDashboardSnapshot(ctx context.Context, in *GetDashboardSnapshotRequest, opts ...grpc.CallOption) (*GetDashboardSnapshotResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetDashboardSnapshotResponse)
err := c.cc.Invoke(ctx, Gateway_GetDashboardSnapshot_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// GatewayServer is the server API for Gateway service.
// All implementations must embed UnimplementedGatewayServer
// for forward compatibility.
//
// Gateway is the Go service that owns the Airwallex integration
// (Issuing API, Global Accounts, webhooks) and fronts LedgerCore for
// the TUI, CLI and Agent. It never stores money state itself — every
// balance-affecting call is proxied to LedgerCore so there is one
// source of truth.
type GatewayServer interface {
IssueCard(context.Context, *IssueCardRequest) (*Card, error)
AdjustCardLimit(context.Context, *AdjustCardLimitRequest) (*Card, error)
GetCard(context.Context, *GetCardRequest) (*Card, error)
ListCards(context.Context, *ListCardsRequest) (*ListCardsResponse, error)
// CloseCard permanently closes a card — see card_issuance.proto's
// identical RPC, which this is a direct fan-out to (docs/adr/0004).
CloseCard(context.Context, *CloseCardRequest) (*Card, error)
RationBridgeFunding(context.Context, *RationBridgeFundingRequest) (*RationBridgeFundingResponse, error)
SimulateDeposit(context.Context, *SimulateDepositRequest) (*SimulateDepositResponse, error)
StreamActivity(*StreamActivityRequest, grpc.ServerStreamingServer[ActivityEvent]) error
// GetDashboardSnapshot is the one aggregate read the judge-facing web
// dashboard (services/gateway/internal/httpapi's "/v1/dashboard"
// routes) polls: every tenant's reserve-floor headroom in one round
// trip, plus the most recent agent decisions (rationale and
// policy_snapshot_json included) across every tenant, newest first.
// Nothing here is new business logic — it's the same ListTenants/
// GetBalance/CheckReserveFloor/ListAgentDecisions data
// services/tui/internal/client already fetches per-tenant over
// separate gRPC calls, aggregated server-side into one response so a
// browser polling this endpoint doesn't need N+1 round trips per
// refresh.
GetDashboardSnapshot(context.Context, *GetDashboardSnapshotRequest) (*GetDashboardSnapshotResponse, error)
mustEmbedUnimplementedGatewayServer()
}
// UnimplementedGatewayServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedGatewayServer struct{}
func (UnimplementedGatewayServer) IssueCard(context.Context, *IssueCardRequest) (*Card, error) {
return nil, status.Error(codes.Unimplemented, "method IssueCard not implemented")
}
func (UnimplementedGatewayServer) AdjustCardLimit(context.Context, *AdjustCardLimitRequest) (*Card, error) {
return nil, status.Error(codes.Unimplemented, "method AdjustCardLimit not implemented")
}
func (UnimplementedGatewayServer) GetCard(context.Context, *GetCardRequest) (*Card, error) {
return nil, status.Error(codes.Unimplemented, "method GetCard not implemented")
}
func (UnimplementedGatewayServer) ListCards(context.Context, *ListCardsRequest) (*ListCardsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListCards not implemented")
}
func (UnimplementedGatewayServer) CloseCard(context.Context, *CloseCardRequest) (*Card, error) {
return nil, status.Error(codes.Unimplemented, "method CloseCard not implemented")
}
func (UnimplementedGatewayServer) RationBridgeFunding(context.Context, *RationBridgeFundingRequest) (*RationBridgeFundingResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RationBridgeFunding not implemented")
}
func (UnimplementedGatewayServer) SimulateDeposit(context.Context, *SimulateDepositRequest) (*SimulateDepositResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SimulateDeposit not implemented")
}
func (UnimplementedGatewayServer) StreamActivity(*StreamActivityRequest, grpc.ServerStreamingServer[ActivityEvent]) error {
return status.Error(codes.Unimplemented, "method StreamActivity not implemented")
}
func (UnimplementedGatewayServer) GetDashboardSnapshot(context.Context, *GetDashboardSnapshotRequest) (*GetDashboardSnapshotResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetDashboardSnapshot not implemented")
}
func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {}
func (UnimplementedGatewayServer) testEmbeddedByValue() {}
// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GatewayServer will
// result in compilation errors.
type UnsafeGatewayServer interface {
mustEmbedUnimplementedGatewayServer()
}
func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) {
// If the following call panics, it indicates UnimplementedGatewayServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Gateway_ServiceDesc, srv)
}
func _Gateway_IssueCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IssueCardRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).IssueCard(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_IssueCard_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).IssueCard(ctx, req.(*IssueCardRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_AdjustCardLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AdjustCardLimitRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).AdjustCardLimit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_AdjustCardLimit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).AdjustCardLimit(ctx, req.(*AdjustCardLimitRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_GetCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCardRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).GetCard(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_GetCard_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).GetCard(ctx, req.(*GetCardRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_ListCards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListCardsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).ListCards(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_ListCards_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).ListCards(ctx, req.(*ListCardsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_CloseCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CloseCardRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).CloseCard(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_CloseCard_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).CloseCard(ctx, req.(*CloseCardRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_RationBridgeFunding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RationBridgeFundingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).RationBridgeFunding(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_RationBridgeFunding_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).RationBridgeFunding(ctx, req.(*RationBridgeFundingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_SimulateDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimulateDepositRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).SimulateDeposit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_SimulateDeposit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).SimulateDeposit(ctx, req.(*SimulateDepositRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Gateway_StreamActivity_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StreamActivityRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(GatewayServer).StreamActivity(m, &grpc.GenericServerStream[StreamActivityRequest, ActivityEvent]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Gateway_StreamActivityServer = grpc.ServerStreamingServer[ActivityEvent]
func _Gateway_GetDashboardSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDashboardSnapshotRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServer).GetDashboardSnapshot(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Gateway_GetDashboardSnapshot_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServer).GetDashboardSnapshot(ctx, req.(*GetDashboardSnapshotRequest))
}
return interceptor(ctx, in, info, handler)
}
// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Gateway_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ration.gateway.v1.Gateway",
HandlerType: (*GatewayServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "IssueCard",
Handler: _Gateway_IssueCard_Handler,
},
{
MethodName: "AdjustCardLimit",
Handler: _Gateway_AdjustCardLimit_Handler,
},
{
MethodName: "GetCard",
Handler: _Gateway_GetCard_Handler,
},
{
MethodName: "ListCards",
Handler: _Gateway_ListCards_Handler,
},
{
MethodName: "CloseCard",
Handler: _Gateway_CloseCard_Handler,
},
{
MethodName: "RationBridgeFunding",
Handler: _Gateway_RationBridgeFunding_Handler,
},
{
MethodName: "SimulateDeposit",
Handler: _Gateway_SimulateDeposit_Handler,
},
{
MethodName: "GetDashboardSnapshot",
Handler: _Gateway_GetDashboardSnapshot_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamActivity",
Handler: _Gateway_StreamActivity_Handler,
ServerStreams: true,
},
},
Metadata: "gateway.proto",
}