Skip to content
Snippets Groups Projects
Commit 74a0289c authored by meskio's avatar meskio :tent:
Browse files

On order purchase update the actuall transaction from the backend

parent 4ce58eb5
Branches
Tags
No related merge requests found
......@@ -52,8 +52,8 @@ class PurchaseOrder extends React.Component {
});
}
onSuccess() {
this.props.onSend(this.state.order, this.state.total);
onSuccess(transaction) {
this.props.onSend(transaction);
this.setState({ noMoney: false });
}
......
......@@ -86,15 +86,6 @@ class ShowOrder extends React.Component {
};
}
onSend(purchase, total) {
const order_purchase = purchase.map((p) => {
p.product = p;
return p;
});
const transaction = { order_purchase, total: -total };
this.setState({ transaction });
}
showTransaction() {
if (this.state.order.active) {
return (
......@@ -103,7 +94,7 @@ class ShowOrder extends React.Component {
purchase={
this.state.transaction && this.state.transaction.order_purchase
}
onSend={(p, t) => this.onSend(p, t)}
onSend={(t) => this.onSend(t)}
/>
);
}
......@@ -117,6 +108,10 @@ class ShowOrder extends React.Component {
}
}
onSend(transaction) {
this.setState({ transaction });
}
setData(data) {
this.setState({ order: data.order, transaction: data.transaction });
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment