+notification from site +version bump fix
Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
Some checks failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/bump_version Pipeline failed
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
This commit is contained in:
11
api/pkg/messaging/notifications/site/demo_request.go
Normal file
11
api/pkg/messaging/notifications/site/demo_request.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package notifications
|
||||
|
||||
import (
|
||||
messaging "github.com/tech/sendico/pkg/messaging/envelope"
|
||||
internalsite "github.com/tech/sendico/pkg/messaging/internal/notifications/site"
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
)
|
||||
|
||||
func DemoRequest(sender string, request *model.DemoRequest) messaging.Envelope {
|
||||
return internalsite.NewDemoRequestEnvelope(sender, request)
|
||||
}
|
||||
9
api/pkg/messaging/notifications/site/handler/handler.go
Normal file
9
api/pkg/messaging/notifications/site/handler/handler.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package notifications
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
)
|
||||
|
||||
type DemoRequestHandler = func(context.Context, *model.DemoRequest) error
|
||||
50
api/pkg/messaging/notifications/site/processor.go
Normal file
50
api/pkg/messaging/notifications/site/processor.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package notifications
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
gmessaging "github.com/tech/sendico/pkg/generated/gmessaging"
|
||||
me "github.com/tech/sendico/pkg/messaging/envelope"
|
||||
internalsite "github.com/tech/sendico/pkg/messaging/internal/notifications/site"
|
||||
np "github.com/tech/sendico/pkg/messaging/notifications/processor"
|
||||
handler "github.com/tech/sendico/pkg/messaging/notifications/site/handler"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type DemoRequestProcessor struct {
|
||||
logger mlogger.Logger
|
||||
handler handler.DemoRequestHandler
|
||||
event model.NotificationEvent
|
||||
}
|
||||
|
||||
func (drp *DemoRequestProcessor) Process(ctx context.Context, envelope me.Envelope) error {
|
||||
var msg gmessaging.DemoRequestEvent
|
||||
if err := proto.Unmarshal(envelope.GetData(), &msg); err != nil {
|
||||
drp.logger.Warn("Failed to decode demo request envelope", zap.Error(err), zap.String("topic", drp.event.ToString()))
|
||||
return err
|
||||
}
|
||||
request := &model.DemoRequest{
|
||||
Name: msg.GetName(),
|
||||
OrganizationName: msg.GetOrganizationName(),
|
||||
Phone: msg.GetPhone(),
|
||||
WorkEmail: msg.GetWorkEmail(),
|
||||
PayoutVolume: msg.GetPayoutVolume(),
|
||||
Comment: msg.GetComment(),
|
||||
}
|
||||
return drp.handler(ctx, request)
|
||||
}
|
||||
|
||||
func (drp *DemoRequestProcessor) GetSubject() model.NotificationEvent {
|
||||
return drp.event
|
||||
}
|
||||
|
||||
func NewDemoRequestProcessor(logger mlogger.Logger, handler handler.DemoRequestHandler) np.EnvelopeProcessor {
|
||||
return &DemoRequestProcessor{
|
||||
logger: logger.Named("demo_request_processor"),
|
||||
handler: handler,
|
||||
event: internalsite.NewDemoRequestEvent(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user