flamingo.me/flamingo-commerce/v3@v3.11.0/cart/interfaces/graphql/dto/taxes.go (about)

     1  package dto
     2  
     3  import (
     4  	"flamingo.me/flamingo-commerce/v3/cart/domain/cart"
     5  )
     6  
     7  type (
     8  	//Taxes – provides custom graphql interface methods
     9  	Taxes struct {
    10  		Items []cart.Tax
    11  	}
    12  )
    13  
    14  // GetByType - returns tax by given type
    15  func (t Taxes) GetByType(taxType string) cart.Tax {
    16  	for _, tax := range t.Items {
    17  		if tax.Type == taxType {
    18  			return tax
    19  		}
    20  	}
    21  	return cart.Tax{}
    22  }