49 lines
1.8 KiB
Go
49 lines
1.8 KiB
Go
package identityhttp
|
|
|
|
import "git.sendico.io/tech/sxchnge/product/identity"
|
|
|
|
type profileDTO struct {
|
|
FullName string `json:"fullName"`
|
|
DateOfBirth string `json:"dateOfBirth"`
|
|
ResidenceCountry string `json:"residenceCountry"`
|
|
}
|
|
|
|
func (p profileDTO) model() identity.Profile {
|
|
return identity.Profile{FullName: p.FullName, DateOfBirth: p.DateOfBirth, ResidenceCountry: p.ResidenceCountry}
|
|
}
|
|
|
|
type verificationDTO struct {
|
|
Status string `json:"status"`
|
|
UpgradePending bool `json:"upgradePending"`
|
|
Reason string `json:"reason,omitempty"`
|
|
SubmissionID string `json:"submissionId,omitempty"`
|
|
Profile profileDTO `json:"profile"`
|
|
}
|
|
|
|
func mapVerification(v identity.Verification) verificationDTO {
|
|
return verificationDTO{Status: v.Status, UpgradePending: v.UpgradePending, Reason: v.Reason, SubmissionID: v.SubmissionID, Profile: profileDTO{FullName: v.Profile.FullName, DateOfBirth: v.Profile.DateOfBirth, ResidenceCountry: v.Profile.ResidenceCountry}}
|
|
}
|
|
|
|
type limitDTO struct {
|
|
Operation string `json:"operation"`
|
|
Period string `json:"period"`
|
|
Currency string `json:"currency"`
|
|
Cap string `json:"cap"`
|
|
Remaining string `json:"remaining"`
|
|
Used string `json:"used"`
|
|
Reserved string `json:"reserved"`
|
|
}
|
|
type limitsDTO struct {
|
|
Tier string `json:"tier"`
|
|
ProfileRef string `json:"profileRef"`
|
|
Entries []limitDTO `json:"entries"`
|
|
}
|
|
|
|
func mapLimits(v identity.Limits) limitsDTO {
|
|
entries := make([]limitDTO, 0, len(v.Entries))
|
|
for _, r := range v.Entries {
|
|
entries = append(entries, limitDTO{Operation: r.Operation, Period: r.Period, Currency: r.Currency, Cap: r.Cap, Remaining: r.Remaining, Used: r.Used, Reserved: r.Reserved})
|
|
}
|
|
return limitsDTO{Tier: v.Tier, ProfileRef: v.ProfileRef, Entries: entries}
|
|
}
|