Skip to content

Commit

Permalink
order dto property examples
Browse files Browse the repository at this point in the history
  • Loading branch information
skoro committed Sep 29, 2024
1 parent ebddd85 commit a0a7cca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Mirspay/Dto/OrderDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
* @param array<ProductDto> $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,

Expand All @@ -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')]
Expand Down
5 changes: 5 additions & 0 deletions src/Mirspay/Dto/ProductDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
Expand Down

0 comments on commit a0a7cca

Please sign in to comment.