We have request to create custom REST webservice for creating gift orders and we are successfully able to create order for single item but facing issues on taking multi items as input.
Can anyone help please?
We have created below files to handle
CreateOrderInterface
interface CreateOrderInterface { /** * @param string $giftCardCode * @return boolean; * @throws \Exception */ public function checkGiftCard($giftCardCode); /** * @param XYZ\GiftCard\Api\JsondataInterface $orderData * @param XYZ\GiftCard\Api\AddressdataInterface $customerAddress * @param XYZ\GiftCard\Api\BillingdataInterface $billingAddress * @param XYZ\GiftCard\Api\ShippingdataInterface $shippingAddress * @param XYZ\GiftCard\Api\ItemsdataInterface $items * @return string; * @throws \Exception */ public function createOrder($orderData, $customerAddress,$billingAddress,$shippingAddress,$items); }
createOrder Model
class createOrder { /** * @param \XYZ\GiftCard\Api\Kensium\GiftCard\Api\JsondataInterface $jsonOrderData * @param \XYZ\GiftCard\Api\Kensium\GiftCard\Api\AddressdataInterface $customerAddress * @param \XYZ\GiftCard\Api\Kensium\GiftCard\Api\BillingdataInterface $billingAddress * @param \XYZ\GiftCard\Api\Kensium\GiftCard\Api\ShippingdataInterface $shippingAddress * @param \XYZ\GiftCard\Api\Kensium\GiftCard\Api\ItemsdataInterface $items * @return array|string * @throws \Exception * @throws \Magento\Framework\Exception\LocalizedException * @throws bool */ public function createOrder($jsonOrderData, $customerAddress, $billingAddress, $shippingAddress,$items) { $invalidType = array(); $invalidSku = array(); $invalidAmount = array(); print_r($jsonOrderData->getItems());die; } }