| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\PaymentGateways\Gateways\Stripe\Traits; |
| 4 |
|
| 5 |
trait FormFieldMarkup |
| 6 |
{ |
| 7 |
public function canShowFields() { |
| 8 |
$status = true; |
| 9 |
$isConfigured = \Give\Helpers\Gateways\Stripe::isAccountConfigured(); |
| 10 |
$isTestMode = give_is_test_mode(); |
| 11 |
$isSslActive = is_ssl(); |
| 12 |
|
| 13 |
if ( ! $isConfigured && ! $isSslActive && ! $isTestMode ) { |
| 14 |
// Account not configured, No SSL scenario. |
| 15 |
\Give_Notices::print_frontend_notice( |
| 16 |
sprintf( |
| 17 |
'<strong>%1$s</strong> %2$s', |
| 18 |
esc_html__( 'Notice:', 'give' ), |
| 19 |
$this->errorMessages['accountNotConfiguredNoSsl'] |
| 20 |
) |
| 21 |
); |
| 22 |
$status = false; |
| 23 |
|
| 24 |
} elseif ( ! $isConfigured ) { |
| 25 |
// Account not configured scenario. |
| 26 |
\Give_Notices::print_frontend_notice( |
| 27 |
sprintf( |
| 28 |
'<strong>%1$s</strong> %2$s', |
| 29 |
esc_html__( 'Notice:', 'give' ), |
| 30 |
$this->errorMessages['accountNotConfigured'] |
| 31 |
) |
| 32 |
); |
| 33 |
$status = false; |
| 34 |
|
| 35 |
} elseif ( ! $isTestMode && ! $isSslActive ) { |
| 36 |
// Account configured, No SSL scenario. |
| 37 |
\Give_Notices::print_frontend_notice( |
| 38 |
sprintf( |
| 39 |
'<strong>%1$s</strong> %2$s', |
| 40 |
esc_html__( 'Notice:', 'give' ), |
| 41 |
$this->errorMessages['accountConfiguredNoSsl'] |
| 42 |
) |
| 43 |
); |
| 44 |
$status = false; |
| 45 |
} |
| 46 |
|
| 47 |
return $status; |
| 48 |
} |
| 49 |
} |
| 50 |
|