first commit
This commit is contained in:
69
templates/tickets/przelewy24.php
Normal file
69
templates/tickets/przelewy24.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
$clientData = $this->order;
|
||||
$merchant_id = $this->settings['p24']['merchant_id'];
|
||||
$pos_id = $this->settings['p24']['pos_id'];
|
||||
|
||||
$crc_key = '';
|
||||
|
||||
if($this->settings['p24']['sandbox']) {
|
||||
$crc_key = $this->settings['p24']['sandbox_crc_key'];
|
||||
} else {
|
||||
$crc_key = $this->settings['p24']['crc_key'];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="spinner_container">
|
||||
<?= \Tpl::view( 'components/spinner'); ?>
|
||||
</div>
|
||||
|
||||
<form
|
||||
action="<?= $this -> settings['p24']['sandbox'] ? 'https://sandbox.przelewy24.pl/trnDirect' : 'https://secure.przelewy24.pl/trnDirect';?>"
|
||||
method="post" class="form" id="form_data" accept-charset="ISO-8859-2">
|
||||
<input type="hidden" name="p24_session_id" value="<?= $this -> przelewy24_hash; ?>" />
|
||||
<input type="hidden" name="p24_merchant_id" value="<?= $merchant_id; ?>" />
|
||||
<input type="hidden" name="p24_pos_id" value="<?= $pos_id; ?>" />
|
||||
<input type="hidden" name="p24_amount" value="<?= $clientData['order_price'] * 100;?>" />
|
||||
<input type="hidden" name="p24_currency" value="PLN" />
|
||||
<input type="hidden" name="p24_description" value="Zamówienie nr <?= $clientData['id']; ?>" />
|
||||
<input type="hidden" name="p24_client" value="<?= $clientData['name'] . ' ' . $clientData['surname'];?>" />
|
||||
<input type="hidden" name="p24_zip" value="<?= $clientData['zip_code']; ?>" />
|
||||
<input type="hidden" name="p24_city" value="<?= $clientData['city']; ?>" />
|
||||
<input type="hidden" name="p24_country" value="PL" />
|
||||
<input type="hidden" name="p24_email" value="<?= $clientData['email']; ?>" />
|
||||
<input type="hidden" name="p24_language" value="pl" />
|
||||
<input type="hidden" name="p24_url_status"
|
||||
value="https://<?= $_SERVER['SERVER_NAME'];?>/tickets/przelewy24_response/" />
|
||||
<input type="hidden" name="p24_url_return"
|
||||
value="https://<?= $_SERVER['SERVER_NAME'];?>/tickets/order_confirm/order=<?= $this -> order['hash'];?>" />
|
||||
<input type="hidden" name="p24_api_version" value="3.2" />
|
||||
<input type="hidden" name="p24_wait_for_result" value="1">
|
||||
<input type="hidden" name="p24_method" value="227">
|
||||
<input type="hidden" name="p24_sign"
|
||||
value="<?= md5( $this -> przelewy24_hash . '|' . $merchant_id . '|' . ( $clientData['order_price'] * 100 ) . '|PLN|' . $crc_key );?>" />
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
dataLayer.push({ ecommerce: null });
|
||||
dataLayer.push({
|
||||
event: "purchase",
|
||||
ecommerce: {
|
||||
transaction_id: "<?= $this -> order['id'];?>",
|
||||
value: <?= str_replace( ',', '.', $this -> order['order_price'] );?>,
|
||||
currency: "PLN",
|
||||
shipping: 0,
|
||||
items: [
|
||||
<? foreach ( $this -> order['tickets'] as $ticket ):?>
|
||||
{
|
||||
'id': <?= (int)$ticket['product_id'];?>,
|
||||
'name': '<?= $ticket['name'];?>',
|
||||
'quantity': <?= $ticket['quantity'];?>,
|
||||
'price': <?= $ticket['price'];?>
|
||||
}<? if ( $ticket != end( $this -> order['tickets'] ) ) echo ',';?>
|
||||
<? endforeach;?>
|
||||
]
|
||||
}
|
||||
});
|
||||
$( document ).ready( function() {
|
||||
$( "#form_data" ).submit();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user