PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
← All changes | src/Admin/Validator.php +37 -0 3.0.0 → 3.1.0 View file →
@@ -166,8 +166,45 @@
166 166
167 167 return ['min' => $rmin, 'max' => $rmax];
168 168 }
169 169
170 + /**
171 + * Reject Scalapay min/max amounts (cents) that are inconsistent, or that widen beyond
172 + * what the PayPlug account currently authorizes (also in cents). The merchant can only
173 + * narrow the account's range, never widen it.
174 + *
175 + * @param $min
176 + * @param $max
177 + * @param $account_min
178 + * @param $account_max
179 + *
180 + * @return array{min: int, max: int}
181 + */
182 + public static function scalapay_thresholds($min, $max, $account_min, $account_max)
183 + {
184 + if ($min > $max) {
185 + http_response_code(200);
186 + wp_send_json_error([
187 + 'msg' => __('payplug_thresholds_scalapay_error_mintext_msg', 'payplug'),
188 + 'class' => 'error',
189 + 'title' => __('payplug_thresholds_scalapay_error_title', 'payplug'),
190 + 'close' => __('payplug_ok', 'payplug'),
191 + ]);
192 + }
193 +
194 + if ($min < $account_min || $max > $account_max) {
195 + http_response_code(200);
196 + wp_send_json_error([
197 + 'msg' => __('payplug_thresholds_scalapay_error_msg', 'payplug'),
198 + 'class' => 'error',
199 + 'title' => __('payplug_thresholds_scalapay_error_title', 'payplug'),
200 + 'close' => __('payplug_ok', 'payplug'),
201 + ]);
202 + }
203 +
204 + return ['min' => $min, 'max' => $max];
205 + }
206 +
170 207 public static function oney_product_animation($status)
171 208 {
172 209 if ($status) {
173 210 return true;