|
@@ -19,6 +19,7 @@ use Webkul\BagistoApi\Admin\Models\AdminOrderDetailInvoice;
|
|
|
use Webkul\BagistoApi\Admin\Models\AdminOrderItemPreview;
|
|
use Webkul\BagistoApi\Admin\Models\AdminOrderItemPreview;
|
|
|
use Webkul\BagistoApi\Admin\State\Concerns\ResolvesAdminDateRange;
|
|
use Webkul\BagistoApi\Admin\State\Concerns\ResolvesAdminDateRange;
|
|
|
use Webkul\BagistoApi\Exception\AuthenticationException;
|
|
use Webkul\BagistoApi\Exception\AuthenticationException;
|
|
|
|
|
+use Webkul\Payment\Payment;
|
|
|
use Webkul\Sales\Models\Order;
|
|
use Webkul\Sales\Models\Order;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -213,6 +214,7 @@ class OrderCollectionProvider implements ProviderInterface
|
|
|
'customer_email' => $order->customer_email,
|
|
'customer_email' => $order->customer_email,
|
|
|
'customer_name' => trim($order->customer_first_name.' '.$order->customer_last_name),
|
|
'customer_name' => trim($order->customer_first_name.' '.$order->customer_last_name),
|
|
|
'payment_title' => $this->paymentTitle($order),
|
|
'payment_title' => $this->paymentTitle($order),
|
|
|
|
|
+ 'additional_details' => $this->additionalDetails($order),
|
|
|
'coupon_code' => $order->coupon_code,
|
|
'coupon_code' => $order->coupon_code,
|
|
|
'total_item_count' => $order->total_item_count,
|
|
'total_item_count' => $order->total_item_count,
|
|
|
'total_qty_ordered' => (int) $order->total_qty_ordered,
|
|
'total_qty_ordered' => (int) $order->total_qty_ordered,
|
|
@@ -276,6 +278,7 @@ class OrderCollectionProvider implements ProviderInterface
|
|
|
$row->customer_email = $order->customer_email;
|
|
$row->customer_email = $order->customer_email;
|
|
|
$row->customer_name = trim($order->customer_first_name.' '.$order->customer_last_name);
|
|
$row->customer_name = trim($order->customer_first_name.' '.$order->customer_last_name);
|
|
|
$row->payment_title = $this->paymentTitle($order);
|
|
$row->payment_title = $this->paymentTitle($order);
|
|
|
|
|
+ $row->additional_details = $this->additionalDetails($order);
|
|
|
$row->coupon_code = $order->coupon_code;
|
|
$row->coupon_code = $order->coupon_code;
|
|
|
$row->total_item_count = $order->total_item_count;
|
|
$row->total_item_count = $order->total_item_count;
|
|
|
$row->total_qty_ordered = (int) $order->total_qty_ordered;
|
|
$row->total_qty_ordered = (int) $order->total_qty_ordered;
|
|
@@ -577,6 +580,39 @@ class OrderCollectionProvider implements ProviderInterface
|
|
|
return $notesByCustomer[$customerId] ?? [];
|
|
return $notesByCustomer[$customerId] ?? [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Payment-method instructions plus the order payment's stored additional
|
|
|
|
|
+ * payload (`order_payment.additional`: transaction id, PayPal payer, …).
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return array<string, mixed>
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function additionalDetails(Order $order): array
|
|
|
|
|
+ {
|
|
|
|
|
+ $payment = $order->payment;
|
|
|
|
|
+ $method = $payment?->method;
|
|
|
|
|
+ $details = [];
|
|
|
|
|
+
|
|
|
|
|
+ if ($method) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $fromMethod = Payment::getAdditionalDetails($method);
|
|
|
|
|
+ } catch (\Throwable) {
|
|
|
|
|
+ $fromMethod = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (is_array($fromMethod)) {
|
|
|
|
|
+ $details = $fromMethod;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $stored = $payment?->additional;
|
|
|
|
|
+
|
|
|
|
|
+ if (is_array($stored) && $stored !== []) {
|
|
|
|
|
+ $details['additional'] = $stored;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $details;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Resolve the payment-method display title from core config.
|
|
* Resolve the payment-method display title from core config.
|
|
|
*/
|
|
*/
|