PluginProbe
PayPlug for WooCommerce (Official) / 2.0.1
PayPlug for WooCommerce (Official) v2.0.1
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 1.2.6 All 101 releases
payplug / src / Admin / Validator.php

Validator.php in PayPlug for WooCommerce (Official) 2.0.1, at src/Admin/Validator.php

174 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Payplug\PayplugWoocommerce\Admin;
4
5 class Validator {
6
7 public static function enabled($value) {
8
9 if ($value == 1){
10 return "yes";
11 }
12
13 if ($value == 0){
14 return "no";
15 }
16
17 http_response_code(400);
18 wp_send_json_error(['error' => 'enabled is missing']);
19 }
20
21 public static function mode($value) {
22 if ($value == 1){
23 return "no";
24 }
25
26 if ($value == 0){
27 return "yes";
28 }
29
30 http_response_code(400);
31 wp_send_json_error(['error' => 'mode is missing']);
32 }
33
34 public static function payment_method($value) {
35
36 if ( !empty($value) && in_array($value, ['redirect', 'popup']) ) {
37 return true;
38 }
39
40 http_response_code(400);
41 wp_send_json_error(['error' => 'payment_method is missing']);
42 }
43
44 public static function debug($value) {
45
46 if ($value == 1){
47 return "yes";
48 }
49
50 if ($value == 0){
51 return "no";
52 }
53
54 http_response_code(400);
55 wp_send_json_error(['error' => 'mode is missing']);
56
57 return "no";
58 }
59
60 public static function oneclick($value) {
61
62 if ($value == 1){
63 return "yes";
64 }
65
66 if ($value == 0){
67 return "no";
68 }
69
70 http_response_code(400);
71 wp_send_json_error(['error' => 'oneclick is missing']);
72 }
73
74 public static function bancontact($value, $test_mode) {
75
76 if($test_mode){
77 return "no";
78 }
79
80 if ($value == 1){
81 return "yes";
82 }
83
84 if ($value == 0){
85 return "no";
86 }
87
88 http_response_code(400);
89 wp_send_json_error(['error' => 'bancontact is missing']);
90 }
91
92 public static function apple_pay($value, $test_mode) {
93
94 if($test_mode){
95 return "no";
96 }
97
98 if ($value == 1){
99 return "yes";
100 }
101
102 if ($value == 0){
103 return "no";
104 }
105
106 http_response_code(400);
107 wp_send_json_error(['error' => 'apple pay is missing']);
108 }
109
110 public static function american_express($value, $test_mode) {
111
112 if($test_mode){
113 return "no";
114 }
115
116 if ($value == 1){
117 return "yes";
118 }
119
120 if ($value == 0){
121 return "no";
122 }
123
124 http_response_code(400);
125 wp_send_json_error(['error' => 'American Express is missing']);
126 }
127
128 public static function oney($value) {
129
130 if ($value == 1){
131 return "yes";
132 }
133
134 return "no";
135
136 http_response_code(400);
137 wp_send_json_error(['error' => 'oney is missing']);
138 }
139
140 public static function oney_type($value) {
141 if (isset($value) && !empty($value)) {
142 if (in_array($value, ['with_fees', 'without_fees'])) {
143 return true;
144 }
145 }
146 return false;
147 }
148
149 public static function oney_thresholds($min, $max) {
150
151 $rmin = 100;
152 $rmax = 3000;
153 if( $min > 99 && $min<$max){
154 $rmin = $min;
155 }
156
157 if( $max <= 3000 && $max>$min ){
158 $rmax = $max;
159 }
160
161 return array("min"=>$rmin, "max"=>$rmax);
162 }
163
164 public static function oney_product_animation($status){
165
166 if($status){
167 return "yes";
168 }else{
169 return "no";
170 }
171
172 }
173 }
174