@@ -82,87 +82,113 @@ func stubNotImplemented(handlerName string) saga.Handler {
8282// - current_account.* for domain-specific handlers
8383func RegisterCurrentAccountHandlers (registry * saga.HandlerRegistry ) error {
8484 handlers := []struct {
85- name string
86- handler saga.Handler
85+ name string
86+ handler saga.Handler
87+ metadata * saga.HandlerMetadata
8788 }{
8889 // Position Keeping handlers (global namespace)
89- {"position_keeping.initiate_log" , currentAccountPositionKeepingInitiateLog },
90- {"position_keeping.update_log" , stubNotImplemented ("position_keeping.update_log" )},
91- {"position_keeping.cancel_log" , currentAccountPositionKeepingCancelLog },
90+ {"position_keeping.initiate_log" , currentAccountPositionKeepingInitiateLog , & saga.HandlerMetadata {
91+ Category : saga .HandlerCategoryIngestion ,
92+ CompensationStrategy : "auto" ,
93+ HasAutoCompensation : true ,
94+ Compensate : "position_keeping.cancel_log" ,
95+ }},
96+ {"position_keeping.update_log" , stubNotImplemented ("position_keeping.update_log" ), & saga.HandlerMetadata {
97+ Category : saga .HandlerCategoryIngestion ,
98+ CompensationStrategy : "none" ,
99+ }},
100+ {"position_keeping.cancel_log" , currentAccountPositionKeepingCancelLog , & saga.HandlerMetadata {
101+ Category : saga .HandlerCategoryIngestion ,
102+ CompensationStrategy : "none" ,
103+ }},
92104
93105 // Financial Accounting handlers (global namespace)
94- {"financial_accounting.post_entries" , stubNotImplemented ("financial_accounting.post_entries" )},
95- {"financial_accounting.reverse_entries" , stubNotImplemented ("financial_accounting.reverse_entries" )},
96- {"financial_accounting.create_booking" , stubNotImplemented ("financial_accounting.create_booking" )},
97- {"financial_accounting.initiate_booking_log" , currentAccountFinAcctInitiateBookingLog },
98- {"financial_accounting.capture_posting" , currentAccountFinAcctCapturePosting },
99- {"financial_accounting.update_booking_log" , currentAccountFinAcctUpdateBookingLog },
100- {"financial_accounting.compensate_posting" , currentAccountFinAcctCompensatePosting },
106+ {"financial_accounting.post_entries" , stubNotImplemented ("financial_accounting.post_entries" ), nil },
107+ {"financial_accounting.reverse_entries" , stubNotImplemented ("financial_accounting.reverse_entries" ), nil },
108+ {"financial_accounting.create_booking" , stubNotImplemented ("financial_accounting.create_booking" ), nil },
109+ {"financial_accounting.initiate_booking_log" , currentAccountFinAcctInitiateBookingLog , & saga.HandlerMetadata {
110+ Category : saga .HandlerCategorySettlement ,
111+ CompensationStrategy : "none" ,
112+ }},
113+ {"financial_accounting.capture_posting" , currentAccountFinAcctCapturePosting , & saga.HandlerMetadata {
114+ Category : saga .HandlerCategorySettlement ,
115+ CompensationStrategy : "auto" ,
116+ Compensate : "financial_accounting.compensate_posting" ,
117+ HasAutoCompensation : true ,
118+ }},
119+ {"financial_accounting.update_booking_log" , currentAccountFinAcctUpdateBookingLog , & saga.HandlerMetadata {
120+ Category : saga .HandlerCategorySettlement ,
121+ CompensationStrategy : "none" ,
122+ }},
123+ {"financial_accounting.compensate_posting" , currentAccountFinAcctCompensatePosting , & saga.HandlerMetadata {
124+ Category : saga .HandlerCategorySettlement ,
125+ CompensationStrategy : "none" ,
126+ }},
101127
102128 // Current Account domain handlers
103- {"current_account.save" , currentAccountRepositorySave },
129+ {"current_account.save" , currentAccountRepositorySave , nil },
104130
105131 // Control handler (stub - implemented in client package for cross-service use)
106- {"current_account.control" , stubNotImplemented ("current_account.control" )},
132+ {"current_account.control" , stubNotImplemented ("current_account.control" ), nil },
107133
108134 // Lien handlers (stubs - not yet implemented but required by schema)
109- {"current_account.create_lien" , stubNotImplemented ("current_account.create_lien" )},
110- {"current_account.execute_lien" , stubNotImplemented ("current_account.execute_lien" )},
111- {"current_account.terminate_lien" , stubNotImplemented ("current_account.terminate_lien" )},
135+ {"current_account.create_lien" , stubNotImplemented ("current_account.create_lien" ), nil },
136+ {"current_account.execute_lien" , stubNotImplemented ("current_account.execute_lien" ), nil },
137+ {"current_account.terminate_lien" , stubNotImplemented ("current_account.terminate_lien" ), nil },
112138
113139 // Platform-wide handlers (stubs - defined in schema for other services)
114- {"notification.send" , stubNotImplemented ("notification.send" )},
115- {"payment_order.create_lien" , stubNotImplemented ("payment_order.create_lien" )},
116- {"payment_order.execute_lien" , stubNotImplemented ("payment_order.execute_lien" )},
117- {"payment_order.post_ledger_entries" , stubNotImplemented ("payment_order.post_ledger_entries" )},
118- {"payment_order.send_to_gateway" , stubNotImplemented ("payment_order.send_to_gateway" )},
119- {"payment_order.terminate_lien" , stubNotImplemented ("payment_order.terminate_lien" )},
120- {"repository.save" , stubNotImplemented ("repository.save" )},
121- {"valuation_engine.valuate" , stubNotImplemented ("valuation_engine.valuate" )},
140+ {"notification.send" , stubNotImplemented ("notification.send" ), nil },
141+ {"payment_order.create_lien" , stubNotImplemented ("payment_order.create_lien" ), nil },
142+ {"payment_order.execute_lien" , stubNotImplemented ("payment_order.execute_lien" ), nil },
143+ {"payment_order.post_ledger_entries" , stubNotImplemented ("payment_order.post_ledger_entries" ), nil },
144+ {"payment_order.send_to_gateway" , stubNotImplemented ("payment_order.send_to_gateway" ), nil },
145+ {"payment_order.terminate_lien" , stubNotImplemented ("payment_order.terminate_lien" ), nil },
146+ {"repository.save" , stubNotImplemented ("repository.save" ), nil },
147+ {"valuation_engine.valuate" , stubNotImplemented ("valuation_engine.valuate" ), nil },
122148
123149 // Reconciliation handlers (stubs - defined in schema for reconciliation service)
124- {"reconciliation.initiate_run" , stubNotImplemented ("reconciliation.initiate_run" )},
125- {"reconciliation.execute_run" , stubNotImplemented ("reconciliation.execute_run" )},
126- {"reconciliation.retrieve_run" , stubNotImplemented ("reconciliation.retrieve_run" )},
127- {"reconciliation.cancel_run" , stubNotImplemented ("reconciliation.cancel_run" )},
128- {"reconciliation.assert_balance" , stubNotImplemented ("reconciliation.assert_balance" )},
129- {"reconciliation.initiate_dispute" , stubNotImplemented ("reconciliation.initiate_dispute" )},
150+ {"reconciliation.initiate_run" , stubNotImplemented ("reconciliation.initiate_run" ), nil },
151+ {"reconciliation.execute_run" , stubNotImplemented ("reconciliation.execute_run" ), nil },
152+ {"reconciliation.retrieve_run" , stubNotImplemented ("reconciliation.retrieve_run" ), nil },
153+ {"reconciliation.cancel_run" , stubNotImplemented ("reconciliation.cancel_run" ), nil },
154+ {"reconciliation.assert_balance" , stubNotImplemented ("reconciliation.assert_balance" ), nil },
155+ {"reconciliation.initiate_dispute" , stubNotImplemented ("reconciliation.initiate_dispute" ), nil },
130156
131157 // Party handlers (stubs - defined in schema for party service)
132- {"party.get_default_payment_method" , stubNotImplemented ("party.get_default_payment_method" )},
158+ {"party.get_default_payment_method" , stubNotImplemented ("party.get_default_payment_method" ), nil },
133159
134160 // Operational Gateway handlers (stubs - defined in schema for operational gateway service)
135- {"operational_gateway.dispatch_instruction" , stubNotImplemented ("operational_gateway.dispatch_instruction" )},
136- {"operational_gateway.cancel_instruction" , stubNotImplemented ("operational_gateway.cancel_instruction" )},
137- {"operational_gateway.get_instruction" , stubNotImplemented ("operational_gateway.get_instruction" )},
161+ {"operational_gateway.dispatch_instruction" , stubNotImplemented ("operational_gateway.dispatch_instruction" ), nil },
162+ {"operational_gateway.cancel_instruction" , stubNotImplemented ("operational_gateway.cancel_instruction" ), nil },
163+ {"operational_gateway.get_instruction" , stubNotImplemented ("operational_gateway.get_instruction" ), nil },
138164
139165 // Financial Gateway handlers (stubs - defined in schema for financial gateway service)
140- {"financial_gateway.dispatch_payment" , stubNotImplemented ("financial_gateway.dispatch_payment" )},
141- {"financial_gateway.cancel_payment" , stubNotImplemented ("financial_gateway.cancel_payment" )},
142- {"financial_gateway.dispatch_refund" , stubNotImplemented ("financial_gateway.dispatch_refund" )},
166+ {"financial_gateway.dispatch_payment" , stubNotImplemented ("financial_gateway.dispatch_payment" ), nil },
167+ {"financial_gateway.cancel_payment" , stubNotImplemented ("financial_gateway.cancel_payment" ), nil },
168+ {"financial_gateway.dispatch_refund" , stubNotImplemented ("financial_gateway.dispatch_refund" ), nil },
143169
144170 // Forecasting handlers (stubs - defined in schema for forecasting service)
145- {"forecasting.compute_forward_curve" , stubNotImplemented ("forecasting.compute_forward_curve" )},
171+ {"forecasting.compute_forward_curve" , stubNotImplemented ("forecasting.compute_forward_curve" ), nil },
146172
147173 // Market Information handlers (stubs - defined in schema for market information service)
148- {"market_information.publish_observation" , stubNotImplemented ("market_information.publish_observation" )},
149- {"market_information.query_latest" , stubNotImplemented ("market_information.query_latest" )},
150- {"market_information.manage_dataset" , stubNotImplemented ("market_information.manage_dataset" )},
174+ {"market_information.publish_observation" , stubNotImplemented ("market_information.publish_observation" ), nil },
175+ {"market_information.query_latest" , stubNotImplemented ("market_information.query_latest" ), nil },
176+ {"market_information.manage_dataset" , stubNotImplemented ("market_information.manage_dataset" ), nil },
151177
152178 // Reference Data handlers (stubs - defined in schema for reference data service)
153- {"reference_data.register_instrument" , stubNotImplemented ("reference_data.register_instrument" )},
154- {"reference_data.delete_instrument" , stubNotImplemented ("reference_data.delete_instrument" )},
155- {"reference_data.register_account_type" , stubNotImplemented ("reference_data.register_account_type" )},
156- {"reference_data.delete_account_type" , stubNotImplemented ("reference_data.delete_account_type" )},
157- {"reference_data.register_valuation_rule" , stubNotImplemented ("reference_data.register_valuation_rule" )},
158- {"reference_data.register_saga_definition" , stubNotImplemented ("reference_data.register_saga_definition" )},
179+ {"reference_data.register_instrument" , stubNotImplemented ("reference_data.register_instrument" ), nil },
180+ {"reference_data.delete_instrument" , stubNotImplemented ("reference_data.delete_instrument" ), nil },
181+ {"reference_data.register_account_type" , stubNotImplemented ("reference_data.register_account_type" ), nil },
182+ {"reference_data.delete_account_type" , stubNotImplemented ("reference_data.delete_account_type" ), nil },
183+ {"reference_data.register_valuation_rule" , stubNotImplemented ("reference_data.register_valuation_rule" ), nil },
184+ {"reference_data.register_saga_definition" , stubNotImplemented ("reference_data.register_saga_definition" ), nil },
159185
160186 // Internal Account handlers (stubs - defined in schema for internal account service)
161- {"internal_account.initiate" , stubNotImplemented ("internal_account.initiate" )},
187+ {"internal_account.initiate" , stubNotImplemented ("internal_account.initiate" ), nil },
162188 }
163189
164190 for _ , h := range handlers {
165- if err := registry .Register (h .name , h .handler ); err != nil {
191+ if err := registry .RegisterWithMetadata (h .name , h .handler , h . metadata ); err != nil {
166192 return fmt .Errorf ("failed to register handler %s: %w" , h .name , err )
167193 }
168194 }
0 commit comments