more
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user