domain_service.go 1.6 KB
package factory

import (
	pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain/service"
	"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/infrastructure/domainService"
)

func CreateShippingService(options map[string]interface{}) (service.ShippingGoodsService, error) {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return domainService.NewShippingGoodsService(transactionContext)
}

func CreateReceivingService(options map[string]interface{}) (service.ReceivingGoodsService, error) {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return domainService.NewReceivingGoodsService(transactionContext)
}

func CreateCancelOrderService(options map[string]interface{}) (service.CancelOrderService, error) {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return domainService.NewCancelOrderService(transactionContext)
}

func CreateReturnGoodsService(options map[string]interface{}) (service.ReturnGoodsService, error) {
	var transactionContext *pgTransaction.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pgTransaction.TransactionContext)
	}
	return domainService.NewReturnGoodsService(transactionContext)
}