Skip to content

Commit

Permalink
2.1.3 version with fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
agnagna committed Dec 19, 2014
1 parent 9ceef01 commit 3790900
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 101 deletions.
25 changes: 10 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
## 2.1.1
## 2.1.3
* microtime() added to extOrderId to avoid ORDER_NOT_UNIQUE error
* fixed status update bug
* API version fixed
* not used status updates removed
* _payuPayMethod from CARD to CARD_TOKEN changed

## 2.1.2
* SDK version 2.1.2 included (SSL3 protocol dissabled)

## 2.1.1
* API 2.1 compatible

## 2.0.2

* Rounding numbers fixed

## 2.0.1

* Refund functionality added
* Added discounted price calculation
* SDK 2.0.0 compatible
Expand All @@ -17,18 +24,15 @@


## 1.8.2

* Changed order's statuses management
* Fixed payment acceptance
* Fixed shipping taxes

## 1.8.1

* Fixed GrandTotal Amount to SubTotal
* Fixed updatePaymentStatusCompleted for Self-Returns

## 1.8.0

* SDK 1.9.2 compatible
* Fixed PayU order cancelling
* Fixed adding customer shipping address in orders that are not virtual
Expand All @@ -37,47 +41,38 @@
* Changed order number in PayU description

## 1.7.0

* Fixed problem with accepting and cancelling order in PayU [Issue #6](https://github.com/PayU/plugin_magento_160/issues/6)
* Removed PayU.php file
* Changed type of license
* Added license file

## 0.1.6.5.1

* Fixed Email empty value in new order
* Changed description labels in configuration
* Updated order statuses list

## 0.1.6.5

* Added customer and shipping information in order create

## 0.1.6.4

* Fixed displaying a message when you add item to cart
* Fixed advertisements localization
* Added redirect after payment cancel

## 0.1.6.3.2

* Fixed empty ShippingCostList in Checkout process

## 0.1.6.3.1

* Fixed order status changes for Completed

## 0.1.6.3

* Changed shopping process flow without authentication before summary
* Fixed billing address for virtual order

## 0.1.6.2

* Fixed shipping costs list for virtual order
* Fixed product tax rates
* Fixed order grand total value

## 0.1.6.1

* Changed extension name: PayU_Account was PayU_PayU
95 changes: 16 additions & 79 deletions app/code/community/PayU/Account/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,21 +579,26 @@ public function orderNotifyRequest() {

$result = OpenPayU_Order::consumeNotification ( $data );
$response = $result->getResponse();

if ($response->order->orderId) {

$this->_transactionId = $response->order->orderId;

$orderId = $response->order->extOrderId;
$extOrderIdExploded = $pieces = explode("-", $response->order->extOrderId);
$orderId = $extOrderIdExploded[0];
// Mage::log(print_r($orderId, true),null, 'notification.log');

$this->setOrderByOrderId ( $orderId );
$this->retrieveAndUpdateByOrderRetrieved ( $response->order );

if($response->order->status == 'COMPLETED' && $this->_order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING){
header("HTTP/1.1 200 OK");
exit;
}

$this->retrieveAndUpdateByOrderRetrieved ( $response->order );
//the response should be status 200
header("HTTP/1.1 200 OK");

}

exit;
}

/**
Expand Down Expand Up @@ -724,42 +729,7 @@ protected function updateShippingInfo($data)
}

}

/**
* Update order status
*
* @param string new order status
*/
protected function updateOrderStatus($orderStatus) {

$payment = $this->_order->getPayment ();
$currentState = $payment->getAdditionalInformation ( 'payu_order_status' );

// change the order status if needed
if ($currentState != $orderStatus) {
try {
switch ($orderStatus) {

case self::ORDER_V2_CANCELED :
$this->updatePaymentStatusCanceled ( $payment );
break;

case self::ORDER_V2_REJECTED :
$this->updatePaymentStatusDenied ( $payment );
break;

case self::ORDER_V2_COMPLETED :
$this->updatePaymentStatusCompleted ( $payment );
break;
}

$payment->setAdditionalInformation ( 'payu_order_status', $orderStatus )->save ();

} catch ( Exception $e ) {
Mage::logException ( $e );
}
}
}


/**
* Update payment status
Expand All @@ -771,66 +741,35 @@ protected function updatePaymentStatus($paymentStatus, $payUOrderStatus) {

$payment = $this->_order->getPayment ();
$currentState = $payment->getAdditionalInformation ( 'payu_payment_status' );
if($currentState == self::ORDER_V2_COMPLETED && $paymentStatus == self::ORDER_V2_PENDING)

if(($currentState == self::ORDER_V2_COMPLETED && $paymentStatus == self::ORDER_V2_PENDING) || ($currentState == self::ORDER_V2_COMPLETED && $paymentStatus == self::ORDER_V2_COMPLETED))
return;

if ($currentState != $paymentStatus) {
try {
switch ($paymentStatus) {

case self::PAYMENT_STATUS_NEW:
$this->updatePaymentStatusNew ( $payment );
break;

case self::ORDER_V2_NEW:
$this->updatePaymentStatusNew ( $payment );
break;

case self::ORDER_V2_PENDING:
$this->updatePaymentStatusPending ( $payment );
break;

case self::PAYMENT_STATUS_CANCEL:
$this->updatePaymentStatusCanceled ( $payment );
break;

case self::ORDER_V2_CANCELED:
$this->updatePaymentStatusCanceled ( $payment );
break;

case self::PAYMENT_STATUS_REJECT:
$this->updatePaymentStatusDenied ( $payment );
break;

case self::ORDER_V2_REJECTED:
$this->updatePaymentStatusDenied ( $payment );
break;

case self::PAYMENT_STATUS_SENT:
$this->updatePaymentStatusSent ( $payment );
break;

case self::PAYMENT_STATUS_REJECT_DONE:
$this->updatePaymentStatusReturned ( $payment );
break;

case self::ORDER_V2_COMPLETED:
$this->updatePaymentStatusCompleted ( $payment );
break;

case self::PAYMENT_STATUS_END :
$this->updatePaymentStatusCompleted ( $payment );
break;

case self::PAYMENT_STATUS_ERROR :
$this->updatePaymentStatusError ( $payment );
break;
}

// set current PayU status information and save
$payment->setAdditionalInformation ( 'payu_payment_status', $paymentStatus )->save ();

} catch ( Exception $e ) {
Mage::logException ( $e );
}
Expand Down Expand Up @@ -973,15 +912,13 @@ public function updatePaymentStatusCompleted($payment) {
$payment->setIsTransactionApproved ( true );
$payment->setIsTransactionClosed ( true );
$payment->addTransaction ( Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER );

if(isset($this->_payuPayMethod)){

if($this->_payuPayMethod == "PBL")
$method = Mage::helper( 'payu_account' )->__ ('Pay by link');

if($this->_payuPayMethod == "CARD")
if($this->_payuPayMethod == "CARD_TOKEN")
$method = Mage::helper( 'payu_account' )->__ ('Pay with card');

}

if(isset($method)){
Expand Down Expand Up @@ -1029,7 +966,7 @@ protected function initializeOpenPayUConfiguration() {
$this->_config = $this->getConfig ();
$this->_myUrl = $this->_config->getBaseUrl ();

OpenPayU_Configuration::setApiVersion ( 2 );
OpenPayU_Configuration::setApiVersion ( 2.1 );
OpenPayU_Configuration::setEnvironment ( 'secure' );
OpenPayU_Configuration::setMerchantPosId ( $this->_config->getMerchantPosId () );
OpenPayU_Configuration::setSignatureKey ( $this->_config->getSignatureKey () );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,10 @@ public function continuePaymentAction(){
$this->setSession();
$this->setOrder();
$this->setPayment();

Mage::log("I am in continue URL",null,'continueUrl.log');
Mage::log($_GET,null,'continueUrl.log');

if(isset($_GET['error']))
{
if(isset($_GET['error'])){
$this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)->save();
}
elseif (defined('Mage_Sales_Model_Order::STATE_PENDING_PAYMENT')) {
}elseif ($this->_order->getState() != Mage_Sales_Model_Order::STATE_PROCESSING && defined('Mage_Sales_Model_Order::STATE_PENDING_PAYMENT')) {
$this->_order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true)->save();
}

Expand Down

0 comments on commit 3790900

Please sign in to comment.