@@ 18-52 (lines=35) @@ | ||
15 | /** |
|
16 | * Exception represents an exception occurred during cart position purchase. |
|
17 | */ |
|
18 | class ErrorPurchaseException extends Exception implements PositionFinishExceptionInterface |
|
19 | { |
|
20 | /** |
|
21 | * @var AbstractPurchase |
|
22 | */ |
|
23 | public $purchase; |
|
24 | ||
25 | /** |
|
26 | * @var AbstractCartPosition |
|
27 | */ |
|
28 | public $position; |
|
29 | ||
30 | /** |
|
31 | * ErrorPurchaseException constructor. |
|
32 | * |
|
33 | * @param string $message |
|
34 | * @param AbstractPurchase $purchase |
|
35 | * @param Exception $previous |
|
36 | */ |
|
37 | public function __construct($message, $purchase, Exception $previous = null) |
|
38 | { |
|
39 | $this->purchase = $purchase; |
|
40 | $this->position = $purchase->position; |
|
41 | ||
42 | parent::__construct($message, 0, $previous); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * {@inheritdoc} |
|
47 | */ |
|
48 | public function getName() |
|
49 | { |
|
50 | return 'Error occurred during item "' . $this->purchase->position->getName() . '"" purchase'; |
|
51 | } |
|
52 | } |
|
53 |
@@ 18-52 (lines=35) @@ | ||
15 | /** |
|
16 | * Exception represents an pending state of position occurred during cart purchase. |
|
17 | */ |
|
18 | class PendingPurchaseException extends Exception implements PositionFinishExceptionInterface |
|
19 | { |
|
20 | /** |
|
21 | * @var AbstractPurchase |
|
22 | */ |
|
23 | public $purchase; |
|
24 | ||
25 | /** |
|
26 | * @var AbstractCartPosition |
|
27 | */ |
|
28 | public $position; |
|
29 | ||
30 | /** |
|
31 | * PendingPurchaseException constructor. |
|
32 | * |
|
33 | * @param string $message |
|
34 | * @param AbstractPurchase $purchase |
|
35 | * @param Exception $previous |
|
36 | */ |
|
37 | public function __construct($message, $purchase, Exception $previous = null) |
|
38 | { |
|
39 | $this->purchase = $purchase; |
|
40 | $this->position = $purchase->position; |
|
41 | ||
42 | parent::__construct($message, 0, $previous); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * {@inheritdoc} |
|
47 | */ |
|
48 | public function getName() |
|
49 | { |
|
50 | return 'Item "' . $this->position->getName() . '"" is pending for additional actions'; |
|
51 | } |
|
52 | } |
|
53 |