public static function getInstance()
 {
     if (self::$_instance === false) {
         self::$_instance = new Cart66CheckoutThrottle();
     }
     return self::$_instance;
 }
Example #2
0
         }
     }
     $jqErrors = $gateway->getJqErrors();
     // Error info for client side error code
 }
 if (count($errors) == 0) {
     // Calculate final billing amounts
     $taxLocation = $gateway->getTaxLocation();
     $tax = $gateway->getTaxAmount();
     $total = Cart66Session::get('Cart66Cart')->getGrandTotal() + $tax;
     $subscriptionAmt = Cart66Session::get('Cart66Cart')->getSubscriptionAmount();
     $oneTimeTotal = $total - $subscriptionAmt;
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Tax: {$tax} | Total: {$total} | Subscription Amount: {$subscriptionAmt} | One Time Total: {$oneTimeTotal}");
     // Throttle checkout attempts
     if (!Cart66Session::get('Cart66CheckoutThrottle')) {
         Cart66Session::set('Cart66CheckoutThrottle', Cart66CheckoutThrottle::getInstance(), true);
     }
     try {
         if (!Cart66Session::get('Cart66CheckoutThrottle')->isReady($gateway->getCardNumberTail(), $oneTimeTotal)) {
             Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Unable to process order: " . print_r($errors, true));
             throw new Cart66Exception(__('Your order could not be processed for the following reasons:', 'cart66'), 66500);
         }
     } catch (Cart66Exception $e) {
         $exception = Cart66Exception::exceptionMessages($e->getCode(), $e->getMessage(), array(__("You must wait ", "cart66") . Cart66Session::get('Cart66CheckoutThrottle')->getTimeRemaining() . __(" more seconds before trying to checkout again.", "cart66")));
         echo Cart66Common::getView('views/error-messages.php', $exception);
         $errors[] = "";
         // Add an error so that the transaction will not be processed
     }
 }
 // Charge credit card for one time transaction using Authorize.net API
 if (count($errors) == 0 && !Cart66Session::get('Cart66InventoryWarning')) {