Support » Plugin: Wirecard WooCommerce Extension » False orderstatus after part refund

  • krut1

    (@krut1)


    If I do a part refund of the order (for example I refund 2 items of 4), then Wirecard WooCommerce Extension changes the status of the order to processing instead of refunded. The bug is here:

    /**
     * Update order with specific order state
     *
     * @param WC_Order $order
     * @param SuccessResponse $response
     *
     * @return WC_Order
     *
     * @since 1.0.0
     */
    public function update_order_state( $order, $response ) {
      $transaction_amount = $response->getData()['requested-amount'];
      switch ( $response->getTransactionType() ) {
        case 'capture-authorization':
        case 'debit':
        case 'purchase':
        case 'deposit':
          $state = 'processing';
          break;
        case 'void-authorization':
          $state = 'cancelled';
          break;
        case 'refund-capture':
        case 'refund-debit':
        case 'refund-purchase':
        case 'credit':
        case 'void-capture':
        case 'void-purchase':
          if ( ( $order->get_total() > $transaction_amount ) && ( $order->get_remaining_refund_amount() !== '0.00' ) ) {
            $state = 'processing';
          } else {
            $state = 'refunded';
          }
          break;
        case 'authorization':
        default:
          $state = 'authorization';
          break;
      }
      $order->update_status( $state, __( 'order_status_gateway_update', 'wirecard-woocommerce-extension' ) );
    
      return $order;
    }

    We have this problem on each CreditCard refund 🙁

    • This topic was modified 3 months ago by krut1.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.