| 1 |
<?php |
| 2 |
|
| 3 |
namespace Moloni\Controllers; |
| 4 |
|
| 5 |
use Moloni\Enums\Sdr; |
| 6 |
|
| 7 |
/** |
| 8 |
* Order line for "SDR - Sistema de Depósito e Reembolso" (Volta) products. |
| 9 |
* |
| 10 |
* Behaves exactly like a regular {@see OrderProduct} line except that it is |
| 11 |
* always issued at 0% with the M99 exemption reason ("Não sujeito ou não |
| 12 |
* tributado") and its Moloni product is created as an {@see SdrProduct} |
| 13 |
* (with the "I" AT product category), regardless of the store taxes. |
| 14 |
*/ |
| 15 |
class OrderSdr extends OrderProduct |
| 16 |
{ |
| 17 |
/** |
| 18 |
* Force the SDR tax treatment on the document line |
| 19 |
* |
| 20 |
* @return OrderSdr |
| 21 |
*/ |
| 22 |
protected function setTaxes() |
| 23 |
{ |
| 24 |
$this->taxes = []; |
| 25 |
$this->exemption_reason = Sdr::EXEMPTION_REASON; |
| 26 |
|
| 27 |
return $this; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Build the SDR Moloni product for this order line |
| 32 |
* |
| 33 |
* @param \WC_Product $wcProduct |
| 34 |
* |
| 35 |
* @return Product |
| 36 |
*/ |
| 37 |
protected function makeMoloniProduct($wcProduct): Product |
| 38 |
{ |
| 39 |
return new SdrProduct($wcProduct); |
| 40 |
} |
| 41 |
} |
| 42 |
|