1 | <?php |
||
36 | class Debit extends Base |
||
37 | { |
||
38 | /** |
||
39 | * @var \Payone\Core\Model\Api\Invoice $invoiceGenerator |
||
40 | */ |
||
41 | protected $invoiceGenerator; |
||
42 | |||
43 | /** |
||
44 | * PAYONE database helper |
||
45 | * |
||
46 | * @var \Payone\Core\Helper\Database |
||
47 | */ |
||
48 | protected $databaseHelper; |
||
49 | |||
50 | /** |
||
51 | * PAYONE toolkit helper |
||
52 | * |
||
53 | * @var \Payone\Core\Helper\Toolkit |
||
54 | */ |
||
55 | protected $toolkitHelper; |
||
56 | |||
57 | /** |
||
58 | * Constructor |
||
59 | * |
||
60 | * @param \Payone\Core\Helper\Shop $shopHelper |
||
61 | * @param \Payone\Core\Helper\Environment $environmentHelper |
||
62 | * @param \Payone\Core\Helper\Api $apiHelper |
||
63 | * @param \Payone\Core\Model\ResourceModel\ApiLog $apiLog |
||
64 | * @param \Payone\Core\Model\Api\Invoice $invoiceGenerator |
||
65 | * @param \Payone\Core\Helper\Database $databaseHelper |
||
66 | * @param \Payone\Core\Helper\Toolkit $toolkitHelper |
||
67 | */ |
||
68 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * Generate position list for invoice data transmission |
||
85 | * |
||
86 | * @param Order $oOrder |
||
87 | * @return array|false |
||
88 | */ |
||
89 | protected function getInvoiceList(Order $oOrder) |
||
115 | |||
116 | /** |
||
117 | * Send request "debit" to PAYONE server API |
||
118 | * |
||
119 | * @param PayoneMethod $oPayment |
||
120 | * @param InfoInterface $oPaymentInfo |
||
121 | * @param float $dAmount |
||
122 | * @return array |
||
123 | */ |
||
124 | public function sendRequest(PayoneMethod $oPayment, InfoInterface $oPaymentInfo, $dAmount) |
||
125 | { |
||
126 | $oOrder = $oPaymentInfo->getOrder(); |
||
127 | |||
128 | $aPositions = $this->getInvoiceList($oOrder); |
||
129 | |||
130 | $iTxid = $oPaymentInfo->getParentTransactionId(); |
||
131 | if (strpos($iTxid, '-') !== false) { |
||
132 | $iTxid = substr($iTxid, 0, strpos($iTxid, '-')); // clean the txid from the magento-suffixes |
||
133 | } |
||
134 | |||
135 | $this->setOrderId($oOrder->getRealOrderId()); |
||
136 | |||
137 | $this->addParameter('request', 'debit'); // Request method |
||
138 | $this->addParameter('mode', $oPayment->getOperationMode()); // PayOne Portal Operation Mode (live or test) |
||
139 | $this->addParameter('txid', $iTxid); // PayOne Transaction ID |
||
140 | $this->addParameter('sequencenumber', $this->databaseHelper->getSequenceNumber($iTxid)); |
||
141 | |||
142 | // Total order sum in smallest currency unit |
||
143 | $this->addParameter('amount', number_format((-1 * $dAmount), 2, '.', '') * 100); |
||
144 | $this->addParameter('currency', $oOrder->getOrderCurrencyCode()); // Currency |
||
145 | $this->addParameter('transactiontype', 'GT'); |
||
146 | |||
147 | $sRefundAppendix = $this->getRefundAppendix($oOrder, $oPayment); |
||
148 | if (!empty($sRefundAppendix)) { |
||
149 | $this->addParameter('invoiceappendix', $sRefundAppendix); |
||
150 | } |
||
151 | |||
152 | if ($this->apiHelper->isInvoiceDataNeeded($oPayment)) { |
||
153 | $this->invoiceGenerator->addProductInfo($this, $oOrder, $aPositions, true); // add invoice parameters |
||
154 | } |
||
155 | |||
156 | // Add debit bank data given - see oxid integration |
||
157 | |||
158 | $aResponse = $this->send($oPayment); |
||
159 | |||
160 | return $aResponse; |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * Get substituted refund appendix text |
||
165 | * |
||
166 | * @param Order $oOrder |
||
167 | * @param PayoneMethod $oPayment |
||
168 | * @return string |
||
169 | */ |
||
170 | protected function getRefundAppendix(Order $oOrder, PayoneMethod $oPayment) |
||
198 | } |
||
199 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: