QueryCustomerAddressListResult.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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/bssopenapi/model/QueryCustomerAddressListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::BssOpenApi;
  19. using namespace AlibabaCloud::BssOpenApi::Model;
  20. QueryCustomerAddressListResult::QueryCustomerAddressListResult() :
  21. ServiceResult()
  22. {}
  23. QueryCustomerAddressListResult::QueryCustomerAddressListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryCustomerAddressListResult::~QueryCustomerAddressListResult()
  29. {}
  30. void QueryCustomerAddressListResult::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 dataNode = value["Data"];
  37. auto allCustomerInvoiceAddressList = value["CustomerInvoiceAddressList"]["CustomerInvoiceAddress"];
  38. for (auto value : allCustomerInvoiceAddressList)
  39. {
  40. Data::CustomerInvoiceAddress customerInvoiceAddressObject;
  41. if(!value["Id"].isNull())
  42. customerInvoiceAddressObject.id = std::stol(value["Id"].asString());
  43. if(!value["UserId"].isNull())
  44. customerInvoiceAddressObject.userId = std::stol(value["UserId"].asString());
  45. if(!value["UserNick"].isNull())
  46. customerInvoiceAddressObject.userNick = value["UserNick"].asString();
  47. if(!value["Addressee"].isNull())
  48. customerInvoiceAddressObject.addressee = value["Addressee"].asString();
  49. if(!value["Province"].isNull())
  50. customerInvoiceAddressObject.province = value["Province"].asString();
  51. if(!value["City"].isNull())
  52. customerInvoiceAddressObject.city = value["City"].asString();
  53. if(!value["County"].isNull())
  54. customerInvoiceAddressObject.county = value["County"].asString();
  55. if(!value["Street"].isNull())
  56. customerInvoiceAddressObject.street = value["Street"].asString();
  57. if(!value["PostalCode"].isNull())
  58. customerInvoiceAddressObject.postalCode = value["PostalCode"].asString();
  59. if(!value["Phone"].isNull())
  60. customerInvoiceAddressObject.phone = value["Phone"].asString();
  61. if(!value["BizType"].isNull())
  62. customerInvoiceAddressObject.bizType = value["BizType"].asString();
  63. if(!value["DeliveryAddress"].isNull())
  64. customerInvoiceAddressObject.deliveryAddress = value["DeliveryAddress"].asString();
  65. data_.customerInvoiceAddressList.push_back(customerInvoiceAddressObject);
  66. }
  67. if(!value["Success"].isNull())
  68. success_ = value["Success"].asString() == "true";
  69. if(!value["Code"].isNull())
  70. code_ = value["Code"].asString();
  71. if(!value["Message"].isNull())
  72. message_ = value["Message"].asString();
  73. }
  74. std::string QueryCustomerAddressListResult::getMessage()const
  75. {
  76. return message_;
  77. }
  78. QueryCustomerAddressListResult::Data QueryCustomerAddressListResult::getData()const
  79. {
  80. return data_;
  81. }
  82. std::string QueryCustomerAddressListResult::getCode()const
  83. {
  84. return code_;
  85. }
  86. bool QueryCustomerAddressListResult::getSuccess()const
  87. {
  88. return success_;
  89. }