|
|
@@ -375,7 +375,21 @@ function formatOrderAsPlainText(o: any): string {
|
|
|
text += `\nStatus: ${statusText}`;
|
|
|
|
|
|
const currency = o.currency?.code || o.currency || '';
|
|
|
- text += `\nTotal: ${o.total || '0'}${currency ? ' ' + currency : ''}`;
|
|
|
+
|
|
|
+ // Add order totals breakdown if available
|
|
|
+ const orderTotals = o.orderTotals || [];
|
|
|
+ if (orderTotals.length > 0) {
|
|
|
+ text += '\nOrder Totals:';
|
|
|
+ for (const total of orderTotals) {
|
|
|
+ // Skip loyalty points and other non-monetary totals
|
|
|
+ if (total.type === 'LOYALTYPOINTS_TO_GET') continue;
|
|
|
+ const name = total.name?.replace(/:$/, '') || total.type || 'Unknown';
|
|
|
+ const valueText = total.valueText || `${total.value}${currency ? ' ' + currency : ''}`;
|
|
|
+ text += `\n - ${name}: ${valueText}`;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ text += `\nTotal: ${o.total || '0'}${currency ? ' ' + currency : ''}`;
|
|
|
+ }
|
|
|
|
|
|
const items = o.orderProducts || o.items || [];
|
|
|
if (items.length > 0) {
|