• Administrator or a Shop Manager user attempt to refund an amount of an Order in status “Processing”: “Your role is not allowed to refund via Wordline Online Checkout”.

    WP 6.8.1, Woo 9.8.5 (no HPOS), Wordline Online Checkout 8.0.0.

    Downgrading to Wordline Online Checkout 7.1.1 fixes the problem immediately.

    • This topic was modified 8 months, 2 weeks ago by Knut Sparhell.
Viewing 2 replies - 1 through 2 (of 2 total)
  • I think this is where things go wrong:

    public function process_refund( $order_id, $amount = null, $reason = ” ) {

    $user = wp_get_current_user();
    if ( ! in_array( $this->rolecapturerefunddelete, $user->roles, true ) || ! in_array( ‘administrator’, $user->roles, true ) ) {
    // The user can only view the data.
    return new WP_Error( ‘notpermitted’, __( ‘Your user role is not allowed to refund via Worldline Online Checkout’, ‘bambora-online-checkout’ ) );
    }

    The user needs to have role ‘administrator’ and the settings must be set to ‘administrator’. Anything else leads to WP_Error.

    A developer of this plugin could maybe change || to &&

    Thread Starter Knut Sparhell

    (@knutsp)

    Additional info: In the setting “User role for access to capture/refund/delete” teh “Shop Manager” role is selected. The problem occurs for the Administrator.

    Thank you @teknikjg for the suggestion. The current logic is weird. I changed || to && and it works. This will limit the access to users with either the designated role or being an administrator, actually only returns error when user does not have the designated role and also not being an administrator.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Refund not allowed’ is closed to new replies.