wp-pay-gateways /
omnikassa-2
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Settings |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2019 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\OmniKassa2 |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\OmniKassa2; |
||
| 12 | |||
| 13 | use Pronamic\WordPress\Pay\Core\GatewaySettings; |
||
| 14 | use Pronamic\WordPress\Pay\WebhookManager; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | /** |
||
| 17 | * Settings |
||
| 18 | * |
||
| 19 | * @author Remco Tolsma |
||
| 20 | * @version 2.1.0 |
||
| 21 | * @since 1.0.0 |
||
| 22 | */ |
||
| 23 | class Settings extends GatewaySettings { |
||
| 24 | /** |
||
| 25 | * Constructs and initialize settings. |
||
| 26 | */ |
||
| 27 | public function __construct() { |
||
| 28 | add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
||
| 29 | add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Sections. |
||
| 34 | * |
||
| 35 | * @param array $sections Sections. |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | public function sections( array $sections ) { |
||
| 39 | $sections['omnikassa-2'] = array( |
||
| 40 | 'title' => __( 'OmniKassa 2.0', 'pronamic_ideal' ), |
||
| 41 | 'methods' => array( 'omnikassa-2' ), |
||
| 42 | ); |
||
| 43 | |||
| 44 | // Advanced. |
||
| 45 | $sections['omnikassa-2_advanced'] = array( |
||
| 46 | 'title' => __( 'Advanced', 'pronamic_ideal' ), |
||
| 47 | 'methods' => array( 'omnikassa-2' ), |
||
| 48 | ); |
||
| 49 | |||
| 50 | // Transaction feedback. |
||
| 51 | $sections['omnikassa-2_feedback'] = array( |
||
| 52 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 53 | 'methods' => array( 'omnikassa-2' ), |
||
| 54 | 'description' => sprintf( |
||
| 55 | /* translators: %s: OmniKassa 2 */ |
||
| 56 | __( 'Set the Webhook URL in the %s dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
||
| 57 | __( 'OmniKassa 2.0', 'pronamic_ideal' ) |
||
| 58 | ), |
||
| 59 | ); |
||
| 60 | |||
| 61 | return $sections; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Fields. |
||
| 66 | * |
||
| 67 | * @param array $fields Fields. |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | public function fields( array $fields ) { |
||
| 71 | // Refresh Token. |
||
| 72 | $fields[] = array( |
||
| 73 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 74 | 'section' => 'omnikassa-2', |
||
| 75 | 'meta_key' => '_pronamic_gateway_omnikassa_2_refresh_token', |
||
| 76 | 'title' => _x( 'Refresh Token', 'omnikassa', 'pronamic_ideal' ), |
||
| 77 | 'type' => 'textarea', |
||
| 78 | 'classes' => array( 'code' ), |
||
| 79 | ); |
||
| 80 | |||
| 81 | // Signing Key. |
||
| 82 | $fields[] = array( |
||
| 83 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 84 | 'section' => 'omnikassa-2', |
||
| 85 | 'meta_key' => '_pronamic_gateway_omnikassa_2_signing_key', |
||
| 86 | 'title' => _x( 'Signing Key', 'omnikassa', 'pronamic_ideal' ), |
||
| 87 | 'type' => 'text', |
||
| 88 | 'classes' => array( 'large-text', 'code' ), |
||
| 89 | ); |
||
| 90 | |||
| 91 | // Transaction feedback. |
||
| 92 | $fields[] = array( |
||
| 93 | 'section' => 'omnikassa-2', |
||
| 94 | 'methods' => array( 'omnikassa-2' ), |
||
| 95 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 96 | 'type' => 'description', |
||
| 97 | 'html' => __( 'Receiving payment status updates needs additional configuration.', 'pronamic_ideal' ), |
||
| 98 | 'features' => Gateway::get_supported_features(), |
||
| 99 | ); |
||
| 100 | |||
| 101 | // Purchase ID. |
||
| 102 | $fields[] = array( |
||
| 103 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 104 | 'section' => 'omnikassa-2_advanced', |
||
| 105 | 'meta_key' => '_pronamic_gateway_omnikassa_2_order_id', |
||
| 106 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
| 107 | 'type' => 'text', |
||
| 108 | 'classes' => array( 'regular-text', 'code' ), |
||
| 109 | 'tooltip' => sprintf( |
||
| 110 | /* translators: %s: Parameter */ |
||
| 111 | __( 'The OmniKassa %s parameter.', 'pronamic_ideal' ), |
||
| 112 | sprintf( '<code>%s</code>', 'orderId' ) |
||
| 113 | ), |
||
| 114 | 'description' => sprintf( |
||
| 115 | '%s %s<br />%s', |
||
| 116 | __( 'Available tags:', 'pronamic_ideal' ), |
||
| 117 | sprintf( |
||
| 118 | '<code>%s</code> <code>%s</code>', |
||
| 119 | '{order_id}', |
||
| 120 | '{payment_id}' |
||
| 121 | ), |
||
| 122 | sprintf( |
||
| 123 | /* translators: %s: {payment_id} */ |
||
| 124 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
| 125 | '{payment_id}' |
||
| 126 | ) |
||
| 127 | ), |
||
| 128 | ); |
||
| 129 | |||
| 130 | // Webhook. |
||
| 131 | $fields[] = array( |
||
| 132 | 'section' => 'omnikassa-2_feedback', |
||
| 133 | 'title' => __( 'Webhook URL', 'pronamic_ideal' ), |
||
| 134 | 'type' => 'text', |
||
| 135 | 'classes' => array( 'large-text', 'code' ), |
||
| 136 | 'value' => add_query_arg( 'omnikassa2_webhook', '', home_url( '/' ) ), |
||
| 137 | 'readonly' => true, |
||
| 138 | 'methods' => array( 'omnikassa-2' ), |
||
| 139 | 'tooltip' => __( 'The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
||
| 140 | ); |
||
| 141 | |||
| 142 | // Webhook status. |
||
| 143 | $fields[] = array( |
||
| 144 | 'section' => 'omnikassa-2_feedback', |
||
| 145 | 'methods' => array( 'omnikassa-2' ), |
||
| 146 | 'title' => __( 'Status', 'pronamic_ideal' ), |
||
| 147 | 'type' => 'description', |
||
| 148 | 'callback' => array( $this, 'feedback_status' ), |
||
| 149 | ); |
||
| 150 | |||
| 151 | return $fields; |
||
| 152 | } |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Transaction feedback status. |
||
| 156 | * |
||
| 157 | * @param array $field Settings field. |
||
| 158 | */ |
||
| 159 | public function feedback_status( $field ) { |
||
| 160 | $features = Gateway::get_supported_features(); |
||
| 161 | |||
| 162 | WebhookManager::settings_status( $field, $features ); |
||
| 163 | } |
||
| 164 | } |
||
| 165 |
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