Skip to content

Commit 7ddaa90

Browse files
committed
fix: allow shopinbit car request status updates
1 parent c6b313b commit 7ddaa90

1 file changed

Lines changed: 30 additions & 35 deletions

File tree

lib/pages/shopinbit/shopinbit_ticket_detail.dart

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,44 +68,39 @@ class _ShopInBitTicketDetailState extends State<ShopInBitTicketDetail> {
6868
final client = ShopInBitService.instance.client;
6969
final id = widget.model.apiTicketId;
7070

71-
// Car research tickets created via /car-research/log-payment are not
72-
// accessible via /tickets/:id/* endpoints (API returns 403). Skip
73-
// those calls for car tickets to avoid log spam. Local data is used.
74-
if (!_isCarResearch) {
75-
final messagesResp = await client.getMessages(id);
76-
final statusResp = await client.getTicketStatus(id);
77-
78-
if (!messagesResp.hasError && messagesResp.value != null) {
79-
final apiMessages = messagesResp.value!;
80-
widget.model.clearMessages();
81-
for (final m in apiMessages) {
82-
widget.model.addMessage(
83-
ShopInBitMessage(
84-
text: m.content,
85-
timestamp: m.timestamp,
86-
isFromUser: !m.fromAgent,
87-
),
88-
);
89-
}
90-
}
91-
92-
if (!statusResp.hasError && statusResp.value != null) {
93-
widget.model.status = ShopInBitOrderModel.statusFromTicketState(
94-
statusResp.value!.state,
71+
final messagesResp = await client.getMessages(id);
72+
final statusResp = await client.getTicketStatus(id);
73+
74+
if (!messagesResp.hasError && messagesResp.value != null) {
75+
final apiMessages = messagesResp.value!;
76+
widget.model.clearMessages();
77+
for (final m in apiMessages) {
78+
widget.model.addMessage(
79+
ShopInBitMessage(
80+
text: m.content,
81+
timestamp: m.timestamp,
82+
isFromUser: !m.fromAgent,
83+
),
9584
);
9685
}
86+
}
9787

98-
if (widget.model.status == ShopInBitOrderStatus.offerAvailable &&
99-
(widget.model.offerProductName == null ||
100-
widget.model.offerPrice == null)) {
101-
final offerResp = await client.getTicketFull(id);
102-
if (!offerResp.hasError && offerResp.value != null) {
103-
final t = offerResp.value!;
104-
widget.model.setOffer(
105-
productName: t.productName,
106-
price: t.customerPrice,
107-
);
108-
}
88+
if (!statusResp.hasError && statusResp.value != null) {
89+
widget.model.status = ShopInBitOrderModel.statusFromTicketState(
90+
statusResp.value!.state,
91+
);
92+
}
93+
94+
if (widget.model.status == ShopInBitOrderStatus.offerAvailable &&
95+
(widget.model.offerProductName == null ||
96+
widget.model.offerPrice == null)) {
97+
final offerResp = await client.getTicketFull(id);
98+
if (!offerResp.hasError && offerResp.value != null) {
99+
final t = offerResp.value!;
100+
widget.model.setOffer(
101+
productName: t.productName,
102+
price: t.customerPrice,
103+
);
109104
}
110105
}
111106

0 commit comments

Comments
 (0)