diff --git a/Block/Payment/Info/Billet.php b/Block/Payment/Info/Billet.php
index 525cd58f..e0df67a9 100644
--- a/Block/Payment/Info/Billet.php
+++ b/Block/Payment/Info/Billet.php
@@ -78,6 +78,7 @@ private function getBoletoLinkFromOrder($info)
$orderRepository = new OrderRepository();
$order = $orderRepository->findByPagarmeId(new OrderId($orderId));
+ $boletoUrl = null;
if ($order !== null) {
$charges = $order->getCharges();
@@ -145,6 +146,11 @@ public function getTransactionInfo()
* @var \Pagarme\Core\Kernel\Aggregates\Order orderObject
*/
$orderObject = $orderService->getOrderByPagarmeId(new OrderId($orderPagarmeId));
+
+ if ($orderObject === null) {
+ return [];
+ }
+
return $orderObject->getCharges()[0]->getLastTransaction();
}
}
diff --git a/Block/Payment/Info/BilletCreditCard.php b/Block/Payment/Info/BilletCreditCard.php
index 8125d32f..ceaff674 100644
--- a/Block/Payment/Info/BilletCreditCard.php
+++ b/Block/Payment/Info/BilletCreditCard.php
@@ -139,6 +139,7 @@ private function getBoletoLinkFromOrder($info)
$orderRepository = new OrderRepository();
$order = $orderRepository->findByPagarmeId(new OrderId($orderId));
+ $boletoUrl = null;
if ($order !== null) {
$charges = $order->getCharges();
@@ -194,11 +195,15 @@ public function getTransactionInfo()
* @var \Pagarme\Core\Kernel\Aggregates\Order orderObject
*/
$orderObject = $orderService->getOrderByPagarmeId(new OrderId($orderPagarmeId));
+ $transactionList = [];
+
+ if ($orderObject === null) {
+ return [];
+ }
$lastTransaction = $orderObject->getCharges()[0]->getLastTransaction();
$secondLastTransaction = $orderObject->getCharges()[1]->getLastTransaction();
- $transactionList = [];
foreach ([$lastTransaction, $secondLastTransaction] as $item) {
if ($item->getAcquirerNsu() != 0) {
$transactionList['creditCard'] =
diff --git a/Block/Payment/Info/CreditCard.php b/Block/Payment/Info/CreditCard.php
index f782c215..5325bd14 100644
--- a/Block/Payment/Info/CreditCard.php
+++ b/Block/Payment/Info/CreditCard.php
@@ -87,6 +87,10 @@ public function getTransactionInfo()
*/
$orderObject = $orderService->getOrderByPagarmeId(new OrderId($orderPagarmeId));
+ if ($orderObject === null) {
+ return [];
+ }
+
return array_merge(
$orderObject->getCharges()[0]->getAcquirerTidCapturedAndAutorize(),
['tid' => $this->getTid($orderObject->getCharges()[0])]
diff --git a/Block/Payment/Info/Pix.php b/Block/Payment/Info/Pix.php
index 9c5f6061..4c95204b 100644
--- a/Block/Payment/Info/Pix.php
+++ b/Block/Payment/Info/Pix.php
@@ -71,6 +71,11 @@ public function getTransactionInfo()
* @var Order orderObject
*/
$orderObject = $orderService->getOrderByPagarmeId(new OrderId($orderPagarmeId));
+
+ if ($orderObject === null) {
+ return [];
+ }
+
return $orderObject->getCharges()[0]->getLastTransaction();
}
}
diff --git a/Block/Payment/Info/TwoCreditCard.php b/Block/Payment/Info/TwoCreditCard.php
index b71e23df..25de36bc 100644
--- a/Block/Payment/Info/TwoCreditCard.php
+++ b/Block/Payment/Info/TwoCreditCard.php
@@ -116,6 +116,10 @@ public function getTransactionInfo()
*/
$orderObject = $orderService->getOrderByPagarmeId(new OrderId($orderPagarmeId));
+ if ($orderObject === null) {
+ return [];
+ }
+
return [
'card1' => array_merge(
$orderObject->getCharges()[0]->getAcquirerTidCapturedAndAutorize(),
diff --git a/composer.json b/composer.json
index a21e6554..0dc3bbdb 100755
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "pagarme/pagarme-magento2-module",
"license": "MIT",
- "version": "1.2.0",
+ "version": "1.2.1",
"type": "magento2-module",
"description": "Magento 2 Module Pagar.me",
"require": {
diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml
index c615426c..84ba97ba 100644
--- a/etc/csp_whitelist.xml
+++ b/etc/csp_whitelist.xml
@@ -6,11 +6,13 @@
https://api.mundipagg.com
+ https://api.pagar.me
https://cdn.mundipagg.com
+ https://api.pagar.me
diff --git a/etc/module.xml b/etc/module.xml
index 353388bb..df72ad5d 100755
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -9,7 +9,7 @@
*/
-->
-
+
diff --git a/view/adminhtml/templates/info/billetCreditCard.phtml b/view/adminhtml/templates/info/billetCreditCard.phtml
index 880b2a70..a8cb2a72 100644
--- a/view/adminhtml/templates/info/billetCreditCard.phtml
+++ b/view/adminhtml/templates/info/billetCreditCard.phtml
@@ -4,7 +4,10 @@
* @var \Pagarme\Core\Kernel\Aggregates\Transaction $lastTransaction
*/
$lastTransactions = $this->getTransactionInfo();
-$postDataBillet = (json_decode($lastTransactions['billet']->getPostData()->tran_data, true));
+$postDataBillet = null;
+if (array_key_exists('billet', $lastTransactions)) {
+ $postDataBillet = (json_decode($lastTransactions['billet']->getPostData()->tran_data, true));
+}
?>
getCcType()): ?>
getTitle()); ?>
@@ -32,7 +35,9 @@ $postDataBillet = (json_decode($lastTransactions['billet']->getPostData()->tran_
= __('NSU from capture'); ?>: = $lastTransactions['creditCard']['captured'] ?>
- = __('TID'); ?>: = $lastTransactions['creditCard']['tid'] ?>
+
+ = __('TID'); ?>: = $lastTransactions['creditCard']['tid'] ?>
+