more changes
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 36s
Build and Publish / BuildAndDeployArm64 (push) Successful in 3m59s

This commit is contained in:
matst80
2025-12-01 20:15:48 +01:00
parent c227870f13
commit 060b3dfbf0
22 changed files with 316 additions and 242 deletions

View File

@@ -768,6 +768,16 @@ func (s *PoolServer) AdyenSessionHandler(w http.ResponseWriter, r *http.Request,
}
func (s *PoolServer) ApplyAnywhere(ctx context.Context, cartId cart.CartId, msgs ...proto.Message) error {
id := uint64(cartId)
if host, isOnOtherHost := s.OwnerHost(id); isOnOtherHost {
_, err := host.Apply(ctx, id, msgs...)
return err
}
_, err := s.Apply(ctx, id, msgs...)
return err
}
func (s *PoolServer) AdyenHookHandler(w http.ResponseWriter, r *http.Request) {
var notificationRequest webhook.Webhook
service := s.adyenClient.Checkout()
@@ -789,6 +799,13 @@ func (s *PoolServer) AdyenHookHandler(w http.ResponseWriter, r *http.Request) {
switch item.EventCode {
case "CAPTURE":
log.Printf("Capture status: %v", item.Success)
// dataBytes, err := json.Marshal(item)
// if err != nil {
// log.Printf("error marshaling item: %v", err)
// http.Error(w, "Error marshaling item", http.StatusInternalServerError)
// return
// }
//s.ApplyAnywhere(r.Context(),0, &messages.PaymentEvent{PaymentId: item.PspReference, Success: item.Success, Name: item.EventCode, Data: &pbany.Any{Value: dataBytes}})
case "AUTHORISATION":
cartId, ok := cart.ParseCartId(item.MerchantReference)
@@ -797,6 +814,8 @@ func (s *PoolServer) AdyenHookHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Invalid cart id", http.StatusBadRequest)
return
}
//s.Apply()
if host, ok := s.OwnerHost(uint64(cartId)); ok {
cartHostMap[host] = append(cartHostMap[host], notificationItem)
continue