first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -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');
}
}

View File

@@ -0,0 +1,63 @@
<?php
class cvIngImojeFrontendComponents extends sfComponents
{
public function executeShowPayment()
{
$this->smarty = new stSmarty('cvIngImojeFrontend');
$ing = new cvIngService();
$plugin = new cvIngPlugin();
$tl = new cvIngTranslationCfg();
$txt = $tl->getArray();
if(!isset($this->order)) {
$this->order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash_code'));
}
$this->smarty->assign('url', $ing->paymentUrl);
$this->smarty->assign('txt', $txt);
$this->smarty->assign('data', $ing->getTransactionData($this->order));
$this->smarty->assign('check_configuration', $plugin->checkPaymentConfiguration(1));
}
public function executeOrderSummary()
{
$id = $this->getRequestParameter('id');
$hash_code = $this->getRequestParameter('hash_code');
$order = OrderPeer::retrieveByIdAndHashCode($id, $hash_code);
if(!$order) {
return sfView::NONE;
}
$payment = $order->getOrderPayment();
if(!$payment) {
return sfView::NONE;
}
$typeModule = $payment->getPaymentType()->getModulename();
if(!in_array($typeModule, array(
'cvIngTwisto',
'cvIngImoje',
))) {
return sfView::NONE;
}
$this->smarty = new stSmarty('cvIngImojeFrontend');
$ing = new cvIngService();
$plugin = new cvIngPlugin();
$tl = new cvIngTranslationCfg();
$txt = $tl->getArray();
$this->smarty->assign('url', $ing->paymentUrl);
$this->smarty->assign('txt', $txt);
$this->smarty->assign('data', $ing->getTransactionData($order, $typeModule == 'cvIngTwisto'
? 1
: 0));
$this->smarty->assign('check_configuration', $plugin->checkPaymentConfiguration(1));
}
}