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

View File

@@ -0,0 +1,2 @@
<?php
$smarty->display('_order_summary.html');

View File

@@ -0,0 +1,3 @@
<?php
st_theme_use_stylesheet('stPayment.css');
$smarty->display('_show_payment.html');

View File

@@ -0,0 +1,4 @@
<?php
st_theme_use_stylesheet('stPayment.css');
$smarty->assign('contactLink', is_object($contactPage) ? url_for('stWebpageFrontend/index?url='.$contactPage->getFriendlyUrl()) : null);
$smarty->display("_return_fail.html");

View File

@@ -0,0 +1,3 @@
<?php
st_theme_use_stylesheet('stPayment.css');
$smarty->display("_return_success.html");

View File

@@ -0,0 +1,20 @@
<form id='cv-ing-form' action="{$url}" method="post">
{foreach key=name item=value from=$data}
<input type="hidden" name="{$name}" value='{$value}' />
{/foreach}
</form>
{literal}
<script>
jQuery(function($){
$(document).ready(function(){
$('#pay_button a, #order_summary_action-bottom a.pay').click(function(e){
$('#cv-ing-form').submit();
e.stopPropagation()
e.preventDefault();
return false;
});
});
});
</script>
{/literal}

View File

@@ -0,0 +1,15 @@
<div id="stPayment_return" class="box roundies">
<div class="title">
<h2>{$txt.header_info_imoje}</h2>
</div>
<div class="content">
<p>
{$txt.return_fail}<br/>
{__ text="Skontaktuj się z nami." langCatalogue="stPayment"}
</p>
{if $contactLink}
<a href="{$contactLink}" class="important roundies">{__ text="Kontakt" langCatalogue="stPayment"}</a>
{/if}
</div>
</div>

View File

@@ -0,0 +1,10 @@
<div id="stPayment_return" class="box roundies">
<div class="title">
<h2>{$txt.header_info_imoje}</h2>
</div>
<div class="content">
<p>{$txt.return_success}</p>
<a href="/" class="important roundies">{__ text="Wróć do zakupów" langCatalogue="stPayment"}</a>
</div>
</div>

View File

@@ -0,0 +1,27 @@
<div id="st_box_payment">
<span>
{$txt.header_info_imoje}
</span>
<div>
{if $check_configuration}
<p>
<img src="https://imoje.ingbank.pl/images/logo.svg" alt="" style="max-width: 250px" />
</p>
<form action="{$url}" method="post">
{foreach key=name item=value from=$data}
<input type="hidden" name="{$name}" value='{$value}' />
{/foreach}
<div class="buttons right">
<button type="submit" class="important roundies">
<span class="arrow_right">{__ text="Zapłać" langCatalogue="stOrder"}</span>
</button>
</div>
<br class="clear" />
</form>
{else}
<p>
{$txt.payment_config_info}
</p>
{/if}
</div>
</div>

View File

@@ -0,0 +1,30 @@
<form id='cv-ing-form' action="{$url}" method="post">
{foreach key=name item=value from=$data}
<input type="hidden" name="{$name}" value='{$value}' />
{/foreach}
</form>
{literal}
<script>
jQuery(function($){
$(document).ready(function(){
if($('#order-pay-btn').length){
$('#order-pay-btn').click(function(e){
$('#cv-ing-form').submit();
e.stopPropagation()
e.preventDefault();
return false;
});
}else if($('.btn.btn-primary.pay').length){
$('.btn.btn-primary.pay').click(function(e){
$('#cv-ing-form').submit();
e.stopPropagation()
e.preventDefault();
return false;
});
}
});
});
</script>
{/literal}

View File

@@ -0,0 +1,17 @@
{set layout="one_column"}
<div id="payment">
<div class="panel panel-default center-block">
<div class="panel-heading">
{$txt.header_info_imoje}
</div>
<div class="panel-body text-center">
<p>
{$txt.return_fail}<br/>
{__ text="Skontaktuj się z nami." langCatalogue="stPayment"}
</p>
{if $contactLink}
<a href="{$contactLink}" class="btn btn-primary">{__ text="Kontakt" langCatalogue="stPayment"}</a>
{/if}
</div>
</div>
</div>

View File

@@ -0,0 +1,12 @@
{set layout="one_column"}
<div id="payment">
<div class="panel panel-default center-block">
<div class="panel-heading">
{$txt.header_info_imoje}
</div>
<div class="panel-body text-center">
<p>{$txt.return_success}</p>
<a href="/" class="btn btn-primary">{__ text="Wróć do zakupów" langCatalogue="stPayment"}</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div class="panel panel-default center-block">
<div class="panel-heading">
{$txt.header_info_imoje}
</div>
<div id="payu-panel-body" class="panel-body text-center">
{if $check_configuration}
<p>
<img src="https://imoje.ingbank.pl/images/logo.svg" alt="" style="max-width: 250px" />
</p>
<form action="{$url}" method="post">
{foreach key=name item=value from=$data}
<input type="hidden" name="{$name}" value="{$value}" />
{/foreach}
<button type="submit" class="btn btn-primary pull-right">
{__ text="Zapłać" langCatalogue="stOrder"}
</button>
</form>
{else}
<p>
{$txt.payment_config_info}
</p>
{/if}
</div>
</div>