Plugin Directory

Changeset 3469936


Ignore:
Timestamp:
02/26/2026 06:48:30 AM (5 weeks ago)
Author:
fxholl
Message:

Fix: Added order notes safety check to prevent duplicate points

Location:
kiskadi/trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kiskadi/trunk/includes/integration/woocommerce/class-order-status.php

    r3253078 r3469936  
    4343        if ( false === $is_transactions_enable ) {
    4444            return;
     45        }
     46
     47        // Busca todas as notas (internas e para o cliente)
     48        $notes = wc_get_order_notes( array(
     49            'order_id' => $order_id,
     50            'type'     => 'any'
     51        ) );
     52
     53        // Verifica se existem notas e se o retorno é um array
     54        if ( ! empty( $notes ) && is_array( $notes ) ) {
     55            foreach ( $notes as $note ) {
     56                // Se encontrar qualquer rastro da Kiskadi, interrompe a execução
     57                if ( strpos( $note->content, 'Kiskadi:' ) !== false ) {
     58                    return;
     59                }
     60            }
    4561        }
    4662
  • kiskadi/trunk/includes/transaction/transformer/class-transaction-api-transformer.php

    r2800910 r3469936  
    3232
    3333        return array(
    34             'consumer'    => $consumer_array,
    35             'spent_value' => $this->transaction_data->spent_value(),
    36             'branch_id'   => $branch->id(),
    37             'products'    => $product_array,
     34            'consumer'          => $consumer_array,
     35            'spent_value'       => $this->transaction_data->spent_value(),
     36            'document_number'   => $this->transaction_data->document_number(),
     37            'sale_date'         => $this->transaction_data->sale_date(),
     38            'branch_id'         => $branch->id(),
     39            'products'          => $product_array,
    3840        );
    3941    }
Note: See TracChangeset for help on using the changeset viewer.