Skip to content

Commit

Permalink
Add store name in comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Dat committed Jan 9, 2017
1 parent 6b97c8f commit 89cb8bb
Show file tree
Hide file tree
Showing 2 changed files with 344 additions and 346 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,75 +41,75 @@ public function payAction()
}

public function payPostAction(){
if ($this->getRequest()->isPost()) {
$iban = "";
$walletId= $this->getRequest()->getPost('wallet_id', false);
$bal= (float)$this->getRequest()->getPost('bal', 0);
$balFormated = Mage::helper("core")->formatPrice((float)$bal);
$ibanId = 0;
$ibanIds = $this->getRequest()->getPost('iban_id', array());
if(count($ibanIds) > 0)
{
$ibanId = current($ibanIds);
$iban = $this->getRequest()->getPost('iban_' . $ibanId, "");
}
$amountToPay = (float)str_replace(",", ".",$this->getRequest()->getPost('amountToPay', 0));
$amountFormated = Mage::helper("core")->formatPrice((float)$amountToPay);
if($amountToPay > $bal)
{
$this->_getSession()->addError($this->__("You can't paid amount upper of your balance amount: %s",$balFormated));
$this->_redirect("*/*/pay");
return $this;
}
if($walletId && $ibanId && $amountToPay > 0 && $bal > 0)
{
try {
$params = array(
"wallet"=>$walletId,
"amountTot"=>sprintf("%.2f" ,$amountToPay),
"amountCom"=>sprintf("%.2f" ,(float)0),
"message"=>$this->__("Moneyout from Magento module"),
"ibanId"=>$ibanId,
"autoCommission" => 0,
);
//Init APi kit
/* @var $kit Sirateck_Lemonway_Model_Apikit_Kit */
$kit = Mage::getSingleton('sirateck_lemonway/apikit_kit');
$apiResponse = $kit->MoneyOut($params);
if($apiResponse->lwError)
Mage::throwException($apiResponse->lwError->getMessage());
if(count($apiResponse->operations))
{
/* @var $op Sirateck_Lemonway_Model_Apikit_Apimodels_Operation */
$op = $apiResponse->operations[0];
if($op->getHpayId())
{
$this->_getSession()->addSuccess($this->__("You paid %s to your Iban %s from your wallet <b>%s</b>",$amountFormated,$iban,$walletId));
}
else {
Mage::throwException($this->__("An error occurred. Please contact support."));
}
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
if ($this->getRequest()->isPost()) {
$iban = "";
$walletId= $this->getRequest()->getPost('wallet_id', false);
$bal= (float)$this->getRequest()->getPost('bal', 0);
$balFormated = Mage::helper("core")->formatPrice((float)$bal);
$ibanId = 0;
$ibanIds = $this->getRequest()->getPost('iban_id', array());
if(count($ibanIds) > 0)
{
$ibanId = current($ibanIds);
$iban = $this->getRequest()->getPost('iban_' . $ibanId, "");
}
$amountToPay = (float)str_replace(",", ".",$this->getRequest()->getPost('amountToPay', 0));
$amountFormated = Mage::helper("core")->formatPrice((float)$amountToPay);
if($amountToPay > $bal)
{
$this->_getSession()->addError($this->__("You can't paid amount upper of your balance amount: %s", $balFormated));
$this->_redirect("*/*/pay");
return $this;
}
if($walletId && $ibanId && $amountToPay > 0 && $bal > 0)
{
try {
$params = array(
"wallet" => $walletId,
"amountTot" => sprintf("%.2f", $amountToPay),
"amountCom" => sprintf("%.2f", (float)0),
"message" => $this->__("Moneyout from %s", Mage::app()->getStore()->getName()),
"ibanId" => $ibanId,
"autoCommission" => 0,
);
//Init APi kit
/* @var $kit Sirateck_Lemonway_Model_Apikit_Kit */
$kit = Mage::getSingleton('sirateck_lemonway/apikit_kit');
$apiResponse = $kit->MoneyOut($params);
if($apiResponse->lwError)
Mage::throwException($apiResponse->lwError->getMessage());
if(count($apiResponse->operations))
{
/* @var $op Sirateck_Lemonway_Model_Apikit_Apimodels_Operation */
$op = $apiResponse->operations[0];
if($op->getHpayId())
{
$this->_getSession()->addSuccess($this->__("You paid %s to your Iban %s from your wallet <b>%s</b>",$amountFormated,$iban,$walletId));
}
else {
Mage::throwException($this->__("An error occurred. Please contact support."));
}
}
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}

}
}
$this->_redirect('*/*/pay');
}
}
$this->_redirect('*/*/pay');
}

/**
Expand All @@ -129,6 +129,6 @@ protected function _isAllowed()
* @return Sirateck_Lemonway_Model_Method_Webkit
*/
protected function getMethodInstance(){
return MAge::getSingleton('sirateck_lemonway/method_webkit');
return MAge::getSingleton('sirateck_lemonway/method_webkit');
}
}
Loading

0 comments on commit 89cb8bb

Please sign in to comment.