1 | <?php |
||
43 | class Authorization extends AddressRequest |
||
44 | { |
||
45 | /** |
||
46 | * Invoice generator |
||
47 | * |
||
48 | * @var \Payone\Core\Model\Api\Invoice |
||
49 | */ |
||
50 | protected $invoiceGenerator; |
||
51 | |||
52 | /** |
||
53 | * Checkout session object |
||
54 | * |
||
55 | * @var \Magento\Checkout\Model\Session |
||
56 | */ |
||
57 | protected $checkoutSession; |
||
58 | |||
59 | /** |
||
60 | * PAYONE toolkit helper |
||
61 | * |
||
62 | * @var \Payone\Core\Helper\Toolkit |
||
63 | */ |
||
64 | protected $toolkitHelper; |
||
65 | |||
66 | /** |
||
67 | * Map for custom parameters to be added $sParamName => $sConfigName |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | protected $aCustomParamMap = [ |
||
72 | 'mid' => 'mid', |
||
73 | 'portalid' => 'portalid', |
||
74 | 'aid' => 'aid', |
||
75 | 'key' => 'key', |
||
76 | 'request' => 'request', |
||
77 | ]; |
||
78 | |||
79 | /** |
||
80 | * Constructor |
||
81 | * |
||
82 | * @param \Payone\Core\Helper\Shop $shopHelper |
||
83 | * @param \Payone\Core\Helper\Environment $environmentHelper |
||
84 | * @param \Payone\Core\Helper\Api $apiHelper |
||
85 | * @param \Payone\Core\Model\ResourceModel\ApiLog $apiLog |
||
86 | * @param \Payone\Core\Helper\Customer $customerHelper |
||
87 | * @param \Payone\Core\Model\Api\Invoice $invoiceGenerator |
||
88 | * @param \Magento\Checkout\Model\Session $checkoutSession |
||
89 | * @param \Payone\Core\Helper\Toolkit $toolkitHelper |
||
90 | */ |
||
91 | public function __construct( |
||
106 | |||
107 | /** |
||
108 | * Send request to PAYONE Server-API with |
||
109 | * request-type "authorization" or "preauthorization" |
||
110 | * |
||
111 | * @param PayoneMethod $oPayment payment object |
||
112 | * @param Order $oOrder order object |
||
113 | * @param float $dAmount order sum amount |
||
114 | * @return array |
||
115 | */ |
||
116 | public function sendRequest(PayoneMethod $oPayment, Order $oOrder, $dAmount) |
||
135 | |||
136 | /** |
||
137 | * Add user parameters |
||
138 | * |
||
139 | * @param PayoneMethod $oPayment |
||
140 | * @param Order $oOrder |
||
141 | * @return void |
||
142 | */ |
||
143 | protected function setUserParameters(PayoneMethod $oPayment, Order $oOrder) |
||
144 | { |
||
145 | $oQuote = $this->checkoutSession->getQuote(); // get quote from session |
||
146 | $oCustomer = $oQuote->getCustomer(); // get customer object from quote |
||
147 | $this->addUserDataParameters($oOrder->getBillingAddress(), $oPayment, $oCustomer->getGender(), $oOrder->getCustomerEmail(), $oCustomer->getDob()); |
||
148 | |||
149 | $oShipping = $oOrder->getShippingAddress(); // get shipping address from order |
||
150 | if ($oShipping) {// shipping address existing? |
||
151 | $this->addAddress($oShipping, true); // add regular shipping address |
||
152 | } elseif ($oPayment->getCode() == PayoneConfig::METHOD_PAYDIREKT || ($oPayment->getCode() == PayoneConfig::METHOD_PAYPAL && $this->shopHelper->getConfigParam('bill_as_del_address', PayoneConfig::METHOD_PAYPAL, 'payone_payment'))) { |
||
153 | $this->addAddress($oOrder->getBillingAddress(), true); // add billing address as shipping address |
||
154 | } |
||
155 | } |
||
156 | |||
157 | /** |
||
158 | * Set the parameters needed for the authorization requests |
||
159 | * |
||
160 | * @param PayoneMethod $oPayment |
||
161 | * @param Order $oOrder |
||
162 | * @param float $dAmount |
||
163 | * @return void |
||
164 | */ |
||
165 | protected function setAuthorizationParameters(PayoneMethod $oPayment, Order $oOrder, $dAmount) |
||
185 | |||
186 | /** |
||
187 | * Set payment-specific parameters |
||
188 | * |
||
189 | * @param PayoneMethod $oPayment |
||
190 | * @param Order $oOrder |
||
191 | * @return void |
||
192 | */ |
||
193 | protected function setPaymentParameters(PayoneMethod $oPayment, Order $oOrder) |
||
206 | |||
207 | /** |
||
208 | * Add non-global parameters specifically configured in the payment type |
||
209 | * |
||
210 | * @param PayoneMethod $oPayment |
||
211 | * @return void |
||
212 | */ |
||
213 | protected function addCustomParameters(PayoneMethod $oPayment) |
||
226 | } |
||
227 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.