engagement

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SendRetryOtp ISC endpoint to send a retry OTP
	SendRetryOtp = "internal/send_retry_otp/"
	// SendOtp ISC endpoint to send OTP
	SendOtp = "internal/send_otp/"
	// VerifyEmailOtp ISC endpoint to verify email OTP
	VerifyEmailOtp = "internal/verify_email_otp/"
	// VerifyOTPEndPoint ISC endpoint to verify OTP
	VerifyOTPEndPoint = "internal/verify_otp/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceEngagement

type ServiceEngagement interface {
	ResolveDefaultNudgeByTitle(
		ctx context.Context,
		UID string,
		flavour feedlib.Flavour,
		nudgeTitle string,
	) error

	SendMail(
		ctx context.Context,
		email string,
		message string,
		subject string,
	) error

	GenerateAndSendOTP(
		ctx context.Context,
		phone string,
		appID *string,
	) (*profileutils.OtpResponse, error)

	SendRetryOTP(
		ctx context.Context,
		msisdn string,
		retryStep int,
		appID *string,
	) (*profileutils.OtpResponse, error)

	VerifyOTP(ctx context.Context, phone, OTP string) (bool, error)

	VerifyEmailOTP(ctx context.Context, email, OTP string) (bool, error)

	SendSMS(ctx context.Context, phoneNumbers []string, message string) error
}

ServiceEngagement represents engagement usecases

type ServiceEngagementImpl

type ServiceEngagementImpl struct {
	Engage extension.ISCClientExtension
	// contains filtered or unexported fields
}

ServiceEngagementImpl represents engagement usecases

func NewServiceEngagementImpl

func NewServiceEngagementImpl(
	eng extension.ISCClientExtension,
	ext extension.BaseExtension,
) *ServiceEngagementImpl

NewServiceEngagementImpl returns new instance of ServiceEngagementImpl

func (*ServiceEngagementImpl) GenerateAndSendOTP

func (en *ServiceEngagementImpl) GenerateAndSendOTP(
	ctx context.Context,
	phone string,
	appID *string,
) (*profileutils.OtpResponse, error)

GenerateAndSendOTP creates a new otp and sends it to the provided phone number.

func (*ServiceEngagementImpl) ResolveDefaultNudgeByTitle

func (en *ServiceEngagementImpl) ResolveDefaultNudgeByTitle(
	ctx context.Context,
	UID string,
	flavour feedlib.Flavour,
	nudgeTitle string,
) error

ResolveDefaultNudgeByTitle calls the `engagement service` to resolve any default nudge by its `Title`

func (*ServiceEngagementImpl) SendMail

func (en *ServiceEngagementImpl) SendMail(
	ctx context.Context,
	email string,
	message string,
	subject string,
) error

SendMail sends emails to communicate to our users

func (*ServiceEngagementImpl) SendRetryOTP

func (en *ServiceEngagementImpl) SendRetryOTP(
	ctx context.Context,
	msisdn string,
	retryStep int,
	appID *string,
) (*profileutils.OtpResponse, error)

SendRetryOTP generates fallback OTPs when Africa is talking sms fails

func (*ServiceEngagementImpl) SendSMS

func (en *ServiceEngagementImpl) SendSMS(ctx context.Context, phoneNumbers []string, message string) error

SendSMS does the actual delivery of messages to the provided phone numbers

func (*ServiceEngagementImpl) VerifyEmailOTP

func (en *ServiceEngagementImpl) VerifyEmailOTP(ctx context.Context, email, otp string) (bool, error)

VerifyEmailOTP checks the otp provided matches the one sent to the user via email address

func (*ServiceEngagementImpl) VerifyOTP

func (en *ServiceEngagementImpl) VerifyOTP(ctx context.Context, phone, otp string) (bool, error)

VerifyOTP takes a phone number and an OTP and checks for the validity of the OTP code

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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