| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\PaymentMethods\Cod; |
| 4 |
use FluentCart\Api\StoreSettings; |
| 5 |
use FluentCart\App\Modules\PaymentMethods\Core\BaseGatewaySettings; |
| 6 |
|
| 7 |
class CodSettingsBase extends BaseGatewaySettings |
| 8 |
{ |
| 9 |
|
| 10 |
public $settings; |
| 11 |
public $methodHandler = 'fluent_cart_payment_settings_offline_payment'; |
| 12 |
|
| 13 |
|
| 14 |
public static function getDefaults(): array |
| 15 |
{ |
| 16 |
return [ |
| 17 |
'is_active' => 'no', |
| 18 |
'payment_mode' => 'live', |
| 19 |
]; |
| 20 |
} |
| 21 |
|
| 22 |
public function isActive(): bool |
| 23 |
{ |
| 24 |
return $this->settings['active'] == 'yes'; |
| 25 |
} |
| 26 |
|
| 27 |
public function getMode() |
| 28 |
{ |
| 29 |
return (new StoreSettings)->get('order_mode'); |
| 30 |
} |
| 31 |
|
| 32 |
public function getPublicKey() |
| 33 |
{ |
| 34 |
// TODO: Implement getPublicKey() method. |
| 35 |
} |
| 36 |
|
| 37 |
public function getApiKey() |
| 38 |
{ |
| 39 |
// TODO: Implement getApiKey() method. |
| 40 |
} |
| 41 |
|
| 42 |
public function get($key = '') |
| 43 |
{ |
| 44 |
$settings = $this->settings; |
| 45 |
|
| 46 |
if ($key && isset($this->settings[$key])) { |
| 47 |
return $this->settings[$key]; |
| 48 |
} |
| 49 |
return $settings; |
| 50 |
} |
| 51 |
} |
| 52 |
|