-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adicionado status PAYMENT_REVIEW para novos pedidos e habilitado rotina de checagem de status de pedidos por padrão #309
base: master
Are you sure you want to change the base?
Changes from all commits
f7d8ef3
56d7088
b11e879
8a8d3c2
5f8876b
a3e6324
fe248c1
8698dd7
1391af2
b9f0337
073d8ff
b367223
b2ef0bf
974bbfa
8ac1985
428c24d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* @package RicardoMartins_PagSeguro | ||
* @copyright Copyright (c) 2022 Gamuza Technologies (http://www.gamuza.com.br/) | ||
* @author Eneias Ramos de Melo <[email protected]> | ||
*/ | ||
|
||
class RicardoMartins_PagSeguro_Model_Api extends Mage_Api_Model_Resource_Abstract | ||
{ | ||
public function sessionId() | ||
{ | ||
return Mage::helper('ricardomartins_pagseguro')->getSessionId(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ | |
*/ | ||
class RicardoMartins_PagSeguro_Model_Payment_Cc extends RicardoMartins_PagSeguro_Model_Abstract | ||
{ | ||
protected $_code = 'rm_pagseguro_cc'; | ||
const CODE = 'rm_pagseguro_cc'; | ||
|
||
protected $_code = self::CODE; | ||
protected $_formBlockType = 'ricardomartins_pagseguro/form_cc'; | ||
protected $_infoBlockType = 'ricardomartins_pagseguro/form_info_cc'; | ||
protected $_isGateway = true; | ||
|
@@ -75,6 +77,12 @@ public function assignData($data) | |
$data = new Varien_Object($data); | ||
} | ||
|
||
$session = Mage::getSingleton('api/session'); | ||
|
||
if ($session->isLoggedIn()) { | ||
$session->setData('PsPayment', serialize($data->getData('PsPayment'))); | ||
} | ||
|
||
$info = $this->getInfoInstance(); | ||
|
||
$info->setAdditionalInformation('sender_hash', $this->_pHelper->getPaymentHash('sender_hash')); | ||
|
@@ -316,6 +324,8 @@ protected function _order($payment, $amount, $ccIdx) | |
{ | ||
$order = $payment->getOrder(); | ||
|
||
$order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nem todo pagamento começa como Payment review. Isso poderia confundir o comprador. Ex: Pedido com Boleto deve entrar como Pending e não review. Review só ocorre no caso de análise de fraude de um pagamento realizado/capturado com sucesso. |
||
|
||
if ($this->isMultiCardPayment($payment)) { | ||
$cardData = $payment->getAdditionalInformation("cc" . $ccIdx); | ||
$payment->setData("_current_card_index", $ccIdx); | ||
|
@@ -1302,4 +1312,9 @@ public function recalculateInstallmentsAndPlaceOrder($payment, $amount) | |
Mage::throwException($e->getMessage()); | ||
} | ||
} | ||
|
||
public function getInstructions() | ||
{ | ||
return trim($this->getConfigData('instructions')); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
/** | ||
* @package RicardoMartins_PagSeguro | ||
* @copyright Copyright (c) 2022 Gamuza Technologies (http://www.gamuza.com.br/) | ||
* @author Eneias Ramos de Melo <[email protected]> | ||
*/ | ||
--> | ||
|
||
<config> | ||
<api> | ||
<resources> | ||
<ricardomartins_pagseguro translate="title" module="ricardomartins_pagseguro"> | ||
<model>ricardomartins_pagseguro/api</model> | ||
<title>RicardoMartins PagSeguro API</title> | ||
<acl>ricardomartins_pagseguro</acl> | ||
<methods> | ||
<session_id translate="title" module="ricardomartins_pagseguro"> | ||
<title>Get session ID to process card token.</title> | ||
<acl>ricardomartins_pagseguro/session_id</acl> | ||
<method>sessionId</method> | ||
</session_id> | ||
</methods> | ||
</ricardomartins_pagseguro> | ||
</resources> | ||
<acl> | ||
<resources> | ||
<ricardomartins_pagseguro translate="title" module="ricardomartins_pagseguro"> | ||
<title>RicardoMartins PagSeguro API</title> | ||
<sort_order>0</sort_order> | ||
<session_id translate="title" module="ricardomartins_pagseguro"> | ||
<title>Session ID</title> | ||
</session_id> | ||
</ricardomartins_pagseguro> | ||
</resources> | ||
</acl> | ||
</api> | ||
</config> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,7 @@ | |
<active>0</active> | ||
<title>Cartão de Crédito - via PagSeguro UOL</title> | ||
<order_status>pending</order_status> | ||
<paid_status>paid</paid_status> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A alteração do status do pedido se dá definindo o status padrão para aquele state. A maioria dos módulos de pagamento usa isso como padrão. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. É muito útil para integrações de pedidos, caso seja necessário utilizar um status personalizado para pedidos pagos. Ou para visualizações de pedidos no admin personalizadas como o do Toluca Store. Adicionei um fallback para utilizar o status atual caso um novo não for configurado 8698dd7 |
||
<allowspecific>0</allowspecific> | ||
<flag>42x20</flag> | ||
<payment_action>order</payment_action> | ||
|
@@ -182,18 +183,21 @@ | |
<!--<specificcountry>BR</specificcountry>--> | ||
<group_restriction>0</group_restriction> | ||
<info_brl>1</info_brl> | ||
<total_installments>0</total_installments> | ||
<show_total>1</show_total> | ||
<installment_limit>1</installment_limit> | ||
<force_installments_selection>0</force_installments_selection> | ||
<installments_product>0</installments_product> | ||
<installments_product_message>Parcele em até {num_parcelas}x de R${valor_parcela} (Total R${valor_total}) com PagSeguro UOL.</installments_product_message> | ||
<sort_order>1</sort_order> | ||
</rm_pagseguro_cc> | ||
<rm_pagseguro> | ||
<customer_cpf_attribute>taxvat</customer_cpf_attribute> | ||
<address_telephone_attribute>telephone</address_telephone_attribute> | ||
<customer_cpf_attribute>customer|taxvat</customer_cpf_attribute> | ||
<address_telephone_attribute>cellphone</address_telephone_attribute> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Não temos atributo cellphone por padrão. (pelo menos nao no openmage 20.0.13 que estou usando pra teste) |
||
<address_street_attribute>street_1</address_street_attribute> | ||
<address_number_attribute>street_2</address_number_attribute> | ||
<address_neighborhood_attribute>street_2</address_neighborhood_attribute> | ||
<address_complement_attribute>street_3</address_complement_attribute> | ||
<address_neighborhood_attribute>street_4</address_neighborhood_attribute> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boa. Não sei como deixei isso passar. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aconteceu meu caro :) |
||
<notification_url_nosid>1</notification_url_nosid> | ||
<ws_url>https://ws.pagseguro.uol.com.br/v2/</ws_url> | ||
<ws_url_app>https://ws.ricardomartins.net.br/pspro/v7/wspagseguro/v2/</ws_url_app> | ||
<js_url>https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js</js_url> | ||
|
@@ -204,8 +208,9 @@ | |
<jsdelivr_enabled>1</jsdelivr_enabled> | ||
<jsdelivr_minify>1</jsdelivr_minify> | ||
<stc_mirror>1</stc_mirror> | ||
<updater_enabled>0</updater_enabled> | ||
<send_status_change_email>0</send_status_change_email> | ||
<updater_enabled>1</updater_enabled> | ||
<send_invoice_email>1</send_invoice_email> | ||
<send_status_change_email>1</send_status_change_email> | ||
</rm_pagseguro> | ||
<rm_pagseguro_kiosk> | ||
<active>0</active> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,13 @@ $multiCcEnabled = Mage::helper('ricardomartins_pagseguro')->isMultiCcEnabled(); | |
</div> | ||
</li> | ||
*/ ?> | ||
<?php if ($this->getInstructions()): ?> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O que o motivou a ter instruções adicionais pra pedidos com cartão? (curiosidade) |
||
<li> | ||
<div class="<?php echo $_code; ?>-instructions-content agreement-content"> | ||
<?php echo nl2br($this->getInstructions()) ?> | ||
</div> | ||
</li> | ||
<?php endif; ?> | ||
<?php if ($multiCcEnabled):?> | ||
<li> | ||
<label for="multicc"><?php echo __('Pay with 2 cards')?></label> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se passar como false ele não mudará o status do pedido depois da fatura criada. Não consigo ver sentido neste ser o comportamento padrão. Pedidos com fatura gerada viram Processing (ou outro status associado como padrao pro Processing).