new pisilinux web sites

This commit is contained in:
Erkan IŞIK
2026-07-01 16:44:17 +03:00
commit b58488b586
21740 changed files with 2066209 additions and 0 deletions
+205
View File
@@ -0,0 +1,205 @@
<?php namespace ZN\Payment;
class Currency
{
/**
* Currency short code list.
*
* @var array
*/
protected static $list =
[
'USN' => 997,
'XSU' => 994,
'CLF' => 990,
'BRL' => 986,
'PLN' => 985,
'BOV' => 984,
'GEL' => 981,
'UAH' => 980,
'MXV' => 979,
'EUR' => 978,
'BAM' => 977,
'CDF' => 976,
'BGN' => 975,
'BYR' => 974,
'AOA' => 973,
'TJS' => 972,
'AFN' => 971,
'COU' => 970,
'MGA' => 969,
'SRD' => 968,
'ZMW' => 967,
'XUA' => 965,
'XDR' => 960,
'XPF' => 953,
'XOF' => 952,
'XCD' => 951,
'XAF' => 950,
'TRY' => 949,
'CHW' => 948,
'CHE' => 947,
'RON' => 946,
'AZN' => 944,
'MZN' => 943,
'RSD' => 941,
'UYI' => 940,
'SDG' => 938,
'VEF' => 937,
'GHS' => 936,
'TMT' => 934,
'ZWL' => 932,
'CUC' => 931,
'TWD' => 901,
'YER' => 886,
'WST' => 882,
'UZS' => 860,
'UYU' => 858,
'USD' => 840,
'TZS' => 834,
'GBP' => 826,
'EGP' => 818,
'MKD' => 807,
'UGX' => 800,
'TND' => 788,
'AED' => 784,
'TTD' => 780,
'TOP' => 776,
'THB' => 764,
'SYP' => 760,
'CHF' => 756,
'SEK' => 752,
'SZL' => 748,
'SSP' => 728,
'ZAR' => 710,
'SOS' => 706,
'VND' => 704,
'SGD' => 702,
'SLL' => 694,
'SCR' => 690,
'SAR' => 682,
'STN' => 678,
'SHP' => 654,
'RWF' => 646,
'RUB' => 643,
'QAR' => 634,
'PHP' => 608,
'PEN' => 604,
'PYG' => 600,
'PGK' => 598,
'PAB' => 590,
'PKR' => 586,
'NOK' => 578,
'NGN' => 566,
'NIO' => 558,
'NZD' => 554,
'VUV' => 548,
'AWG' => 533,
'ANG' => 532,
'NPR' => 524,
'NAD' => 516,
'OMR' => 512,
'MAD' => 504,
'MDL' => 498,
'MNT' => 496,
'MXN' => 484,
'MUR' => 480,
'MRU' => 478,
'MVR' => 462,
'MYR' => 458,
'MWK' => 454,
'MOP' => 446,
'LYD' => 434,
'LRD' => 430,
'LSL' => 426,
'LBP' => 422,
'LAK' => 418,
'KGS' => 417,
'KWD' => 414,
'KRW' => 410,
'KPW' => 408,
'KES' => 404,
'JOD' => 400,
'KZT' => 398,
'JPY' => 392,
'JMD' => 388,
'ILS' => 376,
'IQD' => 368,
'IRR' => 364,
'IDR' => 360,
'INR' => 356,
'ISK' => 352,
'HUF' => 348,
'HKD' => 344,
'HNL' => 340,
'HTG' => 332,
'GYD' => 328,
'GNF' => 324,
'GTQ' => 320,
'GIP' => 292,
'GMD' => 270,
'DJF' => 262,
'FJD' => 242,
'FKP' => 238,
'ERN' => 232,
'ETB' => 230,
'SVC' => 222,
'DOP' => 214,
'DKK' => 208,
'CZK' => 203,
'CUP' => 192,
'HRK' => 191,
'CRC' => 188,
'KMF' => 174,
'COP' => 170,
'CNY' => 156,
'CLP' => 152,
'LKR' => 144,
'KYD' => 136,
'CVE' => 132,
'CAD' => 124,
'KHR' => 116,
'BIF' => 108,
'MMK' => 104,
'BND' => 96,
'SBD' => 90,
'BZD' => 84,
'BWP' => 72,
'BOB' => 68,
'BTN' => 64,
'BMD' => 60,
'BBD' => 52,
'AMD' => 51,
'BDT' => 50,
'BHD' => 48,
'BSD' => 44,
'AUD' => 36,
'ARS' => 32,
'DZD' => 12,
'ALL' => 8
];
/**
* Get currency
*
* @param string|int $short
* @param string &key = NULL
*
* @return
*/
public static function get($short, &$code = NULL)
{
if( is_numeric($short) && in_array($short, self::$list) )
{
$code = array_flip(self::$list)[$short];
return $short;
}
elseif( $currency = (self::$list[$code = strtoupper($short)] ?? NULL) )
{
return $currency;
}
throw new Exception\InvalidCurrencyInformationException(NULL, $short);
}
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class InvalidBankException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi geçerli bir banka değildir!',
'en' => '[%] information is not a valid bank!'
];
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class InvalidCardTypeException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi geçerli bir kart türü değildir! Kullanılabilir Seçenekler:[visa, mastercard]',
'en' => '[%] information is not a valid card type! Available Options[visa, mastercard]'
];
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class InvalidCommandException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi geçerli bir komut değildir!',
'en' => '[%] information is not a valid command!'
];
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class InvalidCurrencyInformationException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi geçersiz para birimidir!',
'en' => '[%] information is invalid currency code!'
];
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class InvalidSendTypeException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi geçerli bir tür değildir!',
'en' => '[%] information is not a valid type!'
];
}
@@ -0,0 +1,21 @@
<?php namespace ZN\Payment\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class MissingInformationException extends Exception
{
const lang =
[
'tr' => '[%] bilgisi eksik!',
'en' => '[%] information is missing!'
];
}
+38
View File
@@ -0,0 +1,38 @@
<?php namespace ZN\Payment;
use ZN\Singleton;
class Gateway
{
/**
* Get gateway request class
*
* @param string $gateway
*
* @return object
*/
public static function request(string $gateway)
{
return Singleton::class(self::getClassName($gateway, 'Request'));
}
/**
* Get gateway reponse class
*
* @param string $gateway
*
* @return object
*/
public static function response(string $gateway)
{
return Singleton::class(self::getClassName($gateway, 'Response'));
}
/**
* Protected get class name
*/
protected static function getClassName($gateway, $type)
{
return 'ZN\Payment\\' . $gateway . '\\' . $type;
}
}
@@ -0,0 +1,17 @@
<?php
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
class Gateway
{
use ZN\Ability\Facade;
const target = 'ZN\Payment\Gateway';
}
@@ -0,0 +1,73 @@
<?php namespace ZN\Payment;
use ZN\Singleton;
use ZN\DateTime\Date;
abstract class GatewayRequestAbstract
{
/**
* Protected settings
*
* @var array
*/
protected $settings = [];
/**
* Magic call
*
* @param string $method
* @param array $parameters
*
* @return $this
*/
public function __call($method, $parameters)
{
if( isset($parameters[0]) )
{
$this->settings[$method] = $parameters[0];
}
return $this;
}
/**
* Send request.
*
* @param string $type;
*/
abstract public function send(string $type);
/**
* Protected signature encoder
*/
protected function signatureEncoder($signature)
{
return base64_encode(pack('H*', sha1($signature)));
}
/**
* Protected missing information
*/
protected function missingInformation()
{
foreach( $this->required as $data => $value )
{
if( ! isset($this->settings[$data]) )
{
throw new Exception\MissingInformationException(NULL, $value);
}
}
}
/**
* Protected year month converter
*/
protected function yearAndMonthConverter(&$year, &$month)
{
$date = new Date;
$date = $date->convert($year . '-' . $month . '-01', '{sy}/{mn0}');
$dateEx = explode('/', $date);
$year = $dateEx[0] ?? $year;
$month = $dateEx[1] ?? $month;
}
}
@@ -0,0 +1,287 @@
<?php namespace ZN\Payment\Nestpay;
use ZN\Request\URL;
use ZN\Services\CURL;
use ZN\Request\Method;
use ZN\Payment\Currency;
use ZN\Payment\Exception;
use ZN\Payment\GatewayRequestAbstract;
class Request extends GatewayRequestAbstract
{
/**
* Protected banks
*
* @var array
*/
protected $banks =
[
'isbank' => 'https://spos.isbank.com.tr/servlet/est3Dgate',
'akbank' => 'https://www.sanalakpos.com/servlet/est3Dgate',
'finansbank' => 'https://www.fbwebpos.com/servlet/est3Dgate',
'halkbank' => 'https://sanalpos.halkbank.com.tr/servlet/est3Dgate',
'anadolubank' => 'https://anadolusanalpos.est.com.tr/servlet/est3Dgate',
'ziraatbank' => 'https://sanalpos2.ziraatbank.com.tr/fim/est3Dgate',
'teb' => 'https://sanalpos.teb.com.tr/fim/est3Dgate',
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate'
];
/**
* Protected card types
*
* @var array
*/
protected $cardTypes = [1 => 1, 2 => 2, 'visa' => 1, 'mastercard' => 2];
/**
* Protected required
*
* @var array
*/
protected $required =
[
'amount' => 'Amount',
'storeKey' => 'Store Key',
'clientid' => 'Client ID',
'okUrl' => 'OK URL'
];
/**
* Sets card number.
*
* @param string $number
* @param string $month
* @param string $year
* @param string $cvc
*
* @return $this
*/
public function card(string $number, string $month, string $year, string $cvc)
{
$this->yearAndMonthConverter($year, $month);
$this->settings['pan'] = $number;
$this->settings['Ecom_Payment_Card_ExpDate_Year'] = $year;
$this->settings['Ecom_Payment_Card_ExpDate_Month'] = $month;
$this->settings['cv2'] = $cvc;
return $this;
}
/**
* Sets card type.
*
* @param int|string $type
*
* @return $this
*/
public function cardType($type)
{
if( ! isset($this->cardTypes[$type]) )
{
throw new Exception\InvalidCardTypeException(NULL, $type);
}
$this->settings['cardType'] = $this->cardTypes[$type];
return $this;
}
/**
* Sets client id.
*
* @param string $id
*
* @return $this
*/
public function clientId(string $id)
{
$this->settings['clientid'] = $id;
return $this;
}
/**
* Sets order id.
*
* @param string $id
*
* @return $this
*/
public function orderId(string $id)
{
$this->settings['oid'] = $id;
return $this;
}
/**
* Sets amount.
*
* @param string $amount
*
* @return $this
*/
public function amount(string $amount)
{
$this->settings['amount'] = $amount;
return $this;
}
/**
* Sets currency.
*
* @param string|int $currency
*
* @return $this
*/
public function currency($currency)
{
$this->settings['currency'] = Currency::get($currency);
return $this;
}
/**
* Sets random key.
*
* @param string $random
*
* @return $this
*/
public function randomKey(string $random)
{
$this->settings['rnd'] = $random;
return $this;
}
/**
* Sets return url.
*
* @param string $success
* @param string $fail
*
* @return $this
*/
public function returnUrl(string $success, ?string $fail = NULL)
{
$this->settings['okUrl'] = URL::site($success);
$this->settings['failUrl'] = URL::site($fail ?? $success);
return $this;
}
/**
* Sets company name.
*
* @param string $name
*
* @return $this
*/
public function companyName(string $name)
{
$this->settings['firmaadi'] = $name;
return $this;
}
/**
* Sets installment.
*
* @param string $name
*
* @return $this
*/
public function installment(string $name)
{
$this->settings['taksit'] = $name;
return $this;
}
/**
* Sets process type.
*
* @param string $type
*
* @return $this
*/
public function processType(string $type)
{
$this->settings['islemtipi'] = $type;
return $this;
}
/**
* Sets store key.
*
* @param string $key
*
* @return $this
*/
public function storeKey(string $key)
{
$this->settings['storeKey'] = $key;
return $this;
}
/**
* Send request.
*
* @param string $type;
*/
public function send(string $type)
{
$this->missingInformation();
$this->default();
if( ! isset($this->banks[$type]) )
{
throw new Exception\InvalidBankException(NULL, $type);
}
$curl = new CURL;
return $curl->init($this->banks[$type])
->post(true)
->postfields(URL::buildQuery($this->settings))
->returntransfer(true)
->sslVerifypeer(false)
->exec();
}
/**
* Protected signature
*/
protected function signature()
{
$signature = $this->settings['clientid'] .
($this->settings['oid'] ?? NULL).
$this->settings['amount'] .
$this->settings['okUrl'] .
$this->settings['failUrl'] .
$this->settings['islemtipi'] .
($this->settings['taksit'] ?? NULL).
$this->settings['rnd'] .
$this->settings['storeKey'] ;
return $this->signatureEncoder($signature);
}
/**
* Protected default
*/
protected function default()
{
$this->settings['storetype'] = '3d_pay';
$this->settings['islemtipi'] = $this->settings['islemtipi'] ?? 'Auth';
$this->settings['currency'] = $this->settings['currency'] ?? 949;
$this->settings['rnd'] = $this->settings['rnd'] ?? time();
$this->settings['hash'] = $this->signature();
}
}
@@ -0,0 +1,84 @@
<?php namespace ZN\Payment\Nestpay;
use ZN\DataTypes\Arrays;
class Response
{
/**
* Protected exclude parameters
*
* @var array
*/
protected $parameters = ['AuthCode', 'Response', 'HostRefNum', 'ProcReturnCode', 'TransId', 'ErrMsg'];
/**
* Get parameters
*
* @var array
*/
public function parameters()
{
return Arrays\RemoveElement::use($_POST, NULL, $this->parameters);
}
/**
* Is valid hash
*
* @return bool
*/
public function isValidHash() : bool
{
if( ! $hash = ($_POST['HASHPARAMS'] ?? NULL) )
{
return false;
}
$hashEx = explode(':', $hash);
$real = NULL;
foreach( $hashEx as $part )
{
if( ! empty($_POST[$part]) )
{
$real .= $_POST[$part];
}
}
return $real === $_POST['HASHPARAMSVAL'] && $_POST['HASH'] === base64_encode(pack('H*',sha1($real . $_POST['storeKey'])));
}
/**
* Is 3d
*
* @return bool
*/
public function is3D() : bool
{
return in_array($_POST["mdStatus"], ['1','2','3','4']);
}
/**
* Is approved
*
* @return bool
*/
public function isApproved() : bool
{
return empty($_POST["ErrMsg"]) && ($_POST["Response"] ?? NULL) === 'Approved';
}
/**
* Get error messages
*
* @return string|false
*/
public function error()
{
if( ! empty($_POST["ErrMsg"]) )
{
return $_POST["ErrMsg"];
}
return false;
}
}
+285
View File
@@ -0,0 +1,285 @@
<?php namespace ZN\Payment\PayPal;
use ZN\Request\URL;
use ZN\Payment\Currency;
use ZN\Payment\Exception;
use ZN\Payment\GatewayRequestAbstract;
class Request extends GatewayRequestAbstract
{
/**
* Protected banks
*
* @var array
*/
public $types =
[
'paypal' => 'https://www.paypal.com/cgi-bin/webscr',
'test' => 'https://www.sandbox.paypal.com/cgi-bin/webscr'
];
/**
* Protected required
*
* @var array
*/
protected $required =
[
'cmd' => '_xclick',
'no_note' => '1'
];
/**
* Protected $commands
*
* @var array
*/
protected $commands =
[
'normal' => '_xclick',
'cart' => '_cart',
'subscribe' => '_xclick-subscriptions',
'autoBilling' => '_xclick-auto-billing',
'donate' => '_donations',
'encrypt' => '_s-xclick'
];
/**
* Command
*
* @param string $command
*
* @return $this
*/
public function command(string $command)
{
if( ! isset($this->commands[$command]) )
{
throw new Exception\InvalidCommandException(NULL, $command);
}
$this->settings['cmd'] = $this->commands[$command];
return $this;
}
/**
* Sets currency.
*
* @param string|int $currency
*
* @return $this
*/
public function currency($currency)
{
# Is valid currency
Currency::get($currency, $code);
$this->settings['currency_code'] = $code;
return $this;
}
/**
* Sets return url.
*
* @param string $notify
* @param string $success
* @param string $cancel = NULL
*
* @return $this
*/
public function returnUrl(string $notify, string $success, ?string $cancel = NULL)
{
$this->settings['notify_url'] = URL::site($notify);
$this->settings['return'] = URL::site($success);
if( $cancel )
{
$this->settings['cancel_return'] = URL::site($cancel);
}
return $this;
}
/**
* Sets item.
*
* @param string $name
* @param string $number = NULL
* @param float $amount = NULL
* @param int $quantity
*
* @return $this
*/
public function item(string $name, ?string $number = NULL, ?float $amount = NULL, ?int $quantity = NULL)
{
$this->settings['items'][] = ['item_name' => $name, 'item_number' => $number, 'amount' => $amount, 'quantity' => $quantity];
return $this;
}
/**
* Order Id
*
* @param string $name
*
* @return $this
*/
public function orderId(string $name)
{
$this->settings['item_name'] = $name;
return $this;
}
/**
* Sets name.
*
* @param string $first
* @param string $last
*
* @return $this
*/
public function name(string $first, string $last)
{
$this->settings['first_name'] = $first;
$this->settings['last_name'] = $last;
return $this;
}
/**
* Sets buyer.
*
* @param string $email
* @param string $id = NULL
*
* @return $this
*/
public function buyer(string $email, ?string $id = NULL)
{
$this->settings['payer_email'] = $email;
if( $id )
{
$this->settings['payer_id'] = $id;
}
return $this;
}
/**
* Sets seller.
*
* @param string $email
* @param string $id = NULL
*
* @return $this
*/
public function seller(string $email, ?string $id = NULL)
{
$this->settings['receiver_email'] = $email;
if( $id )
{
$this->settings['receiver_id'] = $id;
}
return $this;
}
/**
* Sets seller.
*
* @param string $receiver
*
* @return $this
*/
public function clientId(string $clientId)
{
$this->settings['business'] = $clientId;
return $this;
}
/**
* Sets locale.
*
* @param string $locale
*
* @return $this
*/
public function locale($locale)
{
$this->settings['lc'] = $locale;
return $this;
}
/**
* Send request.
*
* @param string $type;
*/
public function send(string $type = 'paypal')
{
if( ! isset($this->types[$type]) )
{
throw new Exception\InvalidSendTypeException(NULL, $type);
}
$this->setMultipleItems();
$this->setCustomData($this->types[$type]);
$settings = array_merge($this->required, $this->settings);
$requestUrl = $this->types[$type] . '?' . http_build_query($settings);
redirect($requestUrl);
}
/**
* protected set multiple items
*/
protected function setMultipleItems()
{
$items = $this->settings['items'] ?? NULL;
if( ! empty($items) )
{
if( count($items) > 1 )
{
foreach( $items as $key => $values )
{
$id = $key + 1;
foreach( $values as $k => $i )
if( $i !== NULL )
$this->settings[$k . '_' . $id] = $values[$k];
}
}
else
{
foreach( $items[0] as $key => $item )
if( $item !== NULL )
$this->settings[$key] = $item;
}
unset($this->settings['items']);
}
}
/**
* protected set custom data
*/
protected function setCustomData($url)
{
$custom = $this->settings['custom'] ?? '';
$this->settings['custom'] = $url . ',' . $custom;
}
}
@@ -0,0 +1,59 @@
<?php namespace ZN\Payment\PayPal;
use ZN\Services\CURL;
use ZN\Payment\Exception;
class Response
{
/**
* Is valid hash
*
* @return bool
*/
public function isValidHash() : bool
{
if( empty($_POST['custom']) )
{
return false;
}
$query = 'cmd=_notify-validate&' . http_build_query($_POST);
$url = explode(',', $_POST['custom'])[0];
$curl = new CURL;
return $curl->init($url)
->post(true)
->postfields($query)
->returntransfer(true)
->sslVerifypeer(false)
->sslVerifyhost(false)
->exec() === 'VERIFIED';
}
/**
* Is approved
*
* @return bool
*/
public function isApproved() : bool
{
return ! empty($_POST['payment_status']) && ($_POST['payment_status'] ?? NULL) === 'Completed';
}
/**
* Get error messages
*
* @return string|false
*/
public function error()
{
if( $this->isApproved() )
{
return false;
}
return $_POST['payment_status'] ?? 'Payment status not found!';
}
}