32 lines
837 B
Go
32 lines
837 B
Go
package srequest
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
|
|
"github.com/tech/sendico/pkg/model"
|
|
)
|
|
|
|
type Signup struct {
|
|
Account model.AccountData `json:"account"`
|
|
Organization model.Describable `json:"organization"`
|
|
OrganizationTimeZone string `json:"organizationTimeZone"`
|
|
OwnerRole model.Describable `json:"ownerRole"`
|
|
CryptoWallet model.Describable `json:"cryptoWallet"`
|
|
LedgerWallet model.Describable `json:"ledgerWallet"`
|
|
}
|
|
|
|
// UnmarshalJSON enforces strict parsing to catch malformed or unexpected fields.
|
|
func (s *Signup) UnmarshalJSON(data []byte) error {
|
|
type alias Signup
|
|
var payload alias
|
|
|
|
dec := json.NewDecoder(bytes.NewReader(data))
|
|
dec.DisallowUnknownFields()
|
|
if err := dec.Decode(&payload); err != nil {
|
|
return err
|
|
}
|
|
*s = Signup(payload)
|
|
return nil
|
|
}
|