mirror of
https://github.com/anikeen-com/id.git
synced 2026-03-15 14:46:15 +00:00
refactored code
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
This commit is contained in:
39
src/Id/Concerns/ManagesPricing.php
Normal file
39
src/Id/Concerns/ManagesPricing.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Anikeen\Id\Concerns;
|
||||
|
||||
use Anikeen\Id\ApiOperations\Post;
|
||||
use Anikeen\Id\Exceptions\RequestRequiresClientIdException;
|
||||
use Anikeen\Id\Result;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
trait ManagesPricing
|
||||
{
|
||||
use Post;
|
||||
|
||||
/**
|
||||
* Make a new order preview (will not be stored into the database).
|
||||
*
|
||||
* VAT is calculated based on the billing address and shown in the order response.
|
||||
*
|
||||
* @param array{
|
||||
* country_iso: string,
|
||||
* items: array<array{
|
||||
* type: string,
|
||||
* name: string,
|
||||
* description: string,
|
||||
* price: float|int,
|
||||
* unit: string,
|
||||
* units: int
|
||||
* }>
|
||||
* } $attributes The order data:
|
||||
* - country_iso: ISO 3166-1 alpha-2 country code
|
||||
* - items: Array of order items (each with type, name, price, unit, units, and quantity)
|
||||
* @throws RequestRequiresClientIdException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function createOrderPreview(array $attributes = []): Result
|
||||
{
|
||||
return $this->post('v1/orders/preview', $attributes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user