From a0a7cca3a9d47ba90584167dfb58ceabd716a6ae Mon Sep 17 00:00:00 2001 From: Oleksii Skorobogatko Date: Sun, 29 Sep 2024 17:55:31 +0300 Subject: [PATCH] order dto property examples --- src/Mirspay/Dto/OrderDto.php | 8 ++++---- src/Mirspay/Dto/ProductDto.php | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Mirspay/Dto/OrderDto.php b/src/Mirspay/Dto/OrderDto.php index 9fe21b2..dc468bd 100644 --- a/src/Mirspay/Dto/OrderDto.php +++ b/src/Mirspay/Dto/OrderDto.php @@ -17,17 +17,17 @@ * @param array $products */ public function __construct( - #[OA\Property(description: 'Order number.')] + #[OA\Property(description: 'Order number.', example: '8420910032')] #[Assert\Length(min:2, max: 255)] #[SerializedName('order_num')] public string $orderNum, - #[OA\Property(description: 'Which payment gateway use for order purchase.')] + #[OA\Property(description: 'Which payment gateway use for order purchase.', example: 'liqpay')] #[Assert\Length(min: 2, max: 16)] #[SerializedName('payment_gateway')] public string $paymentGateway, - #[OA\Property(description: 'Description of the order.')] + #[OA\Property(description: 'Description of the order.', example: 'Order #00102')] #[Assert\Length(min: 2, max: 255)] public string $description, @@ -36,7 +36,7 @@ public function __construct( #[Assert\Valid] public array $products, - #[OA\Property(description: 'Webpage url to return a customer after filling a payment form.')] + #[OA\Property(description: 'Webpage url to return a customer after filling a payment form.', example: 'https://your-url.com/thank-you-page')] #[Assert\Url] #[Assert\Length(max: 1000)] #[SerializedName('return_url')] diff --git a/src/Mirspay/Dto/ProductDto.php b/src/Mirspay/Dto/ProductDto.php index c670008..f1e02e6 100644 --- a/src/Mirspay/Dto/ProductDto.php +++ b/src/Mirspay/Dto/ProductDto.php @@ -4,20 +4,25 @@ namespace Mirspay\Dto; +use OpenApi\Attributes as OA; use Symfony\Component\Validator\Constraints as Assert; final readonly class ProductDto { public function __construct( + #[OA\Property(description: 'Product SKU', example: 'BGD-1043Y')] #[Assert\Length(min: 2, max: 255)] public string $sku, + #[OA\Property(description: 'Product name', example: 'T-Shirt')] #[Assert\Length(min: 2, max: 255)] public string $name, + #[OA\Property(description: 'Quantity', example: 1)] #[Assert\Positive] public int $qty, + #[OA\Property(description: 'Price (integer)', example: 100_00)] #[Assert\PositiveOrZero] public int $price, ) {