5.98,
'card_num' => '4111111111111111',
'card_code' => '111',
'exp_date' => '11/2013',
);
protected function _doInsert()
{
$form = $this->_getNewForm();
if ($form->validate()) {
$data = $form->getValues();
$payment = App_Service_Payment::factory('authorizeNet', array(
'type' => App_Service_Payment_AuthorizeNet::AUTH_CAPTURE_TYPE,
'data' => $data['payment']
));
$result = $payment->getResponse()->isSuccess();
$paymentData = $payment->getResponse()->getData();
echo 'Result: ', intval($result), '
', 'Response: ' . print_r($paymentData, true) . '
';
exit();
}
$this->_addFormItem($form);
return $this;
}
protected function _getNewForm()
{
$form = new Qs_Form($this->_getFormOptions());
$form->addElement('hidden', 'action', array('value' => 'insert'));
$this->_bindFormFields($form);
$form->setDefaults($this->_formDefaults);
return $form;
}
protected function _bindFormFields(Qs_Form $form)
{
$subForm = new Qs_Form_SubForm();
$subForm->addElement('text', 'amount', array('label' => 'Amount', 'required' => true));
$subForm->addElement('text', 'card_num', array('label' => 'Card Number', 'required' => true));
$subForm->addElement('text', 'card_code', array('label' => 'CVV Code', 'required' => true));
$subForm->addElement('text', 'exp_date', array('label' => 'Card Exp. Date', 'required' => true));
$form->addSubForm($subForm, 'payment');
return $this;
}
}