Generated 2025-08-12 for IntlMarket.
This commit is contained in:
90
intlmarket/CMakeLists.txt
Normal file
90
intlmarket/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(intlmarket_public_header
|
||||
include/alibabacloud/intlmarket/IntlMarketClient.h
|
||||
include/alibabacloud/intlmarket/IntlMarketExport.h )
|
||||
|
||||
set(intlmarket_public_header_model
|
||||
include/alibabacloud/intlmarket/model/CreateOrderRequest.h
|
||||
include/alibabacloud/intlmarket/model/CreateOrderResult.h
|
||||
include/alibabacloud/intlmarket/model/DescribePriceRequest.h
|
||||
include/alibabacloud/intlmarket/model/DescribePriceResult.h )
|
||||
|
||||
set(intlmarket_src
|
||||
src/IntlMarketClient.cc
|
||||
src/model/CreateOrderRequest.cc
|
||||
src/model/CreateOrderResult.cc
|
||||
src/model/DescribePriceRequest.cc
|
||||
src/model/DescribePriceResult.cc )
|
||||
|
||||
add_library(intlmarket ${LIB_TYPE}
|
||||
${intlmarket_public_header}
|
||||
${intlmarket_public_header_model}
|
||||
${intlmarket_src})
|
||||
|
||||
set_target_properties(intlmarket
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}intlmarket
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(intlmarket
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_INTLMARKET_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(intlmarket
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(intlmarket
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(intlmarket
|
||||
jsoncpp)
|
||||
target_include_directories(intlmarket
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(intlmarket
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(intlmarket
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(intlmarket
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(intlmarket
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${intlmarket_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/intlmarket)
|
||||
install(FILES ${intlmarket_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/intlmarket/model)
|
||||
install(TARGETS intlmarket
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_INTLMARKETCLIENT_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_INTLMARKETCLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "IntlMarketExport.h"
|
||||
#include "model/CreateOrderRequest.h"
|
||||
#include "model/CreateOrderResult.h"
|
||||
#include "model/DescribePriceRequest.h"
|
||||
#include "model/DescribePriceResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace IntlMarket
|
||||
{
|
||||
class ALIBABACLOUD_INTLMARKET_EXPORT IntlMarketClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::CreateOrderResult> CreateOrderOutcome;
|
||||
typedef std::future<CreateOrderOutcome> CreateOrderOutcomeCallable;
|
||||
typedef std::function<void(const IntlMarketClient*, const Model::CreateOrderRequest&, const CreateOrderOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateOrderAsyncHandler;
|
||||
typedef Outcome<Error, Model::DescribePriceResult> DescribePriceOutcome;
|
||||
typedef std::future<DescribePriceOutcome> DescribePriceOutcomeCallable;
|
||||
typedef std::function<void(const IntlMarketClient*, const Model::DescribePriceRequest&, const DescribePriceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribePriceAsyncHandler;
|
||||
|
||||
IntlMarketClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
IntlMarketClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
IntlMarketClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~IntlMarketClient();
|
||||
CreateOrderOutcome createOrder(const Model::CreateOrderRequest &request)const;
|
||||
void createOrderAsync(const Model::CreateOrderRequest& request, const CreateOrderAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CreateOrderOutcomeCallable createOrderCallable(const Model::CreateOrderRequest& request) const;
|
||||
DescribePriceOutcome describePrice(const Model::DescribePriceRequest &request)const;
|
||||
void describePriceAsync(const Model::DescribePriceRequest& request, const DescribePriceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
DescribePriceOutcomeCallable describePriceCallable(const Model::DescribePriceRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_INTLMARKETCLIENT_H_
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_INTLMARKETEXPORT_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_INTLMARKETEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_INTLMARKET_LIBRARY)
|
||||
# define ALIBABACLOUD_INTLMARKET_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_INTLMARKET_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_INTLMARKET_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_INTLMARKETEXPORT_H_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERREQUEST_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERREQUEST_H_
|
||||
|
||||
#include <alibabacloud/intlmarket/IntlMarketExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace IntlMarket {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_INTLMARKET_EXPORT CreateOrderRequest : public RpcServiceRequest {
|
||||
public:
|
||||
CreateOrderRequest();
|
||||
~CreateOrderRequest();
|
||||
std::string getOrderSouce() const;
|
||||
void setOrderSouce(const std::string &orderSouce);
|
||||
std::string getCommodity() const;
|
||||
void setCommodity(const std::string &commodity);
|
||||
std::string getClientToken() const;
|
||||
void setClientToken(const std::string &clientToken);
|
||||
std::string getOwnerId() const;
|
||||
void setOwnerId(const std::string &ownerId);
|
||||
std::string getPaymentType() const;
|
||||
void setPaymentType(const std::string &paymentType);
|
||||
std::string getOrderType() const;
|
||||
void setOrderType(const std::string &orderType);
|
||||
|
||||
private:
|
||||
std::string orderSouce_;
|
||||
std::string commodity_;
|
||||
std::string clientToken_;
|
||||
std::string ownerId_;
|
||||
std::string paymentType_;
|
||||
std::string orderType_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace IntlMarket
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERREQUEST_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERRESULT_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/intlmarket/IntlMarketExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace IntlMarket
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_INTLMARKET_EXPORT CreateOrderResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
CreateOrderResult();
|
||||
explicit CreateOrderResult(const std::string &payload);
|
||||
~CreateOrderResult();
|
||||
std::vector<std::string> getInstanceIds()const;
|
||||
std::string getOrderId()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::vector<std::string> instanceIds_;
|
||||
std::string orderId_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_MODEL_CREATEORDERRESULT_H_
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICEREQUEST_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICEREQUEST_H_
|
||||
|
||||
#include <alibabacloud/intlmarket/IntlMarketExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace IntlMarket {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_INTLMARKET_EXPORT DescribePriceRequest : public RpcServiceRequest {
|
||||
public:
|
||||
DescribePriceRequest();
|
||||
~DescribePriceRequest();
|
||||
std::string getCommodity() const;
|
||||
void setCommodity(const std::string &commodity);
|
||||
std::string getOrderType() const;
|
||||
void setOrderType(const std::string &orderType);
|
||||
|
||||
private:
|
||||
std::string commodity_;
|
||||
std::string orderType_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace IntlMarket
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICEREQUEST_H_
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICERESULT_H_
|
||||
#define ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/intlmarket/IntlMarketExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace IntlMarket
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_INTLMARKET_EXPORT DescribePriceResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct PromotionRule
|
||||
{
|
||||
std::string ruleId;
|
||||
std::string title;
|
||||
std::string name;
|
||||
};
|
||||
struct Coupon
|
||||
{
|
||||
std::string couponOptionNo;
|
||||
std::string promotionDesc;
|
||||
std::string couponName;
|
||||
long canPromFee;
|
||||
std::string couponDesc;
|
||||
bool isSelected;
|
||||
std::string couponOptionCode;
|
||||
};
|
||||
|
||||
|
||||
DescribePriceResult();
|
||||
explicit DescribePriceResult(const std::string &payload);
|
||||
~DescribePriceResult();
|
||||
std::string getExpressionCode()const;
|
||||
float getOriginalPrice()const;
|
||||
std::string getMessage()const;
|
||||
std::string getProductCode()const;
|
||||
int getDuration()const;
|
||||
bool getCuxiao()const;
|
||||
float getTradePrice()const;
|
||||
std::string getCode()const;
|
||||
std::string getCycle()const;
|
||||
std::string getInfoTitle()const;
|
||||
std::vector<PromotionRule> getPromotionRules()const;
|
||||
float getDiscountPrice()const;
|
||||
std::string getCurrency()const;
|
||||
std::string getExpressionMessage()const;
|
||||
std::vector<Coupon> getCoupons()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string expressionCode_;
|
||||
float originalPrice_;
|
||||
std::string message_;
|
||||
std::string productCode_;
|
||||
int duration_;
|
||||
bool cuxiao_;
|
||||
float tradePrice_;
|
||||
std::string code_;
|
||||
std::string cycle_;
|
||||
std::string infoTitle_;
|
||||
std::vector<PromotionRule> promotionRules_;
|
||||
float discountPrice_;
|
||||
std::string currency_;
|
||||
std::string expressionMessage_;
|
||||
std::vector<Coupon> coupons_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_INTLMARKET_MODEL_DESCRIBEPRICERESULT_H_
|
||||
125
intlmarket/src/IntlMarketClient.cc
Normal file
125
intlmarket/src/IntlMarketClient.cc
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/intlmarket/IntlMarketClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::IntlMarket;
|
||||
using namespace AlibabaCloud::IntlMarket::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "IntlMarket";
|
||||
}
|
||||
|
||||
IntlMarketClient::IntlMarketClient(const Credentials &credentials, const ClientConfiguration &configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IntlMarketClient::IntlMarketClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IntlMarketClient::IntlMarketClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IntlMarketClient::~IntlMarketClient()
|
||||
{}
|
||||
|
||||
IntlMarketClient::CreateOrderOutcome IntlMarketClient::createOrder(const CreateOrderRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return CreateOrderOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return CreateOrderOutcome(CreateOrderResult(outcome.result()));
|
||||
else
|
||||
return CreateOrderOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IntlMarketClient::createOrderAsync(const CreateOrderRequest& request, const CreateOrderAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, createOrder(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IntlMarketClient::CreateOrderOutcomeCallable IntlMarketClient::createOrderCallable(const CreateOrderRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<CreateOrderOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->createOrder(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IntlMarketClient::DescribePriceOutcome IntlMarketClient::describePrice(const DescribePriceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return DescribePriceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return DescribePriceOutcome(DescribePriceResult(outcome.result()));
|
||||
else
|
||||
return DescribePriceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IntlMarketClient::describePriceAsync(const DescribePriceRequest& request, const DescribePriceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, describePrice(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IntlMarketClient::DescribePriceOutcomeCallable IntlMarketClient::describePriceCallable(const DescribePriceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<DescribePriceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->describePrice(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
81
intlmarket/src/model/CreateOrderRequest.cc
Normal file
81
intlmarket/src/model/CreateOrderRequest.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/intlmarket/model/CreateOrderRequest.h>
|
||||
|
||||
using AlibabaCloud::IntlMarket::Model::CreateOrderRequest;
|
||||
|
||||
CreateOrderRequest::CreateOrderRequest()
|
||||
: RpcServiceRequest("intlmarket", "2025-08-12", "CreateOrder") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
CreateOrderRequest::~CreateOrderRequest() {}
|
||||
|
||||
std::string CreateOrderRequest::getOrderSouce() const {
|
||||
return orderSouce_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setOrderSouce(const std::string &orderSouce) {
|
||||
orderSouce_ = orderSouce;
|
||||
setParameter(std::string("OrderSouce"), orderSouce);
|
||||
}
|
||||
|
||||
std::string CreateOrderRequest::getCommodity() const {
|
||||
return commodity_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setCommodity(const std::string &commodity) {
|
||||
commodity_ = commodity;
|
||||
setParameter(std::string("Commodity"), commodity);
|
||||
}
|
||||
|
||||
std::string CreateOrderRequest::getClientToken() const {
|
||||
return clientToken_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setClientToken(const std::string &clientToken) {
|
||||
clientToken_ = clientToken;
|
||||
setParameter(std::string("ClientToken"), clientToken);
|
||||
}
|
||||
|
||||
std::string CreateOrderRequest::getOwnerId() const {
|
||||
return ownerId_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setOwnerId(const std::string &ownerId) {
|
||||
ownerId_ = ownerId;
|
||||
setParameter(std::string("OwnerId"), ownerId);
|
||||
}
|
||||
|
||||
std::string CreateOrderRequest::getPaymentType() const {
|
||||
return paymentType_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setPaymentType(const std::string &paymentType) {
|
||||
paymentType_ = paymentType;
|
||||
setParameter(std::string("PaymentType"), paymentType);
|
||||
}
|
||||
|
||||
std::string CreateOrderRequest::getOrderType() const {
|
||||
return orderType_;
|
||||
}
|
||||
|
||||
void CreateOrderRequest::setOrderType(const std::string &orderType) {
|
||||
orderType_ = orderType;
|
||||
setParameter(std::string("OrderType"), orderType);
|
||||
}
|
||||
|
||||
59
intlmarket/src/model/CreateOrderResult.cc
Normal file
59
intlmarket/src/model/CreateOrderResult.cc
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/intlmarket/model/CreateOrderResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::IntlMarket;
|
||||
using namespace AlibabaCloud::IntlMarket::Model;
|
||||
|
||||
CreateOrderResult::CreateOrderResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
CreateOrderResult::CreateOrderResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
CreateOrderResult::~CreateOrderResult()
|
||||
{}
|
||||
|
||||
void CreateOrderResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allInstanceIds = value["InstanceIds"]["InstanceId"];
|
||||
for (const auto &item : allInstanceIds)
|
||||
instanceIds_.push_back(item.asString());
|
||||
if(!value["OrderId"].isNull())
|
||||
orderId_ = value["OrderId"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> CreateOrderResult::getInstanceIds()const
|
||||
{
|
||||
return instanceIds_;
|
||||
}
|
||||
|
||||
std::string CreateOrderResult::getOrderId()const
|
||||
{
|
||||
return orderId_;
|
||||
}
|
||||
|
||||
45
intlmarket/src/model/DescribePriceRequest.cc
Normal file
45
intlmarket/src/model/DescribePriceRequest.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/intlmarket/model/DescribePriceRequest.h>
|
||||
|
||||
using AlibabaCloud::IntlMarket::Model::DescribePriceRequest;
|
||||
|
||||
DescribePriceRequest::DescribePriceRequest()
|
||||
: RpcServiceRequest("intlmarket", "2025-08-12", "DescribePrice") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
DescribePriceRequest::~DescribePriceRequest() {}
|
||||
|
||||
std::string DescribePriceRequest::getCommodity() const {
|
||||
return commodity_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setCommodity(const std::string &commodity) {
|
||||
commodity_ = commodity;
|
||||
setParameter(std::string("Commodity"), commodity);
|
||||
}
|
||||
|
||||
std::string DescribePriceRequest::getOrderType() const {
|
||||
return orderType_;
|
||||
}
|
||||
|
||||
void DescribePriceRequest::setOrderType(const std::string &orderType) {
|
||||
orderType_ = orderType;
|
||||
setParameter(std::string("OrderType"), orderType);
|
||||
}
|
||||
|
||||
177
intlmarket/src/model/DescribePriceResult.cc
Normal file
177
intlmarket/src/model/DescribePriceResult.cc
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/intlmarket/model/DescribePriceResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::IntlMarket;
|
||||
using namespace AlibabaCloud::IntlMarket::Model;
|
||||
|
||||
DescribePriceResult::DescribePriceResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
DescribePriceResult::DescribePriceResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
DescribePriceResult::~DescribePriceResult()
|
||||
{}
|
||||
|
||||
void DescribePriceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allPromotionRulesNode = value["PromotionRules"]["PromotionRule"];
|
||||
for (auto valuePromotionRulesPromotionRule : allPromotionRulesNode)
|
||||
{
|
||||
PromotionRule promotionRulesObject;
|
||||
if(!valuePromotionRulesPromotionRule["RuleId"].isNull())
|
||||
promotionRulesObject.ruleId = valuePromotionRulesPromotionRule["RuleId"].asString();
|
||||
if(!valuePromotionRulesPromotionRule["Title"].isNull())
|
||||
promotionRulesObject.title = valuePromotionRulesPromotionRule["Title"].asString();
|
||||
if(!valuePromotionRulesPromotionRule["Name"].isNull())
|
||||
promotionRulesObject.name = valuePromotionRulesPromotionRule["Name"].asString();
|
||||
promotionRules_.push_back(promotionRulesObject);
|
||||
}
|
||||
auto allCouponsNode = value["Coupons"]["Coupon"];
|
||||
for (auto valueCouponsCoupon : allCouponsNode)
|
||||
{
|
||||
Coupon couponsObject;
|
||||
if(!valueCouponsCoupon["CouponOptionNo"].isNull())
|
||||
couponsObject.couponOptionNo = valueCouponsCoupon["CouponOptionNo"].asString();
|
||||
if(!valueCouponsCoupon["PromotionDesc"].isNull())
|
||||
couponsObject.promotionDesc = valueCouponsCoupon["PromotionDesc"].asString();
|
||||
if(!valueCouponsCoupon["CouponName"].isNull())
|
||||
couponsObject.couponName = valueCouponsCoupon["CouponName"].asString();
|
||||
if(!valueCouponsCoupon["CanPromFee"].isNull())
|
||||
couponsObject.canPromFee = std::stol(valueCouponsCoupon["CanPromFee"].asString());
|
||||
if(!valueCouponsCoupon["CouponDesc"].isNull())
|
||||
couponsObject.couponDesc = valueCouponsCoupon["CouponDesc"].asString();
|
||||
if(!valueCouponsCoupon["IsSelected"].isNull())
|
||||
couponsObject.isSelected = valueCouponsCoupon["IsSelected"].asString() == "true";
|
||||
if(!valueCouponsCoupon["CouponOptionCode"].isNull())
|
||||
couponsObject.couponOptionCode = valueCouponsCoupon["CouponOptionCode"].asString();
|
||||
coupons_.push_back(couponsObject);
|
||||
}
|
||||
if(!value["ExpressionCode"].isNull())
|
||||
expressionCode_ = value["ExpressionCode"].asString();
|
||||
if(!value["OriginalPrice"].isNull())
|
||||
originalPrice_ = std::stof(value["OriginalPrice"].asString());
|
||||
if(!value["ProductCode"].isNull())
|
||||
productCode_ = value["ProductCode"].asString();
|
||||
if(!value["Duration"].isNull())
|
||||
duration_ = std::stoi(value["Duration"].asString());
|
||||
if(!value["Cuxiao"].isNull())
|
||||
cuxiao_ = value["Cuxiao"].asString() == "true";
|
||||
if(!value["TradePrice"].isNull())
|
||||
tradePrice_ = std::stof(value["TradePrice"].asString());
|
||||
if(!value["Cycle"].isNull())
|
||||
cycle_ = value["Cycle"].asString();
|
||||
if(!value["InfoTitle"].isNull())
|
||||
infoTitle_ = value["InfoTitle"].asString();
|
||||
if(!value["DiscountPrice"].isNull())
|
||||
discountPrice_ = std::stof(value["DiscountPrice"].asString());
|
||||
if(!value["Currency"].isNull())
|
||||
currency_ = value["Currency"].asString();
|
||||
if(!value["ExpressionMessage"].isNull())
|
||||
expressionMessage_ = value["ExpressionMessage"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getExpressionCode()const
|
||||
{
|
||||
return expressionCode_;
|
||||
}
|
||||
|
||||
float DescribePriceResult::getOriginalPrice()const
|
||||
{
|
||||
return originalPrice_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getProductCode()const
|
||||
{
|
||||
return productCode_;
|
||||
}
|
||||
|
||||
int DescribePriceResult::getDuration()const
|
||||
{
|
||||
return duration_;
|
||||
}
|
||||
|
||||
bool DescribePriceResult::getCuxiao()const
|
||||
{
|
||||
return cuxiao_;
|
||||
}
|
||||
|
||||
float DescribePriceResult::getTradePrice()const
|
||||
{
|
||||
return tradePrice_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getCycle()const
|
||||
{
|
||||
return cycle_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getInfoTitle()const
|
||||
{
|
||||
return infoTitle_;
|
||||
}
|
||||
|
||||
std::vector<DescribePriceResult::PromotionRule> DescribePriceResult::getPromotionRules()const
|
||||
{
|
||||
return promotionRules_;
|
||||
}
|
||||
|
||||
float DescribePriceResult::getDiscountPrice()const
|
||||
{
|
||||
return discountPrice_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getCurrency()const
|
||||
{
|
||||
return currency_;
|
||||
}
|
||||
|
||||
std::string DescribePriceResult::getExpressionMessage()const
|
||||
{
|
||||
return expressionMessage_;
|
||||
}
|
||||
|
||||
std::vector<DescribePriceResult::Coupon> DescribePriceResult::getCoupons()const
|
||||
{
|
||||
return coupons_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user