Skip to content

Commit

Permalink
1cc changes for cache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulwahidsharief committed Jan 2, 2025
1 parent 5c413ca commit 1fdbfe4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
14 changes: 14 additions & 0 deletions includes/api/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ function cartResponse($couponCode){

$response['config'] = $razorpay->getDisplayConfig();

// Every hour post installation check
$getPostInstallationFlag = get_option('rzp_post_installation_update_at');
if (empty($getPostInstallationFlag) == false)
{
if ($getPostInstallationFlag + 3600 < time())
{
$razorpay->autoPostInstallationCheck();
}
}
else
{
$razorpay->autoPostInstallationCheck();
}

$response['enable_ga_analytics'] = get_option('woocommerce_razorpay_settings')['enable_1cc_ga_analytics'] === 'yes' ? true : false;
$response['enable_fb_analytics'] = get_option('woocommerce_razorpay_settings')['enable_1cc_fb_analytics'] === 'yes' ? true : false;

Expand Down
30 changes: 13 additions & 17 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ public function __construct($hooks = true)
(isset($_GET['tab']) === true) &&
($_GET['tab'] === 'checkout') &&
(isset($_GET['section']) === true) &&
($_GET['section'] === 'razorpay'))
($_GET['section'] === 'razorpay') &&
($checkout360Available !== 'yes'))
{
if (!empty($this->getSetting('key_id')) && !empty($this->getSetting('key_secret')))
{
Expand All @@ -485,6 +486,16 @@ public function __construct($hooks = true)
if (!empty($merchantPreferences['features']['one_click_checkout'])) {
$is1ccAvailable = true;
}
else
{
$optionKey = parent::get_option_key();
$razorpay_settings = get_option($optionKey);

$razorpay_settings['enable_1cc'] = 'no';
$razorpay_settings['enable_1cc_mini_cart_checkout'] = 'no';
$razorpay_settings['enable_1cc_pdp_checkout'] = 'no';
update_option($optionKey, apply_filters('woocommerce_settings_api_sanitized_fields_' . $this->id, $razorpay_settings), 'yes');
}

if (!empty($merchantPreferences['features']['one_cc_store_account'])) {
$isAccCreationAvailable = true;
Expand Down Expand Up @@ -1072,7 +1083,7 @@ public function newTrackPluginInstrumentation($key, $secret)

public function enqueue_checkout_js_script_on_checkout()
{
if (is_checkout())
if (is_checkout())
{
wp_enqueue_script(
'razorpay-checkout-js',
Expand Down Expand Up @@ -1385,21 +1396,6 @@ public function createOrGetRazorpayOrderId($order, $orderId, $is1ccCheckout = 'n
{
try
{
// Every hour post installation check
$getPostInstallationFlag = get_option('rzp_post_installation_update_at');
if (empty($getPostInstallationFlag) == false)
{
if ($getPostInstallationFlag + 3600 < time())
{
$this->autoPostInstallationCheck();
}
}
else
{
update_option('rzp_post_installation_update_at', $time);
$this->autoPostInstallationCheck();
}

return $this->createRazorpayOrderId($orderId, $sessionKey);
}
// For the bad request errors, it's safe to show the message to the customer.
Expand Down

0 comments on commit 1fdbfe4

Please sign in to comment.