Documentation ¶
Index ¶
- Constants
- Variables
- func NewAdminUseCase(repo interfaces.AdminRepository, userRepo interfaces.UserRepository) service.AdminUseCase
- func NewAuthUseCase(authRepo interfaces.AuthRepository, tokenService token.TokenService, ...) service.AuthUseCase
- func NewBrandUseCase(brandRepo repoInterface.BrandRepository) interfaces.BrandUseCase
- func NewCartUseCase(cartRepo interfaces.CartRepository, productRepo interfaces.ProductRepository) service.CartUseCase
- func NewCouponUseCase(couponRepo interfaces.CouponRepository, cartRepo interfaces.CartRepository) service.CouponUseCase
- func NewOfferUseCase(offerRepo repo.OfferRepository) interfaces.OfferUseCase
- func NewOrderUseCase(orderRepo interfaces.OrderRepository, cartRepo interfaces.CartRepository, ...) service.OrderUseCase
- func NewPaymentUseCase(paymentRepo interfaces.PaymentRepository, orderRepo interfaces.OrderRepository, ...) service.PaymentUseCase
- func NewProductUseCase(productRepo interfaces.ProductRepository, cloudService cloud.CloudService) service.ProductUseCase
- func NewStockUseCase(stockRepo interfaces.StockRepository) service.StockUseCase
- func NewUserUseCase(userRepo interfaces.UserRepository, cartRepo interfaces.CartRepository, ...) service.UserUseCase
- type OrderUseCase
- func (c *OrderUseCase) CancelOrder(ctx context.Context, shopOrderID uint) error
- func (c *OrderUseCase) FindAllOrderReturns(ctx context.Context, pagination request.Pagination) ([]response.OrderReturn, error)
- func (c *OrderUseCase) FindAllOrderStatuses(ctx context.Context) ([]domain.OrderStatus, error)
- func (c *OrderUseCase) FindAllPendingOrderReturns(ctx context.Context, pagination request.Pagination) ([]response.OrderReturn, error)
- func (c *OrderUseCase) FindAllShopOrders(ctx context.Context, pagination request.Pagination) ([]response.ShopOrder, error)
- func (c *OrderUseCase) FindOrderItems(ctx context.Context, shopOrderID uint, pagination request.Pagination) (orderItems []response.OrderItem, err error)
- func (c *OrderUseCase) FindUserShopOrder(ctx context.Context, userID uint, pagination request.Pagination) ([]response.ShopOrder, error)
- func (c *OrderUseCase) FindUserWallet(ctx context.Context, userID uint) (wallet domain.Wallet, err error)
- func (c *OrderUseCase) FindUserWalletTransactions(ctx context.Context, userID uint, pagination request.Pagination) (transactions []domain.Transaction, err error)
- func (c *OrderUseCase) SaveOrder(ctx context.Context, userID, addressID uint) (uint, error)
- func (c *OrderUseCase) SubmitReturnRequest(ctx context.Context, returnDetails request.Return) error
- func (c *OrderUseCase) UpdateOrderStatus(ctx context.Context, shopOrderID, changeStatusID uint) error
- func (c *OrderUseCase) UpdateReturnDetails(ctx context.Context, updateDetails request.UpdateOrderReturn) error
Constants ¶
View Source
const ( AccessTokenDuration = time.Minute * 20 RefreshTokenDuration = time.Hour * 24 * 7 )
Variables ¶
View Source
var ( // login ErrEmptyLoginCredentials = errors.New("all login credentials are empty") ErrUserNotExist = errors.New("user not exist with given login credentials") ErrUserNotVerified = errors.New("user not verified") ErrUserBlocked = errors.New("user blocked by admin") ErrWrongPassword = errors.New("password doesn't match") // otp ErrOtpExpired = errors.New("otp session expired") ErrInvalidOtp = errors.New("invalid otp") // refresh token ErrInvalidRefreshToken = errors.New("invalid refresh token") ErrRefreshSessionNotExist = errors.New("there is no refresh token session for this token") ErrRefreshSessionExpired = errors.New("refresh token expired in session") ErrRefreshSessionBlocked = errors.New("refresh token blocked in session") // signup ErrUserAlreadyExit = errors.New("user already exist") // cart ErrProductItemOutOfStock = errors.New("product is now out of stock") ErrCartItemAlreadyExist = errors.New("product_item already exist on the cart") ErrCartItemNotExit = errors.New("product_item not exist on cart") ErrEmptyCart = errors.New("user cart is empty") ErrRequireMinimumCartItemQty = errors.New("update cart item qty can not less than 1") ErrInvalidCartItemUpdateQty = errors.New("update cart item qty reached max limit") // admin ErrSameBlockStatus = errors.New("user block status already in given status") //category ErrCategoryAlreadyExist = errors.New("category already exist") // variation ErrVariationAlreadyExist = errors.New("variation already exist") ErrVariationOptionAlreadyExist = errors.New("variation already exist") // product ErrProductAlreadyExist = errors.New("product already exist with this name") // product item ErrProductItemAlreadyExist = errors.New("product item already exist with this configuration") ErrNotEnoughVariations = errors.New("not enough variation options for this product select one variation option from each variation") // offer ErrOfferNameAlreadyExist = errors.New("offer already exist this name") ErrInvalidOfferEndDate = errors.New("invalid offer end date") ErrOfferAlreadyEnded = errors.New("offer already ended") ErrCategoryOfferAlreadyExist = errors.New("an offer already exist for this category") ErrProductOfferAlreadyExist = errors.New("an offer already exist for this product") // order ErrOutOfStockOnCart = errors.New("cart is not valid for order out of stock is in cart") // wish list ErrExistWishListProductItem = errors.New("product item already exist on wish list") // payment ErrBlockedPayment = errors.New("selected payment is blocked by admin") ErrPaymentAmountReachedMax = errors.New("order total price reached payment method maximum amount") ErrPaymentNotApproved = errors.New("payment not approved") // brand ErrBrandAlreadyExist = errors.New("brand name already exist") )
Functions ¶
func NewAdminUseCase ¶
func NewAdminUseCase(repo interfaces.AdminRepository, userRepo interfaces.UserRepository) service.AdminUseCase
func NewAuthUseCase ¶
func NewAuthUseCase(authRepo interfaces.AuthRepository, tokenService token.TokenService, userRepo interfaces.UserRepository, adminRepo interfaces.AdminRepository, optAuth otp.OtpAuth) service.AuthUseCase
func NewBrandUseCase ¶
func NewBrandUseCase(brandRepo repoInterface.BrandRepository) interfaces.BrandUseCase
func NewCartUseCase ¶
func NewCartUseCase(cartRepo interfaces.CartRepository, productRepo interfaces.ProductRepository) service.CartUseCase
func NewCouponUseCase ¶
func NewCouponUseCase(couponRepo interfaces.CouponRepository, cartRepo interfaces.CartRepository) service.CouponUseCase
func NewOfferUseCase ¶
func NewOfferUseCase(offerRepo repo.OfferRepository) interfaces.OfferUseCase
func NewOrderUseCase ¶
func NewOrderUseCase(orderRepo interfaces.OrderRepository, cartRepo interfaces.CartRepository, userRepo interfaces.UserRepository, paymentRepo interfaces.PaymentRepository) service.OrderUseCase
func NewPaymentUseCase ¶
func NewPaymentUseCase(paymentRepo interfaces.PaymentRepository, orderRepo interfaces.OrderRepository, userRepo interfaces.UserRepository, cartRepo interfaces.CartRepository, couponRepo interfaces.CouponRepository, config config.Config) service.PaymentUseCase
func NewProductUseCase ¶
func NewProductUseCase(productRepo interfaces.ProductRepository, cloudService cloud.CloudService) service.ProductUseCase
to get a new instance of productUseCase
func NewStockUseCase ¶
func NewStockUseCase(stockRepo interfaces.StockRepository) service.StockUseCase
func NewUserUseCase ¶
func NewUserUseCase(userRepo interfaces.UserRepository, cartRepo interfaces.CartRepository, productRepo interfaces.ProductRepository) service.UserUseCase
Types ¶
type OrderUseCase ¶
type OrderUseCase struct {
// contains filtered or unexported fields
}
func (*OrderUseCase) CancelOrder ¶
func (c *OrderUseCase) CancelOrder(ctx context.Context, shopOrderID uint) error
func (*OrderUseCase) FindAllOrderReturns ¶
func (c *OrderUseCase) FindAllOrderReturns(ctx context.Context, pagination request.Pagination) ([]response.OrderReturn, error)
to get all order return
func (*OrderUseCase) FindAllOrderStatuses ¶
func (c *OrderUseCase) FindAllOrderStatuses(ctx context.Context) ([]domain.OrderStatus, error)
get all order statuses
func (*OrderUseCase) FindAllPendingOrderReturns ¶
func (c *OrderUseCase) FindAllPendingOrderReturns(ctx context.Context, pagination request.Pagination) ([]response.OrderReturn, error)
to get pending order returns
func (*OrderUseCase) FindAllShopOrders ¶
func (c *OrderUseCase) FindAllShopOrders(ctx context.Context, pagination request.Pagination) ([]response.ShopOrder, error)
func to Find all shop order
func (*OrderUseCase) FindOrderItems ¶
func (c *OrderUseCase) FindOrderItems(ctx context.Context, shopOrderID uint, pagination request.Pagination) (orderItems []response.OrderItem, err error)
func (*OrderUseCase) FindUserShopOrder ¶
func (c *OrderUseCase) FindUserShopOrder(ctx context.Context, userID uint, pagination request.Pagination) ([]response.ShopOrder, error)
Find all orders of a user
func (*OrderUseCase) FindUserWallet ¶
func (*OrderUseCase) FindUserWalletTransactions ¶
func (c *OrderUseCase) FindUserWalletTransactions(ctx context.Context, userID uint, pagination request.Pagination) (transactions []domain.Transaction, err error)
func (*OrderUseCase) SubmitReturnRequest ¶
func (*OrderUseCase) UpdateOrderStatus ¶
func (c *OrderUseCase) UpdateOrderStatus(ctx context.Context, shopOrderID, changeStatusID uint) error
update order
func (*OrderUseCase) UpdateReturnDetails ¶
func (c *OrderUseCase) UpdateReturnDetails(ctx context.Context, updateDetails request.UpdateOrderReturn) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.