Skip to content

Commit

Permalink
v. 3.7.14
Browse files Browse the repository at this point in the history
* Melhoria nos dados que são exibidos sobre os pedidos no admin. Agora é possível clicar para ver a transação no PagSeguro. Além disso, o total líquido a receber e valor das taxas também são exibidos no admin.
* Melhoria nos tipos de dados do sistema que são enviados para aplicação.
  • Loading branch information
r-martins committed Nov 19, 2019
1 parent 26d4be0 commit c4e2739
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
22 changes: 20 additions & 2 deletions app/code/community/RicardoMartins/PagSeguro/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public function getSessionId()
CURLOPT_TIMEOUT => 45,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_USERAGENT => $this->getUserAgent()
)
)
);

$response = null;
Expand Down Expand Up @@ -412,4 +411,23 @@ public function getUserAgent()
'magento' => $mageVersion);
return json_encode($userAgent);
}

/**
* Adds usage information about platform and module's versions
* @return array of headers
*/
public function getCustomHeaders()
{
$psVersion = (string)Mage::getConfig()->getModuleConfig('RicardoMartins_PagSeguro')->version;
$mageVersion = Mage::getVersion();

$headers = array('Platform: Magento', 'Platform-Version: ' . $mageVersion, 'Module-Version: ' . $psVersion);

if (Mage::getConfig()->getModuleConfig('RicardoMartins_PagSeguroPro')) {
$psProVersion = (string)Mage::getConfig()->getModuleConfig('RicardoMartins_PagSeguroPro')->version;
$headers[] = 'Extra-Version: ' . $psProVersion;
}

return $headers;
}
}
14 changes: 12 additions & 2 deletions app/code/community/RicardoMartins/PagSeguro/Model/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,21 @@ public function proccessNotificatonResult(SimpleXMLElement $resultXML)
->addObject($invoice)
->addObject($invoice->getOrder())
->save();
$order->addStatusHistoryComment(sprintf('Fatura #%s criada com sucesso.', $invoice->getIncrementId()));
$order->addStatusHistoryComment(
sprintf('Fatura #%s criada com sucesso.', $invoice->getIncrementId())
);
}
}

$payment->save();

if (isset($resultXML->feeAmount) && isset($resultXML->netAmount)) {
$payment
->setAdditionalInformation('fee_amount', floatval($resultXML->feeAmount))
->setAdditionalInformation('net_amount', floatval($resultXML->netAmount))
->save();
}

$order->save();
Mage::dispatchEvent(
'pagseguro_proccess_notification_after',
Expand Down Expand Up @@ -356,7 +366,7 @@ public function callApi($params, $payment, $type='transactions')
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $helper->getUserAgent());
curl_setopt($ch, CURLOPT_HTTPHEADER, $helper->getCustomHeaders());
$response = '';

try{
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/RicardoMartins/PagSeguro/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<config>
<modules>
<RicardoMartins_PagSeguro>
<version>3.7.13</version>
<version>3.7.14</version>
</RicardoMartins_PagSeguro>
</modules>
<global>
Expand Down Expand Up @@ -144,7 +144,7 @@
<address_neighborhood_attribute>street_2</address_neighborhood_attribute>
<ws_url>https://ws.pagseguro.uol.com.br/v2/</ws_url>
<ws_url_app>https://ws.ricardomartins.net.br/pspro/v6/wspagseguro/v2/</ws_url_app>
<!--<ws_url_app>http://ws.local.com.br/pspro/v6/wspagseguro/v2/</ws_url_app>-->
<!--<ws_url_app>https://ws.local.com.br/pspro/v6/wspagseguro/v2/</ws_url_app>-->
<js_url>https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js</js_url>
<sandbox_ws_url>https://ws.sandbox.pagseguro.uol.com.br/v2/</sandbox_ws_url>
<sandbox_ws_url_app>https://ws.ricardomartins.net.br/pspro/v6/wspagseguro/sandbox/v2/</sandbox_ws_url_app>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<br/>
<?php if($additional = $info->getAdditionalInformation()):?>
Id Transação: <?php echo (isset($additional['transaction_id']))?$this->escapeHtml($additional['transaction_id']):'Desconhecido';?>
<?php if (isset($additional['transaction_id'])): ?>
<?php echo sprintf(' | <a href="%s" target="_blank">Ver no PagSeguro</a>', 'https://pagseguro.uol.com.br/transaction/details.jhtml?code=' . $this->escapeHtml($additional['transaction_id']));?>
<?php endif; ?>
<br/>
<?php endif;?>
Bandeira: <?php echo ucfirst($this->escapeHtml($info->getCcType()));?>
Expand All @@ -12,4 +15,11 @@
<br/>
Parcelas: <?php echo $this->escapeHtml($additional['installment_quantity']);?>x <?php echo Mage::helper('core')->formatCurrency($additional['installment_value']);?>
<?php endif;?>
<?php if(isset($additional['net_amount']) && isset($additional['fee_amount'])):?>
<br/>
Taxa PagSeguro: <?php echo Mage::helper('core')->formatCurrency($additional['fee_amount']);?>
<br/>
Total líquido a receber: <?php echo Mage::helper('core')->formatCurrency($additional['net_amount']);?>
<br/>
<?php endif;?>
<?php endif; ?>

0 comments on commit c4e2739

Please sign in to comment.