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,123 @@
<?php
class stTrustedShopsBackendActions extends autostTrustedShopsBackendActions {
public function executeIndex() {
$this->redirect('stTrustedShopsBackend/list');
}
public function executeList() {
parent::executeList();
if(!$this->pager->getNbResults()){
$notice = '<a href="https://www.trustedshops.eu/merchants/order.html?audit=0" target="_blank" style="text-decoration: underline; color: #555;">'.$this->getContext()->getI18n()->__('Zarejestruj się').'</a> '.$this->getContext()->getI18n()->__('i uzyskaj certyfikat Trusted Shops.');
$this->setFlash("info", $notice, false);
}
}
public function executeInformation() {
$this->menu_items = $this->getMenuItems();
$this->hasCertificate = TrustedShopsPeer::doCount(new Criteria());
}
protected function getMenuItems() {
$i18n = $this->getContext()->getI18N();
return array(
'stTrustedShopsBackend/list' => $i18n->__('Lista certyfikatów'),
'stTrustedShopsBackend/config' => $i18n->__('Konfiguracja'),
);
}
public function executeRatingActive() {
if ($this->getRequest()->hasParameter('id')) {
$i18n = $this->getContext()->getI18N();
$id = $this->getRequest()->getParameter('id');
$cert = TrustedShopsPeer::retrieveByPK($id);
if (is_object($cert)) {
$cert->setRatingStatus(0);
switch (stTrustedShopsConnector::updateRating($cert->getCertificate(), 1)) {
case 'OK':
$this->setFlash('notice', $i18n->__('Dziękujemy za aktywację funkcji Opinia Klienta Trusted Shops!'));
$cert->setRatingStatus(1);
break;
case 'INVALID_TSID':
$this->setFlash('warning', $i18n->__('Nieprawidłowy identyfikator Trusted Shops.'));
break;
case 'NOT_REGISTERED_FOR_TRUSTEDRATING':
$this->setFlash('warning', $i18n->__('Dla tego identyfikatora Trusted Shops nie nastąpiła jeszcze aktywacja Opinii Klienta.'));
break;
}
$cert->save();
}
}
$this->redirect('stTrustedShopsBackend/ratingEdit?id='.$id);
}
protected function updateProtectionPaymentsTrustedShopsFromRequest() {
parent::updateProtectionPaymentsTrustedShopsFromRequest();
$trusted_shops = $this->getRequestParameter('trusted_shops');
if(isset($trusted_shops['payment_method'])) {
foreach($trusted_shops['payment_method'] as $id => $method) {
$c = new Criteria();
$c->add(TrustedShopsHasPaymentTypePeer::TRUSTED_SHOPS_ID, $this->getRequestParameter('id'));
$c->add(TrustedShopsHasPaymentTypePeer::PAYMENT_TYPE_ID, $id);
$trustedShopsPaymentType = TrustedShopsHasPaymentTypePeer::doSelectOne($c);
if (!is_object($trustedShopsPaymentType)) {
$trustedShopsPaymentType = new TrustedShopsHasPaymentType();
$trustedShopsPaymentType->setTrustedShopsId($this->getRequestParameter('id'));
$trustedShopsPaymentType->setPaymentTypeId($id);
}
$trustedShopsPaymentType->setMethod($method);
$trustedShopsPaymentType->save();
}
}
}
public function validateEdit() {
$return = true;
if ($this->getRequest()->getMethod() == sfRequest::POST && $this->getRequest()->hasParameter('id') && $this->getRequest()->getParameter('id') != '') {
$certificate = TrustedShopsPeer::retrieveByPK($this->getRequest()->getParameter('id'));
if (is_object($certificate)) {
$trustedShops = $this->getRequest()->getParameter('trusted_shops');
$config = stConfig::getInstance('stTrustedShopsBackend');
if ($certificate->getType() == 'Excellence') {
if (!isset($trustedShops['username']) || empty($trustedShops['username'])) {
$this->getRequest()->setError('trusted_shops{username}', 'Proszę uzupełnić pole.');
$return = false;
}
if (!isset($trustedShops['password']) || empty($trustedShops['password'])) {
$this->getRequest()->setError('trusted_shops{password}', 'Proszę uzupełnić pole.');
$return = false;
}
if ($return == true) {
$result = stTrustedShopsConnector::checkLogin($trustedShops['certificate'], $trustedShops['username'], $trustedShops['password']);
if ($result != 1) {
$this->getRequest()->setError('trusted_shops{username}', stTrustedShopsConnector::getCheckLoginError($result));
$return = false;
}
}
}
}
}
return $return;
}
}

View File

@@ -0,0 +1,55 @@
<?php
class stTrustedShopsBackendComponents extends autoStTrustedShopsBackendComponents {
public function executePaymentMethods()
{
$this->paymentTypes = array();
$this->paymentTypesSelected = array();
$paymentTypes = PaymentTypePeer::doSelect(new Criteria());
foreach($paymentTypes as $paymentType)
{
$this->paymentTypes[$paymentType->getId()] = $paymentType->getName();
$c = new Criteria();
$c->add(TrustedShopsHasPaymentTypePeer::TRUSTED_SHOPS_ID, $this->trusted_shops->getId());
$c->add(TrustedShopsHasPaymentTypePeer::PAYMENT_TYPE_ID, $paymentType->getId());
$trustedShopsPaymentType = TrustedShopsHasPaymentTypePeer::doSelectOne($c);
if (is_object($trustedShopsPaymentType))
{
$this->paymentTypesSelected[$paymentType->getId()] = $trustedShopsPaymentType->getMethod();
} else {
$this->paymentTypesSelected[$paymentType->getId()] = '';
}
}
$i18n = $this->getContext()->getI18n();
$this->paymentMethods = array('DIRECT_DEBIT' => $i18n->__('polecenie zapłaty'),
'CREDIT_CARD' => $i18n->__('karta kredytowa'),
'INVOICE' => $i18n->__('faktura'),
'CASH_ON_DELIVERY' => $i18n->__('gotówką przy dostawie'),
'PREPAYMENT' => $i18n->__('przedpłata'),
'CHEQUE' => $i18n->__('czek'),
'PAYBOX' => $i18n->__('Paybox'),
'PAYPAL' => $i18n->__('PayPal'),
'AMAZON_PAYMENTS' => $i18n->__('Płatności Amazon'),
'CASH_ON_PICKUP' => $i18n->__('gotówką przy odbiorze'),
'FINANCING' => $i18n->__('finansowanie'),
'LEASING' => $i18n->__('leasing'),
'T_PAY' => $i18n->__('T-Pay'),
'CLICKANDBUY' => $i18n->__('Click&Buy'),
'GIROPAY' => $i18n->__('Giropay'),
'GOOGLE_CHECKOUT' => $i18n->__('Google Checkout'),
'SHOP_CARD' => $i18n->__('karta sklepu'),
'DIRECT_E_BANKING' => $i18n->__('bezpośrednio przez e-banking'),
'MONEYBOOKERS' => $i18n->__('moneybookers.com'),
'DOTPAY' => $i18n->__('Dotpay'),
'PLATNOSCI' => $i18n->__('Płatności.pl'),
'PRZELEWY24' => $i18n->__('Przelewy24'),
'OTHER' => $i18n->__('inne')
);
}
}