From ce1f487f1c617b56909812c1b7f17438a0139e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20M=C3=A1zala?= Date: Mon, 2 Oct 2017 16:04:38 -0300 Subject: [PATCH 01/71] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 98dca87..8798fb9 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { - "name": "pagseguro/magento2", + "name": "pedromazala/magento2", "type": "magento2-module", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "php": "~5.5.0|~5.6.0|~7.0.0", + "php": ">=5.5", "pagseguro/pagseguro-php-sdk": "3.*" }, "autoload": { From e008e7a0c639543e5d3067c8ecae883200b5813d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20M=C3=A1zala?= Date: Mon, 2 Oct 2017 16:50:54 -0300 Subject: [PATCH 02/71] Update composer.json Changing validation of php version. There was a problem using version 7.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8798fb9..4c87c73 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "pedromazala/magento2", + "name": "pagseguro/magento2", "type": "magento2-module", "license": [ "OSL-3.0", From e76d9c860b54a47502fcda5c518d388851fd8165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20M=C3=A1zala?= Date: Mon, 2 Oct 2017 16:53:02 -0300 Subject: [PATCH 03/71] Update README.md the command `chmod` in MacOS need to have `-R` param first --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e5556eb..685afe1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Requisitos ---------- --- - [Magento] Community 2.0 | 2.1 - - [PHP] 5.5.0+ + - [PHP] 5.5+ - [SPL] - [cURL] - [DOM] @@ -34,7 +34,7 @@ Navegue até o diretório raíz da sua instalação do Magento 2 e siga os segui - ```php bin/magento setup:upgrade``` - ```php bin/magento setup:static-content:deploy``` ou ```php bin/magento setup:static-content:deploy pt_BR```, de acordo com as configurações da sua loja. 3. Dê permissões as pastas var/ pub/ - - ```chmod 777 -R var/ pub/``` + - ```chmod -R 777 var/ pub/``` Atualização From 5c372844d224d208ab72cd2f441773dfec32d52f Mon Sep 17 00:00:00 2001 From: Thales San <6105762+thalessan@users.noreply.github.com> Date: Tue, 23 Jan 2018 09:59:10 -0200 Subject: [PATCH 04/71] Fix resources structure on acl file --- etc/acl.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/acl.xml b/etc/acl.xml index b423ff9..4ae6c54 100755 --- a/etc/acl.xml +++ b/etc/acl.xml @@ -1,13 +1,15 @@ - - - - - - - + + + + + + + + + - + From c1d46b4813d4b476e3d0b251ca0d3b1755eeef36 Mon Sep 17 00:00:00 2001 From: Thiago-Medeiros Date: Thu, 8 Feb 2018 09:44:49 -0200 Subject: [PATCH 05/71] fix: Cache of checkout page (lightbox) --- view/frontend/layout/pagseguro_payment_checkout.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/frontend/layout/pagseguro_payment_checkout.xml b/view/frontend/layout/pagseguro_payment_checkout.xml index 4e40447..6160a46 100755 --- a/view/frontend/layout/pagseguro_payment_checkout.xml +++ b/view/frontend/layout/pagseguro_payment_checkout.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file From 735ab302170ba107ea6c463bdd860ffc7e5130bc Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:28:49 -0300 Subject: [PATCH 06/71] Update Abandoned.php --- Model/Transactions/Methods/Abandoned.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Model/Transactions/Methods/Abandoned.php b/Model/Transactions/Methods/Abandoned.php index f3f0fab..acf7fc1 100755 --- a/Model/Transactions/Methods/Abandoned.php +++ b/Model/Transactions/Methods/Abandoned.php @@ -106,7 +106,6 @@ class Abandoned extends Method */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, - \Magento\Framework\App\ResourceConnection $resourceConnection, \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Backend\Model\Session $session, @@ -463,4 +462,4 @@ private function setSent($orderId, $sent) $mapsDeleteQuery = "UPDATE {$tableName} SET sent={$sent} WHERE order_id={$orderId}"; $connection->query($mapsDeleteQuery); } -} \ No newline at end of file +} From a2cfc28e00a942e7b613bf91e29922d903d37341 Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:30:18 -0300 Subject: [PATCH 07/71] Update Cancellation.php --- Model/Transactions/Methods/Cancellation.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Model/Transactions/Methods/Cancellation.php b/Model/Transactions/Methods/Cancellation.php index c13bac2..4052207 100755 --- a/Model/Transactions/Methods/Cancellation.php +++ b/Model/Transactions/Methods/Cancellation.php @@ -94,7 +94,6 @@ class Cancellation extends Method */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, - \Magento\Framework\App\ResourceConnection $resourceConnection, \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Backend\Model\Session $session, \Magento\Sales\Model\Order $order, From cd69b670a084e097e3ac8d4f5a3ab669b00b8525 Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:31:04 -0300 Subject: [PATCH 08/71] Update Conciliation.php --- Model/Transactions/Methods/Conciliation.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Model/Transactions/Methods/Conciliation.php b/Model/Transactions/Methods/Conciliation.php index 5e7781f..26f41f7 100755 --- a/Model/Transactions/Methods/Conciliation.php +++ b/Model/Transactions/Methods/Conciliation.php @@ -94,7 +94,6 @@ class Conciliation extends Method */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, - \Magento\Framework\App\ResourceConnection $resourceConnection, \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Backend\Model\Session $session, \Magento\Sales\Model\Order $order, From 76eca9bac6d4365928beb6ddfd203e36f9dfc2eb Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:31:47 -0300 Subject: [PATCH 09/71] Update Refund.php --- Model/Transactions/Methods/Refund.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Model/Transactions/Methods/Refund.php b/Model/Transactions/Methods/Refund.php index 25eaf18..273c768 100755 --- a/Model/Transactions/Methods/Refund.php +++ b/Model/Transactions/Methods/Refund.php @@ -94,7 +94,6 @@ class Refund extends Method */ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, - \Magento\Framework\App\ResourceConnection $resourceConnection, \Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Backend\Model\Session $session, \Magento\Sales\Model\Order $order, From f0b49915a53b87d76447f3292cbdc21b4408fdab Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:35:19 -0300 Subject: [PATCH 10/71] Update direct-payment-validator.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Para corrigir o erro do Firefox, no entanto, não consigo resolver o problema de não conseguir deletar caracteres --- .../web/js/model/direct-payment-validator.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/view/frontend/web/js/model/direct-payment-validator.js b/view/frontend/web/js/model/direct-payment-validator.js index 93b9f04..e80db39 100644 --- a/view/frontend/web/js/model/direct-payment-validator.js +++ b/view/frontend/web/js/model/direct-payment-validator.js @@ -254,7 +254,7 @@ function displayError(target, error = true) { * @param {this} document * @returns {bool} */ -function documentMask(document) { +function documentMask(document, event) { if (document.value.length < 14 || (document.value.length == 14 && (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 46)) ) { @@ -274,7 +274,7 @@ function documentMask(document) { * @param {type} cnpj * @returns {Boolean} */ -function MascaraCNPJ(cnpj) { +function MascaraCNPJ(cnpj, event) { if (mascaraInteiro(cnpj) == false) { event.returnValue = false; } @@ -286,7 +286,7 @@ function MascaraCNPJ(cnpj) { * @param {type} cnpj * @returns {Boolean} */ -function MascaraData(data) { +function MascaraData(data, event) { if (mascaraInteiro(data) == false) { event.returnValue = false; } @@ -298,7 +298,7 @@ function MascaraData(data) { * @param {type} cnpj * @returns {Boolean} */ -function MascaraCPF(cpf) { +function MascaraCPF(cpf, event) { if (mascaraInteiro(cpf) == false) { event.returnValue = false; } @@ -310,7 +310,7 @@ function MascaraCPF(cpf) { * @param {type} cnpj * @returns {Boolean} */ -function creditCardMask(cc) { +function creditCardMask(cc, event) { if (mascaraInteiro(cc) == false) { event.returnValue = false; } @@ -322,7 +322,7 @@ function creditCardMask(cc) { * @param {type} cnpj * @returns {Boolean} */ -function notNumberMask(someString) { +function notNumberMask(someString, event) { if (maskNotNumber(someString) == false) { event.returnValue = false; } @@ -333,7 +333,7 @@ function notNumberMask(someString) { * Validate and prevent key typed event if it is a numbers * @returns {Boolean} */ -function maskNotNumber() { +function maskNotNumber(event) { if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 46 @@ -352,7 +352,7 @@ function maskNotNumber() { * backspace(8), tab(9), or del(46) * @returns {Boolean} */ -function mascaraInteiro() { +function mascaraInteiro(event) { if (event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 46 @@ -410,9 +410,9 @@ function formataCampo(campo, Mascara, evento) { * @param {type} cnpj * @returns {Boolean} */ -function creditCardCodeMask(code) { +function creditCardCodeMask(code, event) { if (mascaraInteiro(code) == false) { event.returnValue = false; } return true; -} \ No newline at end of file +} From cc553c33f7d06e6d64a6c959b7140ee64135fa29 Mon Sep 17 00:00:00 2001 From: gcampedelli Date: Sun, 25 Feb 2018 23:39:00 -0300 Subject: [PATCH 11/71] Update credit-card-form.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mage-error não está chamando na UI do Magento e valida em JS customizado, conflitando com estilos do styles-m.less e disparando mesmo que o formulário seja válido --- .../web/template/payment/credit-card-form.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/view/frontend/web/template/payment/credit-card-form.html b/view/frontend/web/template/payment/credit-card-form.html index 82ae02a..8031c8f 100644 --- a/view/frontend/web/template/payment/credit-card-form.html +++ b/view/frontend/web/template/payment/credit-card-form.html @@ -70,7 +70,7 @@ keydown: creditCardMask.bind($data, document.getElementById('pagseguro_credit_card_number')) } "/> - + @@ -97,7 +97,7 @@ keydown: notNumberMask.bind($data, document.getElementById('creditCardHolder')) } "/> - + @@ -145,10 +145,10 @@
- +
- +
@@ -178,7 +178,7 @@ keydown: creditCardCodeMask.bind($data,document.getElementById('creditCardCode')) } "/> - + @@ -207,7 +207,7 @@ keydown: mascaraMutuario(document.getElementById('creditCardDocument'), cpfCnpj) } "/> - + @@ -237,7 +237,7 @@ keydown: MascaraData.bind($data,document.getElementById('creditCardHolderBirthdate')) } "/> - + @@ -258,7 +258,7 @@ "> - + @@ -277,7 +277,7 @@
\ No newline at end of file diff --git a/view/adminhtml/web/js/public.js b/view/adminhtml/web/js/public.js index 7960f3c..2be373e 100755 --- a/view/adminhtml/web/js/public.js +++ b/view/adminhtml/web/js/public.js @@ -313,7 +313,9 @@ var WS = { item.magento_id, item.pagseguro_id, item.magento_status, - 'Estornar' + 'Estornar
'+ + 'Estorno Parcial', + ] ); //Adjust column width t.columns.adjust().draw(false); @@ -330,25 +332,47 @@ var WS = { }); }, - 'Refund' : function(url, data, row) + 'Refund' : function(url, data, row, value = null) { var t = jQuery('#pagseguro-datatable').DataTable(); - jQuery.ajax( { url: url + '/pagseguro/refund/refund', - data: {form_key: window.FORM_KEY, data: data}, + data: {form_key: window.FORM_KEY, data: data, value: value}, type: 'POST', showLoader: true, }).success(function(response) { - if (response.success) { - - t.row( row ).remove().draw(); - - Modal.Load('Estorno', 'Transações estornada com sucesso!'); - + var data = JSON.parse(response.payload.data); + if (!data.status) { + if (data.err == 14002) { + Modal.Load('Estorno', 'Valor do estorno está em um formato inválido!.'); + } else if (data.err == 14003) { + Modal.Load('Estorno', 'Valor do estorno inválido! O valor não pode ser negativo.'); + } else if (data.err == 14004) { + Modal.Load('Estorno', 'Valor do estorno é menor do que o permitido.'); + } else if (data.err == 14005) { + Modal.Load('Estorno', 'Valor do estorno é maior do que o permitido.'); + } else if (data.err == 14006) { + Modal.Load('Estorno', 'Saldo insuficiente para estornar a transação.'); + } else if (data.err == 14007) { + Modal.Load('Estorno', 'Status da transação é inválido para ser estornada.'); + } else if (data.err == 14008) { + Modal.Load('Estorno', 'Transação não encontrada.'); + } else if (data.err == 14009) { + Modal.Load('Estorno', "Sua conta PagSeguro não tem permissão para realizar esta ação. Em caso de dúvidas acesse http://forum.pagseguro.uol.com.br"); + } else { + Modal.Load('Estorno', 'Não foi possível executar esta ação. Utilize a conciliação de transações primeiro ou tente novamente mais tarde.'); + } + }else{ + t.row( row ).remove().draw(); + if (value == null) { + Modal.Load('Estorno', 'Transações estornada com sucesso!'); + } else { + Modal.Load('Estorno', 'Estorno parcial realizado com sucesso!'); + } + } } else { - if (response.payload.error == 'Need to conciliate') { + if (response.message == 'Need to conciliate') { //Alert Modal.Load('Estorno', 'Não foi possível executar esta ação. Utilize a conciliação de transações primeiro ou tente novamente mais tarde.'); } else { @@ -366,22 +390,18 @@ var WS = { 'Transactions' : { 'Search' : function(url) { - console.log('chegou') - console.log(url) jQuery.ajax( { url: url + '/pagseguro/transactions/request', data: {form_key: window.FORM_KEY}, type: 'POST', showLoader: true, }).success(function(response) { - console.log(response) if (response.success) { var t = jQuery('#pagseguro-datatable').DataTable(); //Cleans up the table t.clear().draw(); - console.log(response.payload.data) //Check the array for data, if not empty insert data else clear the table. if (response.payload.data.length > 0) { var i = 0; From c995000b7a635d427768a35201efcce5a0d1a23b Mon Sep 17 00:00:00 2001 From: gabriellucius Date: Fri, 23 Mar 2018 23:40:45 -0300 Subject: [PATCH 15/71] feature: add checkout without address feature: add compatibility with 4 lines address (brazilian address) Brazilian address expected format is with 4 lines: 1 street, 2 number, 3 complemente, 4 district --- Model/Direct/BoletoMethod.php | 83 +++++++++-------- Model/Direct/CreditCardMethod.php | 142 ++++++++++++++++-------------- Model/Direct/DebitMethod.php | 83 +++++++++-------- Model/PaymentMethod.php | 77 +++++++++------- composer.json | 2 +- 5 files changed, 211 insertions(+), 176 deletions(-) diff --git a/Model/Direct/BoletoMethod.php b/Model/Direct/BoletoMethod.php index 267c31a..47f8194 100644 --- a/Model/Direct/BoletoMethod.php +++ b/Model/Direct/BoletoMethod.php @@ -163,17 +163,12 @@ private function reference() */ private function shipping() { - $this->setShippingInformation(); - //Shipping Type - $this->_paymentRequest->setShipping()->setType()->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); - //Shipping Coast - $this->_paymentRequest->setShipping()->setCost()->withParameters(number_format( - $this->getShippingAmount(), - 2, - '.', - null //'' - ) - ); + if ($this->_order->getIsVirtual()) { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('false'); + } else { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('true'); + $this->setShippingInformation(); + } } /** @@ -283,9 +278,12 @@ private function getEmail() */ private function setSenderPhone() { - $shipping = $this->getShippingData(); - if (! empty($shipping['telephone'])) { - $phone = \UOL\PagSeguro\Helper\Data::formatPhone($shipping['telephone']); + $addressData = ($this->getBillingAddress()) + ? $this->getBillingAddress() + : $this->_order->getShippingAddress(); + + if (! empty($addressData['telephone'])) { + $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']); $this->_paymentRequest->setSender()->setPhone()->withParameters( $phone['areaCode'], $phone['number'] @@ -298,19 +296,38 @@ private function setSenderPhone() */ private function setShippingInformation() { - $shipping = $this->getShippingData(); - $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); - - $this->_paymentRequest->setShipping()->setAddress()->withParameters( - $this->getShippingAddress($address[0], $shipping), - $this->getShippingAddress($address[1]), - $this->getShippingAddress($address[0]), - \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), - $shipping->getCity(), - $this->getRegionAbbreviation($shipping), - $this->getCountryName($shipping['country_id']), - $this->getShippingAddress($address[2]) - ); + $shipping = $this->_order->getShippingAddress(); + if ($shipping) { + if (count($shipping->getStreet()) === 4) { + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $shipping->getStreetLine(1), + $shipping->getStreetLine(2), + $shipping->getStreetLine(4), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $shipping->getStreetLine(3) + ); + } else { + $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $this->getShippingAddress($address[0], $shipping), + $this->getShippingAddress($address[1]), + $this->getShippingAddress($address[3]), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $this->getShippingAddress($address[2]) + ); + } + + $this->_paymentRequest->setShipping()->setType() + ->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type + $this->_paymentRequest->setShipping()->setCost() + ->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast + } } /** @@ -329,18 +346,6 @@ private function getShippingAddress($address, $shipping = null) return null; } - /** - * Get the shipping Data of the Order - * - * @return object $orderParams - Return parameters, of shipping of order - */ - private function getShippingData() - { - if ($this->_order->getIsVirtual()) - return $this->getBillingAddress(); - return $this->_order->getShippingAddress(); - } - /** * Get shipping amount from magento order * diff --git a/Model/Direct/CreditCardMethod.php b/Model/Direct/CreditCardMethod.php index f12294a..c1aeb99 100644 --- a/Model/Direct/CreditCardMethod.php +++ b/Model/Direct/CreditCardMethod.php @@ -155,17 +155,12 @@ private function reference() */ private function shipping() { - $this->setShippingInformation(); - //Shipping Type - $this->_paymentRequest->setShipping()->setType()->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); - //Shipping Coast - $this->_paymentRequest->setShipping()->setCost()->withParameters(number_format( - $this->getShippingAmount(), - 2, - '.', - null //'' - ) - ); + if ($this->_order->getIsVirtual()) { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('false'); + } else { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('true'); + $this->setShippingInformation(); + } } private function billing() @@ -235,9 +230,12 @@ private function holder() */ private function setHolderPhone() { - $shipping = $this->getShippingData(); - if (! empty($shipping['telephone'])) { - $phone = \UOL\PagSeguro\Helper\Data::formatPhone($shipping['telephone']); + $addressData = ($this->getBillingAddress()) + ? $this->getBillingAddress() + : $this->_order->getShippingAddress(); + + if (! empty($addressData['telephone'])) { + $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']); $this->_paymentRequest->setHolder()->setPhone()->withParameters( $phone['areaCode'], $phone['number'] @@ -250,29 +248,35 @@ private function setHolderPhone() */ private function setBillingInformation() { - $billing = $this->getBillingData(); - $address = \UOL\PagSeguro\Helper\Data::addressConfig($billing['street']); - $this->_paymentRequest->setBilling()->setAddress()->withParameters( - $this->getShippingAddress($address[0], $billing), - $this->getShippingAddress($address[1]), - $this->getShippingAddress($address[0]), - \UOL\PagSeguro\Helper\Data::fixPostalCode($billing->getPostcode()), - $billing->getCity(), - $this->getRegionAbbreviation($billing), - $this->getCountryName($billing['country_id']), - $this->getShippingAddress($address[2]) - ); - } - - /** - * Get the billing Data of the Order - * @return object $orderParams - Return parameters, of billing of order - */ - private function getBillingData() - { - $billingAddress = $this->getBillingAddress(); - return (!empty($billingAddress)) ? $billingAddress : $this->_order->getShippingAddress(); + $billing = $this->getBillingAddress(); + if ($billing) { + if (count($billing->getStreet()) === 4) { + $this->_paymentRequest->setBilling()->setAddress()->withParameters( + $billing->getStreetLine(1), + $billing->getStreetLine(2), + $billing->getStreetLine(4), + \UOL\PagSeguro\Helper\Data::fixPostalCode($billing->getPostcode()), + $billing->getCity(), + $this->getRegionAbbreviation($billing), + $this->getCountryName($billing['country_id']), + $billing->getStreetLine(3) + ); + } else { + $address = \UOL\PagSeguro\Helper\Data::addressConfig($billing['street']); + $this->_paymentRequest->setBilling()->setAddress()->withParameters( + $this->getShippingAddress($address[0], $billing), + $this->getShippingAddress($address[1]), + $this->getShippingAddress($address[3]), + \UOL\PagSeguro\Helper\Data::fixPostalCode($billing->getPostcode()), + $billing->getCity(), + $this->getRegionAbbreviation($billing), + $this->getCountryName($billing['country_id']), + $this->getShippingAddress($address[2]) + ); + } + } } + /** * Set sender hash */ @@ -359,9 +363,12 @@ private function getEmail() */ private function setSenderPhone() { - $shipping = $this->getShippingData(); - if (! empty($shipping['telephone'])) { - $phone = \UOL\PagSeguro\Helper\Data::formatPhone($shipping['telephone']); + $addressData = ($this->getBillingAddress()) + ? $this->getBillingAddress() + : $this->_order->getShippingAddress(); + + if (! empty($addressData['telephone'])) { + $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']); $this->_paymentRequest->setSender()->setPhone()->withParameters( $phone['areaCode'], $phone['number'] @@ -374,19 +381,38 @@ private function setSenderPhone() */ private function setShippingInformation() { - $shipping = $this->getShippingData(); - $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); - - $this->_paymentRequest->setShipping()->setAddress()->withParameters( - $this->getShippingAddress($address[0], $shipping), - $this->getShippingAddress($address[1]), - $this->getShippingAddress($address[0]), - \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), - $shipping->getCity(), - $this->getRegionAbbreviation($shipping), - $this->getCountryName($shipping['country_id']), - $this->getShippingAddress($address[2]) - ); + $shipping = $this->_order->getShippingAddress(); + if ($shipping) { + if (count($shipping->getStreet()) === 4) { + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $shipping->getStreetLine(1), + $shipping->getStreetLine(2), + $shipping->getStreetLine(4), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $shipping->getStreetLine(3) + ); + } else { + $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $this->getShippingAddress($address[0], $shipping), + $this->getShippingAddress($address[1]), + $this->getShippingAddress($address[3]), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $this->getShippingAddress($address[2]) + ); + } + + $this->_paymentRequest->setShipping()->setType() + ->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type + $this->_paymentRequest->setShipping()->setCost() + ->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast + } } /** @@ -405,18 +431,6 @@ private function getShippingAddress($address, $shipping = null) return null; } - /** - * Get the shipping Data of the Order - * - * @return object $orderParams - Return parameters, of shipping of order - */ - private function getShippingData() - { - if ($this->_order->getIsVirtual()) - return $this->getBillingAddress(); - return $this->_order->getShippingAddress(); - } - /** * Get shipping amount from magento order * diff --git a/Model/Direct/DebitMethod.php b/Model/Direct/DebitMethod.php index 6b8f8c7..3846962 100644 --- a/Model/Direct/DebitMethod.php +++ b/Model/Direct/DebitMethod.php @@ -161,17 +161,12 @@ private function reference() */ private function shipping() { - $this->setShippingInformation(); - //Shipping Type - $this->_paymentRequest->setShipping()->setType()->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); - //Shipping Coast - $this->_paymentRequest->setShipping()->setCost()->withParameters(number_format( - $this->getShippingAmount(), - 2, - '.', - null //'' - ) - ); + if ($this->_order->getIsVirtual()) { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('false'); + } else { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('true'); + $this->setShippingInformation(); + } } /** @@ -289,9 +284,12 @@ private function getEmail() */ private function setSenderPhone() { - $shipping = $this->getShippingData(); - if (! empty($shipping['telephone'])) { - $phone = \UOL\PagSeguro\Helper\Data::formatPhone($shipping['telephone']); + $addressData = ($this->getBillingAddress()) + ? $this->getBillingAddress() + : $this->_order->getShippingAddress(); + + if (! empty($addressData['telephone'])) { + $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']); $this->_paymentRequest->setSender()->setPhone()->withParameters( $phone['areaCode'], $phone['number'] @@ -304,19 +302,38 @@ private function setSenderPhone() */ private function setShippingInformation() { - $shipping = $this->getShippingData(); - $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); - - $this->_paymentRequest->setShipping()->setAddress()->withParameters( - $this->getShippingAddress($address[0], $shipping), - $this->getShippingAddress($address[1]), - $this->getShippingAddress($address[0]), - \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), - $shipping->getCity(), - $this->getRegionAbbreviation($shipping), - $this->getCountryName($shipping['country_id']), - $this->getShippingAddress($address[2]) - ); + $shipping = $this->_order->getShippingAddress(); + if ($shipping) { + if (count($shipping->getStreet()) === 4) { + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $shipping->getStreetLine(1), + $shipping->getStreetLine(2), + $shipping->getStreetLine(4), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $shipping->getStreetLine(3) + ); + } else { + $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $this->getShippingAddress($address[0], $shipping), + $this->getShippingAddress($address[1]), + $this->getShippingAddress($address[3]), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $this->getShippingAddress($address[2]) + ); + } + + $this->_paymentRequest->setShipping()->setType() + ->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type + $this->_paymentRequest->setShipping()->setCost() + ->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast + } } /** @@ -335,18 +352,6 @@ private function getShippingAddress($address, $shipping = null) return null; } - /** - * Get the shipping Data of the Order - * - * @return object $orderParams - Return parameters, of shipping of order - */ - private function getShippingData() - { - if ($this->_order->getIsVirtual()) - return $this->getBillingAddress(); - return $this->_order->getShippingAddress(); - } - /** * Get shipping amount from magento order * diff --git a/Model/PaymentMethod.php b/Model/PaymentMethod.php index d3c59a7..25db63b 100644 --- a/Model/PaymentMethod.php +++ b/Model/PaymentMethod.php @@ -89,10 +89,6 @@ public function createPaymentRequest() $this->_paymentRequest->setExtraAmount(round($lastRealOrder->getDiscountAmount(), 2)); //Shipping $this->setShippingInformation(); - $this->_paymentRequest->setShipping()->setType() - ->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type - $this->_paymentRequest->setShipping()->setCost() - ->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast // Sender $this->setSenderInformation(); // Itens @@ -158,19 +154,44 @@ private function setSenderInformation() */ private function setShippingInformation() { - $shipping = $this->getShippingData(); - $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); + if ($this->_checkoutSession->getLastRealOrder()->getIsVirtual()) { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('false'); + } else { + $this->_paymentRequest->setShipping()->setAddressRequired()->withParameters('true'); + $shipping = $this->_checkoutSession->getLastRealOrder()->getShippingAddress(); + if ($shipping) { + if (count($shipping->getStreet()) === 4) { + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $shipping->getStreetLine(1), + $shipping->getStreetLine(2), + $shipping->getStreetLine(4), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $shipping->getStreetLine(3) + ); + } else { + $address = \UOL\PagSeguro\Helper\Data::addressConfig($shipping['street']); - $this->_paymentRequest->setShipping()->setAddress()->withParameters( - $this->getShippingAddress($address[0], $shipping), - $this->getShippingAddress($address[1]), - $this->getShippingAddress($address[3]), - \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), - $shipping->getCity(), - $this->getRegionAbbreviation($shipping), - $this->getCountryName($shipping['country_id']), - $this->getShippingAddress($address[2]) - ); + $this->_paymentRequest->setShipping()->setAddress()->withParameters( + $this->getShippingAddress($address[0], $shipping), + $this->getShippingAddress($address[1]), + $this->getShippingAddress($address[3]), + \UOL\PagSeguro\Helper\Data::fixPostalCode($shipping->getPostcode()), + $shipping->getCity(), + $this->getRegionAbbreviation($shipping), + $this->getCountryName($shipping['country_id']), + $this->getShippingAddress($address[2]) + ); + } + + $this->_paymentRequest->setShipping()->setType() + ->withParameters(\PagSeguro\Enum\Shipping\Type::NOT_SPECIFIED); //Shipping Type + $this->_paymentRequest->setShipping()->setCost() + ->withParameters(number_format($this->getShippingAmount(), 2, '.', '')); //Shipping Coast + } + } } /** * Get shipping address @@ -190,19 +211,6 @@ private function getShippingAddress($address, $shipping = null) return null; } - /** - * Get the shipping Data of the Order - * - * @return object $orderParams - Return parameters, of shipping of order - */ - private function getShippingData() - { - if ($this->_checkoutSession->getLastRealOrder()->getIsVirtual()) { - return $this->getBillingAddress(); - } - return $this->_checkoutSession->getLastRealOrder()->getShippingAddress(); - } - /** * Get shipping amount from session * @@ -282,13 +290,16 @@ public function getRedirectUrl() */ private function setSenderPhone() { - $shipping = $this->getShippingData(); - if (! empty($shipping['telephone'])) { - $phone = \UOL\PagSeguro\Helper\Data::formatPhone($shipping['telephone']); + $addressData = ($this->getBillingAddress()) + ? $this->getBillingAddress() + : $this->_checkoutSession->getLastRealOrder()->getShippingAddress(); + + if (! empty($addressData['telephone'])) { + $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']); $this->_paymentRequest->setSender()->setPhone()->withParameters( $phone['areaCode'], $phone['number'] - ); + ); } } diff --git a/composer.json b/composer.json index 98dca87..2165654 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "require": { "php": "~5.5.0|~5.6.0|~7.0.0", - "pagseguro/pagseguro-php-sdk": "3.*" + "pagseguro/pagseguro-php-sdk": "4.*" }, "autoload": { "files": [ From 412db27adf0f6c7148373aa054060c440137d8ca Mon Sep 17 00:00:00 2001 From: gabriellucius Date: Sat, 24 Mar 2018 00:24:04 -0300 Subject: [PATCH 16/71] feature: add PagSeguro recovery cart configuration in admin --- Model/Direct/BoletoMethod.php | 15 +++++++++++++++ Model/Direct/CreditCardMethod.php | 15 +++++++++++++++ Model/Direct/DebitMethod.php | 15 +++++++++++++++ Model/PaymentMethod.php | 16 ++++++++++++++++ README.md | 7 +++++++ etc/adminhtml/system/general_configuration.xml | 7 +++++++ 6 files changed, 75 insertions(+) diff --git a/Model/Direct/BoletoMethod.php b/Model/Direct/BoletoMethod.php index 47f8194..d430279 100644 --- a/Model/Direct/BoletoMethod.php +++ b/Model/Direct/BoletoMethod.php @@ -105,6 +105,7 @@ public function createPaymentRequest() $this->urls(); $this->items(); $this->config(); + $this->setShoppingCartRecovery(); return $this->register(); } catch (\Exception $exception) { throw $exception; @@ -438,4 +439,18 @@ private function discounts() { $this->_paymentRequest->setExtraAmount(round($this->_order->getDiscountAmount(), 2)); } + + /** + * Set PagSeguro recovery shopping cart value + * + * @return void + */ + private function setShoppingCartRecovery() + { + if ($this->_scopeConfig->getValue('payment/pagseguro/shopping_cart_recovery') == true) { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'true'); + } else { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'false'); + } + } } diff --git a/Model/Direct/CreditCardMethod.php b/Model/Direct/CreditCardMethod.php index c1aeb99..a8d0b3d 100644 --- a/Model/Direct/CreditCardMethod.php +++ b/Model/Direct/CreditCardMethod.php @@ -97,6 +97,7 @@ public function createPaymentRequest() $this->token(); $this->holder(); $this->config(); + $this->setShoppingCartRecovery(); return $this->register(); } catch (\Exception $exception) { throw $exception; @@ -523,4 +524,18 @@ private function discounts() { $this->_paymentRequest->setExtraAmount(round($this->_order->getDiscountAmount(), 2)); } + + /** + * Set PagSeguro recovery shopping cart value + * + * @return void + */ + private function setShoppingCartRecovery() + { + if ($this->_scopeConfig->getValue('payment/pagseguro/shopping_cart_recovery') == true) { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'true'); + } else { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'false'); + } + } } diff --git a/Model/Direct/DebitMethod.php b/Model/Direct/DebitMethod.php index 3846962..61010a3 100644 --- a/Model/Direct/DebitMethod.php +++ b/Model/Direct/DebitMethod.php @@ -103,6 +103,7 @@ public function createPaymentRequest() $this->items(); $this->config(); $this->bank(); + $this->setShoppingCartRecovery(); return $this->register(); } catch (\Exception $exception) { throw $exception; @@ -444,4 +445,18 @@ private function discounts() { $this->_paymentRequest->setExtraAmount(round($this->_order->getDiscountAmount(), 2)); } + + /** + * Set PagSeguro recovery shopping cart value + * + * @return void + */ + private function setShoppingCartRecovery() + { + if ($this->_scopeConfig->getValue('payment/pagseguro/shopping_cart_recovery') == true) { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'true'); + } else { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'false'); + } + } } diff --git a/Model/PaymentMethod.php b/Model/PaymentMethod.php index 25db63b..92682c3 100644 --- a/Model/PaymentMethod.php +++ b/Model/PaymentMethod.php @@ -97,6 +97,8 @@ public function createPaymentRequest() $this->_paymentRequest->setRedirectUrl($this->getRedirectUrl()); // Notification Url $this->_paymentRequest->setNotificationUrl($this->getNotificationUrl()); + // Shopping cart recovery + $this->setShoppingCartRecovery(); try { $this->_library->setEnvironment(); $this->_library->setCharset(); @@ -325,4 +327,18 @@ private function getCountryName($countryId) $this->_countryInformation->getCountryInfo($countryId)->getFullNameLocale() : $countryId; } + + /** + * Set PagSeguro recovery shopping cart value + * + * @return void + */ + private function setShoppingCartRecovery() + { + if ($this->_scopeConfig->getValue('payment/pagseguro/shopping_cart_recovery') == true) { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'true'); + } else { + $this->_paymentRequest->addParameter()->withParameters('enableRecovery', 'false'); + } + } } diff --git a/README.md b/README.md index 84d236d..221008e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ Para acessar e configurar o módulo acesse o menu PagSeguro -> Configurações. - *Por padrão o módulo virá configurado para salvar o arquivo de log em var/log/pagseguro.log*. - **listar transações abandonadas?**: ativa/desativa a pesquisa de transações que foram abandonadas no checkout do PagSeguro. - **transações -> abandonadas**: permite consultar as transações que foram abandonadas nos últimos 10 dias, desta forma você pode enviar emails de recuperação de venda. O e-mail conterá um link que redirecionará o comprador para o fluxo de pagamento, exatamente no ponto onde ele parou. + - **habilitar recuperação de carrinho**: Habilita a recuperação de carrinho do PagSeguro. (por padrão está desabilitada) - **listar parcelamento**: Habilita a exibição de uma listagem de parcelas na tela de visualização do produto. (Irá exibir o maior parcelamento disponível para o produto na tela de exibição do mesmo) ------------------------- @@ -132,6 +133,12 @@ Inputs | Name / Nome | {String} | Nome | | Last Name / Sobrenome | {String} | Sobrenome | | Company / Empresa | {String} | Empresa | +| Configuração de endereço de 4 linhas: +| Address 1 / Endereço 1 / Rua | {String} |Endereço (rua)| +| Address 2 / Endereço 2 / Número | {Integer} |Número | +| Address 3 / Endereço 3 / Complemento | {String} |Complemento | +| Address 4 / Endereço 4 / Bairro | {String} |Bairro | +| Configuração de endereço padrão Magento 2 (2 linhas): | Address / Endereço | {String, Integer} |Endereço, Numero| | Address 2 / Bairro /Endereço (Linha 2) | {String} | Bairro | | PostCode / CEP | {Integer or String} | 99999999 / 99999-999 | diff --git a/etc/adminhtml/system/general_configuration.xml b/etc/adminhtml/system/general_configuration.xml index c172cfa..33110e5 100644 --- a/etc/adminhtml/system/general_configuration.xml +++ b/etc/adminhtml/system/general_configuration.xml @@ -61,6 +61,13 @@ UOL\PagSeguro\Model\System\Config\Yesno payment/pagseguro/abandoned_active + + + Habilita/desabilita a recuperação de carrinho do PagSeguro. + Para saber mais sobre a recuperação de carrinho do PagSeguro, clique <a href="https://pagseguro.uol.com.br/para-seu-negocio/online/recuperacao-de-carrinho" target="_blank">aqui</a>. + UOL\PagSeguro\Model\System\Config\Yesno + payment/pagseguro/shopping_cart_recovery + Ativar a exibição da listagem de parcelas na tela de visualização do produto. (Irá exibir o maior parcelamento disponível para o produto no pagamento com cartão de crédito) From 7e93a1c8f6a35144bbcff85a624a90328af7f8f1 Mon Sep 17 00:00:00 2001 From: andrecristiani Date: Tue, 27 Mar 2018 09:38:16 -0300 Subject: [PATCH 17/71] partial refund finalized --- Model/Transactions/Methods/Refund.php | 24 ++----- view/adminhtml/templates/refund/content.phtml | 3 +- .../templates/transactions/content.phtml | 68 +++++++++---------- view/adminhtml/web/js/public.js | 41 +++-------- 4 files changed, 51 insertions(+), 85 deletions(-) diff --git a/Model/Transactions/Methods/Refund.php b/Model/Transactions/Methods/Refund.php index ea51d25..2e56e52 100755 --- a/Model/Transactions/Methods/Refund.php +++ b/Model/Transactions/Methods/Refund.php @@ -137,24 +137,14 @@ public function execute($data, $value = null) { try { $config = $this->sanitizeConfig($data); $config->value = $value; - if (!$config->needConciliate){ - return json_encode(array( - "status" => false, - "err" => "Need to conciliate", - )); - } - + $this->isConciliate($config); if (!$this->doRefund($config)) - throw new \Exception('impossible to refund'); + throw new \Exception('impossible to refund'); $this->doUpdates($config); return true; } catch (\Exception $exception) { - $error = simplexml_load_string($exception->getMessage()); - return json_encode(array( - "status" => false, - "err" => trim(current($error->error->code)), - )); + throw $exception; } } @@ -345,14 +335,14 @@ private function checkConciliation($payment, $order) */ private function compareStatus($order, $payment) { - if (! (in_array($order->getStatus(), [ + if ((in_array($order->getStatus(), [ $this->getStatusFromPaymentKey(3), $this->getStatusFromPaymentKey(4), $this->getStatusFromPaymentKey(5), - ]) || in_array($payment->getStatus(), [3, 4, 5]))) { - return false; + ]) == 1 && in_array($payment->getStatus(), [3, 4, 5]) == 1)) { + return true; } - return true; + return false; } /** diff --git a/view/adminhtml/templates/refund/content.phtml b/view/adminhtml/templates/refund/content.phtml index 1871ea0..e0a283a 100755 --- a/view/adminhtml/templates/refund/content.phtml +++ b/view/adminhtml/templates/refund/content.phtml @@ -41,7 +41,6 @@
- @@ -113,7 +112,7 @@ id = jQuery(this).find('td')[1]; block = jQuery(this).attr('data-block'); url = $('#adminurl').attr('data-target'); - row = $(this); + row = $(this).parents('tr'); }); } }); diff --git a/view/adminhtml/templates/transactions/content.phtml b/view/adminhtml/templates/transactions/content.phtml index 0208ec1..fb4f540 100755 --- a/view/adminhtml/templates/transactions/content.phtml +++ b/view/adminhtml/templates/transactions/content.phtml @@ -3,41 +3,41 @@
- - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/view/adminhtml/web/js/public.js b/view/adminhtml/web/js/public.js index 2be373e..050163f 100755 --- a/view/adminhtml/web/js/public.js +++ b/view/adminhtml/web/js/public.js @@ -313,7 +313,7 @@ var WS = { item.magento_id, item.pagseguro_id, item.magento_status, - 'Estornar
'+ + 'Estorno total
'+ 'Estorno Parcial', ] ); @@ -334,45 +334,22 @@ var WS = { }, 'Refund' : function(url, data, row, value = null) { + console.log(data) var t = jQuery('#pagseguro-datatable').DataTable(); jQuery.ajax( { url: url + '/pagseguro/refund/refund', - data: {form_key: window.FORM_KEY, data: data, value: value}, + data: {form_key: window.FORM_KEY, data: data}, type: 'POST', showLoader: true, }).success(function(response) { if (response.success) { - var data = JSON.parse(response.payload.data); - if (!data.status) { - if (data.err == 14002) { - Modal.Load('Estorno', 'Valor do estorno está em um formato inválido!.'); - } else if (data.err == 14003) { - Modal.Load('Estorno', 'Valor do estorno inválido! O valor não pode ser negativo.'); - } else if (data.err == 14004) { - Modal.Load('Estorno', 'Valor do estorno é menor do que o permitido.'); - } else if (data.err == 14005) { - Modal.Load('Estorno', 'Valor do estorno é maior do que o permitido.'); - } else if (data.err == 14006) { - Modal.Load('Estorno', 'Saldo insuficiente para estornar a transação.'); - } else if (data.err == 14007) { - Modal.Load('Estorno', 'Status da transação é inválido para ser estornada.'); - } else if (data.err == 14008) { - Modal.Load('Estorno', 'Transação não encontrada.'); - } else if (data.err == 14009) { - Modal.Load('Estorno', "Sua conta PagSeguro não tem permissão para realizar esta ação. Em caso de dúvidas acesse http://forum.pagseguro.uol.com.br"); - } else { - Modal.Load('Estorno', 'Não foi possível executar esta ação. Utilize a conciliação de transações primeiro ou tente novamente mais tarde.'); - } - }else{ - t.row( row ).remove().draw(); - if (value == null) { - Modal.Load('Estorno', 'Transações estornada com sucesso!'); - } else { - Modal.Load('Estorno', 'Estorno parcial realizado com sucesso!'); - } - } + + t.row( row ).remove().draw(); + + Modal.Load('Estorno', 'Transações estornada com sucesso!'); + } else { - if (response.message == 'Need to conciliate') { + if (response.payload.error == 'Need to conciliate') { //Alert Modal.Load('Estorno', 'Não foi possível executar esta ação. Utilize a conciliação de transações primeiro ou tente novamente mais tarde.'); } else { From 17eb513f65747947b4c593764977a0c28cc8d0f0 Mon Sep 17 00:00:00 2001 From: andrecristiani Date: Tue, 27 Mar 2018 11:18:02 -0300 Subject: [PATCH 18/71] updating message header --- .../templates/transactions/content.phtml | 88 ++++++++++--------- .../templates/transactions/header.phtml | 3 +- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/view/adminhtml/templates/transactions/content.phtml b/view/adminhtml/templates/transactions/content.phtml index d2c5abc..09968ac 100755 --- a/view/adminhtml/templates/transactions/content.phtml +++ b/view/adminhtml/templates/transactions/content.phtml @@ -3,41 +3,42 @@
DataID MagentoID PagSeguroAmbienteStatus MagentoAção
- - - - - - - - - - - DataID MagentoID PagSeguroAmbienteStatus MagentoAção
+ + + + + + + + + + +
- - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -51,14 +52,14 @@ Close
DataID MagentoID PagSeguroAmbienteStatus MagentoAção
- - - - - - - - - - - DataID MagentoID PagSeguroAmbienteStatus PagSeguroAção
+ + + + + + + + + + +
-
+