first commit
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class cvIngImojeFrontendActions extends stActions {
|
||||
|
||||
public function executeReturn() {
|
||||
$this->forward('cvIngFrontend', 'returnFail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Pozytywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnSuccess() {
|
||||
$tl=new cvIngTranslationCfg();
|
||||
$txt=$tl->getArray();
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
$this->smarty->assign('txt', $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negatywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnFail() {
|
||||
$tl=new cvIngTranslationCfg();
|
||||
$txt=$tl->getArray();
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
$this->contactPage = WebpagePeer::retrieveByState('CONTACT');
|
||||
$this->smarty->assign('txt', $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Odbieranie statusu transakcji
|
||||
*/
|
||||
public function executeStatusReport() {
|
||||
|
||||
$ing = new cvIngService();
|
||||
if (!$ing->verifySignature()) {
|
||||
return $this->renderText('Error');
|
||||
}
|
||||
if (!$ing->verifyTransactionData()) {
|
||||
return $this->renderText('Error');
|
||||
}
|
||||
|
||||
$order = OrderPeer::retrieveByPK($ing->transactionData['orderId']);
|
||||
|
||||
if ($order !== null) {
|
||||
$payment = $order->getOrderPayment();
|
||||
if ($payment !== null) {
|
||||
if ($ing->transactionData['status'] == 'settled') {
|
||||
$payment->setStatus(true);
|
||||
$payment->save();
|
||||
cvIngLog::add("Success. Status Report (order_id: " . $order->getId() . ") - order has been paid");
|
||||
}
|
||||
} else {
|
||||
cvIngLog::add("Error. Status Report (order_id: " . $order->getId() . ") - missing payment instance");
|
||||
return $this->renderText('Error');
|
||||
}
|
||||
} else {
|
||||
cvIngLog::add("Error. Status Report (order_id: " . $order->getId() . ") - missing order instance");
|
||||
return $this->renderText('Error');
|
||||
}
|
||||
|
||||
return $this->renderText('OK');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user