PluginProbe
Moloni / trunk
Moloni vtrunk
5.0.10 5.0.09 5.0.08 5.0.07 5.0.06 trunk 0.4.0.00 0.4.8.1 3.0.10 3.0.11 3.0.35 3.0.36 3.0.37 3.0.38 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.0.46 3.0.47 3.0.48 3.0.49 3.0.50 All 98 releases
moloni / src / Controllers / OrderSdr.php

OrderSdr.php in Moloni trunk, at src/Controllers/OrderSdr.php

42 lines 1005 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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