Skip to content

Commit

Permalink
WIP #10: свойства элемента заказа
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaoda committed May 8, 2020
1 parent 1561627 commit 4067763
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/Dispatching/Endpoints/Orders/Entites/CustomsDeclaration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,30 @@ public function __construct($entriesType, string $currency)
$this->data['currency'] = $currency;
}

public function addItem(CustomsDeclarationItem $item): void
public function addItem(CustomsDeclarationItem $item)
{
$this->items[] = $item;

return $this;
}

public function addInvoice(string $number)
public function withInvoice(string $number)
{
$this->data['with-invoice'] = true;
$this->data['invoice-number'] = $number;

return $this;
}

public function addCertificate(string $number)
public function withCertificate(string $number)
{
$this->data['with-certificate'] = true;
$this->data['certificate-number'] = $number;

return $this;
}

public function addLicense(string $number)
public function withLicense(string $number)
{
$this->data['with-license'] = true;
$this->data['license-number'] = $number;
Expand All @@ -51,7 +53,7 @@ public function addLicense(string $number)

public function getCurrency(): string
{
return $this->get('entries-type');
return $this->get('currency');
}

public function getEntriesType(): string
Expand Down
32 changes: 30 additions & 2 deletions src/Dispatching/Endpoints/Orders/Entites/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public static function create(
return new self(...\func_get_args());
}

public function __construct(string $title, int $quantity, int $price, ?string $code = null, ?string $article = null)
public function __construct(string $description, int $quantity, ?int $price = null, ?string $code = null, ?string $article = null)
{
$this->data['description'] = $title;
$this->data['description'] = $description;
$this->data['quantity'] = $quantity;
$this->data['value'] = $price;
$this->data['code'] = $code;
Expand All @@ -53,6 +53,27 @@ public function bySupplier(string $inn, string $name, string $phone)
return $this;
}

public function paymentMode(PaymentMode54FZ $mode)
{
$this->data['payattr'] = $mode;

return $this;
}

public function paymentSubject(PaymentSubject54FZ $subject)
{
$this->data['lineattr'] = $subject;

return $this;
}

public function withCustomsDeclarationNumber(string $number)
{
$this->data['customs-declaration-number'] = $number;

return $this;
}

public function withVAT(int $vat)
{
$this->data['vat-rate'] = $vat;
Expand All @@ -67,6 +88,13 @@ public function withInshurance(int $value)
return $this;
}

public function withExcise(int $value)
{
$this->data['excise'] = $value;

return $this;
}

public function toArray(): array
{
return $this->data;
Expand Down

0 comments on commit 4067763

Please sign in to comment.