diff --git a/calls.go b/calls.go index de12121..d33568f 100644 --- a/calls.go +++ b/calls.go @@ -284,6 +284,14 @@ func (a *DerivAPI) IdentityVerificationDocumentAdd(r schema.IdentityVerification return } +// KycAuthStatus Get KYC Authentication Status +func (a *DerivAPI) KycAuthStatus(r schema.KycAuthStatus) (resp schema.KycAuthStatusResp, err error) { + id := a.getNextRequestID() + r.ReqId = &id + err = a.SendRequest(id, r, &resp) + return +} + // LandingCompany The company has a number of licensed subsidiaries in various jurisdictions, which are called Landing Companies. This call will return the appropriate Landing Company for clients of a given country. The landing company may differ for Gaming contracts (Synthetic Indices) and Financial contracts (Forex, Stock Indices, Commodities). func (a *DerivAPI) LandingCompany(r schema.LandingCompany) (resp schema.LandingCompanyResp, err error) { id := a.getNextRequestID() diff --git a/schema/get_account_status_resp.go b/schema/get_account_status_resp.go index fa6cf93..ba64ee3 100644 --- a/schema/get_account_status_resp.go +++ b/schema/get_account_status_resp.go @@ -112,6 +112,8 @@ type GetAccountStatusRespGetAccountStatus struct { // IDV. // - `idv_revoked`: the client used to be fully authenticated by IDV but it was // taken away due to compliance criteria. + // - `mt5_additional_kyc_required`: client tax information, place of birth and + // account opening reason is missing Status []string `json:"status"` } diff --git a/schema/kyc_auth_status.go b/schema/kyc_auth_status.go new file mode 100644 index 0000000..2859a92 --- /dev/null +++ b/schema/kyc_auth_status.go @@ -0,0 +1,68 @@ +// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT. + +package schema + +import "fmt" +import "reflect" +import "encoding/json" + +type KycAuthStatusKycAuthStatus int + +var enumValues_KycAuthStatusKycAuthStatus = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusKycAuthStatus) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusKycAuthStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusKycAuthStatus, v) + } + *j = KycAuthStatusKycAuthStatus(v) + return nil +} + +// Get KYC Authentication Status +type KycAuthStatus struct { + // Must be `1` + KycAuthStatus KycAuthStatusKycAuthStatus `json:"kyc_auth_status"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough KycAuthStatusPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type KycAuthStatusPassthrough map[string]interface{} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatus) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["kyc_auth_status"]; !ok || v == nil { + return fmt.Errorf("field kyc_auth_status: required") + } + type Plain KycAuthStatus + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = KycAuthStatus(plain) + return nil +} diff --git a/schema/kyc_auth_status_resp.go b/schema/kyc_auth_status_resp.go new file mode 100644 index 0000000..76e4d9d --- /dev/null +++ b/schema/kyc_auth_status_resp.go @@ -0,0 +1,247 @@ +// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT. + +package schema + +import "fmt" +import "reflect" +import "encoding/json" + +// A message with KYC Authentication Status. +type KycAuthStatusResp struct { + // Echo of the request made. + EchoReq KycAuthStatusRespEchoReq `json:"echo_req"` + + // Proof of Identity (POI) and Proof of Address (POA) authentication status + // details. + KycAuthStatus *KycAuthStatusRespKycAuthStatus `json:"kyc_auth_status,omitempty"` + + // Action name of the request made. + MsgType KycAuthStatusRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +// Echo of the request made. +type KycAuthStatusRespEchoReq map[string]interface{} + +// Proof of Identity (POI) and Proof of Address (POA) authentication status +// details. +type KycAuthStatusRespKycAuthStatus struct { + // POA authentication status details. + Address KycAuthStatusRespKycAuthStatusAddress `json:"address"` + + // POI authentication status details. + Identity KycAuthStatusRespKycAuthStatusIdentity `json:"identity"` +} + +// POA authentication status details. +type KycAuthStatusRespKycAuthStatusAddress struct { + // Current POA status. + Status *KycAuthStatusRespKycAuthStatusAddressStatus `json:"status,omitempty"` +} + +type KycAuthStatusRespKycAuthStatusAddressStatus string + +const KycAuthStatusRespKycAuthStatusAddressStatusExpired KycAuthStatusRespKycAuthStatusAddressStatus = "expired" +const KycAuthStatusRespKycAuthStatusAddressStatusNone KycAuthStatusRespKycAuthStatusAddressStatus = "none" +const KycAuthStatusRespKycAuthStatusAddressStatusPending KycAuthStatusRespKycAuthStatusAddressStatus = "pending" +const KycAuthStatusRespKycAuthStatusAddressStatusRejected KycAuthStatusRespKycAuthStatusAddressStatus = "rejected" +const KycAuthStatusRespKycAuthStatusAddressStatusVerified KycAuthStatusRespKycAuthStatusAddressStatus = "verified" + +// POI authentication status details. +type KycAuthStatusRespKycAuthStatusIdentity struct { + // Available services for the next POI attempt. + AvailableServices []string `json:"available_services,omitempty"` + + // Details on the rejected POI attempt. + LastRejected *KycAuthStatusRespKycAuthStatusIdentityLastRejected `json:"last_rejected,omitempty"` + + // Service used for the current POI status. + Service *KycAuthStatusRespKycAuthStatusIdentityService `json:"service,omitempty"` + + // Current POI status. + Status *KycAuthStatusRespKycAuthStatusIdentityStatus `json:"status,omitempty"` +} + +// Details on the rejected POI attempt. +type KycAuthStatusRespKycAuthStatusIdentityLastRejected struct { + // Document type of the rejected POI attempt (IDV only). + DocumentType interface{} `json:"document_type,omitempty"` + + // Reason(s) for the rejected POI attempt. + RejectedReasons []string `json:"rejected_reasons,omitempty"` +} + +type KycAuthStatusRespKycAuthStatusIdentityService string + +const KycAuthStatusRespKycAuthStatusIdentityServiceIdv KycAuthStatusRespKycAuthStatusIdentityService = "idv" +const KycAuthStatusRespKycAuthStatusIdentityServiceManual KycAuthStatusRespKycAuthStatusIdentityService = "manual" +const KycAuthStatusRespKycAuthStatusIdentityServiceNone KycAuthStatusRespKycAuthStatusIdentityService = "none" +const KycAuthStatusRespKycAuthStatusIdentityServiceOnfido KycAuthStatusRespKycAuthStatusIdentityService = "onfido" + +type KycAuthStatusRespKycAuthStatusIdentityStatus string + +const KycAuthStatusRespKycAuthStatusIdentityStatusExpired KycAuthStatusRespKycAuthStatusIdentityStatus = "expired" +const KycAuthStatusRespKycAuthStatusIdentityStatusNone KycAuthStatusRespKycAuthStatusIdentityStatus = "none" +const KycAuthStatusRespKycAuthStatusIdentityStatusPending KycAuthStatusRespKycAuthStatusIdentityStatus = "pending" +const KycAuthStatusRespKycAuthStatusIdentityStatusRejected KycAuthStatusRespKycAuthStatusIdentityStatus = "rejected" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusRespKycAuthStatusAddressStatus) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusRespKycAuthStatusAddressStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusRespKycAuthStatusAddressStatus, v) + } + *j = KycAuthStatusRespKycAuthStatusAddressStatus(v) + return nil +} + +var enumValues_KycAuthStatusRespKycAuthStatusIdentityStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", +} + +const KycAuthStatusRespKycAuthStatusIdentityStatusVerified KycAuthStatusRespKycAuthStatusIdentityStatus = "verified" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusRespKycAuthStatusIdentityService) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusRespKycAuthStatusIdentityService { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusRespKycAuthStatusIdentityService, v) + } + *j = KycAuthStatusRespKycAuthStatusIdentityService(v) + return nil +} + +const KycAuthStatusRespKycAuthStatusIdentityStatusSuspected KycAuthStatusRespKycAuthStatusIdentityStatus = "suspected" + +var enumValues_KycAuthStatusRespKycAuthStatusIdentityService = []interface{}{ + "none", + "idv", + "onfido", + "manual", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusRespKycAuthStatusIdentityStatus) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusRespKycAuthStatusIdentityStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusRespKycAuthStatusIdentityStatus, v) + } + *j = KycAuthStatusRespKycAuthStatusIdentityStatus(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusRespKycAuthStatus) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["address"]; !ok || v == nil { + return fmt.Errorf("field address: required") + } + if v, ok := raw["identity"]; !ok || v == nil { + return fmt.Errorf("field identity: required") + } + type Plain KycAuthStatusRespKycAuthStatus + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = KycAuthStatusRespKycAuthStatus(plain) + return nil +} + +type KycAuthStatusRespMsgType string + +var enumValues_KycAuthStatusRespMsgType = []interface{}{ + "kyc_auth_status", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusRespMsgType, v) + } + *j = KycAuthStatusRespMsgType(v) + return nil +} + +const KycAuthStatusRespMsgTypeKycAuthStatus KycAuthStatusRespMsgType = "kyc_auth_status" + +var enumValues_KycAuthStatusRespKycAuthStatusAddressStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req: required") + } + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type: required") + } + type Plain KycAuthStatusResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = KycAuthStatusResp(plain) + return nil +}