wp-pay-gateways /
multisafepay
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay; |
||
| 4 | |||
| 5 | use Pronamic\WordPress\Pay\AbstractGatewayIntegration; |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | /** |
||
| 8 | * Title: MultiSafepay Connect integration |
||
| 9 | * Description: |
||
| 10 | * Copyright: 2005-2020 Pronamic |
||
| 11 | * Company: Pronamic |
||
| 12 | * |
||
| 13 | * @author Remco Tolsma |
||
| 14 | * @version 2.0.5 |
||
| 15 | * @since 1.2.6 |
||
| 16 | */ |
||
| 17 | class Integration extends AbstractGatewayIntegration { |
||
| 18 | /** |
||
| 19 | * Construct Mollie iDEAL integration. |
||
| 20 | * |
||
| 21 | * @param array $args Arguments. |
||
| 22 | */ |
||
| 23 | public function __construct( $args = array() ) { |
||
| 24 | $args = wp_parse_args( |
||
| 25 | $args, |
||
| 26 | array( |
||
| 27 | 'id' => 'multisafepay-connect', |
||
| 28 | 'name' => 'MultiSafepay - Connect', |
||
| 29 | 'url' => 'http://www.multisafepay.com/', |
||
| 30 | 'product_url' => \__( 'http://www.multisafepay.com/', 'pronamic_ideal' ), |
||
| 31 | 'dashboard_url' => 'https://merchant.multisafepay.com/', |
||
| 32 | 'provider' => 'multisafepay', |
||
| 33 | 'supports' => array( |
||
| 34 | 'payment_status_request', |
||
| 35 | 'webhook', |
||
| 36 | 'webhook_no_config', |
||
| 37 | ), |
||
| 38 | 'manual_url' => \__( 'https://www.pronamic.eu/support/how-to-connect-multisafepay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ), |
||
| 39 | ) |
||
| 40 | ); |
||
| 41 | |||
| 42 | parent::__construct( $args ); |
||
| 43 | } |
||
| 44 | |||
| 45 | public function get_settings_fields() { |
||
| 46 | $fields = array(); |
||
| 47 | |||
| 48 | // Account ID |
||
| 49 | $fields[] = array( |
||
| 50 | 'section' => 'general', |
||
| 51 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 52 | 'meta_key' => '_pronamic_gateway_multisafepay_account_id', |
||
| 53 | 'title' => __( 'Account ID', 'pronamic_ideal' ), |
||
| 54 | 'type' => 'text', |
||
| 55 | 'classes' => array( 'code' ), |
||
| 56 | 'tooltip' => sprintf( |
||
| 57 | '%s %s.', |
||
| 58 | __( 'Account ID', 'pronamic_ideal' ), |
||
| 59 | /* translators: %s: MultiSafepay */ |
||
| 60 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 61 | ), |
||
| 62 | ); |
||
| 63 | |||
| 64 | // Site ID |
||
| 65 | $fields[] = array( |
||
| 66 | 'section' => 'general', |
||
| 67 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 68 | 'meta_key' => '_pronamic_gateway_multisafepay_site_id', |
||
| 69 | 'title' => __( 'Site ID', 'pronamic_ideal' ), |
||
| 70 | 'type' => 'text', |
||
| 71 | 'classes' => array( 'code' ), |
||
| 72 | 'tooltip' => sprintf( |
||
| 73 | '%s %s.', |
||
| 74 | __( 'Site ID', 'pronamic_ideal' ), |
||
| 75 | /* translators: %s: MultiSafepay */ |
||
| 76 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 77 | ), |
||
| 78 | ); |
||
| 79 | |||
| 80 | // Site Security Code |
||
| 81 | $fields[] = array( |
||
| 82 | 'section' => 'general', |
||
| 83 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 84 | 'meta_key' => '_pronamic_gateway_multisafepay_site_code', |
||
| 85 | 'title' => __( 'Site Security Code', 'pronamic_ideal' ), |
||
| 86 | 'type' => 'text', |
||
| 87 | 'classes' => array( 'code' ), |
||
| 88 | 'tooltip' => sprintf( |
||
| 89 | '%s %s.', |
||
| 90 | __( 'Site Security Code', 'pronamic_ideal' ), |
||
| 91 | /* translators: %s: MultiSafepay */ |
||
| 92 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 93 | ), |
||
| 94 | ); |
||
| 95 | |||
| 96 | return $fields; |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Get config. |
||
| 101 | * |
||
| 102 | * @param $post_id |
||
| 103 | * |
||
| 104 | * @return Config |
||
| 105 | */ |
||
| 106 | public function get_config( $post_id ) { |
||
| 107 | $config = new Config(); |
||
| 108 | |||
| 109 | $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
||
|
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ...ic_gateway_mode', true) can also be of type false. However, the property $mode is declared as type string. Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
Loading history...
|
|||
| 110 | $config->account_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_account_id', true ); |
||
| 111 | $config->site_id = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_id', true ); |
||
| 112 | $config->site_code = get_post_meta( $post_id, '_pronamic_gateway_multisafepay_site_code', true ); |
||
| 113 | |||
| 114 | if ( Gateway::MODE_TEST === $config->mode ) { |
||
| 115 | $config->api_url = MultiSafepay::API_TEST_URL; |
||
| 116 | } else { |
||
| 117 | $config->api_url = MultiSafepay::API_PRODUCTION_URL; |
||
| 118 | } |
||
| 119 | |||
| 120 | return $config; |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * Get gateway. |
||
| 125 | * |
||
| 126 | * @param int $post_id Post ID. |
||
| 127 | * @return Gateway |
||
| 128 | */ |
||
| 129 | public function get_gateway( $post_id ) { |
||
| 130 | return new Gateway( $this->get_config( $post_id ) ); |
||
| 131 | } |
||
| 132 | } |
||
| 133 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths