notifications

package
v0.0.0-...-c407d37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const MyMoveLink = "https://my.move.mil/"
View Source
const OneSourceTransportationOfficeLink = "https://installations.militaryonesource.mil/search?program-service=2/view-by=ALL"
View Source
const WashingtonHQServicesLink = "https://www.esd.whs.mil"

Variables

View Source
var (
	PrimeCounselingCompleteRawText      = string(assets.MustAsset("notifications/templates/prime_counseling_complete_template.txt"))
	PrimeCounselingCompleteTextTemplate = text.Must(text.New("text_template").Parse(PrimeCounselingCompleteRawText))
	PrimeCounselingCompleteRawHTML      = string(assets.MustAsset("notifications/templates/prime_counseling_complete_template.html"))
	PrimeCounselingCompleteHTMLTemplate = html.Must(html.New("text_template").Parse(PrimeCounselingCompleteRawHTML))
)

Functions

func GetSysAdminEmail

func GetSysAdminEmail(sender NotificationSender) (email string)

GetSysAdminEmail returns the System Administrators' email address that has been set in the NotificationSender

Types

type ClientCertModified

type ClientCertModified struct {
	// contains filtered or unexported fields
}

ClientCertModified has notification content for alerting admins when a user account has been modified

func NewClientCertCreated

func NewClientCertCreated(
	sysAdminEmail string,
	modifiedClientCertID uuid.UUID,
	modifiedAt time.Time,
	responsibleUserID uuid.UUID,
	host string,
) (*ClientCertModified, error)

NewClientCertCreated returns a new ClientCertModified notification for account creation

func NewClientCertRemoved

func NewClientCertRemoved(
	sysAdminEmail string,
	modifiedClientCertID uuid.UUID,
	modifiedAt time.Time,
	responsibleUserID uuid.UUID,
	host string,
) (*ClientCertModified, error)

NewClientCertRemoved returns a new ClientCertModified notification for account removal

func NewClientCertUpdated

func NewClientCertUpdated(
	_ appcontext.AppContext,
	sysAdminEmail string,
	modifiedClientCertID uuid.UUID,
	modifiedAt time.Time,
	responsibleUserID uuid.UUID,
	host string,
) (*ClientCertModified, error)

NewClientCertUpdated returns a new ClientCertModified notification for cert modification

func (ClientCertModified) RenderHTML

func (m ClientCertModified) RenderHTML(appCtx appcontext.AppContext, data clientCertModifiedEmailData) (string, error)

RenderHTML renders the html for the email

func (ClientCertModified) RenderText

func (m ClientCertModified) RenderText(appCtx appcontext.AppContext, data clientCertModifiedEmailData) (string, error)

RenderText renders the text for the email

type LoggerData

type LoggerData struct {
	ServiceMember models.ServiceMember
	PPMShipmentID uuid.UUID
	MoveLocator   string
}

Used to get logging data from GetEmailData

type MoveApproved

type MoveApproved struct {
	// contains filtered or unexported fields
}

MoveApproved has notification content for approved moves

func NewMoveApproved

func NewMoveApproved(
	host string,
	moveID uuid.UUID) *MoveApproved

NewMoveApproved returns a new move approval notification

func (MoveApproved) RenderHTML

func (m MoveApproved) RenderHTML(appCtx appcontext.AppContext, data moveApprovedEmailData) (string, error)

RenderHTML renders the html for the email

func (MoveApproved) RenderText

func (m MoveApproved) RenderText(appCtx appcontext.AppContext, data moveApprovedEmailData) (string, error)

RenderText renders the text for the email

type MoveCanceled

type MoveCanceled struct {
	// contains filtered or unexported fields
}

MoveCanceled has notification content for approved moves

func NewMoveCanceled

func NewMoveCanceled(moveID uuid.UUID) *MoveCanceled

NewMoveCanceled returns a new move approval notification

func (MoveCanceled) RenderHTML

func (m MoveCanceled) RenderHTML(appCtx appcontext.AppContext, data moveCanceledEmailData) (string, error)

RenderHTML renders the html for the email

func (MoveCanceled) RenderText

func (m MoveCanceled) RenderText(appCtx appcontext.AppContext, data moveCanceledEmailData) (string, error)

RenderText renders the text for the email

type MoveCounseled

type MoveCounseled struct {
	// contains filtered or unexported fields
}

MoveCounseled has notification content for counseled moves (before TOO approval)

func NewMoveCounseled

func NewMoveCounseled(moveID uuid.UUID) *MoveCounseled

NewMoveCounseled returns a new move counseled notification (before TOO approval)

func (MoveCounseled) RenderHTML

func (m MoveCounseled) RenderHTML(appCtx appcontext.AppContext, data MoveCounseledEmailData) (string, error)

RenderHTML renders the html for the email

func (MoveCounseled) RenderText

func (m MoveCounseled) RenderText(appCtx appcontext.AppContext, data MoveCounseledEmailData) (string, error)

RenderText renders the text for the email

type MoveCounseledEmailData

type MoveCounseledEmailData struct {
	OriginDutyLocation      *string
	DestinationDutyLocation string
	Locator                 string
	MyMoveLink              string
}

type MoveIssuedToPrime

type MoveIssuedToPrime struct {
	// contains filtered or unexported fields
}

MoveIssuedToPrime has notification content for submitted moves

func NewMoveIssuedToPrime

func NewMoveIssuedToPrime(moveID uuid.UUID) *MoveIssuedToPrime

NewMoveIssuedToPrime returns a new move submitted notification

func (MoveIssuedToPrime) RenderHTML

func (m MoveIssuedToPrime) RenderHTML(appCtx appcontext.AppContext, data moveIssuedToPrimeEmailData) (string, error)

RenderHTML renders the html for the email

func (MoveIssuedToPrime) RenderText

func (m MoveIssuedToPrime) RenderText(appCtx appcontext.AppContext, data moveIssuedToPrimeEmailData) (string, error)

RenderText renders the text for the email

type MoveSubmitted

type MoveSubmitted struct {
	// contains filtered or unexported fields
}

MoveSubmitted has notification content for submitted moves

func NewMoveSubmitted

func NewMoveSubmitted(moveID uuid.UUID) *MoveSubmitted

NewMoveSubmitted returns a new move submitted notification

func (MoveSubmitted) RenderHTML

func (m MoveSubmitted) RenderHTML(appCtx appcontext.AppContext, data moveSubmittedEmailData) (string, error)

RenderHTML renders the html for the email

func (MoveSubmitted) RenderText

func (m MoveSubmitted) RenderText(appCtx appcontext.AppContext, data moveSubmittedEmailData) (string, error)

RenderText renders the text for the email

type Notification

type Notification interface {
	// contains filtered or unexported methods
}

Notification is an interface for creating emails

type NotificationSender

type NotificationSender interface {
	SendNotification(appCtx appcontext.AppContext, notification Notification) error
}

NotificationSender is an interface for sending notifications

func InitEmail

func InitEmail(v *viper.Viper, logger *zap.Logger) (NotificationSender, error)

InitEmail initializes the email backend

type NotificationSendingContext

type NotificationSendingContext struct {
	// contains filtered or unexported fields
}

NotificationSendingContext provides context to a notification sender

func NewNotificationSender

func NewNotificationSender(svc RawEmailSender, domain string, sysAdminEmail string) NotificationSendingContext

NewNotificationSender returns a new NotificationSendingContext

func (NotificationSendingContext) SendNotification

func (n NotificationSendingContext) SendNotification(appCtx appcontext.AppContext, notification Notification) error

SendNotification sends a one or more notifications for all supported mediums

type OfficeAccountRejected

type OfficeAccountRejected struct {
	// contains filtered or unexported fields
}

OfficeAccountRejected has notification content for rejected office users

func NewOfficeAccountRejected

func NewOfficeAccountRejected(officeUserID uuid.UUID) *OfficeAccountRejected

NewOfficeAccountRejected returns a new office user rejected notification

func (OfficeAccountRejected) RenderHTML

func (o OfficeAccountRejected) RenderHTML(appCtx appcontext.AppContext, data officeAccountRejectedEmailData) (string, error)

RenderHTML renders the html for the email

func (OfficeAccountRejected) RenderText

func (o OfficeAccountRejected) RenderText(appCtx appcontext.AppContext, data officeAccountRejectedEmailData) (string, error)

RenderText renders the text for the email

type PaymentReminder

type PaymentReminder struct {
	// contains filtered or unexported fields
}

PaymentReminder has notification content for approved moves

func NewPaymentReminder

func NewPaymentReminder() (*PaymentReminder, error)

NewPaymentReminder returns a new payment reminder notification 14 days after actual move in date

func (PaymentReminder) GetEmailInfo

GetEmailInfo fetches payment email information left joins on duty locations to allow for those fields to be null

func (PaymentReminder) OnSuccess

func (m PaymentReminder) OnSuccess(appCtx appcontext.AppContext, PaymentReminderEmailInfo PaymentReminderEmailInfo) func(string) error

OnSuccess callback passed to be invoked by NewNotificationSender when an email successfully sent saves the svs the email info along with the SES mail id to the notifications table

func (PaymentReminder) RenderHTML

RenderHTML renders the html for the email

func (PaymentReminder) RenderText

RenderText renders the text for the email

type PaymentReminderEmailData

type PaymentReminderEmailData struct {
	OriginDutyLocation      string
	DestinationDutyLocation string
	Locator                 string
	OneSourceLink           string
	MyMoveLink              string
}

PaymentReminderEmailData is used to render an email template

type PaymentReminderEmailInfo

type PaymentReminderEmailInfo struct {
	ServiceMemberID        uuid.UUID   `db:"id"`
	Email                  *string     `db:"personal_email"`
	NewDutyLocationName    string      `db:"new_duty_location_name"`
	OriginDutyLocationName string      `db:"origin_duty_location_name"`
	MoveDate               string      `db:"move_date"`
	Locator                string      `db:"locator"`
	WeightEstimate         *unit.Pound `db:"weight_estimate"`
	IncentiveEstimate      *unit.Cents `db:"incentive_estimate"`
}

PaymentReminderEmailInfo contains payment reminder data for rendering a template

type PaymentReminderEmailInfos

type PaymentReminderEmailInfos []PaymentReminderEmailInfo

PaymentReminderEmailInfos is a slice of PaymentReminderEmailInfo

type PpmPacketEmail

type PpmPacketEmail struct {
	// contains filtered or unexported fields
}

PpmPacketEmail has notification content for approved moves

func NewPpmPacketEmail

func NewPpmPacketEmail(ppmShipmentID uuid.UUID) *PpmPacketEmail

NewPpmPacketEmail returns a new payment reminder notification 14 days after actual move in date

func (PpmPacketEmail) GetEmailData

func (PpmPacketEmail) RenderHTML

func (p PpmPacketEmail) RenderHTML(appCtx appcontext.AppContext, data PpmPacketEmailData) (string, error)

RenderHTML renders the html for the email

func (PpmPacketEmail) RenderText

func (p PpmPacketEmail) RenderText(appCtx appcontext.AppContext, data PpmPacketEmailData) (string, error)

RenderText renders the text for the email

type PpmPacketEmailData

type PpmPacketEmailData struct {
	OriginZIP                         *string
	OriginCity                        *string
	OriginState                       *string
	DestinationZIP                    *string
	DestinationCity                   *string
	DestinationState                  *string
	SubmitLocation                    string
	ServiceBranch                     string
	Locator                           string
	OneSourceTransportationOfficeLink string
	WashingtonHQServicesLink          string
	MyMoveLink                        string
}

ppmPacketEmailData is used to render an email template Uses ZIPs only if no city/state data is provided

type PrimeCounselingComplete

type PrimeCounselingComplete struct {
	// contains filtered or unexported fields
}

PrimeCounselingComplete has notification content for moves that have had their counseling completed by the Prime

func NewPrimeCounselingComplete

func NewPrimeCounselingComplete(moveTaskOrder primemessages.MoveTaskOrder) *PrimeCounselingComplete

NewPrimeCounselingComplete returns a new payment reminder notification 14 days after actual move in date

func (PrimeCounselingComplete) GetEmailData

func (PrimeCounselingComplete) RenderHTML

RenderHTML renders the html for the email

func (PrimeCounselingComplete) RenderText

RenderText renders the text for the email

type PrimeCounselingCompleteData

type PrimeCounselingCompleteData struct {
	CustomerEmail                     string
	OriginDutyLocation                string
	DestinationDutyLocation           string
	Locator                           string
	OneSourceTransportationOfficeLink string
	MyMoveLink                        string
}

PrimeCounselingCompleteData is used to render an email template

type RawEmailSender

type RawEmailSender interface {
	SendRawEmail(ctx context.Context, params *ses.SendRawEmailInput, optFns ...func(*ses.Options)) (*ses.SendRawEmailOutput, error)
}

type ReweighRequested

type ReweighRequested struct {
	// contains filtered or unexported fields
}

ReweighRequested has notification content for submitted moves

func NewReweighRequested

func NewReweighRequested(moveID uuid.UUID, shipment models.MTOShipment) *ReweighRequested

NewReweighRequested returns a new move submitted notification

func (ReweighRequested) RenderHTML

func (m ReweighRequested) RenderHTML(appCtx appcontext.AppContext, data reweighRequestedEmailData) (string, error)

RenderHTML renders the html for the email

func (ReweighRequested) RenderText

func (m ReweighRequested) RenderText(appCtx appcontext.AppContext, data reweighRequestedEmailData) (string, error)

RenderText renders the text for the email

type StubNotificationSender

type StubNotificationSender NotificationSendingContext

StubNotificationSender mocks an SES client for local usage

func NewStubNotificationSender

func NewStubNotificationSender(domain string) StubNotificationSender

NewStubNotificationSender returns a new StubNotificationSender

func (StubNotificationSender) SendNotification

func (m StubNotificationSender) SendNotification(appCtx appcontext.AppContext, notification Notification) error

SendNotification returns a dummy ID

type UserAccountModified

type UserAccountModified struct {
	// contains filtered or unexported fields
}

UserAccountModified has notification content for alerting admins when a user account has been modified

func NewUserAccountActivated

func NewUserAccountActivated(
	appCtx appcontext.AppContext,
	sysAdminEmail string,
	modifiedUserID uuid.UUID,
	modifiedAt time.Time,
) (*UserAccountModified, error)

NewUserAccountActivated returns a new UserAccountModified notification for account activation

func NewUserAccountCreated

func NewUserAccountCreated(
	appCtx appcontext.AppContext,
	sysAdminEmail string,
	modifiedUserID uuid.UUID,
	modifiedAt time.Time,
) (*UserAccountModified, error)

NewUserAccountCreated returns a new UserAccountModified notification for account creation

func NewUserAccountDeactivated

func NewUserAccountDeactivated(
	appCtx appcontext.AppContext,
	sysAdminEmail string,
	modifiedUserID uuid.UUID,
	modifiedAt time.Time,
) (*UserAccountModified, error)

NewUserAccountDeactivated returns a new UserAccountModified notification for account deactivation

func NewUserAccountRemoved

func NewUserAccountRemoved(
	appCtx appcontext.AppContext,
	sysAdminEmail string,
	modifiedUserID uuid.UUID,
	modifiedAt time.Time,
) (*UserAccountModified, error)

NewUserAccountRemoved returns a new UserAccountModified notification for account removal

func (UserAccountModified) RenderHTML

func (m UserAccountModified) RenderHTML(appCtx appcontext.AppContext, data userAccountModifiedEmailData) (string, error)

RenderHTML renders the html for the email

func (UserAccountModified) RenderText

func (m UserAccountModified) RenderText(appCtx appcontext.AppContext, data userAccountModifiedEmailData) (string, error)

RenderText renders the text for the email

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL