| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
class WC_Vipps_Checkout_Session_Amount extends WC_Vipps_Model { |
| 6 |
protected array $required_fields = [ |
| 7 |
"value", |
| 8 |
"currency", |
| 9 |
]; |
| 10 |
|
| 11 |
public ?int $value = null; |
| 12 |
public ?string $currency = null; |
| 13 |
|
| 14 |
public function set_value( int $value ): self { |
| 15 |
$this->value = $value; |
| 16 |
|
| 17 |
return $this; |
| 18 |
} |
| 19 |
|
| 20 |
public function set_currency( string $currency ): self { |
| 21 |
$this->currency = $currency; |
| 22 |
|
| 23 |
return $this; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* @throws WC_Vipps_Recurring_Missing_Value_Exception |
| 28 |
*/ |
| 29 |
public function to_array( bool $check_required = false ): array { |
| 30 |
if ( $check_required ) { |
| 31 |
$this->check_required(); |
| 32 |
} |
| 33 |
|
| 34 |
return [ |
| 35 |
"value" => $this->value, |
| 36 |
"currency" => $this->currency, |
| 37 |
]; |
| 38 |
} |
| 39 |
} |
| 40 |
|