wp-pay-gateways /
icepay
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Pronamic\WordPress\Pay\Gateways\Icepay; |
||
| 4 | |||
| 5 | use Pronamic\WordPress\Pay\Core\GatewaySettings; |
||
| 6 | use Pronamic\WordPress\Pay\WebhookManager; |
||
|
0 ignored issues
–
show
|
|||
| 7 | |||
| 8 | /** |
||
| 9 | * Title: ICEPAY gateway settings |
||
| 10 | * Description: |
||
| 11 | * Copyright: 2005-2019 Pronamic |
||
| 12 | * Company: Pronamic |
||
| 13 | * |
||
| 14 | * @author Remco Tolsma |
||
| 15 | * @version 2.0.0 |
||
| 16 | * @since 1.0.0 |
||
| 17 | */ |
||
| 18 | class Settings extends GatewaySettings { |
||
| 19 | public function __construct() { |
||
| 20 | add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
||
| 21 | add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function sections( array $sections ) { |
||
| 25 | // iDEAL |
||
| 26 | $sections['icepay'] = array( |
||
| 27 | 'title' => __( 'ICEPAY', 'pronamic_ideal' ), |
||
| 28 | 'methods' => array( 'icepay' ), |
||
| 29 | 'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ), |
||
| 30 | ); |
||
| 31 | |||
| 32 | // Advanced |
||
| 33 | $sections['icepay_advanced'] = array( |
||
| 34 | 'title' => __( 'Advanced', 'pronamic_ideal' ), |
||
| 35 | 'methods' => array( 'icepay' ), |
||
| 36 | 'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ), |
||
| 37 | ); |
||
| 38 | |||
| 39 | // Transaction feedback |
||
| 40 | $sections['icepay_feedback'] = array( |
||
| 41 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 42 | 'methods' => array( 'icepay' ), |
||
| 43 | 'description' => __( 'Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
||
| 44 | 'features' => Gateway::get_supported_features(), |
||
| 45 | ); |
||
| 46 | |||
| 47 | return $sections; |
||
| 48 | } |
||
| 49 | |||
| 50 | public function fields( array $fields ) { |
||
| 51 | // Merchant ID |
||
| 52 | $fields[] = array( |
||
| 53 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 54 | 'section' => 'icepay', |
||
| 55 | 'meta_key' => '_pronamic_gateway_icepay_merchant_id', |
||
| 56 | 'title' => _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ), |
||
| 57 | 'type' => 'text', |
||
| 58 | 'tooltip' => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
||
| 59 | ); |
||
| 60 | |||
| 61 | // Secret Code |
||
| 62 | $fields[] = array( |
||
| 63 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 64 | 'section' => 'icepay', |
||
| 65 | 'meta_key' => '_pronamic_gateway_icepay_secret_code', |
||
| 66 | 'title' => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ), |
||
| 67 | 'type' => 'text', |
||
| 68 | 'classes' => array( 'regular-text', 'code' ), |
||
| 69 | 'tooltip' => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
||
| 70 | ); |
||
| 71 | |||
| 72 | // Transaction feedback |
||
| 73 | $fields[] = array( |
||
| 74 | 'section' => 'icepay', |
||
| 75 | 'methods' => array( 'icepay' ), |
||
| 76 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 77 | 'type' => 'description', |
||
| 78 | 'html' => __( 'Receiving payment status updates needs additional configuration.', 'pronamic_ideal' ), |
||
| 79 | 'features' => Gateway::get_supported_features(), |
||
| 80 | ); |
||
| 81 | |||
| 82 | // Purchase ID |
||
| 83 | $fields[] = array( |
||
| 84 | 'filter' => array( |
||
| 85 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 86 | 'flags' => FILTER_FLAG_NO_ENCODE_QUOTES, |
||
| 87 | ), |
||
| 88 | 'section' => 'icepay_advanced', |
||
| 89 | 'meta_key' => '_pronamic_gateway_icepay_order_id', |
||
| 90 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
| 91 | 'type' => 'text', |
||
| 92 | 'classes' => array( 'regular-text', 'code' ), |
||
| 93 | 'tooltip' => sprintf( |
||
| 94 | /* translators: %s: <code>OrderID</code> */ |
||
| 95 | __( 'The Icepay %s parameter.', 'pronamic_ideal' ), |
||
| 96 | sprintf( '<code>%s</code>', 'OrderID' ) |
||
| 97 | ), |
||
| 98 | 'description' => sprintf( |
||
| 99 | '%s %s<br />%s', |
||
| 100 | __( 'Available tags:', 'pronamic_ideal' ), |
||
| 101 | sprintf( |
||
| 102 | '<code>%s</code> <code>%s</code>', |
||
| 103 | '{order_id}', |
||
| 104 | '{payment_id}' |
||
| 105 | ), |
||
| 106 | sprintf( |
||
| 107 | /* translators: %s: <code>{payment_id}</code> */ |
||
| 108 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
| 109 | '{payment_id}' |
||
| 110 | ) |
||
| 111 | ), |
||
| 112 | ); |
||
| 113 | |||
| 114 | // Thank you page URL |
||
| 115 | $fields[] = array( |
||
| 116 | 'section' => 'icepay_feedback', |
||
| 117 | 'title' => __( 'Thank you page URL', 'pronamic_ideal' ), |
||
| 118 | 'type' => 'text', |
||
| 119 | 'classes' => array( 'regular-text', 'code' ), |
||
| 120 | 'value' => home_url( '/' ), |
||
| 121 | 'readonly' => true, |
||
| 122 | ); |
||
| 123 | |||
| 124 | // Error page URL |
||
| 125 | $fields[] = array( |
||
| 126 | 'section' => 'icepay_feedback', |
||
| 127 | 'title' => __( 'Error page URL', 'pronamic_ideal' ), |
||
| 128 | 'type' => 'text', |
||
| 129 | 'classes' => array( 'regular-text', 'code' ), |
||
| 130 | 'value' => home_url( '/' ), |
||
| 131 | 'readonly' => true, |
||
| 132 | ); |
||
| 133 | |||
| 134 | // Postback URL |
||
| 135 | $fields[] = array( |
||
| 136 | 'section' => 'icepay_feedback', |
||
| 137 | 'title' => __( 'Postback URL', 'pronamic_ideal' ), |
||
| 138 | 'type' => 'text', |
||
| 139 | 'classes' => array( 'regular-text', 'code' ), |
||
| 140 | 'value' => home_url( '/' ), |
||
| 141 | 'readonly' => true, |
||
| 142 | ); |
||
| 143 | |||
| 144 | // Webhook status. |
||
| 145 | $fields[] = array( |
||
| 146 | 'section' => 'icepay_feedback', |
||
| 147 | 'methods' => array( 'icepay' ), |
||
| 148 | 'title' => __( 'Status', 'pronamic_ideal' ), |
||
| 149 | 'type' => 'description', |
||
| 150 | 'callback' => array( $this, 'feedback_status' ), |
||
| 151 | ); |
||
| 152 | |||
| 153 | return $fields; |
||
| 154 | } |
||
| 155 | |||
| 156 | /** |
||
| 157 | * Transaction feedback status. |
||
| 158 | * |
||
| 159 | * @param array $field Settings field. |
||
| 160 | */ |
||
| 161 | public function feedback_status( $field ) { |
||
| 162 | $features = Gateway::get_supported_features(); |
||
| 163 | |||
| 164 | WebhookManager::settings_status( $field, $features ); |
||
| 165 | } |
||
| 166 | } |
||
| 167 |
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