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,19 @@
<div class="list-menu">
<ul>
<li class="selected">
<?php echo link_to(__('PayPal'),'stPaypalBackend/config')?>
</li>
<li>
<?php if (sfContext::getInstance()->getUser()->getCulture() == 'pl_PL'): ?>
<a href="https://www.sote.pl/docs/paypal" target="_blank"><?php echo __('Dokumentacja'); ?></a>
<?php else: ?>
<a href="https://www.soteshop.com/docs/paypal" target="_blank"><?php echo __('Documentation'); ?></a>
<?php endif; ?>
</li>
</ul>
</div>
<div class="clr"></div>

View File

@@ -0,0 +1,27 @@
<?php use_helper('stPaypal') ?>
<?php if ($paypal_response->isSuccessful()): ?>
<?php $items = $paypal_response->getItems() ?>
<?php if (count($items) > 1): ?>
<table class="st_record_list" cellspacing="0">
<thead>
<tr>
<?php foreach ($items as $balance): ?>
<th><?php echo $balance->getCurrencyCode() ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<tr>
<?php foreach ($items as $balance): ?>
<td><?php echo $balance->getAmt() ?></td>
<?php endforeach; ?>
</tr>
</tbody>
</table>
<?php else: ?>
<?php echo $items[0]->getAmt() . ' ' . $items[0]->getCurrencyCode() ?>
<?php endif; ?>
<?php else: ?>
<?php echo __('Wystąpiły problemy podczas próby połączenia z Paypal') ?>
<?php endif; ?>

View File

@@ -0,0 +1,33 @@
<?php use_helper('stPaypal', 'stDate') ?>
<?php if ($paypal_response->isSuccessful() && count($paypal_response->getItems()) > 0): ?>
<table class="st_record_list" cellspacing="0">
<thead>
<tr>
<th><?php echo __('Numer zamówienia') ?></th>
<th><?php echo __('Data płatności') ?></th>
<th><?php echo __('Płacący') ?></th>
<th><?php echo __('Kwota płatności') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($paypal_response->getItems() as $transaction): ?>
<tr>
<td><?php echo st_paypal_order_link($transaction->getTransactionId()) ?></td>
<td><?php echo st_format_date($transaction->getTimestamp(), 'f') ?></td>
<td>
<?php echo $transaction->getName() ?><br />
<?php echo $transaction->getEmail() ?>
</td>
<td><?php echo $transaction->getAmt() ?> <?php echo $transaction->getCurrencyCode() ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php elseif ($paypal_response->isSuccessful()): ?>
<p><?php echo __('Brak oczekujących płatności') ?></p>
<?php else: ?>
<?php echo __('Wystąpiły problemy podczas próby połączenia z Paypal') ?>
<?php endif;

View File

@@ -0,0 +1,189 @@
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?>
<?php echo st_get_admin_head('stPaypalPlugin', __('PayPal'), null,array('stPayment')) ?>
<?php st_view_slot_start('application-menu') ?>
<?php st_include_component('stPaypalBackend', 'listMenu') ?>
<?php st_view_slot_end() ?>
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels, 'i18n_catalogue' => 'stPaypalBackend')) ?>
<?php echo form_tag('stPaypalBackend/save', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form', 'class' => 'admin_form')) ?>
<fieldset id="sf_fieldset-paypal-live">
<div class="content">
<div class="row">
<?php echo st_admin_get_form_field('config[enabled]', __('Aktywuj'), 1, 'checkbox_tag', array('checked' => $config->get('enabled'), 'class' => 'st_paypal-live-field', 'size' => '60')) ?>
<div class="clr"></div>
</div>
<div class="form-row">
<?php echo label_for('config_live_api_username', __('Nazwa użytkownika API'), array('class' => 'required')) ?>
<div class="content<?php if ($sf_request->hasError('config{live_api_username}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{live_api_username}')): ?>
<?php echo form_error('config{live_api_username}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_tag('config[live_api_username]', $config->get('live_api_username'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_live_api_password', __('Hasło API'), array('class' => 'required')) ?>
<div class="content<?php if ($sf_request->hasError('config{live_api_password}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{live_api_password}')): ?>
<?php echo form_error('config{live_api_password}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_password_tag('config[live_api_password]', $config->get('live_api_password'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_live_api_signature', __('Podpis API'), array('class' => 'required')) ?>
<div class="content<?php if ($sf_request->hasError('config{live_api_signature}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{live_api_signature}')): ?>
<?php echo form_error('config{live_api_signature}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_password_tag('config[live_api_signature]', $config->get('live_api_signature'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
<?php if (SF_ENVIRONMENT == 'dev' || $sf_request->hasParameter('debug')): ?>
<div class="form-row">
<?php echo label_for('config_enabled', __('Włącz')) ?>
<div class="content">
<?php echo st_admin_checkbox_tag('config[enabled]', true, $config->get('enabled')) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_test_mode', __('Tryb testowy')) ?>
<div class="content">
<?php echo st_admin_checkbox_tag('config[test_mode]', true, $config->get('test_mode')) ?>
<br class="st_clear_all"/>
</div>
</div>
<?php endif ?>
<div class="form-row">
<?php echo label_for('config_show_shipping_info', __('Pokaż dane dostawy').' <a href="#" class="help" title="'.__('Wyświetla dane dostawy na stronie potwierdzenia płatności PayPal').'"></a>') ?>
<div class="content">
<?php echo st_admin_checkbox_tag('config[show_shipping_info]', true, $config->get('show_shipping_info')) ?>
<br class="st_clear_all"/>
</div>
</div>
</fieldset>
<fieldset id="sf_fieldset-paypal-live">
<h2><?php echo __('PayPal Express') ?></h2>
<div class="content">
<div class="form-row">
<?php echo label_for('config_express', __('Aktywuj płatność na karcie produktu')) ?>
<div class="content">
<?php echo st_admin_checkbox_tag('config[express]', true, $config->get('express')) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_show_shipping_info', __('Domyślna dostawa'));?>
<div class="content">
<?php echo select_tag('config[express_delivery]', objects_for_select($deliveries, 'getId', 'getName', $config->get('express_delivery')));?>
<br class="st_clear_all"/>
</div>
</div>
</div>
</fieldset>
<?php if (SF_ENVIRONMENT == 'dev' || $sf_request->hasParameter('debug')): ?>
<fieldset id="sf_fieldset-paypal-sandbox">
<h2><?php echo __('Konfiguracja API (tryb testowy)') ?></h2>
<div class="content">
<div class="form-row">
<?php echo label_for('config_sandbox_api_username', __('Nazwa użytkownika API'), array('class' => 'required')); ?>
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_username}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{sandbox_api_username}')): ?>
<?php echo form_error('config{sandbox_api_username}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_tag('config[sandbox_api_username]', $config->get('sandbox_api_username'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_sandbox_api_password', __('Hasło API'), array('class' => 'required')) ?>
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_password}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{sandbox_api_password}')): ?>
<?php echo form_error('config{sandbox_api_password}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_password_tag('config[sandbox_api_password]', $config->get('sandbox_api_password'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
<div class="form-row">
<?php echo label_for('config_sandbox_api_signature', __('Podpis API'), array('class' => 'required')) ?>
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_signature}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('config{sandbox_api_signature}')): ?>
<?php echo form_error('config{sandbox_api_signature}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<?php echo input_password_tag('config[sandbox_api_signature]', $config->get('sandbox_api_signature'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
<br class="st_clear_all"/>
</div>
</div>
</div>
</fieldset>
<?php endif ?>
<?php if ($config->get('configuration_verified')): ?>
<fieldset id="sf_fieldset-paypal-account">
<h2><?php echo __('Informacje o koncie') ?></h2>
<div class="content">
<div class="form-row">
<div><?php echo __('Bilans konta') ?></div>
<div class="content" id="st_paypal-account-balance" style="margin-left: 15px;">
<?php echo image_tag('backend/stPaypalPlugin/ajax-loader.gif') ?>
</div>
</div>
<div class="form-row">
<div><?php echo __('Oczekujące płatności') ?>:</div>
<div class="content" id="st_paypal-pending-payments" style="margin-left: 15px;">
<?php echo image_tag('backend/stPaypalPlugin/ajax-loader.gif') ?>
</div>
</div>
</div>
</fieldset>
<?php endif ?>
<?php echo st_get_admin_actions(array(
array('type' => 'save', 'label' => __('Zapisz', null, 'stAdminGeneratorPlugin'))
)) ?>
</form>
<div class="clr"></div>
<?php echo st_get_admin_foot();?>
<script type="text/javascript">
jQuery(function($) {
$('#config_test_mode').on('change', function() {
var input = $(this);
if (input.prop('checked'))
{
$('.st_paypal-sandbox-field').prop('disabled', false);
$('.st_paypal-live-field').prop('disabled', true);
}
else
{
$('.st_paypal-sandbox-field').prop('disabled', true);
$('.st_paypal-live-field').prop('disabled', false);
}
});
$.get('<?php echo url_for('stPaypalBackend/ajaxPaypalAccountBalance') ?>', function(response) {
$('#st_paypal-account-balance').html(response);
});
$.get('<?php echo url_for('stPaypalBackend/ajaxPaypalPendingPayments') ?>', function(response) {
$('#st_paypal-pending-payments').html(response);
});
});
</script>