DescribeVerifyResultResult.cc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/cloudauth/model/DescribeVerifyResultResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cloudauth;
  19. using namespace AlibabaCloud::Cloudauth::Model;
  20. DescribeVerifyResultResult::DescribeVerifyResultResult() :
  21. ServiceResult()
  22. {}
  23. DescribeVerifyResultResult::DescribeVerifyResultResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeVerifyResultResult::~DescribeVerifyResultResult()
  29. {}
  30. void DescribeVerifyResultResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto materialNode = value["Material"];
  37. if(!materialNode["FaceImageUrl"].isNull())
  38. material_.faceImageUrl = materialNode["FaceImageUrl"].asString();
  39. if(!materialNode["IdCardName"].isNull())
  40. material_.idCardName = materialNode["IdCardName"].asString();
  41. if(!materialNode["IdCardNumber"].isNull())
  42. material_.idCardNumber = materialNode["IdCardNumber"].asString();
  43. if(!materialNode["FaceQuality"].isNull())
  44. material_.faceQuality = materialNode["FaceQuality"].asString();
  45. if(!materialNode["FaceGlobalUrl"].isNull())
  46. material_.faceGlobalUrl = materialNode["FaceGlobalUrl"].asString();
  47. if(!materialNode["FaceMask"].isNull())
  48. material_.faceMask = materialNode["FaceMask"].asString() == "true";
  49. auto idCardInfoNode = materialNode["IdCardInfo"];
  50. if(!idCardInfoNode["Number"].isNull())
  51. material_.idCardInfo.number = idCardInfoNode["Number"].asString();
  52. if(!idCardInfoNode["Address"].isNull())
  53. material_.idCardInfo.address = idCardInfoNode["Address"].asString();
  54. if(!idCardInfoNode["Nationality"].isNull())
  55. material_.idCardInfo.nationality = idCardInfoNode["Nationality"].asString();
  56. if(!idCardInfoNode["EndDate"].isNull())
  57. material_.idCardInfo.endDate = idCardInfoNode["EndDate"].asString();
  58. if(!idCardInfoNode["FrontImageUrl"].isNull())
  59. material_.idCardInfo.frontImageUrl = idCardInfoNode["FrontImageUrl"].asString();
  60. if(!idCardInfoNode["Authority"].isNull())
  61. material_.idCardInfo.authority = idCardInfoNode["Authority"].asString();
  62. if(!idCardInfoNode["Sex"].isNull())
  63. material_.idCardInfo.sex = idCardInfoNode["Sex"].asString();
  64. if(!idCardInfoNode["Name"].isNull())
  65. material_.idCardInfo.name = idCardInfoNode["Name"].asString();
  66. if(!idCardInfoNode["Birth"].isNull())
  67. material_.idCardInfo.birth = idCardInfoNode["Birth"].asString();
  68. if(!idCardInfoNode["BackImageUrl"].isNull())
  69. material_.idCardInfo.backImageUrl = idCardInfoNode["BackImageUrl"].asString();
  70. if(!idCardInfoNode["StartDate"].isNull())
  71. material_.idCardInfo.startDate = idCardInfoNode["StartDate"].asString();
  72. auto allVideoUrls = materialNode["VideoUrls"]["VideoUrl"];
  73. for (auto value : allVideoUrls)
  74. material_.videoUrls.push_back(value.asString());
  75. if(!value["VerifyStatus"].isNull())
  76. verifyStatus_ = std::stoi(value["VerifyStatus"].asString());
  77. if(!value["AuthorityComparisionScore"].isNull())
  78. authorityComparisionScore_ = std::stof(value["AuthorityComparisionScore"].asString());
  79. if(!value["FaceComparisonScore"].isNull())
  80. faceComparisonScore_ = std::stof(value["FaceComparisonScore"].asString());
  81. if(!value["IdCardFaceComparisonScore"].isNull())
  82. idCardFaceComparisonScore_ = std::stof(value["IdCardFaceComparisonScore"].asString());
  83. }
  84. int DescribeVerifyResultResult::getVerifyStatus()const
  85. {
  86. return verifyStatus_;
  87. }
  88. DescribeVerifyResultResult::Material DescribeVerifyResultResult::getMaterial()const
  89. {
  90. return material_;
  91. }
  92. float DescribeVerifyResultResult::getAuthorityComparisionScore()const
  93. {
  94. return authorityComparisionScore_;
  95. }
  96. float DescribeVerifyResultResult::getFaceComparisonScore()const
  97. {
  98. return faceComparisonScore_;
  99. }
  100. float DescribeVerifyResultResult::getIdCardFaceComparisonScore()const
  101. {
  102. return idCardFaceComparisonScore_;
  103. }