+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:
@@ -0,0 +1,47 @@
|
||||
package notifications
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
gmessaging "github.com/tech/sendico/pkg/generated/gmessaging"
|
||||
messaging "github.com/tech/sendico/pkg/messaging/envelope"
|
||||
"github.com/tech/sendico/pkg/model"
|
||||
nm "github.com/tech/sendico/pkg/model/notification"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type DemoRequestNotification struct {
|
||||
messaging.Envelope
|
||||
request *model.DemoRequest
|
||||
}
|
||||
|
||||
func (drn *DemoRequestNotification) Serialize() ([]byte, error) {
|
||||
if drn.request == nil {
|
||||
return nil, fmt.Errorf("demo request payload is empty")
|
||||
}
|
||||
msg := gmessaging.DemoRequestEvent{
|
||||
Name: drn.request.Name,
|
||||
OrganizationName: drn.request.OrganizationName,
|
||||
Phone: drn.request.Phone,
|
||||
WorkEmail: drn.request.WorkEmail,
|
||||
PayoutVolume: drn.request.PayoutVolume,
|
||||
Comment: drn.request.Comment,
|
||||
}
|
||||
data, err := proto.Marshal(&msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return drn.Envelope.Wrap(data)
|
||||
}
|
||||
|
||||
func NewDemoRequestEvent() model.NotificationEvent {
|
||||
return model.NewNotification(mservice.Site, nm.NACreated)
|
||||
}
|
||||
|
||||
func NewDemoRequestEnvelope(sender string, request *model.DemoRequest) messaging.Envelope {
|
||||
return &DemoRequestNotification{
|
||||
Envelope: messaging.CreateEnvelope(sender, NewDemoRequestEvent()),
|
||||
request: request,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user