| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\PaymentMethods\SquareGateway; |
| 4 |
|
| 5 |
use FluentCart\App\Modules\PaymentMethods\Core\BaseGatewaySettings; |
| 6 |
use FluentCart\App\Helpers\Helper; |
| 7 |
use FluentCart\Framework\Support\Arr; |
| 8 |
|
| 9 |
class SquareSettingsBase extends BaseGatewaySettings |
| 10 |
{ |
| 11 |
public $settings; |
| 12 |
public $methodHandler = 'fluent_cart_payment_settings_square'; |
| 13 |
|
| 14 |
|
| 15 |
public static function getDefaults() |
| 16 |
{ |
| 17 |
return [ |
| 18 |
'is_active' => 'no', |
| 19 |
'application_id' => '', |
| 20 |
'access_token' => '', |
| 21 |
'location_id' => '', |
| 22 |
'webhook_signature_key' => '', |
| 23 |
'payment_mode' => 'sandbox', |
| 24 |
]; |
| 25 |
} |
| 26 |
|
| 27 |
public function isActive(): bool |
| 28 |
{ |
| 29 |
return $this->settings['is_active'] == 'yes'; |
| 30 |
} |
| 31 |
|
| 32 |
public function get($key = '') |
| 33 |
{ |
| 34 |
if ($key && isset($this->settings[$key])) { |
| 35 |
return $this->settings[$key]; |
| 36 |
} |
| 37 |
return $this->settings; |
| 38 |
} |
| 39 |
|
| 40 |
public function getMode() |
| 41 |
{ |
| 42 |
return $this->get('payment_mode'); |
| 43 |
} |
| 44 |
|
| 45 |
public function getApplicationId() |
| 46 |
{ |
| 47 |
return $this->get('application_id'); |
| 48 |
} |
| 49 |
|
| 50 |
public function getAccessToken() |
| 51 |
{ |
| 52 |
return Helper::decryptKey($this->get('access_token')); |
| 53 |
} |
| 54 |
|
| 55 |
public function getLocationId() |
| 56 |
{ |
| 57 |
return $this->get('location_id'); |
| 58 |
} |
| 59 |
|
| 60 |
public function getWebhookSignatureKey() |
| 61 |
{ |
| 62 |
return Helper::decryptKey($this->get('webhook_signature_key')); |
| 63 |
} |
| 64 |
} |
| 65 |
|