Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Corrige chamadas diretas às propriedades do objeto order #130

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sfwill-dev
Copy link
Contributor

@sfwill-dev sfwill-dev commented Jul 16, 2020

Nas versões mais recentes do Woocommerce, ao realizar chamadas diretas às propriedades do objeto order, nós recebemos um aviso (notice). Exemplo:

Notice: id foi chamada incorretamente. Order properties should not be accessed directly.

Por mais que acabe funcionando, devido a funções de compatibilidade (link do repo do Woocommerce), alguns clientes já estão reclamando desse "erro".

Ao corrigir, o que antes era, por exemplo:

$order->id

fica:

$order->get_id()

Além disso, adicionei uma verificação de versão mínima do Woocommerce, já que pelo que entendi as funções mais recentes de get das propriedades foram incluídas na versão 3.0 (que é de 2017).

Obs.: Também tive que ajustar a url do teste de boleto, revertendo a alteração desse commit, devido ao "revert" que também rolou aqui na Pagar.me.

@sfwill-dev
Copy link
Contributor Author

Oi @claudiosanches tudo bem? Como pode ver, a verificação de versão mínima acabei fazendo em 2 arquivos, no arquivo principal do plugin e também no de template. Se tiver uma sugestão melhor por favor me avisa :)

@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch 2 times, most recently from 3b38f0b to 5ec3279 Compare July 16, 2020 03:25
@murilohns murilohns requested a review from claudiosanches July 30, 2020 14:20
@murilohns
Copy link
Contributor

@claudiosanches consegue dar uma força com esse review?

Copy link
Owner

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valeu pela força, no geral parece tudo bem, entretanto tem algumas coisas para corrigir.

includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
woocommerce-pagarme.php Outdated Show resolved Hide resolved
@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch 2 times, most recently from 489a495 to 691e698 Compare August 3, 2020 22:44
@sfwill-dev
Copy link
Contributor Author

Valeu pelos comentários @claudiosanches! Já fiz as mudanças :)

Copy link
Owner

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tem mais algumas correções que precisam ser feitas, já para usar tudo do CRUD.

includes/admin/views/html-notice-missing-woocommerce.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-api.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-banking-ticket-gateway.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-credit-card-gateway.php Outdated Show resolved Hide resolved
includes/class-wc-pagarme-my-account.php Outdated Show resolved Hide resolved
@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch from 691e698 to 46ac70f Compare August 7, 2020 13:30
@sfwill-dev
Copy link
Contributor Author

Boa @claudiosanches, feito!

@sfwill-dev
Copy link
Contributor Author

Oi @claudiosanches tudo bem? Consegue por favor dar uma força no review após minhas últimas alterações?

Copy link
Owner

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parece que só falta corrigir o nome, de resto parece que esta tudo certo.

@@ -246,17 +246,17 @@ public function generate_transaction_data( $order, $posted ) {
'amount' => $order->get_total() * 100,
'postback_url' => WC()->api_request_url( get_class( $this->gateway ) ),
'customer' => array(
'name' => trim( $order->billing_first_name . ' ' . $order->billing_last_name ),
'email' => $order->billing_email,
'name' => trim( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'name' => trim( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ),
'name' => $order->get_formatted_billing_full_name(),

@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch from 46ac70f to 0d19b64 Compare August 14, 2020 11:54
@sfwill-dev
Copy link
Contributor Author

Boa, obrigado @claudiosanches, fiz a alteração!

@sfwill-dev
Copy link
Contributor Author

Oi @claudiosanches tudo bem? Consegue por favor dar uma força nesse review / approve?

@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch 2 times, most recently from 1b829a0 to 0a18de5 Compare September 17, 2020 14:29
@sfwill-dev
Copy link
Contributor Author

Oi @claudiosanches tudo bem? Consegue por favor dar uma força nesse review / approve para a gente poder fazer o merge?

1 similar comment
@sfwill-dev
Copy link
Contributor Author

Oi @claudiosanches tudo bem? Consegue por favor dar uma força nesse review / approve para a gente poder fazer o merge?

@murilohns
Copy link
Contributor

@claudiosanches, você consegue dar uma força nesse PR? Seu review tá como Request changes ainda, mas o @willian-soaresferreira já alterou as coisas que você pediu

Além disso não seguimos em frente com ele por mexer em alguns pontos centrais do plugin, e gostaríamos muito do teu approve

@claudiosanches
Copy link
Owner

@murilohns consigo sim no final de semana.

@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch 2 times, most recently from 95e8e18 to cac2ca7 Compare November 19, 2020 20:02
@sfwill-dev sfwill-dev force-pushed the fix/direct-call-to-order-object-properties branch from cac2ca7 to b161f7c Compare November 19, 2020 20:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants