From 77cbbba0204a77fd7be52732d3699201c196e8ab Mon Sep 17 00:00:00 2001 From: stenioanibal Date: Thu, 30 Jul 2020 16:35:08 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Corrige=20bill=5Fitems=20inv=C3=A1lido=20qu?= =?UTF-8?q?ando=20a=20quantidade=20n=C3=A3o=20=C3=A9=20um=20valor=20inteir?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Para produtos em que uma caixa, por exemplo, representa 1.5 metros quadrados e o múltiplo de venda ocorre em cima dessa quantidade, o módulo não consegue processar o pagamento pelo fato de que a API apenas aceita um número inteiro na quantidade do produto. --- includes/class-vindi-payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-vindi-payment.php b/includes/class-vindi-payment.php index 930e686..868def6 100755 --- a/includes/class-vindi-payment.php +++ b/includes/class-vindi-payment.php @@ -487,7 +487,7 @@ protected function build_discount_item_for_bill() $item = $this->container->api->find_or_create_product("Cupom de desconto", 'wc-discount'); $discount_item = array( 'type' => 'discount', - 'vindi_id' => $item['id'], + 'vindi_id' => ceil($item['id']), 'price' => (float) $total_discount * -1, 'qty' => 1 ); From 41faf57ecb692e97b0ca8c22603e8a5215b6ae2b Mon Sep 17 00:00:00 2001 From: stenioanibal Date: Sat, 1 Aug 2020 13:46:04 -0300 Subject: [PATCH 2/2] Desfaz commit incorreto e aplica o arredondamento na quantidade O arredondamento havia sido inserido no local errado aqui no github. Este commit remove esse problema e coloca o mesmo no local correto, arredondando a quantidade dos produtos para a bill. --- includes/class-vindi-payment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-vindi-payment.php b/includes/class-vindi-payment.php index 868def6..e1467a2 100755 --- a/includes/class-vindi-payment.php +++ b/includes/class-vindi-payment.php @@ -487,7 +487,7 @@ protected function build_discount_item_for_bill() $item = $this->container->api->find_or_create_product("Cupom de desconto", 'wc-discount'); $discount_item = array( 'type' => 'discount', - 'vindi_id' => ceil($item['id']), + 'vindi_id' => $item['id'], 'price' => (float) $total_discount * -1, 'qty' => 1 ); @@ -499,7 +499,7 @@ protected function build_product_items_for_bill($order_item) { $item = array( 'product_id' => $order_item['vindi_id'], - 'quantity' => $order_item['qty'], + 'quantity' => ceil($order_item['qty']), 'pricing_schema' => array( 'price' => $order_item['price'], 'schema_type' => 'per_unit'