protected function init($paymentParams, $order, $items) { if (!$paymentParams instanceof HIPAY_MAPI_PaymentParams || !HIPAY_MAPI_UTILS::is_an_array_of($order, 'HIPAY_MAPI_Order') || !HIPAY_MAPI_UTILS::is_an_array_of($items, 'HIPAY_MAPI_Item') || count($items) < 1) { throw new Exception('Wrong parameters'); } try { $paymentParams->check(); } catch (Exception $e) { throw new Exception($e->getMessage()); } foreach ($order as $orderObj) { try { $orderObj->check(); } catch (Exception $e) { throw new Exception($e->getMessage()); } } foreach ($items as $obj) { try { $obj->check(); } catch (Exception $e) { throw new Exception($e->getMessage()); } } $this->paymentParams = clone $paymentParams; $this->paymentParams->lock(); foreach ($order as $obj) { $this->order[] = clone $obj; end($this->order)->lock(); $this->_taxItemsAmount[] = 0; $this->_taxShippingAmount[] = 0; $this->_taxInsuranceAmount[] = 0; $this->_taxFixedCostAmount[] = 0; $this->_itemsTotalAmount[] = 0; $this->_taxTotalAmount[] = 0; $this->_orderTotalAmount[] = 0; $this->_affiliateTotalAmount[] = 0; } foreach ($items as $obj) { $this->items[] = clone $obj; end($this->items)->lock(); } try { $this->compute(); } catch (Exception $e) { throw new Exception($e->getMessage()); } }