diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-12 11:08:10 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-12 11:59:14 +0800 |
commit | 6ea1859f82fdde343be5d7d649d40e43223395e3 (patch) | |
tree | 0d64bffaf48878425241442dd68cab2d2de4f076 | |
parent | 82f3e8426f4092831d25a97e05a91ce3663bc3c6 (diff) |
Order now takes only SKU
-rw-r--r-- | interchange.cxx | 5 | ||||
-rw-r--r-- | interchange.hxx | 12 | ||||
-rw-r--r-- | ord.cxx | 4 |
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); @@ -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() |