| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
class WC_Vipps_Checkout_Session_Merchant_Info extends WC_Vipps_Model { |
| 6 |
protected array $required_fields = [ |
| 7 |
"callback_url", |
| 8 |
"return_url", |
| 9 |
"callback_authorization_token" |
| 10 |
]; |
| 11 |
|
| 12 |
public ?string $callback_url = null; |
| 13 |
public ?string $return_url = null; |
| 14 |
public ?string $callback_authorization_token = null; |
| 15 |
public ?string $terms_and_conditions_url = null; |
| 16 |
|
| 17 |
public function set_callback_url( string $callback_url ): self { |
| 18 |
$this->callback_url = $callback_url; |
| 19 |
|
| 20 |
return $this; |
| 21 |
} |
| 22 |
|
| 23 |
public function set_return_url( string $return_url ): self { |
| 24 |
$this->return_url = $return_url; |
| 25 |
|
| 26 |
return $this; |
| 27 |
} |
| 28 |
|
| 29 |
public function set_callback_authorization_token( string $callback_authorization_token ): self { |
| 30 |
$this->callback_authorization_token = $callback_authorization_token; |
| 31 |
|
| 32 |
return $this; |
| 33 |
} |
| 34 |
|
| 35 |
public function set_terms_and_conditions_url( string $terms_and_conditions_url ): self { |
| 36 |
$this->terms_and_conditions_url = $terms_and_conditions_url; |
| 37 |
|
| 38 |
return $this; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* @throws WC_Vipps_Recurring_Missing_Value_Exception |
| 43 |
*/ |
| 44 |
public function to_array( bool $check_required = false ): array { |
| 45 |
if ( $check_required ) { |
| 46 |
$this->check_required(); |
| 47 |
} |
| 48 |
|
| 49 |
return array_merge( |
| 50 |
[ |
| 51 |
"callbackUrl" => $this->callback_url, |
| 52 |
"returnUrl" => $this->return_url, |
| 53 |
"callbackAuthorizationToken" => $this->callback_authorization_token, |
| 54 |
], |
| 55 |
$this->conditional( "termsAndConditionsUrl", $this->terms_and_conditions_url ), |
| 56 |
); |
| 57 |
} |
| 58 |
} |
| 59 |
|