selfsub

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package selfsub implements the user self-service subscription management of the subscription module: viewing, token reset, notes, and the two-phase cancellation with its billing refund. Only the module facade may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRemainingAmount

func CalculateRemainingAmount(ctx context.Context, deps Deps, userSubscribeId int64) (int64, error)

Types

type Deps

type Deps struct {
	UserSubs repository.UserSubscriptionRepo
	Plans    repository.SubscribeRepo
	// Users/Orders/Logs are read (and, for the refund, wallet) ports onto the
	// identity, billing and platform domains.
	Users  repository.UserRepo
	Orders repository.OrderRepo
	Cache  repository.UserCacheRepo
	Logs   repository.LogRepo
	Inbox  repository.InboxRepo
	Store  repository.Store
	// SingleModel forbids holding more than one blocking subscription;
	// runtime-mutable, read per request.
	SingleModel func() bool
}

type GetSubscribeLogLogic

type GetSubscribeLogLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*GetSubscribeLogLogic) GetSubscribeLog

func (l *GetSubscribeLogLogic) GetSubscribeLog(req *dto.GetSubscribeLogRequest) (resp *dto.GetSubscribeLogResponse, err error)

type PreUnsubscribeLogic

type PreUnsubscribeLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*PreUnsubscribeLogic) PreUnsubscribe

func (l *PreUnsubscribeLogic) PreUnsubscribe(req *dto.PreUnsubscribeRequest) (resp *dto.PreUnsubscribeResponse, err error)

type QueryUserSubscribeLogic

type QueryUserSubscribeLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*QueryUserSubscribeLogic) QueryUserSubscribe

func (l *QueryUserSubscribeLogic) QueryUserSubscribe() (resp *dto.QueryUserSubscribeListResponse, err error)

type ResetUserSubscribeTokenLogic

type ResetUserSubscribeTokenLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*ResetUserSubscribeTokenLogic) ResetUserSubscribeToken

func (l *ResetUserSubscribeTokenLogic) ResetUserSubscribeToken(req *dto.ResetUserSubscribeTokenRequest) error

type Service

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

func NewService

func NewService(deps Deps) *Service

func (*Service) GetSubscribeLog

func (*Service) PreUnsubscribe

func (*Service) QueryUserSubscribe

func (s *Service) QueryUserSubscribe(ctx context.Context) (*dto.QueryUserSubscribeListResponse, error)

func (*Service) ResetUserSubscribeToken

func (s *Service) ResetUserSubscribeToken(ctx context.Context, req *dto.ResetUserSubscribeTokenRequest) error

func (*Service) Unsubscribe

func (s *Service) Unsubscribe(ctx context.Context, req *dto.UnsubscribeRequest) error

func (*Service) UpdateUserSubscribeNote

func (s *Service) UpdateUserSubscribeNote(ctx context.Context, req *dto.UpdateUserSubscribeNoteRequest) error

type UnsubscribeLogic

type UnsubscribeLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*UnsubscribeLogic) Unsubscribe

func (l *UnsubscribeLogic) Unsubscribe(req *dto.UnsubscribeRequest) error

Unsubscribe cancels the subscription in a subscription-domain transaction, then settles the refund in a billing-domain transaction (gift amount first for balance-paid orders, then regular balance). A crash between the two is repaired when the user retries: a Deducted subscription whose refund marker is missing resumes at the refund stage.

type UpdateUserSubscribeNoteLogic

type UpdateUserSubscribeNoteLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*UpdateUserSubscribeNoteLogic) UpdateUserSubscribeNote

func (l *UpdateUserSubscribeNoteLogic) UpdateUserSubscribeNote(req *dto.UpdateUserSubscribeNoteRequest) error

Jump to

Keyboard shortcuts

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