summaryrefslogtreecommitdiff
path: root/ord.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'ord.cxx')
-rw-r--r--ord.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/ord.cxx b/ord.cxx
index 35b496c..4b3577b 100644
--- a/ord.cxx
+++ b/ord.cxx
@@ -1,9 +1,22 @@
#include <algorithm>
#include <memory>
+#include "interchange.hxx"
#include "interchange/ord.hxx"
namespace QInterchange {
+ static Ord* ord;
+
+ Ord::Ord(QObject* parent) :
+ QAbstractListModel{parent},
+ m_data{nullptr},
+ m_subtotal{.0},
+ m_shipping{.0},
+ m_totalCost{.0}
+ {
+ ord = this;
+ }
+
int Ord::rowCount(QModelIndex const& parent) const
{
Q_UNUSED(parent)
@@ -81,6 +94,15 @@ namespace QInterchange {
void Ord::checkout(Member& member)
{
- interchange_ord_checkout(m_data, member.data());
+ interchange_ord_checkout(m_data, member.data(),
+ [](interchange_response* response) {
+ ord->emitTransaction(QString{response->data});
+ interchange_free_response(response);
+ });
+ }
+
+ void Ord::emitTransaction(QString const& response)
+ {
+ emit gotTransaction(response);
}
}