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/Ajax.php +22 -0 3.0.0 → 3.1.0 View file →
@@ -654,8 +654,30 @@
654 654 'max' => (int) $data['oney_max_amounts'] * 100,
655 655 ]);
656 656 $options['payment_methods']['configuration']['oney']['with_fees'] = 'with_fees' == (string) $data['payplug_oney'];
657 657
658 + // scalapay payment - the thresholds widget isn't necessarily rendered (a stale admin
659 + // JS bundle right after a deploy, for instance). Its absence must not reach
660 + // Validator::scalapay_thresholds(), which would read the missing values as 0, fail
661 + // the "below the account minimum" check and abort the whole request via
662 + // wp_send_json_error() - discarding every other setting in this save, since
663 + // update_options() only runs at the end of this method.
664 + if (array_key_exists('scalapay_min_amounts', $data) && array_key_exists('scalapay_max_amounts', $data)) {
665 + [$scalapay_authorized_min, $scalapay_authorized_max] = Scalapay::authorized_bounds(
666 + $options['payment_methods']['configuration']['scalapay'] ?? [],
667 + $options['payment_methods']['permissions']['scalapay']['amounts'] ?? '{}'
668 + );
669 + // round() before the cast: the submitted values are euros, so a bare (int) cast
670 + // would bind tighter than the * 100 and truncate the cents (49.99 -> 4900).
671 + $scalapay_thresholds = Validator::scalapay_thresholds(
672 + (int) round((float) $data['scalapay_min_amounts'] * 100),
673 + (int) round((float) $data['scalapay_max_amounts'] * 100),
674 + $scalapay_authorized_min,
675 + $scalapay_authorized_max
676 + );
677 + $options['payment_methods']['configuration']['scalapay']['custom_amounts'] = json_encode($scalapay_thresholds);
678 + }
679 +
658 680 // Force-disable methods unavailable in test mode: submitted 'active' flags are
659 681 // trusted as-is, so one enabled while in live mode stays active after just
660 682 // switching to test unless we re-check it here.
661 683 if (!$options['mode']) {