diff --git a/src/Docs/Shop/Controllers/Catalog/CategoryController.php b/src/Docs/Shop/Controllers/Catalog/CategoryController.php index ba340c0c..bcb67990 100755 --- a/src/Docs/Shop/Controllers/Catalog/CategoryController.php +++ b/src/Docs/Shop/Controllers/Catalog/CategoryController.php @@ -163,8 +163,8 @@ public function get() * * @OA\Property( * property="data", - * type="object", - * ref="#/components/schemas/Category" + * type="array", + * * @OA\Items(ref="#/components/schemas/Category") * ) * ) * ), diff --git a/src/Docs/Shop/Controllers/Catalog/ProductController.php b/src/Docs/Shop/Controllers/Catalog/ProductController.php index f8ad518d..5d609a10 100755 --- a/src/Docs/Shop/Controllers/Catalog/ProductController.php +++ b/src/Docs/Shop/Controllers/Catalog/ProductController.php @@ -372,7 +372,7 @@ public function configurableConfig() * @OA\Property( * property="attachments[]", * type="array", - * @OA\Items(type="file"), + * @OA\Items(type="string", format="binary"), * description="Array of attachment files (images or videos)" * ), * required={"comment", "rating", "title"} diff --git a/src/Docs/Shop/Controllers/Core/CountryController.php b/src/Docs/Shop/Controllers/Core/CountryController.php index 0dd73ddb..94e2a77e 100755 --- a/src/Docs/Shop/Controllers/Core/CountryController.php +++ b/src/Docs/Shop/Controllers/Core/CountryController.php @@ -197,11 +197,10 @@ public function get() * description="Successful operation", * * @OA\JsonContent( - * * @OA\Property( * property="data", - * type="object", - * ref="#/components/schemas/CountryState" + * type="array", + * @OA\Items(ref="#/components/schemas/CountryState") * ) * ) * ), @@ -232,8 +231,8 @@ public function states() * * @OA\Property( * property="data", - * type="object", - * ref="#/components/schemas/CountryState" + * type="array", + * @OA\Items(ref="#/components/schemas/CountryState") * ) * ) * ), diff --git a/src/Docs/Shop/Controllers/Customer/CheckoutController.php b/src/Docs/Shop/Controllers/Customer/CheckoutController.php index d975549c..5a381819 100755 --- a/src/Docs/Shop/Controllers/Customer/CheckoutController.php +++ b/src/Docs/Shop/Controllers/Customer/CheckoutController.php @@ -22,7 +22,7 @@ class CheckoutController * * @OA\Property( * property="billing", - * type="array", + * type="object", * description="", * example={ * "id": 14, @@ -36,32 +36,26 @@ class CheckoutController * "city": "Marrero", * "state": "LA", * "country": "US", - * "postcode": 70072, + * "postcode": "70072", * "phone": 9871234560 * }, - * - * @OA\Items( - * - * @OA\Property(property="id", type="integer"), - * @OA\Property(property="address", type="array", @OA\Items( - * @OA\Property(type="string") - * )), - * @OA\Property(property="save_as_address", type="boolean"), - * @OA\Property(property="use_for_shipping", type="boolean"), - * @OA\Property(property="first_name", type="string"), - * @OA\Property(property="last_name", type="string"), - * @OA\Property(property="email", type="string"), - * @OA\Property(property="company_name", type="string"), - * @OA\Property(property="city", type="string"), - * @OA\Property(property="state", type="string"), - * @OA\Property(property="country", type="string"), - * @OA\Property(property="postcode", type="integer"), - * @OA\Property(property="phone", type="integer") - * ) + * @OA\Property(property="id", type="integer"), + * @OA\Property(property="address", type="array", @OA\Items(@OA\Property(type="string"))), + * @OA\Property(property="save_as_address", type="boolean"), + * @OA\Property(property="use_for_shipping", type="boolean"), + * @OA\Property(property="first_name", type="string"), + * @OA\Property(property="last_name", type="string"), + * @OA\Property(property="email", type="string"), + * @OA\Property(property="company_name", type="string"), + * @OA\Property(property="city", type="string"), + * @OA\Property(property="state", type="string"), + * @OA\Property(property="country", type="string"), + * @OA\Property(property="postcode", type="string"), + * @OA\Property(property="phone", type="integer") * ), * @OA\Property( * property="shipping", - * type="array", + * type="object", * description="", * example={ * "id": null, @@ -74,27 +68,23 @@ class CheckoutController * "city": "Mansfield", * "state": "OH", * "country": "US", - * "postcode": 44907, + * "postcode": "44907", * "phone": 987654321 * }, - * - * @OA\Items( - * - * @OA\Property(property="id", type="integer"), - * @OA\Property(property="address", type="array", @OA\Items( - * @OA\Property(type="string") - * )), - * @OA\Property(property="save_as_address", type="boolean"), - * @OA\Property(property="first_name", type="string"), - * @OA\Property(property="last_name", type="string"), - * @OA\Property(property="email", type="string"), - * @OA\Property(property="company_name", type="string"), - * @OA\Property(property="city", type="string"), - * @OA\Property(property="state", type="string"), - * @OA\Property(property="country", type="string"), - * @OA\Property(property="postcode", type="integer"), - * @OA\Property(property="phone", type="integer") - * ) + * @OA\Property(property="id", type="integer"), + * @OA\Property(property="address", type="array", @OA\Items( + * @OA\Property(type="string") + * )), + * @OA\Property(property="save_as_address", type="boolean"), + * @OA\Property(property="first_name", type="string"), + * @OA\Property(property="last_name", type="string"), + * @OA\Property(property="email", type="string"), + * @OA\Property(property="company_name", type="string"), + * @OA\Property(property="city", type="string"), + * @OA\Property(property="state", type="string"), + * @OA\Property(property="country", type="string"), + * @OA\Property(property="postcode", type="string"), + * @OA\Property(property="phone", type="integer") * ), * required={"billing"} * ) @@ -246,15 +236,8 @@ public function saveShipping() * * @OA\Property( * property="payment", - * type="array", - * example={ - * "method": "cashondelivery" - * }, - * - * @OA\Items( - * - * @OA\Property(property="method", type="string") - * ) + * type="object", + * @OA\Property(property="method", type="string", example="cashondelivery"), * ), * required={"payment"} * ) diff --git a/src/Docs/Shop/Controllers/Customer/WishlistController.php b/src/Docs/Shop/Controllers/Customer/WishlistController.php index d88fa48c..df93998f 100755 --- a/src/Docs/Shop/Controllers/Customer/WishlistController.php +++ b/src/Docs/Shop/Controllers/Customer/WishlistController.php @@ -21,8 +21,23 @@ class WishlistController * * @OA\Property( * property="data", - * type="object", - * ref="#/components/schemas/Wishlist" + * type="array", + * @OA\Items( + * @OA\Property(property="id", type="integer"), + * @OA\Property(property="product", type="object", ref="#/components/schemas/Product"), + * @OA\Property( + * property="created_at", + * example="2020-01-27 17:50:45", + * format="datetime", + * type="string" + * ), + * @OA\Property( + * property="updated_at", + * example="2020-01-27 17:50:45", + * format="datetime", + * type="string" + * ) + * ) * ) * ) * ), @@ -67,14 +82,14 @@ public function get() * mediaType="application/json", * * @OA\Schema( - * + * required={"product_id"}, + * @OA\Property(property="product_id", type="integer", example=1), * @OA\Property( * property="additional", * type="array", * example={ * "selected_configurable_option": 2, * "quantity": 1, - * "product_id": 1, * "super_attribute": { * "attribute_id_1": "attribute_option_id_1", * "attribute_id_2": "attribute_option_id_2" @@ -88,10 +103,8 @@ public function get() * type="array", * * @OA\Items( - * * @OA\Property(property="selected_configurable_option", type="integer"), * @OA\Property(property="quantity", type="integer"), - * @OA\Property(property="product_id", type="integer"), * @OA\Property( * property="super_attribute", * type="array", @@ -153,6 +166,15 @@ public function store() * ) * ), * + * @OA\RequestBody( + * @OA\MediaType( + * mediaType="application/json", + * @OA\Schema( + * @OA\Property(property="quantity", type="integer", example=1, nullable=true) + * ) + * ) + * ), + * * @OA\Response( * response=200, * description="Successful operation", diff --git a/src/Docs/Shop/Models/Catalog/Attribute.php b/src/Docs/Shop/Models/Catalog/Attribute.php index d61033ce..20127873 100755 --- a/src/Docs/Shop/Models/Catalog/Attribute.php +++ b/src/Docs/Shop/Models/Catalog/Attribute.php @@ -82,10 +82,12 @@ class Attribute /** * @OA\Property( * title="Options", - * description="Attribute's options" + * description="Attribute's options", + * type="array", + * @OA\Items(ref="#/components/schemas/AttributeOption") * ) * - * @var \Webkul\RestApi\Docs\Shop\Models\Catalog\AttributeOption + * @var \Webkul\RestApi\Docs\Shop\Models\Catalog\AttributeOption[] */ public $options; diff --git a/src/Docs/Shop/Models/Catalog/AttributeFamily.php b/src/Docs/Shop/Models/Catalog/AttributeFamily.php index 314e12f8..87641b38 100755 --- a/src/Docs/Shop/Models/Catalog/AttributeFamily.php +++ b/src/Docs/Shop/Models/Catalog/AttributeFamily.php @@ -59,7 +59,9 @@ class AttributeFamily /** * @OA\Property( * title="Groups", - * description="Attribute's groups" + * description="Attribute's groups", + * type="array", + * @OA\Items(ref="#/components/schemas/AttributeGroup") * ) * * @var \Webkul\RestApi\Docs\Shop\Models\Catalog\AttributeGroup diff --git a/src/Docs/Shop/Models/Catalog/AttributeGroup.php b/src/Docs/Shop/Models/Catalog/AttributeGroup.php index d527c898..c493e78d 100755 --- a/src/Docs/Shop/Models/Catalog/AttributeGroup.php +++ b/src/Docs/Shop/Models/Catalog/AttributeGroup.php @@ -58,7 +58,9 @@ class AttributeGroup /** * @OA\Property( * title="Attributes", - * description="Attributes" + * description="Attributes", + * type="array", + * @OA\Items(ref="#/components/schemas/Attribute") * ) * * @var \Webkul\RestApi\Docs\Shop\Models\Catalog\Attribute diff --git a/src/Docs/Shop/Models/Catalog/Product.php b/src/Docs/Shop/Models/Catalog/Product.php index 8be8669c..250f1d06 100755 --- a/src/Docs/Shop/Models/Catalog/Product.php +++ b/src/Docs/Shop/Models/Catalog/Product.php @@ -70,10 +70,11 @@ class Product * @OA\Property( * title="Price", * description="Product price", - * example=12.20 + * example="12.20", + * type="string" * ) * - * @var float + * @var string */ public $price; @@ -81,7 +82,8 @@ class Product * @OA\Property( * title="Formatted Price", * description="Product's formatted price", - * example="$12.20" + * example="$12.20", + * type="string" * ) * * @var string @@ -113,7 +115,9 @@ class Product /** * @OA\Property( * title="Images", - * description="Product's images" + * description="Product's images", + * type="array", + * @OA\Items(ref="#/components/schemas/ProductImage") * ) * * @var \Webkul\RestApi\Docs\Shop\Models\Catalog\ProductImage @@ -287,10 +291,11 @@ class Product * @OA\Property( * title="Special Price", * description="Product's special price, Only use if special_price is applied to product", - * example=8.00 + * example="8.00", + * type="string" * ) * - * @var float + * @var string */ public $special_price; @@ -298,7 +303,8 @@ class Product * @OA\Property( * title="Formatted Special Price", * description="Product's formatted special price, Only use if special_price is applied to product", - * example="$8.00" + * example="$8.00", + * type="string" * ) * * @var string @@ -309,10 +315,11 @@ class Product * @OA\Property( * title="Regular Price", * description="Product's regular price", - * example=12.20 + * example="12.20", + * type="string" * ) * - * @var float + * @var string */ public $regular_price; @@ -320,7 +327,8 @@ class Product * @OA\Property( * title="Formatted Regular Price", * description="Product's formatted regular price", - * example="$12.20" + * example="$12.20", + * type="string" * ) * * @var string diff --git a/src/Docs/Shop/Models/Catalog/ProductConfigurableConfig.php b/src/Docs/Shop/Models/Catalog/ProductConfigurableConfig.php index 3b5e4322..cb20d7fc 100755 --- a/src/Docs/Shop/Models/Catalog/ProductConfigurableConfig.php +++ b/src/Docs/Shop/Models/Catalog/ProductConfigurableConfig.php @@ -198,13 +198,13 @@ class ProductConfigurableConfig * @OA\Property( * property="regular_price", * type="object", - * @OA\Property(property="price", type="integer", example=60.00), + * @OA\Property(property="price", type="string", example="60.00"), * @OA\Property(property="formated_price", type="string", example="$60.00") * ), * @OA\Property( * property="final_price", * type="object", - * @OA\Property(property="price", type="integer", example=60.00), + * @OA\Property(property="price", type="string", example="60.00"), * @OA\Property(property="formated_price", type="string", example="$60.00") * ) * ) @@ -301,7 +301,7 @@ class ProductConfigurableConfig * "price": 30 * }, * @OA\Property(property="formated_price", type="string", example="$30.00"), - * @OA\Property(property="price", type="float", example=30.00) + * @OA\Property(property="price", type="string", example="30.00") * ) * * @var object diff --git a/src/Docs/Shop/Models/Catalog/ProductImage.php b/src/Docs/Shop/Models/Catalog/ProductImage.php index d323de1e..a17af7d2 100755 --- a/src/Docs/Shop/Models/Catalog/ProductImage.php +++ b/src/Docs/Shop/Models/Catalog/ProductImage.php @@ -22,17 +22,6 @@ class ProductImage */ public $id; - /** - * @OA\Property( - * title="Type", - * description="Image type", - * enum={"images"} - * ) - * - * @var string - */ - protected $type; - /** * @OA\Property( * title="Path", @@ -98,28 +87,4 @@ class ProductImage * @var string */ protected $large_image_url; - - /** - * @OA\Property( - * title="Product ID", - * description="Product ID", - * format="int64", - * example=1 - * ) - * - * @var int - */ - public $product_id; - - /** - * @OA\Property( - * title="Position", - * description="Image position", - * format="int64", - * example=0 - * ) - * - * @var int - */ - public $position; } diff --git a/src/Docs/Shop/Models/Core/Theme.php b/src/Docs/Shop/Models/Core/Theme.php index 27e1aa98..20284000 100644 --- a/src/Docs/Shop/Models/Core/Theme.php +++ b/src/Docs/Shop/Models/Core/Theme.php @@ -22,6 +22,18 @@ class Theme */ public $id; + /** + * @OA\Property( + * title="Theme code", + * description="Theme code", + * type="string", + * example="default" + * ) + * + * @var string + */ + public $theme_code; + /** * @OA\Property( * title="channel_id", @@ -39,7 +51,8 @@ class Theme * title="type", * description="type", * example="image_carousel", - * type="string" + * type="string", + * enum={"image_carousel", "static_content", "category_carousel", "product_carousel", "footer_links", "services_content"} * ) * * @var string @@ -107,4 +120,101 @@ class Theme * @var int */ public $sort_order; + + /** + * @OA\Property( + * title="Options", + * description="Variable structure depending on theme type", + * additionalProperties=true, + * type="object", + * oneOf={ + * @OA\Schema( + * title="Image Carousel Options", + * @OA\Property( + * property="images", + * type="array", + * @OA\Items( + * @OA\Property(property="link", type="string"), + * @OA\Property(property="image", type="string"), + * @OA\Property(property="title", type="string") + * ) + * ) + * ), + * @OA\Schema( + * title="Static Content Options", + * @OA\Property(property="css", type="string"), + * @OA\Property(property="html", type="string") + * ), + * @OA\Schema( + * title="Category Carousel Options", + * @OA\Property( + * property="filters", + * type="object", + * @OA\Property(property="sort", type="string"), + * @OA\Property(property="limit", type="integer"), + * @OA\Property(property="parent_id", type="integer") + * ) + * ), + * @OA\Schema( + * title="Product Carousel Options", + * @OA\Property(property="title", type="string"), + * @OA\Property( + * property="filters", + * type="object", + * @OA\Property(property="new", type="integer"), + * @OA\Property(property="sort", type="string"), + * @OA\Property(property="limit", type="integer") + * ) + * ), + * @OA\Schema( + * title="Footer Links Options", + * @OA\Property( + * property="column_1", + * type="array", + * @OA\Items( + * @OA\Property(property="url", type="string"), + * @OA\Property(property="title", type="string"), + * @OA\Property(property="sort_order", type="integer") + * ) + * ), + * @OA\Property( + * property="column_2", + * type="array", + * @OA\Items( + * @OA\Property(property="url", type="string"), + * @OA\Property(property="title", type="string"), + * @OA\Property(property="sort_order", type="integer") + * ) + * ) + * ), + * @OA\Schema( + * title="Services Content Options", + * @OA\Property( + * property="services", + * type="array", + * @OA\Items( + * @OA\Property(property="title", type="string"), + * @OA\Property(property="description", type="string"), + * @OA\Property(property="service_icon", type="string") + * ) + * ) + * ) + * } + * ) + * + * @var array + */ + public $options; + + /** + * @OA\Property( + * title="Translations", + * description="Theme translations", + * type="array", + * @OA\Items(ref="#/components/schemas/ThemeTranslation") + * ) + * + * @var array + */ + public $translations; } diff --git a/src/Docs/Shop/Models/Core/ThemeTranslation.php b/src/Docs/Shop/Models/Core/ThemeTranslation.php new file mode 100644 index 00000000..34a49a31 --- /dev/null +++ b/src/Docs/Shop/Models/Core/ThemeTranslation.php @@ -0,0 +1,135 @@ +input('quantity')); + try { + $result = Cart::moveToCart($wishlistItem, $request->input('quantity')); - if ($result) { - $cart = Cart::getCart(); + if ($result) { + $cart = Cart::getCart(); + + return response([ + 'data' => $cart ? new CartResource($cart) : null, + 'message' => trans('rest-api::app.shop.wishlist.moved'), + ]); + } return response([ - 'data' => $cart ? new CartResource($cart) : null, - 'message' => trans('rest-api::app.shop.wishlist.moved'), - ]); - } + 'message' => trans('rest-api::app.shop.wishlist.option-missing'), + ], 400); + } catch (Throwable $throwable) { + report($throwable); - return response([ - 'message' => trans('rest-api::app.shop.wishlist.option-missing'), - ], 400); + return response([ + 'message' => trans('rest-api::app.shop.wishlist.unknown-failure'), + ], 400); + } } /** diff --git a/src/Resources/lang/en/app.php b/src/Resources/lang/en/app.php index ac4390da..50eb86b1 100755 --- a/src/Resources/lang/en/app.php +++ b/src/Resources/lang/en/app.php @@ -495,11 +495,12 @@ ], 'wishlist' => [ - 'moved' => 'Item successfully moved To cart.', - 'option-missing' => 'Product options are missing, so item can not be moved to the wishlist.', - 'removed' => 'Item Successfully Removed From Wishlist.', - 'remove-fail' => 'Item Cannot Be Removed From Wishlist.', - 'success' => 'Item Successfully Added To Wishlist.', + 'moved' => 'Item successfully moved To cart.', + 'option-missing' => 'Product options are missing, so item can not be moved to the wishlist.', + 'removed' => 'Item Successfully Removed From Wishlist.', + 'remove-fail' => 'Item Cannot Be Removed From Wishlist.', + 'success' => 'Item Successfully Added To Wishlist.', + 'unknown-failure' => 'Something went wrong!', 'error' => [ 'security-warning' => 'Suspicious activity found!',