setAttrib('id', 'payment-verification-form'); return $this; } public function addButtons() { $this->addStepButtons(); $this->getElement('btnNext')->setLabel('Confirm'); return $this; } public function isValid($data) { $isValid = parent::isValid($data); return $this->isAgreedWithTerms() && $isValid; } private function isAgreedWithTerms() { if ('y' != Qs_Request::getPostValue('paymentConfirmed')) { $this->addError('You should confirm payment method'); return false; } return true; } protected function _addResources() { $this->initDialog(); return parent::_addResources(); } public function getPayment($field = null, $default = null) { return Qs_Array::get($this->_payment, $field, $default); } public function setPayment(array $payment) { $this->_payment = $payment; return $this; } private function initDialog() { $id = 'paymentConfirmationModal'; $item = [ 'id' => $id, 'payment' => $this->getPayment(), 'tpl' => 'Payment/confirmation-dialog.tpl', ]; $this->getDoc()->addItem($item, 'AFTER_BODY'); $this->getDoc()->addScript('js/app/payment/form/verificationForm.js'); $this->getDoc()->addInitObject('app.payment.form.VerificationForm', [[ 'id' => $this->getId(), 'nodes' => [ 'dialog' => '#' . $id, 'dialogConfirmButton' => '#' . $id . ' [data-confirm]', ], ]]); } }