customer/internal/utils/transfer/tariff.go

24 lines
671 B
Go
Raw Normal View History

2023-05-30 11:33:57 +00:00
package transfer
import (
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/proto/discount"
)
func TariffsToProductInformations(tarrifs []models.Tariff) []*discount.ProductInformation {
productInformations := make([]*discount.ProductInformation, len(tarrifs))
for index, tariff := range tarrifs {
productInformations[index] = TariffToProductInformation(tariff)
}
return productInformations
}
func TariffToProductInformation(tarrif models.Tariff) *discount.ProductInformation {
return &discount.ProductInformation{
ID: tarrif.ID,
Price: float64(tarrif.Price),
}
}