-
Notifications
You must be signed in to change notification settings - Fork 0
/
yandexkassaemail.php
64 lines (56 loc) · 1.78 KB
/
yandexkassaemail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* JBZoo Element YandexKassa by Email
*
* This file is part of the JBZoo CCK package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package JBZoo
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/Element-Payment-YandexKassa-Email
* @author Denis Smetannikov <denis@jbzoo.com>
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Class JBCartElementPaymentYandexKassaEmail
*/
class JBCartElementPaymentYandexKassaEmail extends JBCartElementPayment
{
/**
* Payment uri
* @var string
*/
private $_uri = 'https://money.yandex.ru/eshop.xml';
/**
* Redirect to payment form action
* @return null|string
*/
public function getRedirectUrl()
{
$summa = $this->getOrderSumm()->val($this->config->get('currency', 'rub'));
$summa = number_format($summa, 2, '.', '');
$query = array(
'shopId' => JString::trim($this->config->get('shopId')),
'scid' => JString::trim($this->config->get('scid')),
'sum' => $summa,
'customerNumber' => 'UserID ' . JFactory::getUser()->id,
'orderNumber' => $this->getOrder()->id,
);
$paymentType = $this->config->get('paymentType', 'AC');
if ($paymentType && $paymentType != 'none') {
$query['paymentType'] = $paymentType;
}
return $this->_uri . '?' . $this->_jbrouter->query($query);
}
/**
* Set payment rate
* @return JBCartValue
*/
public function getRate()
{
return $this->_order->val($this->config->get('rate', '3.5%'));
}
}