PluginProbe ʕ •ᴥ•ʔ
Razorpay for WooCommerce / 4.2.0
Razorpay for WooCommerce v4.2.0
4.8.6 4.8.5 4.8.4 trunk 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.0-beta 1.6.1 1.6.2 1.6.3 1.6.5 2.0.0 2.0.1 2.1.0 2.2.0 2.3.0 2.3.1 2.3.2 2.4.0 2.4.1 2.4.2 2.4.3 2.5.0 2.6.0 2.7.0 2.7.1 2.7.2 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 3.0.0 3.0.1 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.1.0 4.2.0 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.4.0 4.4.1 4.4.2 4.4.3 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3
woo-razorpay / includes / utils.php
woo-razorpay / includes Last commit date
Errors 8 years ago api 3 years ago support 3 years ago debug.php 4 years ago plugin-instrumentation.php 3 years ago razorpay-route-actions.php 4 years ago razorpay-route.php 4 years ago razorpay-webhook.php 3 years ago state-map.php 4 years ago utils.php 3 years ago
utils.php
118 lines
1 <?php
2 /**
3 * controls visibility of 1cc buttons
4 * checks test mode, metrics collection config
5 * NOTE: we add additional check to see if the config field exists as it may cause issues
6 * during plugin updates
7 */
8
9 /**
10 * payment plugins are loaded even if they are disabled which triggers the 1cc button flow
11 * we need to check if the plugin is disabled
12 */
13 function isRazorpayPluginEnabled()
14 {
15 return (
16 empty(get_option('woocommerce_razorpay_settings')['enabled']) === false
17 && 'yes' == get_option('woocommerce_razorpay_settings')['enabled']
18 );
19 }
20
21 function isTestModeEnabled()
22 {
23 return (
24 empty(get_option('woocommerce_razorpay_settings')['enable_1cc_test_mode']) === false
25 && 'yes' == get_option('woocommerce_razorpay_settings')['enable_1cc_test_mode']
26 );
27 }
28
29 function is1ccEnabled()
30 {
31 return (
32 empty(get_option('woocommerce_razorpay_settings')['enable_1cc']) === false
33 && 'yes' == get_option('woocommerce_razorpay_settings')['enable_1cc']
34 );
35 }
36
37 function isProductSupported()
38 {
39
40 }
41
42 function isCartSupported()
43 {
44
45 }
46
47 function isDebugModeEnabled()
48 {
49 return (
50 empty(get_option('woocommerce_razorpay_settings')['enable_1cc_debug_mode']) === false
51 && 'yes' == get_option('woocommerce_razorpay_settings')['enable_1cc_debug_mode']
52 );
53 }
54
55 function isPdpCheckoutEnabled()
56 {
57 return (
58 empty(get_option('woocommerce_razorpay_settings')['enable_1cc_pdp_checkout']) === false
59 && 'yes' == get_option('woocommerce_razorpay_settings')['enable_1cc_pdp_checkout']
60 );
61 }
62
63 function isMiniCartCheckoutEnabled()
64 {
65 return (
66 empty(get_option('woocommerce_razorpay_settings')['enable_1cc_mini_cart_checkout']) === false
67 && 'yes' == get_option('woocommerce_razorpay_settings')['enable_1cc_mini_cart_checkout']
68 );
69 }
70
71 function isMandatoryAccCreationEnabled()
72 {
73 return (
74 empty(get_option('woocommerce_razorpay_settings')['1cc_account_creation']) === false
75 && 'yes' == get_option('woocommerce_razorpay_settings')['1cc_account_creation']
76 );
77 }
78 function validateInput($route, $param)
79 {
80 $failure_reason = null;
81
82 switch ($route) {
83 case 'list':
84 if (empty(sanitize_text_field($param['amount'])) === true) {
85 $failure_reason = 'Field amount is required.';
86 }
87 break;
88
89 case 'apply':
90 if (empty(sanitize_text_field($param['code'])) === true) {
91 $failure_reason = 'Field code is required.';
92
93 } elseif (empty(sanitize_text_field($param['order_id'])) === true) {
94
95 $failure_reason = 'Field order id is required.';
96
97 }
98 break;
99
100 case 'shipping':
101 if (empty(sanitize_text_field($param['order_id'])) === true) {
102 $failure_reason = 'Field order id is required.';
103
104 } elseif (empty($param['addresses']) === true) {
105
106 $failure_reason = 'Field addresses is required.';
107
108 }
109 break;
110
111 default:
112
113 break;
114 }
115
116 return $failure_reason;
117 }
118