| @@ 160-168 (lines=9) @@ | ||
| 157 | * @since 4.0.6 |
|
| 158 | * @return bool True if the keys are set *and* valid, false otherwise (for example, if keys are empty or the secret key was pasted as publishable key). |
|
| 159 | */ |
|
| 160 | public function are_keys_set() { |
|
| 161 | // NOTE: updates to this function should be added to are_keys_set() |
|
| 162 | // in includes/payment-methods/class-wc-stripe-payment-request.php |
|
| 163 | ||
| 164 | if ( $this->testmode ) { |
|
| 165 | return preg_match( '/^pk_test_/', $this->publishable_key ) |
|
| 166 | && preg_match( '/^[rs]k_test_/', $this->secret_key ); |
|
| 167 | } else { |
|
| 168 | return preg_match( '/^pk_live_/', $this->publishable_key ) |
|
| 169 | && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 170 | } |
|
| 171 | } |
|
| @@ 107-115 (lines=9) @@ | ||
| 104 | * @since 4.0.6 |
|
| 105 | * @return boolean True if the keys are set *and* valid, false otherwise (for example, if keys are empty or the secret key was pasted as publishable key). |
|
| 106 | */ |
|
| 107 | public function are_keys_set() { |
|
| 108 | // NOTE: updates to this function should be added to are_keys_set() |
|
| 109 | // in includes/abstracts/abstract-wc-stripe-payment-gateway.php |
|
| 110 | if ( $this->testmode ) { |
|
| 111 | return preg_match( '/^pk_test_/', $this->publishable_key ) |
|
| 112 | && preg_match( '/^[rs]k_test_/', $this->secret_key ); |
|
| 113 | } else { |
|
| 114 | return preg_match( '/^pk_live_/', $this->publishable_key ) |
|
| 115 | && preg_match( '/^[rs]k_live_/', $this->secret_key ); |
|
| 116 | } |
|
| 117 | } |
|
| 118 | ||