/**
  * Force a page refresh when an order is updated to have a zero total and we're not using the "login app" mode.
  *
  * This ensures that the standard WC checkout form is rendered.
  */
 public function force_standard_mode_refresh_with_zero_order_total($cart)
 {
     // Avoid constant reload loop in the event we've forced a checkout refresh
     if (!is_ajax()) {
         unset(WC()->session->reload_checkout);
     }
     // Login app mode can handle zero-total orders
     if ('yes' === $this->settings['enable_login_app']) {
         return;
     }
     if (!$this->gateway->is_available()) {
         return;
     }
     // Get the previous cart total
     $previous_total = WC()->session->wc_amazon_previous_total;
     // Store the current total
     WC()->session->wc_amazon_previous_total = $cart->total;
     // If the total is non-zero, and we don't know what the previous total was, bail.
     if (is_null($previous_total) || $cart->needs_payment()) {
         return;
     }
     // This *wasn't* as zero-total order, but is now
     if ($previous_total > 0) {
         // Force reload, re-rendering standard WC checkout form
         WC()->session->reload_checkout = true;
     }
 }
 /**
  * Enforce: "Amazon imposes a $500 per calendar month limit on the amount of funds you can charge a buyer."
  * See: https://payments.amazon.com/documentation/automatic/201752090#201757640
  *
  * @return bool
  */
 function is_available()
 {
     $is_available = parent::is_available();
     if ($is_available && WC_Subscriptions_Cart::cart_contains_subscription()) {
         $potential_monthly_max = $this->calculate_potential_monthly_maximum_payment_in_cart();
         if ($potential_monthly_max > 500) {
             return false;
         }
     }
     return $is_available;
 }