diff options
author | Merov Linden <merov@lindenlab.com> | 2014-05-07 14:51:36 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-05-07 14:51:36 -0700 |
commit | bd0d62c339d197ec2fa50cc642a864071677dc3a (patch) | |
tree | 2e75bee19139b70c5712752fcf639ab3808cfe03 | |
parent | e916b47f12ba0e84ee6b1faed687b920e49633f8 (diff) |
DD-22 : WIP : Partial implementation of PUT associate_listing
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 40 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 15c1630a2a..701d341753 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -301,6 +301,29 @@ public: } } }; + +class LLSLMAssociateListingsResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLSLMAssociateListingsResponder); +public: + + LLSLMAssociateListingsResponder() {} + + virtual void completed(U32 status, const std::string& reason, const LLSD& content) { } + + void completedHeader(U32 status, const std::string& reason, const LLSD& content) + { + if (isGoodStatus(status)) + { + LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT); + } + else + { + log_SLM_error("Get merchant", status, reason, content.get("error_code"), content.get("error_description")); + } + } +}; + // SLM Responders End /////////////////////////////////////////////////////////////////////////////// @@ -902,6 +925,23 @@ void LLMarketplaceData::updateSLMListing(const LLUUID& folder_id, S32 listing_id } // PUT /associate_inventory/:listing_folder_id/:version_folder_id/:listing_id +void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id) +{ + LLSD headers = LLSD::emptyMap(); + headers["Accept"] = "application/json"; + headers["Content-Type"] = "application/json"; + + LLSD data = LLSD::emptyMap(); + + // Send request + std::string url = getSLMConnectURL("/associate_inventory/") + + folder_id.asString() + "/" + + version_id.asString() + "/" + + llformat("%d",listing_id); + + llinfos << "Merov : associate listing : " << url << llendl; + LLHTTPClient::put(url, data, new LLSLMAssociateListingsResponder(), headers); +} std::string LLMarketplaceData::getSLMConnectURL(const std::string& route) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index f0a1f2f4b8..3be1abf24f 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -165,6 +165,7 @@ public: //void getSLMListing(); void createSLMListing(const LLUUID& folder_id); void updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed); + void associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id); bool isEmpty() { return (mMarketplaceItems.size() == 0); } |