flamingo.me/flamingo-commerce/v3@v3.11.0/price/interfaces/templatefunctions/commercePriceFormat.go (about)

     1  package templatefunctions
     2  
     3  import (
     4  	"context"
     5  
     6  	"flamingo.me/flamingo-commerce/v3/price/application"
     7  	"flamingo.me/flamingo-commerce/v3/price/domain"
     8  )
     9  
    10  // CommercePriceFormatFunc for formatting prices
    11  type CommercePriceFormatFunc struct {
    12  	priceService *application.Service
    13  }
    14  
    15  // Inject dependencies
    16  func (pff *CommercePriceFormatFunc) Inject(priceService *application.Service) {
    17  	pff.priceService = priceService
    18  }
    19  
    20  // Func as implementation of debug method
    21  // todo fix
    22  func (pff *CommercePriceFormatFunc) Func(context.Context) interface{} {
    23  	return func(price domain.Price) string {
    24  		return pff.priceService.FormatPrice(price)
    25  	}
    26  }