| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\PaymentGateways\Stripe\DataTransferObjects; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class NewStripeAccountOnBoardingDto |
| 7 |
* @package Give\PaymentGateways\Stripe\DataTransferObjects |
| 8 |
* |
| 9 |
* @since 2.13.0 |
| 10 |
*/ |
| 11 |
final class NewStripeAccountOnBoardingDto |
| 12 |
{ |
| 13 |
/** |
| 14 |
* @var mixed|string |
| 15 |
*/ |
| 16 |
public $stripePublishableKey; |
| 17 |
/** |
| 18 |
* @var mixed|string |
| 19 |
*/ |
| 20 |
public $stripeUserId; |
| 21 |
/** |
| 22 |
* @var mixed|string |
| 23 |
*/ |
| 24 |
public $stripeAccessToken; |
| 25 |
/** |
| 26 |
* @var mixed|string |
| 27 |
*/ |
| 28 |
public $stripeAccessTokenTest; |
| 29 |
/** |
| 30 |
* @var bool |
| 31 |
*/ |
| 32 |
public $isConnected; |
| 33 |
/** |
| 34 |
* @var mixed|string |
| 35 |
*/ |
| 36 |
public $stripePublishableKeyTest; |
| 37 |
/** |
| 38 |
* @var int |
| 39 |
*/ |
| 40 |
public $formId; |
| 41 |
|
| 42 |
/** |
| 43 |
* @since 2.13.0 |
| 44 |
* |
| 45 |
* @param array $array |
| 46 |
* |
| 47 |
*/ |
| 48 |
public static function fromArray($array) |
| 49 |
{ |
| 50 |
$self = new static(); |
| 51 |
|
| 52 |
$self->formId = ! empty($array['post']) ? absint($array['post']) : 0; |
| 53 |
$self->stripePublishableKey = ! empty($array['stripe_publishable_key']) ? $array['stripe_publishable_key'] : ''; |
| 54 |
$self->stripePublishableKeyTest = ! empty($array['stripe_publishable_key_test']) ? $array['stripe_publishable_key_test'] : ''; |
| 55 |
$self->stripeUserId = ! empty($array['stripe_user_id']) ? $array['stripe_user_id'] : ''; |
| 56 |
$self->stripeAccessToken = ! empty($array['stripe_access_token']) ? $array['stripe_access_token'] : ''; |
| 57 |
$self->stripeAccessTokenTest = ! empty($array['stripe_access_token_test']) ? $array['stripe_access_token_test'] : ''; |
| 58 |
$self->isConnected = ! empty($array['connected']) && absint($array['connected']); |
| 59 |
|
| 60 |
return $self; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* @since 2.13.0 |
| 65 |
* @return bool |
| 66 |
*/ |
| 67 |
public function hasValidateData() |
| 68 |
{ |
| 69 |
return $this->stripePublishableKey && |
| 70 |
$this->stripeUserId && |
| 71 |
$this->stripeAccessToken && |
| 72 |
$this->stripeAccessTokenTest && |
| 73 |
$this->isConnected; |
| 74 |
} |
| 75 |
} |
| 76 |
|