Implementing deprecated filters
If you for some strange reason would like to implement filters that has been used in the old plugin, implementation should look like this. In this live example, you actually execute the deprecated filter before executing the up-to-date one. Doing this, you get the chance to inject old values on the way through the new filter.
$deprecatedStoreId = WordPress::applyFiltersDeprecated('set_storeid', null); $storeId = (int)WordPress::applyFilters('setStoreId', $deprecatedStoreId);
Implemented and available filters
This plugin offers a bunch of internal filters and actions. Below is a list of them.
Filter name | Type | In | Return | Description |
---|---|---|---|---|
rbwc_admin_dynamic_content | filter | $content $current_section | $yourContent | Renders dynamic content for each section. If something specific, that is not included in the form fields, this could be used and will be appended in the bottom of each section. |
rbwc_get_dependent_settings | filter | $currentArray | $yourArray | If settings are dependent of other activated options in the configuration, this filter should be used. The plugin use this internally, to enable/disable the developer-options tab. |
rbwc_get_plugin_information | filter | $content | $yourContent | Content added to this section will be shown in the information/support, as a part of the "version view". If you for example need to show openssl releases or other vital data for your platform, you should add it here. Example: [ 'OpenSSL version' => defined('OPENSSL_VERSION_TEXT') ? OPENSSL_VERSION_TEXT : '' ] |
rbwc_can_display_order_info_after_details | filter | boolean | boolean | rbwc_can_display_order_info_after_<WHERE> The can_display-trio is used to disable each payment info section in the admin view. The details section also has a separate action that triggers instead of the standard action from woocommerce. That action delivers all payment information required to recreate the "bluebox information" from v2.x. |
rbwc_show_order_details | action | $orderData | Is echo | This action is executed right after the rbwc_can_display_order_info_after_details-filter. By disabling the three can_display_order_info and execute this hook with a full order representation, it is possible to create your own view right after the order details in the admin. This is pushed in here, in case the future requires a different view from this plugin. |
rbwc_can_display_order_info_after_billing | filter | boolean | boolean | rbwc_can_display_order_info_after_<WHERE> The can_display-trio is used to disable each payment info section in the admin view. |
rbwc_can_display_order_info_after_shipping | filter | boolean | boolean | rbwc_can_display_order_info_after_<WHERE> The can_display-trio is used to disable each payment info section in the admin view. |
rbwc_get_payment_field_size | filter | $size, $fieldName | integer | If you believe you need a shorter or longer value for the default payment field lenght, that is set to 24, you can apply for that value here. |
rbwc_can_process_order | action | WC_Order | Is action | This is not a filter that returns a true or false value - if developers or other plugins for example needs to stop something before process_order initialized a payment for Resurs Bank, this is a place to push out an exception. Any exception thrown here will reflect back to the checkout and show that exception as a custom error message. |
rbwc_can_process_order_response | filter | array | array | Specially designed responses that occurs during process_payment. In short, the event that happens here are after a successful payment. Currently the plugin uses this part itself to approve and redirect to success when RCO is in use. See example below: public function canProcessOrderResponse($return, $order) { $returnUrl = WC_Payment_Gateway::get_return_url($order); if (Data::getCheckoutType() === ResursDefault::TYPE_RCO) { // Updating the required response without cleaning the rest. $return['result'] = 'success'; $return['redirect'] = $returnUrl; } return $return; } |
rbwc_prefer_article_number_sku | filter | boolean | boolean | If you have further requirements of how article numbers are fetched, you could return true for this, to make the plugin use Sku instead - if it exists. Currently not fully implemented. |
rbwc_get_article_number | filter | $currentArticleNumber, WC_Product | $theArticleNumber | If you have further ways of fetching an article from a WC_Product object, this is where you do it. |
rbwc_coupons_ex_tax | filter | boolean, WC_Coupon | boolean | For special occasions when the options should remain untouched but we still need to make exceptions for coupons. |
rbwc_get_coupon_vat_pct | filter | integer | integer | Default value for vat percent in the coupon calculcation method is 0. Coupons are normally, at least in Sweden, already applied with vat. |
rbwc_get_address_disabled | filter | boolean | boolean | Disable getAddress form in checkout (where it is implementable). |
rbwc_js_loaders_checkout | filter | array | array | List of javascripts (frameworks?) that should be loaded during RCO. |
rbwc_get_shipping_name | filter | string | string | Generates own article number for shipping if the default "shipping" is not preferred, or if another translation is needed. |
rbwc_get_shipping_description | filter | string | string | Generates a orderline description for the shipping, if the preferred translation for "Shipping" is not preferred. |
rbwc_set_store_id | filter | string | string | Set a store id for the payment request. |
rbwc_trigger_callback | filter | array | array | External code to handle test callbacks. |
rbwc_get_address_field_controller | filter | array | array | getTransformedAddressResponse, ability to use other fields than the defaults, generated by the internal filter. |
rbwc_get_address_button_text | filter | string | string | Alternative naming or translation for the getAddress request button. Default is "Get address". |
resurs_trigger_test_callback | filter | string | string | External trigger for the test callback. |
set_storeid | filter | string | string | Store id, old filter. |
resurs_getaddress_enabled | filter | boolean | boolean | Sets, in the old fashioned way, a state if getAddress should be enabled where it is normally disabled. |