utils

package
v0.6.27 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEnvVarEmpty = errors.New("getenv: environment variable empty")

Functions

func CheckIfIsCancelledBeforeThreshold added in v0.5.61

func CheckIfIsCancelledBeforeThreshold(cancelledAt time.Time, appointmentScheduledStartDateTime time.Time, threshold float64) bool

func CheckIfRequestIsAuthenticated added in v0.5.76

func CheckIfRequestIsAuthenticated(req *http.Request) (bool, *string)

func CommaSeparatedValuesTo

func CommaSeparatedValuesTo()

func FeelgoodResponseToStruct added in v0.5.93

func FeelgoodResponseToStruct(response *resty.Response, obj interface{}) error

func GetInternalAuthTokenFromLocalCache added in v0.5.91

func GetInternalAuthTokenFromLocalCache(localCache *ristretto.Cache) string

func GetInternalToken added in v0.5.90

func GetInternalToken(ctx context.Context, config *GetInternalTokenConfig) (string, error)

func GetPercentageToReimburse added in v0.5.67

func GetPercentageToReimburse(payload GetPercentageToReimbursePayload) float64

func JsonToStruct

func JsonToStruct(jsonStr string, obj interface{}) error

func Paginate added in v0.5.68

func Paginate(value interface{}, pagination *models.Pagination, db *gorm.DB) func(db *gorm.DB) *gorm.DB

func SetInternalAuthTokenInLocalCache added in v0.5.89

func SetInternalAuthTokenInLocalCache(localCache *ristretto.Cache, token string)

func SliceContains added in v0.5.85

func SliceContains(slice []string, item string) bool

func StructToJson

func StructToJson(obj interface{}) string

Types

type AmountsBreakdown added in v0.5.31

type AmountsBreakdown struct {
	PractitionerPaymentAmount float64 `json:"practitioner_payment_amount"`
	ReimbursementAmount       float64 `json:"reimbursement_amount"`
	PlatformFeeAmount         float64 `json:"platform_fee_amount"`
}

func GetAmountsBreakdownForAppointmentCancellation added in v0.5.31

func GetAmountsBreakdownForAppointmentCancellation(payload GetAmountsBreakdownForAppointmentCancellationPayload) (AmountsBreakdown, error)

type GetAmountsBreakdownForAppointmentCancellationPayload added in v0.5.31

type GetAmountsBreakdownForAppointmentCancellationPayload struct {
	AmountPayed                       float64   `json:"amount_payed" validate:"required gte=0"`
	ScheduledStartDateTime            time.Time `json:"scheduled_start_date_time" validate:"required"`
	HoursThreshold                    float64   `json:"hours_threshold" validate:"required gte=0"`
	PlatformFee                       float64   `json:"platform_fee" validate:"required gte=0 lte=1"`
	CancellationAt                    time.Time `json:"cancellation_at" validate:"required"`
	PercentageToRefundBeforeThreshold float64   `json:"percentage_to_refund_before_threshold" validate:"required gte=0 lte=1"`
	PercentageToRefundAfterThreshold  float64   `json:"percentage_to_refund_after_threshold" validate:"required gte=0 lte=1"`
}

type GetInternalTokenConfig added in v0.5.90

type GetInternalTokenConfig struct {
	RetryCount    int
	RetryWaitTime time.Duration
	ServiceName   string
	Debug         bool
	AuthMSHost    string
}

type GetPercentageToReimbursePayload added in v0.5.70

type GetPercentageToReimbursePayload struct {
	CancellationAt                    time.Time `json:"cancellation_at" validate:"required"`
	AppointmentScheduledDateTime      time.Time `json:"appointment_scheduled_date_time" validate:"required"`
	HoursThreshold                    float64   `json:"hours_threshold" validate:"required gte=0"`
	PercentageToRefundBeforeThreshold float64   `json:"percentage_to_refund_before_threshold" validate:"required gte=0 lte=1"`
	PercentageToRefundAfterThreshold  float64   `json:"percentage_to_refund_after_threshold" validate:"required gte=0 lte=1"`
}

type RawFeelgoodResponse added in v0.6.13

type RawFeelgoodResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Error   string      `json:"error"`
	Data    interface{} `json:"data"`
}

func ToRawFeelgoodResponse added in v0.6.13

func ToRawFeelgoodResponse(response *resty.Response) (RawFeelgoodResponse, error)

func (*RawFeelgoodResponse) IsError added in v0.6.13

func (r *RawFeelgoodResponse) IsError() bool

func (*RawFeelgoodResponse) IsZero added in v0.6.13

func (r *RawFeelgoodResponse) IsZero() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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