| 233 | } |
| 234 | |
| 235 | std::string API::order(const Domains & domains, OrderCallback callback) const |
| 236 | { |
| 237 | std::string payload_from_domains; |
| 238 | { |
| 239 | Poco::JSON::Object payload_json_object; |
| 240 | auto payload_identifiers = Poco::JSON::Array(); |
| 241 | |
| 242 | for (const auto & domain : domains) |
| 243 | { |
| 244 | Poco::JSON::Object identifier; |
| 245 | identifier.set("type", "dns"); |
| 246 | identifier.set("value", domain); |
| 247 | payload_identifiers.add(identifier); |
| 248 | } |
| 249 | |
| 250 | payload_json_object.set("identifiers", payload_identifiers); |
| 251 | |
| 252 | std::ostringstream payload; // STYLE_CHECK_ALLOW_STD_STRING_STREAM |
| 253 | payload.exceptions(std::ios::failbit); |
| 254 | Poco::JSON::Stringifier::stringify(payload_json_object, payload); |
| 255 | |
| 256 | payload_from_domains = payload.str(); |
| 257 | } |
| 258 | |
| 259 | auto http_response = std::make_shared<Poco::Net::HTTPResponse>(); |
| 260 | auto json = doJWSRequestExpectingJSON(directory->new_order, payload_from_domains, http_response); |
| 261 | |
| 262 | ProfileEvents::increment(ProfileEvents::ACMECertificateOrders); |
| 263 | |
| 264 | auto status = json->getValue<std::string>("status"); |
| 265 | auto expires = json->getValue<std::string>("expires"); |
| 266 | auto authorizations = json->getArray("authorizations"); |
| 267 | auto finalize = json->getValue<std::string>("finalize"); |
| 268 | |
| 269 | LOG_TEST(log, "Status: {}, Expires: {}, Finalize: {}", status, expires, finalize); |
| 270 | |
| 271 | auto order_url = http_response->get("Location"); |
| 272 | |
| 273 | for (const auto & auth : *authorizations) |
| 274 | processAuthorization(Poco::URI(auth.toString()), callback); |
| 275 | |
| 276 | return order_url; |
| 277 | } |
| 278 | |
| 279 | Order API::describeOrder(const Poco::URI & order_url) const |
| 280 | { |
no test coverage detected