more
All checks were successful
Build and Publish / Metadata (push) Successful in 8s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m12s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m9s

This commit is contained in:
matst80
2025-10-14 12:30:12 +02:00
parent 7a79efbb9f
commit 0b9c14c231
9 changed files with 201 additions and 25 deletions

View File

@@ -1,6 +1,9 @@
package voucher
import "math"
import (
"errors"
"math"
)
type Rule struct {
Type string `json:"type"`
@@ -20,8 +23,13 @@ type Service struct {
}
var ErrInvalidCode = errors.New("invalid vouchercode")
func (s *Service) GetVoucher(code string) (*Voucher, error) {
value := int64(math.Round(100 * math.Pow(10, 2)))
if code == "" {
return nil, ErrInvalidCode
}
return &Voucher{
Code: code,
Value: value,