|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
|
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
|
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
7
|
|
|
* (at your option) any later version. |
|
8
|
|
|
* |
|
9
|
|
|
* PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12
|
|
|
* GNU Lesser General Public License for more details. |
|
13
|
|
|
* |
|
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
15
|
|
|
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
|
16
|
|
|
* |
|
17
|
|
|
* PHP version 5 |
|
18
|
|
|
* |
|
19
|
|
|
* @category Payone |
|
20
|
|
|
* @package Payone_Magento2_Plugin |
|
21
|
|
|
* @author FATCHIP GmbH <[email protected]> |
|
22
|
|
|
* @copyright 2003 - 2020 Payone GmbH |
|
23
|
|
|
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
|
24
|
|
|
* @link http://www.payone.de |
|
25
|
|
|
*/ |
|
26
|
|
|
|
|
27
|
|
|
namespace Payone\Core\Model\Api\Request\Genericpayment; |
|
28
|
|
|
|
|
29
|
|
|
use Magento\Quote\Model\Quote; |
|
|
|
|
|
|
30
|
|
|
use Payone\Core\Model\Methods\PayoneMethod; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Class for the PAYONE Server API request genericpayment - "start_session" |
|
34
|
|
|
*/ |
|
35
|
|
|
class StartSession extends Base |
|
36
|
|
|
{ |
|
37
|
|
|
/** |
|
38
|
|
|
* Invoice generator |
|
39
|
|
|
* |
|
40
|
|
|
* @var \Payone\Core\Model\Api\Invoice |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $invoiceGenerator; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Constructor |
|
46
|
|
|
* |
|
47
|
|
|
* @param \Payone\Core\Helper\Shop $shopHelper |
|
48
|
|
|
* @param \Payone\Core\Helper\Environment $environmentHelper |
|
49
|
|
|
* @param \Payone\Core\Helper\Api $apiHelper |
|
50
|
|
|
* @param \Payone\Core\Model\ResourceModel\ApiLog $apiLog |
|
51
|
|
|
* @param \Payone\Core\Helper\Customer $customerHelper |
|
52
|
|
|
* @param \Payone\Core\Model\Api\Invoice $invoiceGenerator |
|
53
|
|
|
*/ |
|
54
|
|
|
public function __construct( |
|
55
|
|
|
\Payone\Core\Helper\Shop $shopHelper, |
|
56
|
|
|
\Payone\Core\Helper\Environment $environmentHelper, |
|
57
|
|
|
\Payone\Core\Helper\Api $apiHelper, |
|
58
|
|
|
\Payone\Core\Model\ResourceModel\ApiLog $apiLog, |
|
59
|
|
|
\Payone\Core\Helper\Customer $customerHelper, |
|
60
|
|
|
\Payone\Core\Model\Api\Invoice $invoiceGenerator |
|
61
|
|
|
) { |
|
62
|
|
|
parent::__construct($shopHelper, $environmentHelper, $apiHelper, $apiLog, $customerHelper); |
|
63
|
|
|
$this->customerHelper = $customerHelper; |
|
64
|
|
|
$this->invoiceGenerator = $invoiceGenerator; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Send request to PAYONE Server-API with |
|
69
|
|
|
* request-type "genericpayment" |
|
70
|
|
|
* |
|
71
|
|
|
* @param Quote $oQuote |
|
72
|
|
|
* @param PayoneMethod $oPayment |
|
73
|
|
|
* @param double $dShippingCosts |
|
74
|
|
|
* @return array Response |
|
75
|
|
|
*/ |
|
76
|
|
|
public function sendRequest(Quote $oQuote, PayoneMethod $oPayment, $dShippingCosts) |
|
77
|
|
|
{ |
|
78
|
|
|
$this->addParameter('request', 'genericpayment'); |
|
79
|
|
|
$this->addParameter('add_paydata[action]', 'start_session'); |
|
80
|
|
|
$this->addParameter('api_version', '3.10'); |
|
81
|
|
|
$this->addParameter('mode', $oPayment->getOperationMode()); |
|
82
|
|
|
$this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
|
83
|
|
|
|
|
84
|
|
|
$this->addParameter('amount', number_format($this->apiHelper->getQuoteAmount($oQuote), 2, '.', '') * 100); // add price to request |
|
85
|
|
|
$this->addParameter('currency', $this->apiHelper->getCurrencyFromQuote($oQuote)); // add currency to request |
|
86
|
|
|
|
|
87
|
|
|
$oBilling = $oQuote->getBillingAddress(); |
|
88
|
|
|
$this->addAddress($oBilling); |
|
89
|
|
|
if ($oBilling->getCompany()) { |
|
90
|
|
|
$this->addParameter('add_paydata[organization_entity_type]', 'OTHER'); |
|
91
|
|
|
$this->addParameter('add_paydata[organization_registry_id]', ''); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
$oShipping = $oQuote->getShippingAddress(); |
|
95
|
|
|
if ($oShipping) { |
|
96
|
|
|
$this->addAddress($oShipping, true); |
|
97
|
|
|
$this->addParameter('add_paydata[shipping_email]', $oQuote->getCustomerEmail()); |
|
98
|
|
|
$this->addParameter('add_paydata[shipping_title]', ''); |
|
99
|
|
|
$this->addParameter('add_paydata[shipping_telephonenumber]', ''); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
$this->addParameter('clearingtype', 'fnc'); |
|
103
|
|
|
$this->addParameter('financingtype', $oPayment->getSubType()); |
|
104
|
|
|
|
|
105
|
|
|
$this->invoiceGenerator->addProductInfo($this, $oQuote, false, false, $dShippingCosts); |
|
|
|
|
|
|
106
|
|
|
|
|
107
|
|
|
return $this->send($oPayment); |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths