summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interchange.cxx5
-rw-r--r--interchange.hxx12
-rw-r--r--ord.cxx4
3 files changed, 8 insertions, 13 deletions
diff --git a/interchange.cxx b/interchange.cxx
index 9833b1d..2daba1e 100644
--- a/interchange.cxx
+++ b/interchange.cxx
@@ -82,12 +82,9 @@ namespace QInterchange {
emit gotOrder(response);
}
- void Interchange::order(QString const& sku, Catalog const& catalog,
- Ord& order)
+ void Interchange::order(QString const& sku)
{
- auto data = order.data();
interchange_ord_order(sku.toLatin1().constData(),
- catalog.constData(), &data,
[](interchange_response* response) {
interchange->emitOrder(QString{response->data});
interchange_free_response(response);
diff --git a/interchange.hxx b/interchange.hxx
index 8a4dfc3..b8b36d5 100644
--- a/interchange.hxx
+++ b/interchange.hxx
@@ -28,13 +28,6 @@ namespace QInterchange {
* \brief Destructor.
*/
~Interchange();
- /*!
- * \brief For putting an item to a cart.
- * \param sku The SKU of the item to order.
- * \param catalog The catalog from which the item is.
- * \param order The order.
- */
- void order(QString const& sku, Catalog const& catalog, Ord& order);
public slots:
/*!
@@ -65,6 +58,11 @@ namespace QInterchange {
* \brief For fetching data about all active products.
*/
void defaultAllProducts();
+ /*!
+ * \brief For putting an item to a cart.
+ * \param sku The SKU of the item to order.
+ */
+ void order(QString const& sku);
signals:
void gotCatalog(QString const& response);
diff --git a/ord.cxx b/ord.cxx
index f1cfcac..9d27432 100644
--- a/ord.cxx
+++ b/ord.cxx
@@ -15,12 +15,12 @@ namespace QInterchange {
m_totalCost{.0}
{
ord = this;
- if (order) return;
+ if (!order) return;
for (size_t i = 0; i < order->nitems; i++)
addItem(Item{order->items[i]});
m_subtotal = order->subtotal;
m_totalCost = order->total_cost;
- this->m_data = order;
+ m_data = order;
}
Ord::~Ord()