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
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
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,
|
|
}
|
|
}
|