Skip to content

Commit

Permalink
#9 add dispute
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Aug 15, 2024
1 parent 9cf47da commit 943c184
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Docs/V1/Admin/Models/Sales/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,18 @@ class Order
*/
private $shipments;

/**
* @OA\Property(
* title="Dispute",
* description="Order's dispute",
* type="array",
* @OA\Items(ref="#/components/schemas/Dispute")
* )
* @var array
*/

private $dispute;

/**
* @OA\Property(
* title="Created at",
Expand Down
6 changes: 6 additions & 0 deletions src/Http/Resources/Api/V1/Admin/Sales/DisputeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DisputeResource extends JsonResource
*/
public function toArray($request)
{

return [
'id' => $this->id,
'order_id' => $this->order_id,
Expand Down Expand Up @@ -85,4 +86,9 @@ public function toArray($request)
// 'dispute_refund_transaction_payment_transaction_amount' => $this->refund_transaction_payment_transaction_amount,
];
}

// public static function collects($resource)
// {
// return get_class($resource) === 'Webkul\Sales\Models\OrderDispute' ? self::class : parent::collects($resource);
// }
}
3 changes: 2 additions & 1 deletion src/Http/Resources/Api/V1/Admin/Sales/OrderResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function toArray($request)
'items' => OrderItemResource::collection($this->items),
'invoices' => InvoiceResource::collection($this->invoices),
'shipments' => ShipmentResource::collection($this->shipments),
'disputes' => DisputeResource::collection($this->disputes),
//'dispute' => $this->when($this->dispute, new DisputeResource($this->dispute)),
'dispute' => $this->dispute,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
];
Expand Down

0 comments on commit 943c184

Please sign in to comment.