Skip to content

Commit

Permalink
suffixed transient
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulwahidsharief committed Jan 2, 2025
1 parent 6d6764e commit 587f894
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions woo-razorpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,26 +456,25 @@ public function __construct($hooks = true)
$is1ccAvailable = false;
$isAccCreationAvailable = false;
$merchantPreferences = [];
$checkout360Available = get_option('rzp_checkout360_status');
$checkout360Available = get_option('rzp_checkout360_status', "");

$merchantPreferences = get_transient(self::ONE_CC_MERCHANT_PREF);
$merchantPreferences = get_transient(self::ONE_CC_MERCHANT_PREF . "_" . $checkout360Available);

// Load preference API call only for administrative interface + razorpay payment settings page.
if (current_user_can('administrator') &&
(empty($merchantPreferences['features']['one_click_checkout']) === true) &&
(isset($_GET['tab']) === true) &&
($_GET['tab'] === 'checkout') &&
(isset($_GET['section']) === true) &&
($_GET['section'] === 'razorpay') &&
($checkout360Available !== 'yes'))
($_GET['section'] === 'razorpay'))
{
if (!empty($this->getSetting('key_id')) && !empty($this->getSetting('key_secret')))
{
try {

$api = $this->getRazorpayApiInstance();
$merchantPreferences = $api->request->request('GET', 'merchant/1cc_preferences');
set_transient( self::ONE_CC_MERCHANT_PREF, $merchantPreferences, 7200 );
set_transient( self::ONE_CC_MERCHANT_PREF . "_" . $checkout360Available, $merchantPreferences, 7200 );

} catch (\Exception $e) {
rzpLogError($e->getMessage());
Expand Down

0 comments on commit 587f894

Please sign in to comment.