Mundipagg_Integracao - Version 2.9.6

Version Notes

- Remove the payment methods for 3,4 and 5 credit cards

- Refact in 2 credit cards payment method

- Add integration error 400/500 reason in Magento admin (order data screen).

- Fix no cancelation order when error 400 occurs.

Download this release

Release Info

Developer MundiPagg
Extension Mundipagg_Integracao
Version 2.9.6
Comparing to
See all releases


Code changes from version 2.9.5 to 2.9.6

app/code/community/Uecommerce/Mundipagg/Block/Info.php CHANGED
@@ -27,50 +27,94 @@
27
* @package Uecommerce_Mundipagg
28
* @author Uecommerce Dev Team
29
*/
30
31
- class Uecommerce_Mundipagg_Block_Info extends Mage_Payment_Block_Info
32
- {
33
- protected function _construct()
34
- {
35
parent::_construct();
36
$this->setTemplate('mundipagg/payment/info/mundipagg.phtml');
37
}
38
-
39
/**
40
- * Retrieve order model instance
41
- *
42
- * @return Mage_Sales_Model_Order
43
- */
44
- public function getOrder()
45
- {
46
return Mage::registry('current_order');
47
}
48
-
49
/**
50
- * Retrieve invoice model instance
51
- *
52
- * @return Mage_Sales_Model_Order_Invoice
53
- */
54
- public function getInvoice()
55
- {
56
return Mage::registry('current_invoice');
57
}
58
-
59
/**
60
- * Retrieve shipment model instance
61
- *
62
- * @return Mage_Sales_Model_Order_Shipment
63
- */
64
- public function getShipment()
65
- {
66
- return Mage::registry('current_shipment');
67
- }
68
-
69
- /**
70
- * Retrieve payment method
71
- */
72
- public function getFormaPagamento()
73
- {
74
- return $this->getInfo()->getAdditionalInformation('PaymentMethod');
75
- }
76
}
27
* @package Uecommerce_Mundipagg
28
* @author Uecommerce Dev Team
29
*/
30
+ class Uecommerce_Mundipagg_Block_Info extends Mage_Payment_Block_Info {
31
32
+ protected function _construct() {
33
parent::_construct();
34
$this->setTemplate('mundipagg/payment/info/mundipagg.phtml');
35
}
36
+
37
/**
38
+ * Retrieve order model instance
39
+ *
40
+ * @return Mage_Sales_Model_Order
41
+ */
42
+ public function getOrder() {
43
return Mage::registry('current_order');
44
}
45
+
46
/**
47
+ * Retrieve invoice model instance
48
+ *
49
+ * @return Mage_Sales_Model_Order_Invoice
50
+ */
51
+ public function getInvoice() {
52
return Mage::registry('current_invoice');
53
}
54
+
55
+ /**
56
+ * Retrieve shipment model instance
57
+ *
58
+ * @return Mage_Sales_Model_Order_Shipment
59
+ */
60
+ public function getShipment() {
61
+ return Mage::registry('current_shipment');
62
+ }
63
+
64
+ /**
65
+ * Retrieve payment method
66
+ */
67
+ public function getFormaPagamento() {
68
+ return $this->getInfo()->getAdditionalInformation('PaymentMethod');
69
+ }
70
+
71
/**
72
+ * @param $ccQty credit card quantity
73
+ * @param $ccPos credit card position
74
+ * @return array|mixed|null
75
+ */
76
+ public function getCcBrand($ccPos) {
77
+ return $this->getInfo()->getAdditionalInformation("{$ccPos}_CreditCardBrand");
78
+ }
79
+
80
+ public function getCcValue($ccPos) {
81
+ $value = $this->getInfo()->getAdditionalInformation("{$ccPos}_AmountInCents") * 0.01;
82
+
83
+ return Mage::helper('core')->currency($value, true, false);
84
+ }
85
+
86
+ public function getInstallmentsNumber($ccQty, $ccPos) {
87
+ if ($ccQty == 1) {
88
+ $installments = $this->getInfo()->getAdditionalInformation("mundipagg_creditcard_credito_parcelamento_1_1");
89
+ } else {
90
+ $installments = $this->getInfo()
91
+ ->getAdditionalInformation("mundipagg_twocreditcards_credito_parcelamento_{$ccQty}_{$ccPos}");
92
+ }
93
+
94
+
95
+ $installments .= "x";
96
+
97
+ return $installments;
98
+ }
99
+
100
+ public function getAuthorizationCode($ccPos) {
101
+ $authCode = $this->getInfo()->getAdditionalInformation("{$ccPos}_AuthorizationCode");
102
+
103
+ if (empty($authCode)) {
104
+ $authCode = "N/A";
105
+ }
106
+
107
+ return $authCode;
108
+ }
109
+
110
+ public function getTransactionId($ccPos) {
111
+ $txnId = $this->getInfo()->getAdditionalInformation("{$ccPos}_TransactionIdentifier");
112
+
113
+ if (empty($txnId)) {
114
+ $txnId = "N/A";
115
+ }
116
+
117
+ return $txnId;
118
+ }
119
+
120
}
app/code/community/Uecommerce/Mundipagg/Block/Standard/Form.php CHANGED
@@ -87,4 +87,17 @@ class Uecommerce_Mundipagg_Block_Standard_Form extends Mage_Payment_Block_Form
87
return Mage::helper('mundipagg/installments')->getInstallmentForCreditCardType($ccType);
88
89
}
90
}
87
return Mage::helper('mundipagg/installments')->getInstallmentForCreditCardType($ccType);
88
89
}
90
+
91
+ /**
92
+ * @return Mage_Sales_Model_Order
93
+ */
94
+ public function loadOrder(){
95
+ /** @var Mage_Sales_Model_Quote $quote */
96
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
97
+
98
+ /** @var Mage_Sales_Model_Order $order */
99
+ $order = Mage::getModel('sales/order')->loadByIncrementId($quote->getReservedOrderId());
100
+
101
+ return $order;
102
+ }
103
}
app/code/community/Uecommerce/Mundipagg/Helper/CheckoutSession.php ADDED
@@ -0,0 +1,28 @@
1
+ <?php
2
+
3
+ /**
4
+ * Helper methods to checkout session
5
+ */
6
+ class Uecommerce_Mundipagg_Helper_CheckoutSession extends Mage_Core_Helper_Abstract {
7
+
8
+ public function getInstance() {
9
+ return Mage::getSingleton('checkout/session');
10
+ }
11
+
12
+ /**
13
+ * Get approval_request_success flag from checkout session
14
+ * @return null|string
15
+ */
16
+ public function getApprovalRequest() {
17
+ return $this->getInstance()->getApprovalRequestSuccess();
18
+ }
19
+
20
+ /**
21
+ * Set approval_request_success flag into checkout session
22
+ * @param string $flag
23
+ */
24
+ public function setApprovalRequest($flag) {
25
+ $this->getInstance()->setApprovalRequestSuccess($flag);
26
+ }
27
+
28
+ }
app/code/community/Uecommerce/Mundipagg/Helper/Log.php CHANGED
@@ -14,10 +14,12 @@ class Uecommerce_Mundipagg_Helper_Log extends Mage_Core_Helper_Abstract {
14
15
public function setMethod($method) {
16
$this->method = $method;
17
}
18
19
public function setLogLabel($logLabel) {
20
$this->logLabel = $logLabel;
21
}
22
23
public function getLogLabel() {
14
15
public function setMethod($method) {
16
$this->method = $method;
17
+ return $this;
18
}
19
20
public function setLogLabel($logLabel) {
21
$this->logLabel = $logLabel;
22
+ return $this;
23
}
24
25
public function getLogLabel() {
app/code/community/Uecommerce/Mundipagg/Model/Api.php CHANGED
@@ -88,7 +88,9 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
88
$num = $helper->getCreditCardsNumber($data['payment_method']);
89
$installmentCount = 1;
90
91
- if ($num > 1) {
92
$creditCardOperationEnum = 'AuthOnly';
93
} else {
94
$creditCardOperationEnum = $standard->getCreditCardOperationEnum();
@@ -106,8 +108,8 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
106
if ($token->getId() && $token->getEntityId() == $order->getCustomerId()) {
107
$creditcardTransactionData->CreditCard->InstantBuyKey = $token->getToken();
108
$creditcardTransactionData->CreditCard->CreditCardBrand = $token->getCcType();
109
- $creditcardTransactionData->CreditCardOperation = $creditCardOperationEnum;
110
/** Tipo de operação: AuthOnly | AuthAndCapture | AuthAndCaptureWithDelay */
111
$creditcardTransactionData->AmountInCents = intval(strval(($paymentData['AmountInCents']))); // Valor da transação
112
$creditcardTransactionData->InstallmentCount = $paymentData['InstallmentCount']; // Nº de parcelas
113
$creditcardTransactionData->Options->CurrencyIso = "BRL"; //Moeda do pedido
@@ -286,10 +288,6 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
286
$result['CreateDate'] = $createDate;
287
}
288
289
- /**
290
- * @TODO precisa refatorar isto, pois deste jeito esta gravando offlineretry pra que qualquer pedido
291
- * com mais de 1 cartao
292
- */
293
// save offline retry statements if this feature is enabled
294
$this->saveOfflineRetryStatements($orderReference, new DateTime($createDate));
295
@@ -352,7 +350,6 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
352
}
353
} catch (Exception $e) {
354
//Redirect to Cancel page
355
-
356
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('cancel');
357
358
//Log error
@@ -441,15 +438,10 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
441
$helper = Mage::helper('mundipagg');
442
443
// Set Data
444
- $_request = array();
445
- $_request["Order"] = array();
446
$_request["Order"]["OrderReference"] = $order->getIncrementId();
447
-
448
- // if ($standard->getEnvironment() != 'production') {
449
- // $_request["Order"]["OrderReference"] = md5(date('Y-m-d H:i:s')); // Identificação do pedido na loja
450
- // }
451
-
452
- $_request["BoletoTransactionCollection"] = array();
453
454
$boletoTransactionCollection = new stdclass();
455
@@ -1395,6 +1387,13 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
1395
return $returnMessage;
1396
}
1397
1398
// cannot capture transaction
1399
$returnMessage = "KO | #{$orderReference} | {$transactionKey} | Transaction can't be captured: ";
1400
$returnMessage .= $return;
@@ -1720,65 +1719,43 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
1720
1721
$totalPaid += $amountToCapture;
1722
1723
$transactions = Mage::getModel('sales/order_payment_transaction')
1724
->getCollection()
1725
- ->addAttributeToFilter('order_id', array('eq' => $order->getEntityId()));
1726
-
1727
- foreach ($transactions as $i) {
1728
- $orderTransactionKey = $i->getAdditionalInformation('TransactionKey');
1729
1730
- // transactionKey found
1731
- if ($orderTransactionKey == $transactionKey) {
1732
- $transaction = $i;
1733
- break;
1734
- }
1735
- }
1736
1737
- if (is_null($transaction)) {
1738
Mage::throwException(self::TRANSACTION_NOT_FOUND);
1739
}
1740
1741
if ($transaction->getIsClosed() == true) {
1742
Mage::throwException(self::TRANSACTION_ALREADY_CAPTURED);
1743
}
1744
1745
$accTotalPaid = sprintf($totalPaid);
1746
$accGrandTotal = sprintf($grandTotal);
1747
1748
switch (true) {
1749
-
1750
// total paid equal grand_total, create invoice
1751
case $accTotalPaid == $accGrandTotal:
1752
- $invoice = null;
1753
-
1754
try {
1755
- $order->setBaseTotalPaid(null)
1756
- ->setTotalPaid(null)
1757
- ->save();
1758
1759
- $invoice = $orderPayment->createInvoice($order);
1760
1761
} catch (Exception $e) {
1762
Mage::throwException($e->getMessage());
1763
}
1764
-
1765
- // close transaction
1766
- $transactionToClose = $this->getOrderTxnByTransactionKey($order->getId(), $transactionKey);
1767
-
1768
- if (is_null($transactionToClose)) {
1769
- $log->warning("Transaction not found");
1770
- } else {
1771
- $payment = $order->getPayment();
1772
-
1773
- $transactionToClose->setOrderPaymentObject($payment)
1774
- ->setIsClosed(true)
1775
- ->save();
1776
- }
1777
-
1778
- $this->equalizeInvoiceTotals($invoice);
1779
-
1780
- return $invoice;
1781
-
1782
break;
1783
1784
// order overpaid
@@ -1800,7 +1777,14 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
1800
Mage::throwException("Cannot set order to underpaid: {$e->getMessage()}");
1801
}
1802
1803
- return self::ORDER_UNDERPAID;
1804
break;
1805
1806
// unexpected situation
@@ -1808,11 +1792,11 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
1808
Mage::throwException(self::UNEXPECTED_ERROR);
1809
break;
1810
}
1811
-
1812
}
1813
1814
/**
1815
* Create invoice
1816
* @return string OK|KO
1817
*/
1818
private function createInvoice($order, $data, $totalPaid, $status) {
@@ -1938,91 +1922,6 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
1938
return array('result' => simplexml_load_string($_response));
1939
}
1940
1941
- /**
1942
- * Status reference:
1943
- * http://docs.mundipagg.com/docs/enumera%C3%A7%C3%B5es
1944
- *
1945
- * @param array $postData
1946
- * @TODO refatorar o tratamento das transacoes com este metodo
1947
- */
1948
- private function processCreditCardTransactionNotification($postData) {
1949
- $status = $postData['CreditCardTransaction']['CreditCardTransactionStatus'];
1950
- $transactionKey = $postData['CreditCardTransaction']['TransactionKey'];
1951
- $capturedAmountInCents = $postData['CreditCardTransaction']['CapturedAmountInCents'];
1952
- $ccTransactionEnum = new Uecommerce_Mundipagg_Model_Enum_CreditCardTransactionStatusEnum();
1953
- $helperLog = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
1954
-
1955
- switch ($status) {
1956
- case $ccTransactionEnum::AUTHORIZED_PENDING_CAPTURE:
1957
- break;
1958
-
1959
- case $ccTransactionEnum::CAPTURED:
1960
- break;
1961
-
1962
- case $ccTransactionEnum::PARTIAL_CAPTURE:
1963
- break;
1964
-
1965
- case $ccTransactionEnum::NOT_AUTHORIZED:
1966
- break;
1967
-
1968
- case $ccTransactionEnum::VOIDED:
1969
- break;
1970
-
1971
- case $ccTransactionEnum::PENDING_VOID:
1972
- break;
1973
-
1974
- case $ccTransactionEnum::PARTIAL_VOID:
1975
- break;
1976
-
1977
- case $ccTransactionEnum::REFUNDED:
1978
- break;
1979
-
1980
- case $ccTransactionEnum::PENDING_REFUND:
1981
- break;
1982
-
1983
- case $ccTransactionEnum::PARTIAL_REFUNDED:
1984
- break;
1985
-
1986
- case $ccTransactionEnum::WITH_ERROR:
1987
- break;
1988
-
1989
- case $ccTransactionEnum::NOT_FOUND_ACQUIRER:
1990
- break;
1991
-
1992
- case $ccTransactionEnum::PENDING_AUTHORIZE:
1993
- break;
1994
-
1995
- case $ccTransactionEnum::INVALID:
1996
- break;
1997
- }
1998
- }
1999
-
2000
- /**
2001
- * @author Ruan Azevedo
2002
- * @since 2016-07-20
2003
- * Status reference:
2004
- * http://docs.mundipagg.com/docs/enumera%C3%A7%C3%B5es
2005
- * @TODO refatorar o tratamento das transacoes de boleto com este metodo
2006
- */
2007
- private function processBoletoTransactionNotification() {
2008
- $status = '';
2009
- $boletoTransactionEnum = new Uecommerce_Mundipagg_Model_Enum_BoletoTransactionStatusEnum();
2010
-
2011
- switch ($status) {
2012
- case $boletoTransactionEnum::GENERATED:
2013
- break;
2014
-
2015
- case $boletoTransactionEnum::PAID:
2016
- break;
2017
-
2018
- case $boletoTransactionEnum::UNDERPAID:
2019
- break;
2020
-
2021
- case $boletoTransactionEnum::OVERPAID:
2022
- break;
2023
- }
2024
- }
2025
-
2026
/**
2027
* Mail error to Mage::getStoreConfig('trans_email/ident_custom1/email')
2028
*
@@ -2107,7 +2006,6 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
2107
2108
if ($error) {
2109
$helperLog->error($outputMsg, true);
2110
- // Mage::throwException($outputMsg);
2111
}
2112
2113
if (is_null($sessionId)) {
@@ -2128,6 +2026,7 @@ class Uecommerce_Mundipagg_Model_Api extends Uecommerce_Mundipagg_Model_Standard
2128
2129
/**
2130
* Method to unify the transactions requests and his logs
2131
*
2132
* @since 05-24-2016
2133
* @param array $dataToPost
88
$num = $helper->getCreditCardsNumber($data['payment_method']);
89
$installmentCount = 1;
90
91
+ $approvalRequest = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
92
+
93
+ if ($num > 1 || $approvalRequest === 'partial') {
94
$creditCardOperationEnum = 'AuthOnly';
95
} else {
96
$creditCardOperationEnum = $standard->getCreditCardOperationEnum();
108
if ($token->getId() && $token->getEntityId() == $order->getCustomerId()) {
109
$creditcardTransactionData->CreditCard->InstantBuyKey = $token->getToken();
110
$creditcardTransactionData->CreditCard->CreditCardBrand = $token->getCcType();
111
/** Tipo de operação: AuthOnly | AuthAndCapture | AuthAndCaptureWithDelay */
112
+ $creditcardTransactionData->CreditCardOperation = $creditCardOperationEnum;
113
$creditcardTransactionData->AmountInCents = intval(strval(($paymentData['AmountInCents']))); // Valor da transação
114
$creditcardTransactionData->InstallmentCount = $paymentData['InstallmentCount']; // Nº de parcelas
115
$creditcardTransactionData->Options->CurrencyIso = "BRL"; //Moeda do pedido
288
$result['CreateDate'] = $createDate;
289
}
290
291
// save offline retry statements if this feature is enabled
292
$this->saveOfflineRetryStatements($orderReference, new DateTime($createDate));
293
350
}
351
} catch (Exception $e) {
352
//Redirect to Cancel page
353
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('cancel');
354
355
//Log error
438
$helper = Mage::helper('mundipagg');
439
440
// Set Data
441
+ $_request = [];
442
+ $_request["Order"] = [];
443
$_request["Order"]["OrderReference"] = $order->getIncrementId();
444
+ $_request["BoletoTransactionCollection"] = [];
445
446
$boletoTransactionCollection = new stdclass();
447
1387
return $returnMessage;
1388
}
1389
1390
+ if ($return === self::TRANSACTION_CAPTURED) {
1391
+ $returnMessage = "OK | #{$orderReference} | {$transactionKey} | Transaction captured.";
1392
+ $helperLog->info($returnMessage);
1393
+
1394
+ return $returnMessage;
1395
+ }
1396
+
1397
// cannot capture transaction
1398
$returnMessage = "KO | #{$orderReference} | {$transactionKey} | Transaction can't be captured: ";
1399
$returnMessage .= $return;
1719
1720
$totalPaid += $amountToCapture;
1721
1722
+ /** @var Mage_Sales_Model_Resource_Order_Payment_Transaction_Collection $transactions */
1723
$transactions = Mage::getModel('sales/order_payment_transaction')
1724
->getCollection()
1725
+ ->addAttributeToFilter('order_id', ['eq' => $order->getEntityId()])
1726
+ ->addAttributeToFilter('txn_id', ['eq' => "{$transactionKey}-authorization"]);
1727
1728
+ $transaction = $transactions->getFirstItem();
1729
+ $txnsFound = count($transactions);
1730
1731
+ if (is_null($transactions) || $txnsFound <= 0) {
1732
Mage::throwException(self::TRANSACTION_NOT_FOUND);
1733
+ } else if ($txnsFound > 1) {
1734
+ Mage::throwException("More than one transaction for the TransactionKey in the database");
1735
}
1736
1737
if ($transaction->getIsClosed() == true) {
1738
Mage::throwException(self::TRANSACTION_ALREADY_CAPTURED);
1739
}
1740
1741
+ $order->setBaseTotalPaid($totalPaid)
1742
+ ->setTotalPaid($totalPaid)
1743
+ ->save();
1744
+
1745
$accTotalPaid = sprintf($totalPaid);
1746
$accGrandTotal = sprintf($grandTotal);
1747
1748
switch (true) {
1749
// total paid equal grand_total, create invoice
1750
case $accTotalPaid == $accGrandTotal:
1751
try {
1752
+ $invoice = $orderPayment->orderPaid($order, $this);
1753
1754
+ return $invoice;
1755
1756
} catch (Exception $e) {
1757
Mage::throwException($e->getMessage());
1758
}
1759
break;
1760
1761
// order overpaid
1777
Mage::throwException("Cannot set order to underpaid: {$e->getMessage()}");
1778
}
1779
1780
+ $transaction->setOrderPaymentObject($order->getPayment());
1781
+ $transaction->setIsClosed(true)->save();
1782
+
1783
+ if ($order->getPayment()->getMethod() === 'mundipagg_twocreditcards') {
1784
+ return self::TRANSACTION_CAPTURED;
1785
+ } else {
1786
+ return self::ORDER_UNDERPAID;
1787
+ }
1788
break;
1789
1790
// unexpected situation
1792
Mage::throwException(self::UNEXPECTED_ERROR);
1793
break;
1794
}
1795
}
1796
1797
/**
1798
* Create invoice
1799
+ * @todo must be deprecated use Uecommerce_Mundipagg_Model_Order_Payment createInvoice
1800
* @return string OK|KO
1801
*/
1802
private function createInvoice($order, $data, $totalPaid, $status) {
1922
return array('result' => simplexml_load_string($_response));
1923
}
1924
1925
/**
1926
* Mail error to Mage::getStoreConfig('trans_email/ident_custom1/email')
1927
*
2006
2007
if ($error) {
2008
$helperLog->error($outputMsg, true);
2009
}
2010
2011
if (is_null($sessionId)) {
2026
2027
/**
2028
* Method to unify the transactions requests and his logs
2029
+ * @todo must be deprecated, use Uecommerce_Mundipagg_Model_Api::sendJSON method
2030
*
2031
* @since 05-24-2016
2032
* @param array $dataToPost
app/code/community/Uecommerce/Mundipagg/Model/Observer.php CHANGED
@@ -165,14 +165,14 @@ class Uecommerce_Mundipagg_Model_Observer extends Uecommerce_Mundipagg_Model_Sta
165
$result = $event->getResult();
166
$isPartial = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
167
168
- if ($isPartial == 'partial') {
169
switch ($method->getCode()) {
170
case 'mundipagg_creditcardoneinstallment':
171
case 'mundipagg_creditcard':
172
- case 'mundipagg_twocreditcards':
173
- case 'mundipagg_threecreditcards':
174
- case 'mundipagg_fourcreditcards':
175
- case 'mundipagg_fivecreditcards':
176
$active = Mage::getStoreConfig('payment/' . $method->getCode() . '/active');
177
178
if ($active == '1') {
165
$result = $event->getResult();
166
$isPartial = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
167
168
+ if ($isPartial === 'partial') {
169
switch ($method->getCode()) {
170
case 'mundipagg_creditcardoneinstallment':
171
case 'mundipagg_creditcard':
172
+ // case 'mundipagg_twocreditcards':
173
+ // case 'mundipagg_threecreditcards':
174
+ // case 'mundipagg_fourcreditcards':
175
+ // case 'mundipagg_fivecreditcards':
176
$active = Mage::getStoreConfig('payment/' . $method->getCode() . '/active');
177
178
if ($active == '1') {
app/code/community/Uecommerce/Mundipagg/Model/Order/Payment.php CHANGED
@@ -17,6 +17,11 @@ class Uecommerce_Mundipagg_Model_Order_Payment {
17
Mage::throwException(self::ERR_CANNOT_CREATE_INVOICE);
18
}
19
20
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
21
22
if (!$invoice->getTotalQty()) {
@@ -47,6 +52,28 @@ class Uecommerce_Mundipagg_Model_Order_Payment {
47
return $invoice;
48
}
49
50
public function orderOverpaid(Mage_Sales_Model_Order $order) {
51
try {
52
$order->setStatus('overpaid')
17
Mage::throwException(self::ERR_CANNOT_CREATE_INVOICE);
18
}
19
20
+ // reset total paid because invoice generation set order total_paid also
21
+ $order->setBaseTotalPaid(null)
22
+ ->setTotalPaid(null)
23
+ ->save();
24
+
25
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
26
27
if (!$invoice->getTotalQty()) {
52
return $invoice;
53
}
54
55
+ /**
56
+ * @param Mage_Sales_Model_Order $order
57
+ * @param Uecommerce_Mundipagg_Model_Standard $standard
58
+ * @return Mage_Sales_Model_Order_Invoice
59
+ */
60
+ public function orderPaid(Mage_Sales_Model_Order $order, Uecommerce_Mundipagg_Model_Standard $standard) {
61
+ try {
62
+ $invoice = $this->createInvoice($order, $standard);
63
+
64
+ $log = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
65
+ $log->setLogLabel("#{$order->getIncrementId()}");
66
+
67
+ $standard->closeAuthorizationTxns($order);
68
+ $log->info("Authorization transactions closed");
69
+
70
+ return $invoice;
71
+
72
+ } catch (Exception $e) {
73
+ Mage::throwException($e);
74
+ }
75
+ }
76
+
77
public function orderOverpaid(Mage_Sales_Model_Order $order) {
78
try {
79
$order->setStatus('overpaid')
app/code/community/Uecommerce/Mundipagg/Model/Standard.php CHANGED
@@ -362,16 +362,6 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
362
}
363
364
$epsilon = 0.00001;
365
-
366
- // $helperLog = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
367
- // $helperLog->info("totalInstallments: {$totalInstallments}");
368
- // $helperLog->info("grandTotal: {$grandTotal}");
369
- // $helperLog->info("getPaymentInterest: {$info->getPaymentInterest()}");
370
- // $helperLog->info("epsilon: {$epsilon}");
371
-
372
- // if ($totalInstallments > 0 && ($grandTotal - $totalInstallments - $info->getPaymentInterest())) {
373
- // Mage::throwException(Mage::helper('payment')->__('Installments does not match with quote.'));
374
- // }
375
}
376
} else {
377
if (isset($mundipagg['method'])) {
@@ -582,14 +572,15 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
582
$result = $helper->issetOr($resultPayment['result'], false);
583
$ccResultCollection = $helper->issetOr($result['CreditCardTransactionResultCollection']);
584
585
- /**
586
- * @todo: Refact this. Integration time out message must be setted only if the API response is false
587
- * 'CreditCardTransactionResultCollection' null or empty is not a timeout
588
- */
589
- if (is_null($ccResultCollection)) {
590
return $this->integrationTimeOut($order, $payment);
591
}
592
593
if (is_null($ccResultCollection) === false) {
594
// We record transaction(s)
595
if (count($ccResultCollection) == 1) {
@@ -708,7 +699,7 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
708
}
709
710
// Save transactions
711
- foreach ($ccTxnResultCollection as $txn){
712
$this->_addTransaction(
713
$payment,
714
$txn['TransactionKey'],
@@ -841,6 +832,7 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
841
// Error
842
if (!$capture) {
843
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('cancel');
844
return $this;
845
}
846
@@ -899,7 +891,7 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
899
900
// Return error
901
if (isset($resultPayment['error'])) {
902
- return $this->paymentError($order, $resultPayment);
903
}
904
905
if (isset($resultPayment['message'])) {
@@ -1207,6 +1199,9 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
1207
case $type:
1208
$approvalRequest = $api->creditCardTransaction($order, $data, $this);
1209
break;
1210
}
1211
1212
if ($approvalRequest === false) {
@@ -1380,10 +1375,6 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
1380
}
1381
}
1382
1383
- // Transaction
1384
- // $transactionKey = isset($dataR['CreditCardTransactionResultCollection']['CreditCardTransactionResult']['TransactionKey']) ? $dataR['CreditCardTransactionResultCollection']['CreditCardTransactionResult']['TransactionKey'] : null;
1385
- // $creditCardTransactionStatusEnum = isset($dataR['CreditCardTransactionResultCollection']['CreditCardTransactionResult']['CreditCardTransactionStatus']) ? $dataR['CreditCardTransactionResultCollection']['CreditCardTransactionResult']['CreditCardTransactionStatus'] : null;
1386
-
1387
$transactionKey = $transaction['TransactionKey'];
1388
$creditCardTransactionStatusEnum = $transaction['CreditCardTransactionStatus'];
1389
@@ -1415,7 +1406,7 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
1415
$orderKeys = (array)$orderPayment->getAdditionalInformation('OrderKey');
1416
1417
if (is_null($orderKeys) || !is_array($orderKeys)) {
1418
- $orderKeys = array();
1419
}
1420
1421
if (!in_array($newOrderKey, $orderKeys)) {
@@ -1551,18 +1542,9 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
1551
$TransactionReference = $transaction->getAdditionalInformation('TransactionReference');
1552
}
1553
1554
- // $data['CreditCardTransactionCollection']['AmountInCents'] = $payment->getOrder()->getBaseGrandTotal() * 100;
1555
- // $data['CreditCardTransactionCollection']['TransactionKey'] = $TransactionKey;
1556
- // $data['CreditCardTransactionCollection']['TransactionReference'] = $TransactionReference;
1557
- // $data['OrderKey'] = $payment->getAdditionalInformation('OrderKey');
1558
$orderkeys = $payment->getAdditionalInformation('OrderKey');
1559
1560
if (!is_array($orderkeys)) {
1561
- // $errMsg = "Impossible to capture: orderkeys must be an array";
1562
- // $helperLog = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
1563
- //
1564
- // $helperLog->error($errMsg);
1565
- // Mage::throwException($errMsg);
1566
$orderkeys = array($orderkeys);
1567
}
1568
@@ -2025,11 +2007,7 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
2025
2026
$helperLog->info($message);
2027
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('success');
2028
-
2029
- }/* else {
2030
- $helperLog->info("{$logLabel} | Payment not authorized and order is not on offline retry.");
2031
- Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('cancel');
2032
- }*/
2033
}
2034
2035
/**
@@ -2059,15 +2037,13 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
2059
}
2060
2061
/**
2062
- * @param Mage_Sales_Model_Order $order
2063
- * @param $resultPayment
2064
* @return $this
2065
*/
2066
- private function paymentError(Mage_Sales_Model_Order $order, $resultPayment) {
2067
try {
2068
- $payment = $order->getPayment();
2069
$transactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER;
2070
-
2071
$helper = Mage::helper('mundipagg');
2072
$result = $helper->issetOr($resultPayment['result']);
2073
$ccTxnCollection = $helper->issetOr($result['CreditCardTransactionResultCollection']);
@@ -2102,13 +2078,12 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
2102
$payment->setSkipOrderProcessing(true)->save();
2103
2104
if (isset($resultPayment['ErrorDescription'])) {
2105
- $order->addStatusHistoryComment(Mage::helper('mundipagg')->__(htmlspecialchars_decode($resultPayment['ErrorDescription'])));
2106
- $order->save();
2107
-
2108
Mage::throwException(Mage::helper('mundipagg')->__($resultPayment['ErrorDescription']));
2109
} else {
2110
- Mage::throwException(Mage::helper('mundipagg')->__('Erro'));
2111
}
2112
} catch (Exception $e) {
2113
return $this;
2114
}
@@ -2239,4 +2214,230 @@ class Uecommerce_Mundipagg_Model_Standard extends Mage_Payment_Model_Method_Abst
2239
->save();
2240
}
2241
2242
}
362
}
363
364
$epsilon = 0.00001;
365
}
366
} else {
367
if (isset($mundipagg['method'])) {
572
$result = $helper->issetOr($resultPayment['result'], false);
573
$ccResultCollection = $helper->issetOr($result['CreditCardTransactionResultCollection']);
574
575
+ if ($result === false) {
576
return $this->integrationTimeOut($order, $payment);
577
}
578
579
+ // Return error
580
+ if (isset($resultPayment['error'])) {
581
+ return $this->paymentError($payment, $resultPayment);
582
+ }
583
+
584
if (is_null($ccResultCollection) === false) {
585
// We record transaction(s)
586
if (count($ccResultCollection) == 1) {
699
}
700
701
// Save transactions
702
+ foreach ($ccTxnResultCollection as $txn) {
703
$this->_addTransaction(
704
$payment,
705
$txn['TransactionKey'],
832
// Error
833
if (!$capture) {
834
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('cancel');
835
+
836
return $this;
837
}
838
891
892
// Return error
893
if (isset($resultPayment['error'])) {
894
+ return $this->paymentError($payment, $resultPayment);
895
}
896
897
if (isset($resultPayment['message'])) {
1199
case $type:
1200
$approvalRequest = $api->creditCardTransaction($order, $data, $this);
1201
break;
1202
+
1203
+ default:
1204
+ $approvalRequest = false;
1205
}
1206
1207
if ($approvalRequest === false) {
1375
}
1376
}
1377
1378
$transactionKey = $transaction['TransactionKey'];
1379
$creditCardTransactionStatusEnum = $transaction['CreditCardTransactionStatus'];
1380
1406
$orderKeys = (array)$orderPayment->getAdditionalInformation('OrderKey');
1407
1408
if (is_null($orderKeys) || !is_array($orderKeys)) {
1409
+ $orderKeys = [];
1410
}
1411
1412
if (!in_array($newOrderKey, $orderKeys)) {
1542
$TransactionReference = $transaction->getAdditionalInformation('TransactionReference');
1543
}
1544
1545
$orderkeys = $payment->getAdditionalInformation('OrderKey');
1546
1547
if (!is_array($orderkeys)) {
1548
$orderkeys = array($orderkeys);
1549
}
1550
2007
2008
$helperLog->info($message);
2009
Mage::getSingleton('checkout/session')->setApprovalRequestSuccess('success');
2010
+ }
2011
}
2012
2013
/**
2037
}
2038
2039
/**
2040
+ * @param Mage_Sales_Model_Order_Payment $payment
2041
+ * @param $resultPayment
2042
* @return $this
2043
*/
2044
+ private function paymentError(Mage_Sales_Model_Order_Payment $payment, $resultPayment) {
2045
try {
2046
$transactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER;
2047
$helper = Mage::helper('mundipagg');
2048
$result = $helper->issetOr($resultPayment['result']);
2049
$ccTxnCollection = $helper->issetOr($result['CreditCardTransactionResultCollection']);
2078
$payment->setSkipOrderProcessing(true)->save();
2079
2080
if (isset($resultPayment['ErrorDescription'])) {
2081
Mage::throwException(Mage::helper('mundipagg')->__($resultPayment['ErrorDescription']));
2082
+
2083
} else {
2084
+ Mage::throwException(Mage::helper('mundipagg')->__('Error'));
2085
}
2086
+
2087
} catch (Exception $e) {
2088
return $this;
2089
}
2214
->save();
2215
}
2216
2217
+ /**
2218
+ * @param Mage_Checkout_Model_Type_Onepage $onepage
2219
+ * @param array $postData
2220
+ * @return null|string $redirectRoute
2221
+ * @throws Exception
2222
+ */
2223
+ public function retryAuthorization(Mage_Checkout_Model_Type_Onepage &$onepage, $postData) {
2224
+ $redirectRoute = null;
2225
+
2226
+ /* @var Uecommerce_Mundipagg_Helper_CheckoutSession $session */
2227
+ $session = Mage::helper('mundipagg/checkoutSession');
2228
+ $lastQuoteId = $session->getInstance()->getLastSuccessQuoteId();
2229
+ $session->getInstance()->setQuoteId($lastQuoteId);
2230
+
2231
+ /* @var Mage_Sales_Model_Quote $quote */
2232
+ $quote = Mage::getModel('sales/quote')->load($lastQuoteId);
2233
+ $quote->setIsActive(true);
2234
+
2235
+ $onepage->setQuote($quote);
2236
+
2237
+ // Get Reserved Order Id
2238
+ $reservedOrderId = $quote->getReservedOrderId();
2239
+
2240
+ if ($reservedOrderId == false) {
2241
+ return $redirectRoute;
2242
+ }
2243
+
2244
+ $session->setApprovalRequest('partial');
2245
+
2246
+ $order = Mage::getModel('sales/order')->loadByIncrementId($reservedOrderId);
2247
+
2248
+ //
2249
+ $additionalInfo = $order->getPayment()->getAdditionalInformation();
2250
+ $num = 1;
2251
+
2252
+ if ($additionalInfo['2_Success']) {
2253
+ $num++;
2254
+ }
2255
+
2256
+ $idxToken = "mundipagg_twocreditcards_token_2_{$num}";
2257
+
2258
+ switch (true) {
2259
+ case isset($additionalInfo[$idxToken]) :
2260
+ $order->getPayment()->setAdditionalInformation();
2261
+ break;
2262
+ }
2263
+
2264
+ /* @var Uecommerce_Mundipagg_Helper_Data $helper */
2265
+ $helper = Mage::helper('mundipagg');
2266
+
2267
+ if ($order->getStatus() === 'pending' || $order->getStatus() === 'payment_review') {
2268
+ if (empty($postData)) {
2269
+ throw new Exception($helper->__('Invalid data'));
2270
+ // Mage::throwException($helper->__('Invalid data'));
2271
+ // return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data'));
2272
+ }
2273
+
2274
+ $paymentMethod = $helper->issetOr($postData['method']);
2275
+
2276
+ if ($quote->isVirtual()) {
2277
+ $quote->getBillingAddress()->setPaymentMethod($paymentMethod);
2278
+ } else {
2279
+ $quote->getShippingAddress()->setPaymentMethod($paymentMethod);
2280
+ }
2281
+
2282
+ $payment = $quote->getPayment();
2283
+ $payment->importData($postData);
2284
+
2285
+ $quote->save();
2286
+
2287
+ switch ($paymentMethod) {
2288
+ case 'mundipagg_creditcardoneinstallment':
2289
+ $standard = Mage::getModel('mundipagg/creditcardoneinstallment');
2290
+ break;
2291
+ case 'mundipagg_creditcard':
2292
+ $standard = Mage::getModel('mundipagg/creditcard');
2293
+ break;
2294
+
2295
+ case 'mundipagg_twocreditcards':
2296
+ $standard = Mage::getModel('mundipagg/twocreditcards');
2297
+ break;
2298
+
2299
+ case 'mundipagg_threecreditcards':
2300
+ $standard = Mage::getModel('mundipagg/threecreditcards');
2301
+ break;
2302
+
2303
+ case 'mundipagg_fourcreditcards':
2304
+ $standard = Mage::getModel('mundipagg/fourcreditcards');
2305
+ break;
2306
+
2307
+ case 'mundipagg_fivecreditcards':
2308
+ $standard = Mage::getModel('mundipagg/fivecreditcards');
2309
+ break;
2310
+
2311
+ default:
2312
+ return 'mundipagg/standard/partial';
2313
+ break;
2314
+ }
2315
+
2316
+ /* @var Uecommerce_Mundipagg_Model_Standard $standard */
2317
+ $resultPayment = $standard->doPayment($payment, $order);
2318
+ $txns = $helper->issetOr($resultPayment['result']['CreditCardTransactionResultCollection']);
2319
+
2320
+ foreach ($txns as $txn) {
2321
+ $standard->_addTransaction(
2322
+ $order->getPayment(),
2323
+ $helper->issetOr($txn['TransactionKey']),
2324
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH,
2325
+ $txn,
2326
+ $num - 1
2327
+ );
2328
+ }
2329
+
2330
+ $teste = $order->getPayment();
2331
+ $order->getPayment()->save();
2332
+
2333
+ // $this->replaceNotAuthorizedCcInfo($txns[0], $order->getPayment());
2334
+
2335
+ $accAuthorizedAmount = sprintf($order->getData('payment_authorization_amount'));
2336
+ $accGrandTotal = sprintf($order->getData('grand_total'));
2337
+
2338
+ if ($standard->getAntiFraud() == 0 &&
2339
+ $standard->getPaymentAction() === 'order' &&
2340
+ $accAuthorizedAmount == $accGrandTotal
2341
+ ) {
2342
+ $standard->captureAndcreateInvoice($order->getPayment());
2343
+ }
2344
+
2345
+ switch ($session->getApprovalRequest()) {
2346
+ case 'success':
2347
+ // Send new order email when not in admin and payment is success
2348
+ if (Mage::app()->getStore()->getCode() !== 'admin') {
2349
+ $order->sendNewOrderEmail();
2350
+ }
2351
+ $redirectRoute = 'mundipagg/standard/success';
2352
+ break;
2353
+
2354
+ case 'partial':
2355
+ $redirectRoute = 'mundipagg/standard/partial';
2356
+ break;
2357
+
2358
+ case 'cancel':
2359
+ $redirectRoute = 'mundipagg/standard/cancel';
2360
+ break;
2361
+
2362
+ default:
2363
+ throw new Exception("Unexpected approvalRequestSuccess: {$session->getApprovalRequest()}");
2364
+ }
2365
+ }
2366
+
2367
+ return $redirectRoute;
2368
+ }
2369
+
2370
+ /**
2371
+ * Replace the not authorized payment additional information
2372
+ */
2373
+ public function replaceNotAuthorizedCcInfo($mundiResponse, Mage_Sales_Model_Order_Payment &$payment) {
2374
+ $info = $payment->getAdditionalInformation();
2375
+ $ccQty = $info['mundipagg_type'][0];
2376
+ $keys = array_keys($info);
2377
+ $ccsData = [];
2378
+ $otherData = [];
2379
+
2380
+ // separate credit cards payment additional information
2381
+ foreach ($keys as $key) {
2382
+ $idxTwoInitialLetters = $key[0] . $key[1];
2383
+ $value = $info[$key];
2384
+
2385
+ if ($idxTwoInitialLetters === '1_') {
2386
+ $ccsData[1][$key] = $value;
2387
+ } elseif ($idxTwoInitialLetters === '2_') {
2388
+ $ccsData[2][$key] = $value;
2389
+ } else {
2390
+ $otherData[$key] = $value;
2391
+ }
2392
+ }
2393
+
2394
+ $notAuthorizedCc = null;
2395
+
2396
+ // get just the not authorized credit card data
2397
+ for ($i = 1; $i <= $ccQty; $i++) {
2398
+ $idx = "{$i}_Success";
2399
+ $success = $ccsData[$i][$idx];
2400
+
2401
+ if ($success) {
2402
+ // $notAuthorizedCc = $i === 1 ? 1 : 2;
2403
+ if ($i === 1) {
2404
+ $notAuthorizedCc = 1;
2405
+ } else {
2406
+ $notAuthorizedCc = 2;
2407
+ }
2408
+ break;
2409
+ }
2410
+ }
2411
+
2412
+ $responseKeys = $this->extractTxnKeys($mundiResponse);
2413
+ $key = null;
2414
+
2415
+ foreach ($responseKeys as $key => $val) {
2416
+ $idx = "{$notAuthorizedCc}_{$val}";
2417
+ $ccsData[$idx] = isset($ccsData[$idx]) ? $ccsData[$idx] : null;
2418
+ }
2419
+
2420
+ $data = $otherData + $ccsData[1] + $ccsData[2];
2421
+
2422
+ $payment->setAdditionalInformation($data)->save();
2423
+ }
2424
+
2425
+ public function extractTxnKeys($txn) {
2426
+ $keys = [];
2427
+
2428
+ foreach ($txn as $key => $val) {
2429
+ if (is_array($txn[$key]) && !empty($txn[$key])) {
2430
+
2431
+ foreach ($txn[$key] as $subKey => $subVal) {
2432
+ $keys[] = $subKey;
2433
+ }
2434
+
2435
+ } else {
2436
+ $keys[] = $key;
2437
+ }
2438
+ }
2439
+
2440
+ return $keys;
2441
+ }
2442
+
2443
}
app/code/community/Uecommerce/Mundipagg/controllers/StandardController.php CHANGED
@@ -70,10 +70,7 @@ class Uecommerce_Mundipagg_StandardController extends Mage_Core_Controller_Front
70
* Partial payment
71
*/
72
public function partialAction() {
73
- $paymentMethod = Mage::helper('payment')->getMethodInstance('mundipagg_creditcard');
74
-
75
$session = Mage::getSingleton('checkout/session');
76
-
77
$approvalRequestSuccess = $session->getApprovalRequestSuccess();
78
79
if (!$session->getLastSuccessQuoteId() && $approvalRequestSuccess != 'partial') {
@@ -83,11 +80,9 @@ class Uecommerce_Mundipagg_StandardController extends Mage_Core_Controller_Front
83
}
84
85
$lastQuoteId = $session->getLastSuccessQuoteId();
86
-
87
$session->setQuoteId($lastQuoteId);
88
89
$quote = Mage::getModel('sales/quote')->load($lastQuoteId);
90
-
91
$this->getOnepage()->setQuote($quote);
92
$this->getOnepage()->getQuote()->setIsActive(true);
93
$this->getOnepage()->getQuote()->save();
@@ -114,145 +109,29 @@ class Uecommerce_Mundipagg_StandardController extends Mage_Core_Controller_Front
114
* Partial payment Post
115
*/
116
public function partialPostAction() {
117
- $session = Mage::getSingleton('checkout/session');
118
-
119
- // Post
120
- if ($data = $this->getRequest()->getPost('payment', array())) {
121
- try {
122
- $lastQuoteId = $session->getLastSuccessQuoteId();
123
-
124
- $session->setQuoteId($lastQuoteId);
125
-
126
- $quote = Mage::getModel('sales/quote')->load($lastQuoteId);
127
-
128
- $this->getOnepage()->setQuote($quote);
129
- $this->getOnepage()->getQuote()->setIsActive(true);
130
-
131
- // Get Reserved Order Id
132
- if ($reservedOrderId = $this->getOnepage()->getQuote()->getReservedOrderId()) {
133
- $session->setApprovalRequestSuccess('partial');
134
-
135
- $order = Mage::getModel('sales/order')->loadByIncrementId($reservedOrderId);
136
-
137
- if ($order->getStatus() == 'pending' OR $order->getStatus() == 'payment_review') {
138
- if (empty($data)) {
139
- return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data'));
140
- }
141
-
142
- if ($this->getOnepage()->getQuote()->isVirtual()) {
143
- $quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
144
- } else {
145
- $quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
146
- }
147
-
148
- $payment = $quote->getPayment();
149
- $payment->importData($data);
150
-
151
- $quote->save();
152
-
153
- switch ($data['method']):
154
- case 'mundipagg_creditcardoneinstallment':
155
- $onepage = Mage::getModel('mundipagg/creditcardoneinstallment');
156
- break;
157
- case 'mundipagg_creditcard':
158
- $onepage = Mage::getModel('mundipagg/creditcard');
159
- break;
160
-
161
- case 'mundipagg_twocreditcards':
162
- $onepage = Mage::getModel('mundipagg/twocreditcards');
163
- break;
164
-
165
- case 'mundipagg_threecreditcards':
166
- $onepage = Mage::getModel('mundipagg/threecreditcards');
167
- break;
168
-
169
- case 'mundipagg_fourcreditcards':
170
- $onepage = Mage::getModel('mundipagg/fourcreditcards');
171
- break;
172
-
173
- case 'mundipagg_fivecreditcards':
174
- $onepage = Mage::getModel('mundipagg/fivecreditcards');
175
- break;
176
-
177
- default:
178
- $this->_redirect('mundipagg/standard/partial');
179
- break;
180
- endswitch;
181
-
182
- $resultPayment = $onepage->doPayment($payment, $order);
183
- $approvalRequestSuccess = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
184
-
185
- // Send new order email when not in admin and payment is success
186
- if ($approvalRequestSuccess == 'success') {
187
- if (Mage::app()->getStore()->getCode() != 'admin') {
188
- $order->sendNewOrderEmail();
189
- }
190
- }
191
192
- $info = $order->getPayment();
193
-
194
- // We record transaction(s)
195
- $json = json_encode($resultPayment['result']);
196
- $dataR = array();
197
- $dataR = json_decode($json, true);
198
-
199
- $transactions = $resultPayment['result']['CreditCardTransactionResultCollection'];
200
-
201
- if (count($transactions) == 1) {
202
- $trans = $dataR['CreditCardTransactionResultCollection'][0];
203
-
204
- $onepage->_addTransaction($order->getPayment(), $trans['TransactionKey'], Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, $trans);
205
-
206
- } else {
207
- $transactions = $dataR['CreditCardTransactionResultCollection'];
208
-
209
- foreach ($transactions as $key => $trans) {
210
- $onepage->_addTransaction($order->getPayment(), $trans['TransactionKey'], Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, $trans);
211
- }
212
-
213
- // We can capture only if anti fraud is disabled and payment action is "AuthorizeAndCapture"
214
- $creditCardTransactionResultCollection = $transactions;
215
-
216
- if (
217
- count($creditCardTransactionResultCollection) > 1 &&
218
- $onepage->getAntiFraud() == 0 &&
219
- $onepage->getPaymentAction() == 'order'
220
- ) {
221
- $resultCapture = $onepage->captureAndcreateInvoice($info);
222
- }
223
- }
224
225
- switch ($approvalRequestSuccess) {
226
- case 'success':
227
- $this->_redirect('mundipagg/standard/success');
228
- break;
229
230
- case 'partial':
231
- $this->_redirect('mundipagg/standard/partial');
232
- break;
233
234
- case 'cancel':
235
- $this->_redirect('mundipagg/standard/cancel');
236
- break;
237
238
- default:
239
- Mage::throwException("Unexpected approvalRequestSuccess: {$approvalRequestSuccess}");
240
- }
241
242
- // // Redirect
243
- // if ($approvalRequestSuccess == 'success') {
244
- // $this->_redirect('mundipagg/standard/success');
245
- // } else {
246
- // $this->_redirect('mundipagg/standard/partial');
247
- // }
248
- }
249
- }
250
- } catch (Exception $e) {
251
- //Log error
252
- Mage::logException($e);
253
- }
254
- } else {
255
- $this->_redirect();
256
}
257
}
258
@@ -324,10 +203,10 @@ class Uecommerce_Mundipagg_StandardController extends Mage_Core_Controller_Front
324
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
325
$order = Mage::getModel('sales/order')->load($lastOrderId);
326
327
- try{
328
Uecommerce_Mundipagg_Model_Standard::transactionWithError($order);
329
330
- } catch (Exception $e){
331
$log = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
332
$log->error($e->getMessage());
333
}
@@ -472,4 +351,14 @@ class Uecommerce_Mundipagg_StandardController extends Mage_Core_Controller_Front
472
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
473
}
474
}
475
}
70
* Partial payment
71
*/
72
public function partialAction() {
73
$session = Mage::getSingleton('checkout/session');
74
$approvalRequestSuccess = $session->getApprovalRequestSuccess();
75
76
if (!$session->getLastSuccessQuoteId() && $approvalRequestSuccess != 'partial') {
80
}
81
82
$lastQuoteId = $session->getLastSuccessQuoteId();
83
$session->setQuoteId($lastQuoteId);
84
85
$quote = Mage::getModel('sales/quote')->load($lastQuoteId);
86
$this->getOnepage()->setQuote($quote);
87
$this->getOnepage()->getQuote()->setIsActive(true);
88
$this->getOnepage()->getQuote()->save();
109
* Partial payment Post
110
*/
111
public function partialPostAction() {
112
+ $postData = $this->getRequest()->getPost('payment', []);
113
114
+ if ($postData == false) {
115
+ $this->_redirect();
116
117
+ return;
118
+ }
119
120
+ /* @var Uecommerce_Mundipagg_Model_Standard $standard */
121
+ $standard = Mage::getModel('mundipagg/standard');
122
123
+ try {
124
+ $route = $standard->retryAuthorization($this->getOnepage(), $postData);
125
+ $this->_redirect($route);
126
+ } catch (Exception $e) {
127
+ /* @var Uecommerce_Mundipagg_Helper_CheckoutSession $session */
128
+ $sessionHelper = Mage::helper('mundipagg/checkoutSession');
129
+ $sessionHelper->getInstance()->addError($sessionHelper->__('Unable to authorize'));
130
131
+ $log = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
132
+ $log->debug($e->getMessage());
133
134
+ $this->_redirect('/checkout/onepage/');
135
}
136
}
137
203
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
204
$order = Mage::getModel('sales/order')->load($lastOrderId);
205
206
+ try {
207
Uecommerce_Mundipagg_Model_Standard::transactionWithError($order);
208
209
+ } catch (Exception $e) {
210
$log = new Uecommerce_Mundipagg_Helper_Log(__METHOD__);
211
$log->error($e->getMessage());
212
}
351
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
352
}
353
}
354
+
355
+ public function indexAction(){
356
+ $order = Mage::getModel('sales/order')->loadByIncrementId($this->getRequest()->getParam('order'));
357
+ $payment = $order->getPayment();
358
+ $info = $payment->getAdditionalInformation();
359
+
360
+ var_dump($info);
361
+
362
+ }
363
+
364
}
app/code/community/Uecommerce/Mundipagg/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<Uecommerce_Mundipagg>
5
- <version>2.9.4</version>
6
</Uecommerce_Mundipagg>
7
</modules>
8
2
<config>
3
<modules>
4
<Uecommerce_Mundipagg>
5
+ <version>2.9.6</version>
6
</Uecommerce_Mundipagg>
7
</modules>
8
app/code/community/Uecommerce/Mundipagg/etc/system.xml CHANGED
@@ -709,249 +709,6 @@
709
</sort_order>
710
</fields>
711
</mundipagg_twocreditcards>
712
- <mundipagg_threecreditcards type="group" translate="label">
713
- <label><![CDATA[MundiPagg - 3 Cartões de Crédito]]></label>
714
- <sort_order>450</sort_order>
715
- <show_in_default>1</show_in_default>
716
- <show_in_website>1</show_in_website>
717
- <show_in_store>1</show_in_store>
718
- <comment>
719
- <![CDATA[<br><a href="http://www.mundipagg.com.br" target="_blank"><img title="MundiPagg" alt="MundiPagg" src="/skin/adminhtml/default/default/images/mundipagg/mundi-magento-admin-banner.png"/></a><br><br><br>]]></comment>
720
- <fields>
721
- <active translate="label">
722
- <label>Enabled</label>
723
- <frontend_type>select</frontend_type>
724
- <source_model>adminhtml/system_config_source_yesno</source_model>
725
- <sort_order>1</sort_order>
726
- <show_in_default>1</show_in_default>
727
- <show_in_website>1</show_in_website>
728
- <show_in_store>1</show_in_store>
729
- </active>
730
-
731
- <title translate="label">
732
- <label>Title</label>
733
- <frontend_type>text</frontend_type>
734
- <sort_order>2</sort_order>
735
- <show_in_default>1</show_in_default>
736
- <show_in_website>1</show_in_website>
737
- <show_in_store>1</show_in_store>
738
- <comment>
739
- <![CDATA[Frase que irá aparecer no seu checkout para descrever a forma de pagamento.]]></comment>
740
- </title>
741
-
742
- <allowspecific translate="label">
743
- <label>Payment from Applicable Countries</label>
744
- <frontend_type>allowspecific</frontend_type>
745
- <sort_order>60</sort_order>
746
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
747
- <show_in_default>1</show_in_default>
748
- <show_in_website>1</show_in_website>
749
- <show_in_store>1</show_in_store>
750
- </allowspecific>
751
-
752
- <specificcountry translate="label">
753
- <label>Payment from Specific Countries</label>
754
- <frontend_type>multiselect</frontend_type>
755
- <sort_order>61</sort_order>
756
- <source_model>adminhtml/system_config_source_country</source_model>
757
- <show_in_default>1</show_in_default>
758
- <show_in_website>1</show_in_website>
759
- <show_in_store>1</show_in_store>
760
- </specificcountry>
761
-
762
- <min_order_total translate="label">
763
- <label>Min Order Total</label>
764
- <frontend_type>text</frontend_type>
765
- <sort_order>70</sort_order>
766
- <show_in_default>1</show_in_default>
767
- <show_in_website>1</show_in_website>
768
- <show_in_store>1</show_in_store>
769
- <frontend_class>validate-number</frontend_class>
770
- </min_order_total>
771
-
772
- <max_order_total translate="label">
773
- <label>Max Order Total</label>
774
- <frontend_type>text</frontend_type>
775
- <sort_order>80</sort_order>
776
- <show_in_default>1</show_in_default>
777
- <show_in_website>1</show_in_website>
778
- <show_in_store>1</show_in_store>
779
- <frontend_class>validate-number</frontend_class>
780
- </max_order_total>
781
-
782
- <sort_order translate="label">
783
- <label>Sort Order</label>
784
- <frontend_type>text</frontend_type>
785
- <sort_order>100</sort_order>
786
- <show_in_default>1</show_in_default>
787
- <show_in_website>1</show_in_website>
788
- <show_in_store>1</show_in_store>
789
- <frontend_class>validate-number</frontend_class>
790
- </sort_order>
791
- </fields>
792
- </mundipagg_threecreditcards>
793
- <mundipagg_fourcreditcards type="group" translate="label">
794
- <label><![CDATA[MundiPagg - 4 Cartões de Crédito]]></label>
795
- <sort_order>460</sort_order>
796
- <show_in_default>1</show_in_default>
797
- <show_in_website>1</show_in_website>
798
- <show_in_store>1</show_in_store>
799
- <comment>
800
- <![CDATA[<br><a href="http://www.mundipagg.com.br" target="_blank"><img title="MundiPagg" alt="MundiPagg" src="/skin/adminhtml/default/default/images/mundipagg/mundi-magento-admin-banner.png"/></a><br><br><br>]]></comment>
801
- <fields>
802
- <active translate="label">
803
- <label>Enabled</label>
804
- <frontend_type>select</frontend_type>
805
- <source_model>adminhtml/system_config_source_yesno</source_model>
806
- <sort_order>1</sort_order>
807
- <show_in_default>1</show_in_default>
808
- <show_in_website>1</show_in_website>
809
- <show_in_store>1</show_in_store>
810
- </active>
811
-
812
- <title translate="label">
813
- <label>Title</label>
814
- <frontend_type>text</frontend_type>
815
- <sort_order>2</sort_order>
816
- <show_in_default>1</show_in_default>
817
- <show_in_website>1</show_in_website>
818
- <show_in_store>1</show_in_store>
819
- <comment>
820
- <![CDATA[Frase que irá aparecer no seu checkout para descrever a forma de pagamento.]]></comment>
821
- </title>
822
-
823
- <allowspecific translate="label">
824
- <label>Payment from Applicable Countries</label>
825
- <frontend_type>allowspecific</frontend_type>
826
- <sort_order>60</sort_order>
827
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
828
- <show_in_default>1</show_in_default>
829
- <show_in_website>1</show_in_website>
830
- <show_in_store>1</show_in_store>
831
- </allowspecific>
832
-
833
- <specificcountry translate="label">
834
- <label>Payment from Specific Countries</label>
835
- <frontend_type>multiselect</frontend_type>
836
- <sort_order>61</sort_order>
837
- <source_model>adminhtml/system_config_source_country</source_model>
838
- <show_in_default>1</show_in_default>
839
- <show_in_website>1</show_in_website>
840
- <show_in_store>1</show_in_store>
841
- </specificcountry>
842
-
843
- <min_order_total translate="label">
844
- <label>Min Order Total</label>
845
- <frontend_type>text</frontend_type>
846
- <sort_order>70</sort_order>
847
- <show_in_default>1</show_in_default>
848
- <show_in_website>1</show_in_website>
849
- <show_in_store>1</show_in_store>
850
- <frontend_class>validate-number</frontend_class>
851
- </min_order_total>
852
-
853
- <max_order_total translate="label">
854
- <label>Max Order Total</label>
855
- <frontend_type>text</frontend_type>
856
- <sort_order>80</sort_order>
857
- <show_in_default>1</show_in_default>
858
- <show_in_website>1</show_in_website>
859
- <show_in_store>1</show_in_store>
860
- <frontend_class>validate-number</frontend_class>
861
- </max_order_total>
862
-
863
- <sort_order translate="label">
864
- <label>Sort Order</label>
865
- <frontend_type>text</frontend_type>
866
- <sort_order>100</sort_order>
867
- <show_in_default>1</show_in_default>
868
- <show_in_website>1</show_in_website>
869
- <show_in_store>1</show_in_store>
870
- <frontend_class>validate-number</frontend_class>
871
- </sort_order>
872
- </fields>
873
- </mundipagg_fourcreditcards>
874
- <mundipagg_fivecreditcards type="group" translate="label">
875
- <label><![CDATA[MundiPagg - 5 Cartões de Crédito]]></label>
876
- <sort_order>470</sort_order>
877
- <show_in_default>1</show_in_default>
878
- <show_in_website>1</show_in_website>
879
- <show_in_store>1</show_in_store>
880
- <comment>
881
- <![CDATA[<br><a href="http://www.mundipagg.com.br" target="_blank"><img title="MundiPagg" alt="MundiPagg" src="/skin/adminhtml/default/default/images/mundipagg/mundi-magento-admin-banner.png"/></a><br><br><br>]]></comment>
882
- <fields>
883
- <active translate="label">
884
- <label>Enabled</label>
885
- <frontend_type>select</frontend_type>
886
- <source_model>adminhtml/system_config_source_yesno</source_model>
887
- <sort_order>1</sort_order>
888
- <show_in_default>1</show_in_default>
889
- <show_in_website>1</show_in_website>
890
- <show_in_store>1</show_in_store>
891
- </active>
892
-
893
- <title translate="label">
894
- <label>Title</label>
895
- <frontend_type>text</frontend_type>
896
- <sort_order>2</sort_order>
897
- <show_in_default>1</show_in_default>
898
- <show_in_website>1</show_in_website>
899
- <show_in_store>1</show_in_store>
900
- <comment>
901
- <![CDATA[Frase que irá aparecer no seu checkout para descrever a forma de pagamento.]]></comment>
902
- </title>
903
-
904
- <allowspecific translate="label">
905
- <label>Payment from Applicable Countries</label>
906
- <frontend_type>allowspecific</frontend_type>
907
- <sort_order>60</sort_order>
908
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
909
- <show_in_default>1</show_in_default>
910
- <show_in_website>1</show_in_website>
911
- <show_in_store>1</show_in_store>
912
- </allowspecific>
913
-
914
- <specificcountry translate="label">
915
- <label>Payment from Specific Countries</label>
916
- <frontend_type>multiselect</frontend_type>
917
- <sort_order>61</sort_order>
918
- <source_model>adminhtml/system_config_source_country</source_model>
919
- <show_in_default>1</show_in_default>
920
- <show_in_website>1</show_in_website>
921
- <show_in_store>1</show_in_store>
922
- </specificcountry>
923
-
924
- <min_order_total translate="label">
925
- <label>Min Order Total</label>
926
- <frontend_type>text</frontend_type>
927
- <sort_order>70</sort_order>
928
- <show_in_default>1</show_in_default>
929
- <show_in_website>1</show_in_website>
930
- <show_in_store>1</show_in_store>
931
- <frontend_class>validate-number</frontend_class>
932
- </min_order_total>
933
-
934
- <max_order_total translate="label">
935
- <label>Max Order Total</label>
936
- <frontend_type>text</frontend_type>
937
- <sort_order>80</sort_order>
938
- <show_in_default>1</show_in_default>
939
- <show_in_website>1</show_in_website>
940
- <show_in_store>1</show_in_store>
941
- <frontend_class>validate-number</frontend_class>
942
- </max_order_total>
943
-
944
- <sort_order translate="label">
945
- <label>Sort Order</label>
946
- <frontend_type>text</frontend_type>
947
- <sort_order>100</sort_order>
948
- <show_in_default>1</show_in_default>
949
- <show_in_website>1</show_in_website>
950
- <show_in_store>1</show_in_store>
951
- <frontend_class>validate-number</frontend_class>
952
- </sort_order>
953
- </fields>
954
- </mundipagg_fivecreditcards>
955
<mundipagg_boleto type="group" translate="label">
956
<label><![CDATA[MundiPagg - Boleto]]></label>
957
<sort_order>480</sort_order>
709
</sort_order>
710
</fields>
711
</mundipagg_twocreditcards>
712
<mundipagg_boleto type="group" translate="label">
713
<label><![CDATA[MundiPagg - Boleto]]></label>
714
<sort_order>480</sort_order>
app/code/community/Uecommerce/Mundipagg/sql/mundipagg_setup/mysql4-upgrade-2.9.4-2.9.5.php ADDED
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $prefix = Mage::getConfig()->getTablePrefix();
5
+
6
+ $installer->startSetup();
7
+
8
+ $sql = "
9
+ UPDATE {$prefix}core_config_data
10
+ SET VALUE = 0
11
+ WHERE path IN (
12
+ 'payment/mundipagg_threecreditcards/active',
13
+ 'payment/mundipagg_fourcreditcards/active',
14
+ 'payment/mundipagg_fivecreditcards/active'
15
+ );";
16
+
17
+ $installer->run($sql);
18
+ $installer->endSetup();
app/design/adminhtml/default/default/template/mundipagg/payment/info/mundipagg.phtml CHANGED
@@ -28,6 +28,7 @@
28
* @author Uecommerce Dev Team
29
*/
30
31
$helper = Mage::helper('mundipagg');
32
33
if (Mage::registry('current_order')):
@@ -50,20 +51,26 @@ endif;
50
51
$standard = Mage::getModel('mundipagg/standard');
52
53
- $paymentAction = $standard->getPaymentAction();
54
-
55
- if ($paymentAction == 'authorize') {
56
- $paymentAction = 'authorization';
57
- }
58
?>
59
<div>
60
- <p>
61
<?php
62
$info = $this->getInfo();
63
$PaymentMethod = $info->getAdditionalInformation('PaymentMethod');
64
$integrationError = $info->getAdditionalInformation('IntegrationError');
65
66
- echo $helper->__('Method') . ': ' . $helper->__($PaymentMethod) . '<br/>';
67
68
$orderKeys = (array)$orderKeys = $_order->getPayment()->getAdditionalInformation('OrderKey');
69
$orderKeysQty = count($orderKeys);
@@ -81,122 +88,28 @@ if ($paymentAction == 'authorize') {
81
endif;
82
83
if ($OrderReference = $_order->getPayment()->getAdditionalInformation('OrderReference')):
84
- echo $helper->__('OrderReference') . ': ' . $OrderReference . '<br/>';
85
endif;
86
endif;
87
88
- // Informations about transaction
89
- $transaction = Mage::getModel('sales/order_payment_transaction')->getCollection()
90
- ->addAttributeToFilter('order_id', array('eq' => $_order->getEntityId()))
91
- ->addAttributeToFilter('txn_type', array('eq' => $paymentAction));
92
- $authCode = '';
93
- $tid = '';
94
- $ccNumber = '';
95
- $message = '';
96
- $errorMessage = '';
97
-
98
- foreach ($transaction as $t) :
99
- $t = $t->getData();
100
- $txDetail = $t['additional_information'];
101
-
102
- if (!empty($txDetail)):
103
- $authCode = isset($txDetail['AuthorizationCode']) ? $txDetail['AuthorizationCode'] : null;
104
- $tid = isset($txDetail['TransactionIdentifier']) ? $txDetail['TransactionIdentifier'] : null;
105
- $ccNumber = isset($txDetail['MaskedCreditCardNumber']) ? $txDetail['MaskedCreditCardNumber'] : null;
106
-
107
- if (isset($txDetail['CreditCardNumber'])) {
108
- $ccNumber = $txDetail['CreditCardNumber'];
109
- }
110
-
111
- $message = isset($txDetail['AcquirerMessage']) ? $txDetail['AcquirerMessage'] : null;
112
- endif;
113
- endforeach;
114
-
115
- if ($PaymentMethod == '1CreditCards' || $PaymentMethod == 'mundipagg_creditcard'):
116
- // Token
117
- $token = $this->getInfo()->getAdditionalInformation('mundipagg_creditcard_token_1_1');
118
-
119
- if ($token && $token != 'new'):
120
- echo $helper->__('Credit Card Issuer') . ': ';
121
- echo $this->getInfo()->getAdditionalInformation('CreditCardBrandEnum_mundipagg_creditcard_token_1_1');
122
- echo '<br/>';
123
- if ($ccNumber) echo 'Numeração: ' . $ccNumber . '<br>';
124
-
125
- if ($this->getInfo()->getAdditionalInformation('mundipagg_creditcard_credito_parcelamento_1_1')):
126
- echo $helper->__('InstallmentsCount') . ': ';
127
- echo $this->getInfo()->getAdditionalInformation('mundipagg_creditcard_credito_parcelamento_1_1');
128
- echo 'x<br/>';
129
- endif;
130
- else:
131
- echo $helper->__('Credit Card Issuer') . ': ';
132
- echo $this->getInfo()->getAdditionalInformation('mundipagg_creditcard_1_1_cc_type');
133
- echo '<br/>';
134
- if ($ccNumber) echo 'Numeração: ' . $ccNumber . '<br>';
135
-
136
- if ($this->getInfo()->getAdditionalInformation('mundipagg_creditcard_new_credito_parcelamento_1_1')):
137
- echo $helper->__('InstallmentsCount') . ': ';
138
- echo $this->getInfo()->getAdditionalInformation('mundipagg_creditcard_new_credito_parcelamento_1_1');
139
- echo 'x<br/>';
140
- endif;
141
- endif;
142
-
143
- if ($authCode):
144
- echo 'Autorização: <b>' . $authCode . '</b><br/>';
145
- endif;
146
-
147
- if ($tid):
148
- echo 'ID da Transação: ' . $tid . '<br/>';
149
- endif;
150
-
151
- if ($message):
152
- echo 'Retorno adquirente: ' . $message . '<br/>';
153
- endif;
154
-
155
- if ($CreditCardTransactionStatusEnum = $_order->getPayment()->getAdditionalInformation('1_CreditCardTransactionStatusEnum')):
156
- echo $helper->__('Transaction Status') . ': ' . $CreditCardTransactionStatusEnum . '<br/>';
157
- else:
158
- if ($CreditCardTransactionStatusEnum = $_order->getPayment()->getAdditionalInformation('CreditCardTransactionStatusEnum')):
159
- echo $helper->__('Transaction Status') . ': ' . $CreditCardTransactionStatusEnum . '<br/>';
160
- endif;
161
- endif;
162
-
163
- endif;
164
-
165
- if ($PaymentMethod == 'mundipagg_creditcardoneinstallment'):
166
- // Token
167
- $token = $this->getInfo()->getAdditionalInformation('mundipagg_creditcardoneinstallment_token_1_1');
168
-
169
- if ($token && $token != 'new'):
170
- echo $helper->__('Credit Card Issuer') . ': ';
171
- echo $this->getInfo()->getAdditionalInformation('CreditCardBrandEnum_mundipagg_creditcardoneinstallment_token_1_1');
172
- echo '<br/>';
173
- ?>
174
- <?php
175
- else:
176
- echo $helper->__('Credit Card Issuer') . ': ';
177
- echo $this->getInfo()->getAdditionalInformation('mundipagg_creditcardoneinstallment_1_1_cc_type');
178
- echo '<br/>';
179
- endif;
180
-
181
- if ($authCode):
182
- echo $helper->__('Autorização') . ': ' . $authCode . '<br/>';
183
- endif;
184
-
185
- if ($tid):
186
- echo $helper->__('Nosso Número') . ': ' . $tid . '<br/>';
187
- endif;
188
-
189
- if ($message):
190
- echo 'Retorno adquirente: ' . $message . '<br/>';
191
- endif;
192
-
193
- if ($CreditCardTransactionStatusEnum = $_order->getPayment()->getAdditionalInformation('1_CreditCardTransactionStatusEnum')):
194
- echo $helper->__('Transaction Status') . ': ' . $CreditCardTransactionStatusEnum . '<br/>';
195
- else:
196
- if ($CreditCardTransactionStatusEnum = $_order->getPayment()->getAdditionalInformation('CreditCardTransactionStatusEnum')):
197
- echo $helper->__('Transaction Status') . ': ' . $CreditCardTransactionStatusEnum . '<br/>';
198
- endif;
199
- endif;
200
endif;
201
202
if (($PaymentMethod == 'BoletoBancario' || $PaymentMethod == 'mundipagg_boleto') && $boletoUrl = $_order->getPayment()->getAdditionalInformation('BoletoUrl')):
@@ -225,15 +138,15 @@ if ($paymentAction == 'authorize') {
225
endif;
226
endforeach;
227
?>
228
- <p>
229
<?php echo $helper->__('Nosso Número'); ?>: <b><?php echo $nossoNumero; ?></b>
230
- </p>
231
- <p>
232
<?php echo $helper->__('Código de Barras'); ?>: <?php echo $barcode; ?>
233
- </p>
234
- <p>
235
- <a href="<?php echo $boletoUrl; ?>" target="_blank"><?php echo $helper->__('Print boleto'); ?></a>
236
- </p>
237
<?php
238
endif;
239
@@ -246,13 +159,6 @@ if ($paymentAction == 'authorize') {
246
<?php
247
endif;
248
?>
249
- </p>
250
-
251
- <?php
252
- // Integration Error
253
- if ($info->getAdditionalInformation('IntegrationError')):
254
- echo "<p class='error'>{$helper->__('Integration error')}: {$info->getAdditionalInformation('IntegrationError')}</p>";
255
- endif;
256
- ?>
257
258
</div>
28
* @author Uecommerce Dev Team
29
*/
30
31
+ /* @var Uecommerce_Mundipagg_Helper_Data $helper */
32
$helper = Mage::helper('mundipagg');
33
34
if (Mage::registry('current_order')):
51
52
$standard = Mage::getModel('mundipagg/standard');
53
54
?>
55
<div>
56
+ <p>
57
<?php
58
$info = $this->getInfo();
59
+
60
+ $errorCode = $info->getAdditionalInformation('ErrorCode');
61
+ $errorDescription = $info->getAdditionalInformation('ErrorDescription');
62
+
63
+ if ($errorCode >= 400 && $errorDescription) {
64
+ echo "<b>[{$helper->__('Integration error')}]</b><br/>";
65
+ echo "{$helper->__('Error code')}: {$errorCode}<br/>";
66
+ echo "{$helper->__('Error description')}: {$errorDescription}<br/><br/>";
67
+ return;
68
+ }
69
+
70
$PaymentMethod = $info->getAdditionalInformation('PaymentMethod');
71
$integrationError = $info->getAdditionalInformation('IntegrationError');
72
73
+ echo "{$helper->__('Method')}: {$helper->__($PaymentMethod)}<br/>";
74
75
$orderKeys = (array)$orderKeys = $_order->getPayment()->getAdditionalInformation('OrderKey');
76
$orderKeysQty = count($orderKeys);
88
endif;
89
90
if ($OrderReference = $_order->getPayment()->getAdditionalInformation('OrderReference')):
91
+ echo "{$helper->__('OrderReference')}: {$OrderReference}<br/>";
92
endif;
93
endif;
94
95
+ $ccQty = $info->getAdditionalInformation('mundipagg_type');
96
+ $ccQty = str_replace('CreditCards', '', $ccQty);
97
+
98
+ if ($ccQty > 0):
99
+ for ($i = 1; $i <= $ccQty; $i++) {
100
+ $authorizationCode = $this->getAuthorizationCode($i);
101
+ $txnId = $this->getTransactionId($i);
102
+
103
+ echo "<p>";
104
+ echo "{$helper->__('Credit card issuer')}: {$this->getCcBrand($i)}<br/>";
105
+ echo "{$helper->__('Masked number')}: {$info->getAdditionalInformation("{$i}_MaskedCreditCardNumber")}<br/>";
106
+ echo "{$helper->__('Amount')}: {$this->getCcValue($i)}<br/>";
107
+ echo "{$helper->__('Installments')}: {$this->getInstallmentsNumber($ccQty, $i)}<br/>";
108
+ echo "{$helper->__('Authorization code')}: {$authorizationCode}<br/>";
109
+ echo "{$helper->__('Transaction ID')}: {$txnId}<br/>";
110
+ echo "{$helper->__('Acquirer message')}: {$info->getAdditionalInformation("{$i}_AcquirerMessage")}<br/>";
111
+ echo "</p>";
112
+ }
113
endif;
114
115
if (($PaymentMethod == 'BoletoBancario' || $PaymentMethod == 'mundipagg_boleto') && $boletoUrl = $_order->getPayment()->getAdditionalInformation('BoletoUrl')):
138
endif;
139
endforeach;
140
?>
141
+ <p>
142
<?php echo $helper->__('Nosso Número'); ?>: <b><?php echo $nossoNumero; ?></b>
143
+ </p>
144
+ <p>
145
<?php echo $helper->__('Código de Barras'); ?>: <?php echo $barcode; ?>
146
+ </p>
147
+ <p>
148
+ <a href="<?php echo $boletoUrl; ?>" target="_blank"><?php echo $helper->__('Print boleto'); ?></a>
149
+ </p>
150
<?php
151
endif;
152
159
<?php
160
endif;
161
?>
162
+ </p>
163
164
</div>
app/design/frontend/base/default/template/mundipagg/form.phtml CHANGED
@@ -47,9 +47,10 @@ $orderGrandTotal = $standard->getQuote()->getBaseGrandTotal();
47
// Partial payment?
48
$isPartial = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
49
50
- if($isPartial == 'partial'):
51
- $authorizedAmount = Mage::getSingleton('checkout/session')->getAuthorizedAmount();
52
-
53
$baseGrandTotal = $orderGrandTotal - $authorizedAmount;
54
else :
55
$baseGrandTotal = $orderGrandTotal;
47
// Partial payment?
48
$isPartial = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
49
50
+ if($isPartial == 'partial'):
51
+ $order = $this->loadOrder();
52
+ $authorizedAmount = $order->getPaymentAuthorizationAmount();
53
+ $orderGrandTotal = $order->getBaseGrandTotal();
54
$baseGrandTotal = $orderGrandTotal - $authorizedAmount;
55
else :
56
$baseGrandTotal = $orderGrandTotal;
app/design/frontend/rwd/default/template/mundipagg/form.phtml CHANGED
@@ -27,16 +27,17 @@
27
* @package Uecommerce_Mundipagg
28
* @author Uecommerce Dev Team
29
*/
30
-
31
//Return Standard model
32
$standard = $this->getStandard();
33
34
// Get Quote
35
$quote = $standard->getQuote();
36
37
$installmentsHelper = Mage::helper('mundipagg/installments');
38
39
- if($quote->isVirtual()) {
40
$data = $quote->getBillingAddress();
41
} else {
42
$data = $quote->getShippingAddress();
@@ -47,16 +48,17 @@ $orderGrandTotal = $standard->getQuote()->getBaseGrandTotal();
47
// Partial payment?
48
$isPartial = Mage::getSingleton('checkout/session')->getApprovalRequestSuccess();
49
50
- if($isPartial == 'partial'):
51
- $authorizedAmount = Mage::getSingleton('checkout/session')->getAuthorizedAmount();
52
-
53
$baseGrandTotal = $orderGrandTotal - $authorizedAmount;
54
else :
55
$baseGrandTotal = $orderGrandTotal;
56
endif;
57
58
- if($data->getMundipaggInterest()) {
59
- $baseGrandTotal = $baseGrandTotal-$data->getMundipaggInterest();
60
}
61
62
// We check if taxvat is enabled
@@ -75,307 +77,380 @@ $_code = $this->getMethodCode();
75
?>
76
77
78
- <ul id="payment_form_<?php echo $_code ?>" style="display:none;">
79
- <div>
80
- <input type="hidden" id="baseGrandTotal" name="baseGrandTotal" value="<?php echo number_format($baseGrandTotal, "2", ",", ""); ?>"/>
81
- <?php if ($isPartial == 'partial'): ?>
82
- <input type="hidden" name="partial" id="partial" value="1"/>
83
- <input type="hidden" name="payment[multi]" id="multi" value="1"/>
84
- <?php endif; ?>
85
- </div>
86
- <?php
87
- // START CREDIT CARD PAYMENT METHOD
88
- $num = 1;
89
-
90
- switch ($_code):
91
- case 'mundipagg_creditcardoneinstallment':
92
- $num = 1;
93
- $paymentMethod = '1CreditCardsOneInstallment';
94
- $paymentMethodLabel = $this->__('Credit Card');
95
- break;
96
-
97
- case 'mundipagg_creditcard':
98
- $num = 1;
99
- $paymentMethod = '1CreditCards';
100
- $paymentMethodLabel = $this->__('Credit Card');
101
- break;
102
-
103
- case 'mundipagg_twocreditcards':
104
- $num = 2;
105
- $paymentMethod = '2CreditCards';
106
- $paymentMethodLabel = $this->__('Pay with 2 Credit Cards');
107
- break;
108
-
109
- case 'mundipagg_threecreditcards':
110
- $num = 3;
111
- $paymentMethod = '3CreditCards';
112
- $paymentMethodLabel = $this->__('Pay with 3 Credit Cards');
113
- break;
114
-
115
- case 'mundipagg_fourcreditcards':
116
- $num = 4;
117
- $paymentMethod = '4CreditCards';
118
- $paymentMethodLabel = $this->__('Pay with 4 Credit Cards');
119
- break;
120
-
121
- case 'mundipagg_fivecreditcards':
122
- $num = 5;
123
- $paymentMethod = '5CreditCards';
124
- $paymentMethodLabel = $this->__('Pay with 5 Credit Cards');
125
- break;
126
- endswitch;
127
- ?>
128
- <li>
129
- <div id="<?php echo $_code; ?>">
130
- <?php if($num != 1 && $isPartial != 'partial'): ?>
131
- <p></p>
132
- <div>
133
- <b><?php echo $this->__('Grand Total') ?>:</b> <?php echo $currencySymbol.number_format($baseGrandTotal, "2", ",", "."); ?>
134
- </div>
135
- <p></p>
136
- <?php endif ?>
137
- <?php if ( $_code == 'mundipagg_creditcardoneinstallment' || $_code == 'mundipagg_creditcard' || $_code == 'mundipagg_twocreditcards' || $_code == 'mundipagg_threecreditcards' || $_code == 'mundipagg_fourcreditcards' || $_code == 'mundipagg_fivecreditcards'): ?>
138
- <ul>
139
- <?php for($c=1;$c<=$num;$c++): ?>
140
- <input type="hidden" id="mundipagg_type" name="payment[mundipagg_type]" value="<?php echo $paymentMethod ; ?>"/>
141
- <?php $currentSelectedToken = null; ?>
142
- <?php if($countCcs > 0 ):?>
143
- <li class="fields" style="margin-bottom: 5px;">
144
- <div class="field">
145
- <label class="required"><?php echo $this->__('Select a Credit Card or add a new one') ?><span class="required">*</span></label>
146
- <div class="input-box">
147
-
148
- <select id="<?php echo $_code; ?>_token_<?php echo $num; ?>_<?php echo $c;?>" data="group_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_token_<?php echo $num; ?>_<?php echo $c;?>]" class="required-entry tokens group_<?php echo $num; ?>_<?php echo $c;?>" onchange="token_or_not(<?php echo $num; ?>,<?php echo $c;?>,this)">
149
- <option value="">...</option>
150
- <?php
151
- $selected = '';
152
-
153
- if($countCcs == 1):
154
- $selected = 'selected="selected"';
155
- endif;
156
-
157
- foreach($ccs as $id => $cc):
158
-
159
- if($countCcs == 1){
160
- $currentSelectedToken = Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cc->getCcType());
161
- }
162
- $dataType = $currentSelectedToken?$currentSelectedToken:Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cc->getCcType());
163
- echo '<option value="'.$cc->getId().'" '.$selected.' data="'.$dataType.'">'.$cc->getCcType().' '.$cc->getCreditCardMask().'</option>';
164
- endforeach;
165
- ?>
166
- <option value="new"><?php echo $this->__('New Credit Card') ?></option>
167
- </select>
168
- </div>
169
- </div>
170
- </li>
171
- <?php if($num != 1): ?>
172
- <div id="value_<?php echo $num; ?>_<?php echo $c;?>">
173
- <li class="fields" style="margin-bottom: 5px;">
174
- <div class="field">
175
- <label class="required"><?php echo $this->__('Value (Ex: 100,50)') ?> <span class="required">*</span></label>
176
- <div class="input-box">
177
- <input type="text" id="<?php echo $_code; ?>_value_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_value_<?php echo $num; ?>_<?php echo $c;?>]" title="<?php echo $this->__('Value (Ex: 100,50)') ?>" class="required-entry validate-greater-than-zero input-text check_values group_<?php echo $num; ?>_<?php echo $c;?>" onchange="calculateInstallmentValue(this, <?php echo $num;?>, <?php echo $c;?>, '<?php echo Mage::getUrl('',array('_secure'=>true)); ?>');" onkeydown="remove_special_characters(event);" value=""/>
178
- </div>
179
- </div>
180
- </li>
181
- </div>
182
- <?php endif; ?>
183
- <?php if ($installmentsHelper->isInstallmentsEnabled() && $_code != 'mundipagg_creditcardoneinstallment'): ?>
184
- <div id="parcelamento_<?php echo $num; ?>_<?php echo $c;?>" <?php if($countCcs > 1): ?>style="display:none"<?php endif?>>
185
- <li class="fields" style="margin-bottom: 5px;">
186
- <div class="field">
187
- <label class="required"><?php echo $this->__('Credit options') ?> <?php if($num == 2):?><!--<a href="javascript:void(0);" onclick="javascript:void(0);">(<?php /*echo $this->__('click to update') */?>)</a>--><?php endif ?></label>
188
- <div class="input-box">
189
- <select id="<?php echo $_code; ?>_credito_parcelamento_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_credito_parcelamento_<?php echo $num; ?>_<?php echo $c;?>]" class="required-entry installment-token group_<?php echo $num; ?>_<?php echo $c;?>">
190
- <?php foreach($this->getInstallments($currentSelectedToken) as $key => $parcel): ?>
191
- <option value="<?php echo $key ?>"><?php echo $parcel ?></option>
192
- <?php endforeach ?>
193
- </select>
194
- </div>
195
- </div>
196
- </li>
197
- </div>
198
- <?php endif; ?>
199
- <?php endif; ?>
200
- <div class="division"></div>
201
- <div id="<?php echo $_code; ?>_new_credit_card_<?php echo $num; ?>_<?php echo $c;?>" <?php if( $countCcs > 0 ) { ?>style="display:none"<?php } ?>>
202
-
203
- <li style="margin-bottom: 5px;">
204
- <div class="field">
205
- <label class="required"><?php echo $this->__('Credit Card Issuer') ?> <span class="required">*</span></label>
206
- <div class="input-box">
207
- <ul class="inline input-radio">
208
- <?php
209
- $ccards = $standard->getCcTypes();
210
- $_i = 1;
211
- ?>
212
- <?php foreach($ccards as $ccard): ?>
213
- <li class="cc_brands">
214
- <div class="cc_brand_types <?php echo strtolower($ccard); ?>">&nbsp;</div>
215
- <!--<img src="<?php //echo $this->getSkinUrl('images/mundipagg/'.$ccard.'.png');?>" alt="<?php //echo $ccard ?>" border="0" class="cursor_hand" onclick="setCcType(this, '<?php //echo $_code; ?>', '<?php //echo $num; ?>', '<?php //echo $c;?>', '<?php //echo $ccard; ?>');">-->
216
- <input type="radio" name="payment[<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_credito_instituicao]" id="<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_credito_instituicao_<?php echo $ccard; ?>" value="<?php echo $ccard ?>" class="<?php if ($_i == 1): ?>validate-one-required-by-name<?php endif; ?>" onclick="setCcType(this, '<?php echo $_code; ?>', '<?php echo $num; ?>', '<?php echo $c;?>', '<?php echo $ccard; ?>');">
217
- </li>
218
- <?php
219
- $_i++;
220
- endforeach
221
- ?>
222
- </ul>
223
- <p class="info-payment"><i><small><?php echo $this->__('The flag is automatically selected after entering the credit card number below.'); ?></small></i></p>
224
- <input type="hidden" name="payment[<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_cc_type]" id="<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_cc_type" value="" class="validate-cc-type-select"/>
225
- </div>
226
- </div>
227
- </li>
228
- <li style="margin-bottom: 5px;">
229
- <div class="field">
230
- <label class="required"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label>
231
- <div class="input-box">
232
- <input type="text" id="<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_cc_number" name="payment[<?php echo $_code; ?>_<?php echo $num; ?>_<?php echo $c;?>_cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text required-entry validate-cc-number" onkeydown="remove_characters(event);" value=""/>
233
- </div>
234
- </div>
235
- </li>
236
- <li style="margin-bottom: 5px;">
237
- <div class="field">
238
- <label class="required"><?php echo $this->__('Credit Card Holder name') ?> <span class="required">*</span></label>
239
- <div class="input-box">
240
- <input type="text" id="<?php echo $_code; ?>_cc_holder_name_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_cc_holder_name_<?php echo $num; ?>_<?php echo $c;?>]" class="required-entry input-text" />
241
- </div>
242
- </div>
243
- </li>
244
- <li style="margin-bottom: 5px;">
245
- <div class="field">
246
- <label class="required"><?php echo $this->__('Expiration date') ?> <span class="required">*</span></label>
247
- <div class="input-box">
248
- <div class="v-fix">
249
- <select id="<?php echo $_code; ?>_expirationMonth_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_expirationMonth_<?php echo $num; ?>_<?php echo $c;?>]" class="month required-entry validate-cc-exp-new">
250
- <option value=""><?php echo $this->__('Month') ?></option>
251
- <option value="1">01 - <?php echo $this->__('January') ?></option>
252
- <option value="2">02 - <?php echo $this->__('February') ?></option>
253
- <option value="3">03 - <?php echo $this->__('March') ?></option>
254
- <option value="4">04 - <?php echo $this->__('April') ?></option>
255
- <option value="5">05 - <?php echo $this->__('May') ?></option>
256
- <option value="6">06 - <?php echo $this->__('June') ?></option>
257
- <option value="7">07 - <?php echo $this->__('July') ?></option>
258
- <option value="8">08 - <?php echo $this->__('August') ?></option>
259
- <option value="9">09 - <?php echo $this->__('September') ?></option>
260
- <option value="10">10 - <?php echo $this->__('October') ?></option>
261
- <option value="11">11 - <?php echo $this->__('November') ?></option>
262
- <option value="12">12 - <?php echo $this->__('December') ?></option>
263
- </select>
264
- </div>
265
- <div class="v-fix" style="padding-left:6px;">
266
- <select id="<?php echo $_code; ?>_expirationYear_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_expirationYear_<?php echo $num; ?>_<?php echo $c;?>]" class="year required-entry">
267
- <option value=""><?php echo $this->__('Year') ?></option>
268
- <?php
269
- $i = date('Y');
270
- $year = date('Y');
271
- $year10 = $year + 10;
272
- for( $i = $year; $i <= $year10; $i++ ):
273
- ?>
274
- <option value="<?php echo substr($i, -2);?>"><?php echo $i;?></option>
275
- <?php endfor; ?>
276
- </select>
277
- </div>
278
- </div>
279
- </div>
280
- </li>
281
- <li style="margin-bottom: 5px;">
282
- <div class="field">
283
- <label class="required"><?php echo $this->__('Card Verification Number') ?> <span class="required">*</span></label>
284
- <div class="input-box">
285
- <div class="v-fix">
286
- <input type="text" id="<?php echo $_code; ?>_cc_cid_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_cc_cid_<?php echo $num; ?>_<?php echo $c;?>]" style="width: 55px" class="required-entry input-text validate-cc-cvn validate-length" maxlength="4" onkeydown="remove_characters(event);"/>
287
- </div>
288
- <div class="v-fix" style="padding-left:6px;">
289
- <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
290
- </div>
291
- </div>
292
- </div>
293
- </li>
294
- <?php if($num != 1): ?>
295
- <li style="margin-bottom: 5px;">
296
- <div class="field">
297
- <label class="required"><?php echo $this->__('Value (Ex: 100,50)') ?> <span class="required">*</span></label>
298
- <div class="input-box">
299
- <input type="text" id="<?php echo $_code; ?>_new_value_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_new_value_<?php echo $num; ?>_<?php echo $c;?>]" title="<?php echo $this->__('Value (Ex: 100,50)') ?>" class="required-entry input-text validate-greater-than-zero check_values" onchange="calculateInstallmentValue(this, <?php echo $num;?>, <?php echo $c;?>, '<?php echo Mage::getUrl('',array('_secure'=>true)); ?>');" onkeydown="remove_special_characters(event);" value=""/>
300
- </div>
301
- </div>
302
- </li>
303
- <?php endif; ?>
304
- <?php if ($installmentsHelper->isInstallmentsEnabled() && $_code != 'mundipagg_creditcardoneinstallment'): ?>
305
- <li style="margin-bottom: 5px;">
306
- <div class="field">
307
- <label class="required"><?php echo $this->__('Credit options') ?> <?php if($num ==2): ?><!--<a href="javascript:void(0);" onclick="javascript:void(0);">(<?php /*echo $this->__('click to update') */?>)</a>--><?php endif ?></label>
308
- <div class="input-box">
309
- <select id="<?php echo $_code; ?>_new_credito_parcelamento_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_new_credito_parcelamento_<?php echo $num; ?>_<?php echo $c;?>]" onchange="checkInstallments(this, '<?php echo Mage::getUrl('',array('_secure'=>true)); ?>');">
310
- <?php foreach($this->getInstallments() as $key => $parcel): ?>
311
- <option value="<?php echo $key ?>"><?php echo $parcel ?></option>
312
<?php endforeach ?>
313
- </select>
314
- </div>
315
- </div>
316
- </li>
317
- <?php endif; ?>
318
- <?php if ($standard->getConfigData('clearsale') && !$_taxvat->isEnabled() && Mage::getSingleton('customer/session')->getCustomer()->getTaxvat() == ''): ?>
319
- <li style="margin-bottom: 5px;">
320
- <div class="field">
321
- <label class="required"><?php echo $this->__('CPF ou CNPJ') ?> <span class="required">*</span></label>
322
- <div class="input-box">
323
- <input type="text" id="<?php echo $_code; ?>_cc_taxvat_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_cc_taxvat_<?php echo $num; ?>_<?php echo $c;?>]" title="<?php echo $this->__('CPF ou CNPJ') ?>" class="validar_cpf required-entry" onkeydown="remove_characters(event);"/>
324
- </div>
325
- </div>
326
- </li>
327
- <?php endif;?>
328
- <?php if($standard->getQuote()->getCheckoutMethod() != 'guest'): ?>
329
- <?php if(Mage::getStoreConfig('payment/mundipagg_standard/save_cardonfile')): ?>
330
- <li>
331
-
332
- <div class="input-box" style="padding-top: 10px">
333
- <div class="field">
334
- <label class="required"><?php echo $this->__('Save Card On File') ?></label>
335
- <input type="checkbox" id="<?php echo $_code; ?>_save_token_<?php echo $num; ?>_<?php echo $c;?>" name="payment[<?php echo $_code; ?>_save_token_<?php echo $num; ?>_<?php echo $c;?>]" value="new"/>
336
- </div>
337
-
338
- </div>
339
- </li>
340
- <?php endif; ?>
341
- <?php endif; ?>
342
- </div>
343
- <?php endfor; ?>
344
- </ul>
345
- <?php endif ?>
346
- </div>
347
- </li>
348
- <?php // END CREDIT CARD PAYMENT METHOD ?>
349
- </ul>
<