| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Line item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @author    Pronamic <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright 2005-2019 Pronamic | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license   GPL-3.0-or-later | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @package   Pronamic\WordPress\Pay\Gateways\Adyen | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace Pronamic\WordPress\Pay\Gateways\Adyen; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * Line item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @author  Reüel van der Steege | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * @version 1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @since   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | class LineItem { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	 * Amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	 * @var int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	private $amount_excluding_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 * Amount including tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	 * @var int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	private $amount_including_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	 * Description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	 * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	private $description; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	 * Item id. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	 * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	private $id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	 * Quantity. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	 * @var int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	private $quantity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	 * Tax amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	 * @var int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	private $tax_amount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	 * Tax category (high, low, none, zero). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	 * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	private $tax_category; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	 * Tax percentage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	 * @var int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	private $tax_percentage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	 * Construct line item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	 * @param string $description          Name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	 * @param int    $quantity             Quantity. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	 * @param int    $amount_including_tax Amount (including tax). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 * @throws InvalidArgumentException Throws invalid argument exception when arguments are invalid. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	public function __construct( $description, $quantity, $amount_including_tax ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 		$this->set_description( $description ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		$this->set_quantity( $quantity ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		$this->set_amount_including_tax( $amount_including_tax ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	 * Get amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 	 * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	public function get_amount_excluding_tax() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		return $this->amount_excluding_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 	 * Set amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	 * @param int $amount_excluding_tax Amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 	public function set_amount_excluding_tax( $amount_excluding_tax = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 		$this->amount_excluding_tax = $amount_excluding_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 	 * Get amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	 * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 	public function get_amount_including_tax() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 		return $this->amount_including_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 	 * Set amount including tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 	 * @param int $amount_including_tax Amount excluding tax. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	public function set_amount_including_tax( $amount_including_tax = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 		$this->amount_including_tax = $amount_including_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 	 * Get item description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 	 * @return string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 	public function get_description() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		return $this->description; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	 * Set item description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	 * @param string|null $description Description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 	 * @throws InvalidArgumentException Throws invalid argument exception when value does not apply to format `AN..max 100`. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 	public function set_description( $description = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 		$this->description = $description; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 	 * Get item ID. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 	 * @return string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 	public function get_id() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 		return $this->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 	 * Set item ID. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 	 * @param string|null $id ID. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 	public function set_id( $id = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 		$this->id = $id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 	 * Get quantity. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 	 * @return int | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 171 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 172 |  |  | 	public function get_quantity() { | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  | 		return $this->quantity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	 * Get quantity. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 	 * @param int $quantity Quantity. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 	public function set_quantity( $quantity = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 		$this->quantity = $quantity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 	 * Get tax amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 	 * @return int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 	public function get_tax_amount() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 		return $this->tax_amount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 	 * Set tax amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 	 * @param int|null $tax_amount Tax amount. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 	public function set_tax_amount( $tax_amount = null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 		$this->tax_amount = $tax_amount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 	 * Get tax category. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 	 * @return int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 	public function get_tax_category() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 		return $this->tax_category; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 	 * Set tax category. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 	 * @param int|null $tax_category Tax category. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 	public function set_tax_category( $tax_category ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 		$this->tax_category = $tax_category; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 	 * Get tax percentage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 	 * @return int|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 	public function get_tax_percentage() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		return $this->tax_percentage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 	 * Set tax percentage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 	 * @param int|null $tax_percentage Tax percentage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 	public function set_tax_percentage( $tax_percentage ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 		$this->tax_percentage = $tax_percentage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 	 * Get JSON. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 	 * @return object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 	public function get_json() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 		$object = (object) array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 		if ( null !== $this->amount_excluding_tax ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 			$object->amountExcludingTax = $this->amount_excluding_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 		if ( null !== $this->amount_including_tax ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 			$object->amountIncludingTax = $this->amount_including_tax; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 		if ( null !== $this->description ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 			$object->description = $this->description; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		if ( null !== $this->id ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 			$object->id = $this->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 		if ( null !== $this->quantity ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 			$object->quantity = $this->quantity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 		if ( null !== $this->tax_amount ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 			$object->taxAmount = $this->tax_amount; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 		if ( null !== $this->tax_category ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 			$object->taxCategory = $this->tax_category; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 		if ( null !== $this->tax_percentage ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 			$object->taxPercentage = $this->tax_percentage; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  | 		return $object; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 281 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 282 |  |  |  |