chore(avs): adjust to newly refined VSM specifications (WIP)
This commit is contained in:
parent
39474d169c
commit
df559fead1
@ -137,10 +137,14 @@ instance ToJSON AvsLicence where
|
||||
toJSON AvsLicenceRollfeld = Number 2
|
||||
|
||||
instance FromJSON AvsLicence where
|
||||
parseJSON (Number n) | n == 0 = pure AvsNoLicence
|
||||
| n == 1 = pure AvsLicenceVorfeld
|
||||
parseJSON (Number n) | n == 1 = pure AvsLicenceVorfeld -- ordered by occurrence, n==1 is most common case
|
||||
| n == 2 = pure AvsLicenceRollfeld
|
||||
| n == 0 = pure AvsNoLicence -- n==0 never received from AVS, only sent to AVS
|
||||
#ifdef DEVELOPMENT
|
||||
parseJSON invalid = prependFailure "parsing AvsLicence failed, " $ fail $ "expected Int value being 0, 1 or 2. Found " ++ show invalid
|
||||
#else
|
||||
parseJSON _ = pure AvsNoLicence -- we simply ignore all other values
|
||||
#endif
|
||||
|
||||
-- | Ought to be identical to QualificationShortname!
|
||||
licence2char :: AvsLicence -> Char
|
||||
@ -312,8 +316,7 @@ deriveJSON defaultOptions
|
||||
|
||||
data AvsPersonLicence = AvsPersonLicence
|
||||
{ avsLicencePersonID :: AvsPersonId
|
||||
, avsLicenceRampLicence :: AvsLicence -- Schnittstelle unklar: RampDrivingLicence oder RampLicence
|
||||
--, avsLicenceRampDrivingLicence :: AvsLicence
|
||||
, avsLicenceRampLicence :: AvsLicence
|
||||
}
|
||||
deriving (Eq, Ord, Show, Generic, Typeable)
|
||||
deriveJSON defaultOptions
|
||||
@ -324,16 +327,21 @@ deriveJSON defaultOptions
|
||||
} ''AvsPersonLicence
|
||||
|
||||
data AvsLicenceResponse = AvsLicenceResponse
|
||||
{ avsResponsePersonID :: AvsPersonId
|
||||
, avsResponseSuccess :: SloppyBool
|
||||
, avsResponseMessage :: Text
|
||||
}
|
||||
{ avsResponsePersonID :: AvsPersonId
|
||||
, avsResponseSuccess :: SloppyBool
|
||||
, avsResponseMessage :: Text
|
||||
}
|
||||
| AvsErrorResponse
|
||||
{ avsResponseStatus :: Text
|
||||
, avsResponseMessage :: Text
|
||||
}
|
||||
deriving (Eq, Ord, Show, Generic, Typeable)
|
||||
deriveJSON defaultOptions
|
||||
{ fieldLabelModifier = dropCamel 2
|
||||
, omitNothingFields = True
|
||||
, tagSingleConstructors = False
|
||||
, rejectUnknownFields = False
|
||||
, sumEncoding = UntaggedValue
|
||||
} ''AvsLicenceResponse
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user