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 - 2017 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 Payone\Core\Model\Methods\PayoneMethod; |
30
|
|
|
use Magento\Quote\Model\Quote; |
|
|
|
|
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Class for the PAYONE Server API request genericpayment - "calculation" |
34
|
|
|
*/ |
35
|
|
|
class Calculation extends Base |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* Send request to PAYONE Server-API with request-type "genericpayment" and action "calculation" |
39
|
|
|
* |
40
|
|
|
* @param PayoneMethod $oPayment payment object |
41
|
|
|
* @param Quote $oQuote order object |
42
|
|
|
* @return array |
43
|
|
|
*/ |
44
|
|
|
public function sendRequest(PayoneMethod $oPayment, Quote $oQuote) |
45
|
|
|
{ |
46
|
|
|
$this->addParameter('request', 'genericpayment'); |
47
|
|
|
$this->addParameter('add_paydata[action]', 'calculation'); |
48
|
|
|
|
49
|
|
|
$this->addParameter('mode', $oPayment->getOperationMode()); |
50
|
|
|
$this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
51
|
|
|
$this->addParameter('api_version', '3.10'); |
52
|
|
|
|
53
|
|
|
$this->addParameter('clearingtype', $oPayment->getClearingtype()); |
54
|
|
|
$this->addParameter('financingtype', $oPayment->getSubType()); |
55
|
|
|
|
56
|
|
|
$this->addParameter('amount', number_format($this->apiHelper->getQuoteAmount($oQuote), 2, '.', '') * 100); // add price to request |
57
|
|
|
$this->addParameter('currency', $this->apiHelper->getCurrencyFromQuote($oQuote)); // add currency to request |
58
|
|
|
|
59
|
|
|
$oBilling = $oQuote->getBillingAddress(); |
60
|
|
|
$this->addParameter('country', $oBilling->getCountryId()); |
61
|
|
|
$this->addParameter('lastname', $oBilling->getLastname()); |
62
|
|
|
|
63
|
|
|
return $this->send($oPayment); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Send request to PAYONE Server-API with request-type "genericpayment" and action "calculation" |
68
|
|
|
* |
69
|
|
|
* @param PayoneMethod $oPayment payment object |
70
|
|
|
* @param Quote $oQuote order object |
71
|
|
|
* @return array |
72
|
|
|
*/ |
73
|
|
|
public function sendRequestRatepay(PayoneMethod $oPayment, Quote $oQuote, $sRatepayShopId, $sCalcType, $sCalcValue) |
74
|
|
|
{ |
75
|
|
|
$this->addParameter('request', 'genericpayment'); |
76
|
|
|
$this->addParameter('add_paydata[action]', 'calculation'); |
77
|
|
|
|
78
|
|
|
$this->addParameter('mode', $oPayment->getOperationMode()); |
79
|
|
|
$this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
80
|
|
|
$this->addParameter('api_version', '3.10'); |
81
|
|
|
|
82
|
|
|
$this->addParameter('clearingtype', $oPayment->getClearingtype()); |
83
|
|
|
$this->addParameter('financingtype', $oPayment->getSubType()); |
84
|
|
|
|
85
|
|
|
$this->addParameter('amount', number_format($this->apiHelper->getQuoteAmount($oQuote), 2, '.', '') * 100); // add price to request |
86
|
|
|
$this->addParameter('currency', $this->apiHelper->getCurrencyFromQuote($oQuote)); // add currency to request |
87
|
|
|
|
88
|
|
|
$this->addParameter('add_paydata[shop_id]', $sRatepayShopId); |
89
|
|
|
$this->addParameter('add_paydata[customer_allow_credit_inquiry]', 'yes'); |
90
|
|
|
|
91
|
|
|
$this->addParameter('add_paydata[calculation_type]', $sCalcType); |
92
|
|
|
if ($sCalcType == "calculation-by-rate") { |
93
|
|
|
$this->addParameter('add_paydata[rate]', $sCalcValue); |
94
|
|
|
} elseif ($sCalcType == "calculation-by-time") { |
95
|
|
|
$this->addParameter('add_paydata[month]', $sCalcValue); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
return $this->send($oPayment); |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
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