summaryrefslogtreecommitdiff
path: root/ord.cxx
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-12 17:46:34 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-12 17:46:34 +0800
commitf70a1a57d83e4f50a7221d13b173a156ef0eb6cf (patch)
treeb2dc619e44eee4a1328cca2abb5a926cc7f55666 /ord.cxx
parent628fbf1304bff4de9be752d2f4be77d58a5ab689 (diff)
Checkout needs only profile from order
Diffstat (limited to 'ord.cxx')
-rw-r--r--ord.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/ord.cxx b/ord.cxx
index 9d27432..f7e2161 100644
--- a/ord.cxx
+++ b/ord.cxx
@@ -6,6 +6,7 @@
namespace QInterchange {
static Ord* ord;
+ static char* order_profile;
Ord::Ord(struct interchange_ord_order *order, QObject* parent) :
QAbstractListModel{parent},
@@ -89,16 +90,16 @@ namespace QInterchange {
void Ord::setProfile(QString const& profile)
{
- auto orderProfile = profile.toLatin1().data();
- if (m_data->profile) free(m_data->profile);
- m_data->profile = (char*)malloc(strlen(orderProfile) + 1);
- strcpy(m_data->profile, orderProfile);
+ if (this->profile != profile) this->profile = profile;
}
void Ord::checkout(Member& member)
{
- interchange_ord_checkout(m_data, member.data(),
+ order_profile = (char*)malloc(profile.size() + 1);
+ strcpy(order_profile, profile.toLatin1().constData());
+ interchange_ord_checkout(order_profile, member.data(),
[](interchange_response* response) {
+ free(order_profile);
ord->emitTransaction(QString{response->data});
interchange_free_response(response);
});