mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
)
|
|
|
|
// PurchaseExpenseBridge defines hooks that allow purchase flows to stay in sync with expense data once it exists.
|
|
type PurchaseExpenseBridge interface {
|
|
OnItemsCreated(ctx context.Context, purchaseID uint64, items []entity.PurchaseItem) error
|
|
OnItemsDeleted(ctx context.Context, purchaseID uint64, itemIDs []uint64) error
|
|
OnItemsReceived(ctx context.Context, purchaseID uint64, updates []ExpenseReceivingPayload) error
|
|
}
|
|
|
|
// ExpenseReceivingPayload captures the minimum data expense integration will need once available.
|
|
type ExpenseReceivingPayload struct {
|
|
PurchaseItemID uint64
|
|
ProductID uint64
|
|
WarehouseID uint64
|
|
ReceivedQty float64
|
|
ReceivedDate *time.Time
|
|
}
|
|
|
|
// noopPurchaseExpenseBridge is the default implementation until the expense module is ready.
|
|
type noopPurchaseExpenseBridge struct{}
|
|
|
|
func NewNoopPurchaseExpenseBridge() PurchaseExpenseBridge {
|
|
return &noopPurchaseExpenseBridge{}
|
|
}
|
|
|
|
func (n *noopPurchaseExpenseBridge) OnItemsCreated(_ context.Context, _ uint64, _ []entity.PurchaseItem) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopPurchaseExpenseBridge) OnItemsDeleted(_ context.Context, _ uint64, _ []uint64) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *noopPurchaseExpenseBridge) OnItemsReceived(_ context.Context, _ uint64, _ []ExpenseReceivingPayload) error {
|
|
return nil
|
|
}
|