test add vouchers and shared service
Some checks failed
Build and Publish / Metadata (push) Successful in 13s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m22s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-10-14 09:10:01 +02:00
parent 11e82de114
commit 6c44a03dd1
7 changed files with 152 additions and 18 deletions

32
pkg/voucher/service.go Normal file
View File

@@ -0,0 +1,32 @@
package voucher
import "math"
type Rule struct {
Type string `json:"type"`
Value int64 `json:"value"`
}
type Voucher struct {
Code string `json:"code"`
Value int64 `json:"discount"`
TaxValue int64 `json:"taxValue"`
TaxRate int `json:"taxRate"`
rules []Rule `json:"rules"`
}
type Service struct {
// Add fields here
}
func (s *Service) GetVoucher(code string) (*Voucher, error) {
value := int64(math.Round(100 * math.Pow(10, 2)))
return &Voucher{
Code: code,
Value: value,
TaxValue: int64(float64(value) * 0.2),
TaxRate: 2500,
rules: nil,
}, nil
}