Christmas Holiday Exception Patch - RWC-284, github issue #65

Error rendering macro 'jira' : null
release fixes several error handlers for both front and backend. The patch is also available from github, in issue #65.

  • getResursAjaxify for resursbank_get_payment_methods and resursbank_get_new_callbacks are now not blindly picking up the ajax return, but also checks if errors occurred during the requests. If the API's are down or timing out an error will be shown on screen. This feature is also mockable. If any exceptions occurs, no data will be updated nor removed from database.
  • When errors are sent through frontend calls we can add an element for where we want to show the error. If that element is missing, we will now instead display errors in console and as an alert, just to make sure noone misses important errors.
  • canMock can now specifically be set to not reset the mock=true setting on furst run, as this sometimes acts as a controller only before the mock is running. As of today, when running mocks it is canMock that is actually resetting the mocksetting in wp-admin before proceeding to the real mock feature, where it is normally not resetting. This is done since we want all mocks behave the same way. canMock is the one method that decides whether mocking can be performed or not.
  • API Tweaking: Custom SOAP URL added to configuration. We never got to use it, but we will leave it here, so that SOAP-calls can be redirected to other endpoints at Resurs on demand. This is only available for test environment today.
  • Added: mock_annuity_factor_config_exception, mock_get_payment_methods_exception and mock_get_empty_payment_methods_exception. The last of those three should probably be removed again as it is a very complex runner. However, with this function we discovered several places that potentially crashes the platform if the plugin is newly installed and no payment methods has yet been fetched from Resurs Bank. If this condition applies (i.e. no methods and a broken API), there will be generic problems that flows through wp-admin.
  • Also added mock_callback_update_exception for mocking the update button the same way as above.
  • getFieldMethodList has running filters that actively fetches payment methods from Resurs Bank instead of from the stored database (unless the storage is empty). This request among others covers values for "automatically debited payments" and is, during problems with API communications the least important feature that can be sacrificed in the wp-admin - instead of the alternative which crashes the platform during more serious problems.
  • Both annuity factors and payment methods are now not only catched but also forwarded to the template by "silent exceptions". This was never implemented fully since the mocking features stopped display data on "empty database" entirely and ran its regular exception notes in the template. We've also changed how data is returned from those requests and the plugin will always use stored information until it is manually updated. This gives us the opportunity to reach the admin panel even if the API is down, as locally stored data has higher priority than "always fetch new data on fly". API exceptions as of this patch will therefore rescue the local experience.
  • getAvailableAutoDebitMethods was, through the mocking features, discovered to run even during the local save-configuration. This is not necessary as it only updates a dropdown selector with available "auto debit metods". If it is requested, the primary function is to get from the local storage rather from a remote getPaymentMethods.
  • As api_soap_url is a part of the configuration the setup for the API has been restructured, to primary set the soapurl before setting up cache, etc. We've also added an extra check for the mock feature annuityFactorConfigException here, to - if mocked - clear out the content of $stored even if there is local data available (more details above).
  • On exceptions during payment/callback requests, no data will be reset to empty values. If there are exceptions in this process, and there are locally stored data the methods will fail over to this data first.
  • getAnnuityFactors has never used its stored data because of wrong typecheck in the function.
  • In getPaymentMethods, the huge section for getEmptyPaymentMethodsException should be considered if longer needed.
  • Thanks to the mocking we discovered that woocommerce internal request for getGatewaysFromPaymentMethods is also using parts of the above fixes. This means, if there is no local data available and getPaymentMethods and such API calls are down, this will cause huge problems with availability in at least wp-admin. We are now catching those errors and returning an empty gateway error if Resurs is unavailable.
  • One nonce message has been fixed: "The page security (nonce) is reportedly expired or wrong."