I've create a plugin to listen to api POST /V1/order/:orderId/refund
and I would like to receive custom field. I've added a field for testing like: name:['test']
Body
E.G:
{
"items": [
{
"extension_attributes": {},
"order_item_id": 7,
"qty": 1
}
],
"isOnline": false,
"notify": true,
"appendComment": true,
"name": [
{
"test": "ok"
}
], //THIS IS MY CUSTOM FIELD
"comment": {
"extension_attributes": {},
"comment": "refund has been created",
"is_visible_on_front": 0
},
"arguments": {
"shipping_amount": 0,
"adjustment_positive": 0,
"adjustment_negative": 0,
"extension_attributes": {
"return_to_stock_items": []
}
}
}
beforeExecute
Method:
...
/**
* Create refund for invoice
*
* @param int $invoiceId
* @param \Magento\Sales\Api\Data\CreditmemoItemCreationInterface[] $items
* @param bool|null $isOnline
* @param bool|null $notify
* @param bool|null $appendComment
* @param \Magento\Sales\Api\Data\CreditmemoCommentCreationInterface|null $comment
* @param \Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface|null $arguments
* @param mixed $name
* @return int
* @since 100.1.3
*/
public function beforeExecute (
\Magento\Sales\Model\RefundOrder $subject,
$orderId,
array $items = [],
$notify = false,
$appendComment = false,
\Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null,
\Magento\Sales\Api\Data\CreditmemoCreationArgumentsInterface $arguments = null,
array $name = []
) {
print_r($name);die;
}
...
My custom field name
is an array similar to items
: but I am receiving an empty array from Response
:
Anyone any help Appreciated!