diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b607ad --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# MAGENTO PAYMENT INTEGRATION BY NOVALNET +The Magento Payment Gateway by Novalnet enables secure integration of payments and payment services for all Magento shops. The full-service platform allow merchant to automate payment processing, enrich customer experiences and improve conversion rate through one interface and one contract partner. + +## Integration requirements +Novalnet merchant account is required for processing all international and local payments through this Magento Payment Gateway. The module is available for the magento versions 1.4.2.x to 1.9.4.5 in the following languages: EN & DE + +## Key features +- Easy configuration of all international & local payment methods +- One PCI DSS certified payment platform for all payment services from checkout to collection +- Complete automation of all payment processes +- 60+ risk & payment fraud detection modules to prevent defaults in real time +- Clear overview of payment status from checkout to receivables +- Multilevel claims management with integrated handover to collection and various export functions for the accounting +- Comprehensive fraud prevention solution with more than 60 modules (Machine learning) +- Reporting & analytics dashboards with multiple export options +- Automated e-mail notifications for staying up to date on the payment status +- Automated bookkeeping report in XML, SOAP, CSV, MT940 +- Simple seamless integration of the payment module +- Secure SSL-encoded gateways +- Credit/Debit Card iframe integration +- Custom CSS configuration for Credit/Debit Card iframe +- One click shopping supported for Credit/Debit Cards, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Instalment by Direct Debit SEPA & PayPal +- Easy way of confirmation and cancellation of on-hold transactions (Cancel & Confirm option) for Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Instalment payment for Direct Debit SEPA, Credit/Debit Cards, Invoice, Invoice with payment guarantee, Instalment payment for Invoice, Prepayment & PayPal. +- Refund option for Credit/Debit Cards, Direct Debit SEPA, Debit SEPA with payment guarantee, Instalment payment for Direct Debit SEPA, Invoice, Invoice with payment guarantee, Instalment payment for Invoice, Prepayment, Barzahlen/viacash, Sofort, iDEAL, eps, giropay, PayPal & Przelewy24. +- Due date change option for Prepayment & Invoice payment. +- Payment slip expiry date update option for Barzahlen/viacash payment. +- Supports the multi-store features of Magento +- Allowed countries customization +- All SUPEE secure patches are supported +- Automatic order creation on subscription renewal +- Subscription management (suspend, reactivate, cancel) in both Magento store and Magento admin + +For detailed documentation and other technical inquiries, please send us an email at sales@novalnet.de + +## Integrated payment methods +- Direct Debit SEPA +- Credit/Debit Cards +- Invoice +- Prepayment +- Invoice with payment guarantee +- Direct Debit SEPA with payment guarantee +- iDEAL +- Sofort +- giropay +- Barzahlen/viacash +- Przelewy24 +- eps +- Instalment by Invoice +- Instalment by Direct Debit SEPA +- PayPal + +## License +See our License Agreement at: https://www.novalnet.com/payment-plugins/free/license + +## Documentation & Support +For more information about the Magento Payment Integration by Novalnet, please get in touch with us: sales@novalnet.de or +49 89 9230683-20
+ +Novalnet AG
+Zahlungsinstitut (ZAG)
+Feringastr. 4
+85774 Unterföhring
+Deutschland
+Website: www.novalnet.de + +## Who is Novalnet AG? +

Novalnet AG is a leading financial service institution offering payment gateways for processing online payments. Operating in the market as a full payment service provider Novalnet AG provides online merchants user-friendly payment integration with all major shop systems and self-programmed sites.

+

Accept, manage and monitor payments all on one platform with one single contract!

+

Our SaaS engine is PCI DSS certified and designed to enable real-time risk management, secured payments via escrow accounts, efficient receivables management, dynamic member and subscription management, customized payment solutions for various business models (e.g. marketplaces, affiliate programs etc.) etc.

diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Novalnetutility.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Novalnetutility.php new file mode 100755 index 0000000..da31131 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Novalnetutility.php @@ -0,0 +1,23 @@ +_headerText = Mage::helper('novalnet_payment')->__('Novalnet Recurring Profiles'); + parent::__construct(); + $this->_removeButton('add'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/Grid.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/Grid.php new file mode 100755 index 0000000..f373759 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/Grid.php @@ -0,0 +1,171 @@ +setId('novalnet_recurring_profile_grid'); + $this->setUseAjax(true); + $this->setSaveParametersInSession(true); + } + + /** + * Prepare grid collection object + * + * @param none + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel('sales/recurring_profile_collection') + ->addFieldToFilter( + 'method_code', array( + 'like' => '%novalnet%', + ) + ); + $collection->setOrder('profile_id', 'desc'); + $this->setCollection($collection); + + if (!$this->getParam($this->getVarNameSort())) { + $collection->setOrder('profile_id', 'desc'); + } + + return parent::_prepareCollection(); + } + + /** + * Prepare grid columns + * + * @param none + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_Grid + */ + protected function _prepareColumns() + { + $profile = Mage::getModel('sales/recurring_profile'); + + $this->addColumn( + 'reference_id', array( + 'header' => $profile->getFieldLabel('reference_id'), + 'index' => 'reference_id', + 'html_decorators' => array('nobr'), + 'width' => 1, + ) + ); + + if (!Mage::app()->isSingleStoreMode()) { + $this->addColumn( + 'store_id', array( + 'header' => Mage::helper('adminhtml')->__('Store'), + 'index' => 'store_id', + 'type' => 'store', + 'store_view' => true, + 'display_deleted' => true, + ) + ); + } + + $profileState = $profile->getAllStates(); + uasort($profileState, 'strcasecmp'); + $this->addColumn( + 'state', array( + 'header' => $profile->getFieldLabel('state'), + 'index' => 'state', + 'type' => 'options', + 'options' => $profileState, + 'html_decorators' => array('nobr'), + 'width' => 1, + ) + ); + + $this->addColumn( + 'created_at', array( + 'header' => Mage::helper('novalnet_payment')->__('Created on'), + 'index' => 'created_at', + 'type' => 'datetime', + 'html_decorators' => array('nobr'), + 'width' => 1, + ) + ); + + $this->addColumn( + 'updated_at', array( + 'header' => Mage::helper('novalnet_payment')->__('Updated on'), + 'index' => 'updated_at', + 'type' => 'datetime', + 'html_decorators' => array('nobr'), + 'width' => 1, + ) + ); + + $methods = array(); + foreach (Mage::helper('payment')->getRecurringProfileMethods() as $method) { + if (preg_match("/novalnet/i", $method->getCode())) { + $methods[$method->getCode()] = $method->getTitle(); + } + } + + $this->addColumn( + 'method_code', array( + 'header' => $profile->getFieldLabel('method_code'), + 'index' => 'method_code', + 'type' => 'options', + 'options' => $methods, + ) + ); + + $this->addColumn( + 'schedule_description', array( + 'header' => $profile->getFieldLabel('schedule_description'), + 'index' => 'schedule_description', + ) + ); + + return parent::_prepareColumns(); + } + + /** + * Get row url for js event handlers + * + * @param mixed $row + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl('adminhtml/sales_recurring_profile/view', array('profile' => $row->getId())); + } + + /** + * Get grid url + * + * @param none + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current' => true)); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/View.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/View.php new file mode 100755 index 0000000..189e57f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Recurring/Profile/View.php @@ -0,0 +1,172 @@ +getMethodCode())) { + return parent::_prepareLayout(); + } + + $this->_addButton( + 'back', array( + 'label' => Mage::helper('adminhtml')->__('Back'), + 'onclick' => "setLocation('{$this->getUrl('*/*/')}')", + 'class' => 'back' + ) + ); + // Get transaction information + $transactionStatus = $this->getTransactionStatus($profile); + + $comfirmationMessage = Mage::helper('sales')->__('Are you sure you want to do this?'); + + // cancel + if ($profile->canCancel() && $transactionStatus->getAmount()) { + $url = $this->getUrl( + '*/*/updateState', array('profile' => $profile->getId(), + 'action' => 'cancel') + ); + $this->_addButton( + 'cancel', array( + 'label' => Mage::helper('sales')->__('Cancel'), + 'onclick' => "cancelButtonViewStatus('recurring_buttons_view','recurring_cancel_button_view')", + 'class' => 'delete', + ) + ); + } + + // suspend + $state = $profile->getState(); + if ($profile->canSuspend() && $state != 'pending' && $transactionStatus->getAmount()) { + $url = $this->getUrl( + '*/*/updateState', array('profile' => $profile->getId(), + 'action' => 'suspend') + ); + $this->_addButton( + 'suspend', array( + 'label' => Mage::helper('sales')->__('Suspend'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'delete', + ) + ); + } + + // activate + if ($profile->canActivate() && $state != 'pending') { + $url = $this->getUrl( + '*/*/updateState', array('profile' => $profile->getId(), + 'action' => 'activate') + ); + $this->_addButton( + 'activate', array( + 'label' => Mage::helper('sales')->__('Activate'), + 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')", + 'class' => 'add', + ) + ); + } + } + + /** + * Set title and a hack for tabs container + * + * @param none + * @return Mage_Sales_Block_Adminhtml_Recurring_Profile_View + */ + protected function _beforeToHtml() + { + $profile = Mage::registry('current_recurring_profile'); + $this->_headerText = Mage::helper('sales')->__('Recurring Profile # %s', $profile->getReferenceId()); + $this->setViewHtml('
'); + return parent::_beforeToHtml(); + } + + /** + * Get cancel reasons for recurring cancel + * + * @param none + * @return mixed + */ + protected function _getCancelButtonWithReasons() + { + $profile = Mage::registry('current_recurring_profile'); + $comfirmationMessage = Mage::helper('sales')->__('Are you sure you want to do this?'); + $helper = Mage::helper('sales'); + $lang = array($helper->__("Please select reason"), $helper->__("Product is costly"), $helper->__("Cheating"), + $helper->__("Partner interfered"), $helper->__("Financial problem"), + $helper->__("Content does not match my likes"), $helper->__("Content is not enough"), + $helper->__("Interested only for a trial"), $helper->__("Page is very slow"), + $helper->__("Satisfied customer"), $helper->__("Logging in problems"), $helper->__("Other reasons")); + $cancelview = ""; + if ($profile->canCancel()) { + $cancelReason = $helper->__("Please select the reason of subscription cancellation"); + $select = Mage::app()->getLayout()->createBlock('core/html_select') + ->setName("cancel_reason") + ->setId("reason-unsubscribe") + ->setOptions($lang); + + $cancelview .= $select->getHtml(); + + $url = $this->getUrl( + '*/*/updateState', array('profile' => $profile->getId(), + 'action' => 'cancel') + ); + $this->setChild( + 'cancel', $this->getLayout()->createBlock('adminhtml/widget_button')->setData( + array( + 'label' => Mage::helper('sales')->__('Cancel'), + 'onclick' => "subscriptionCancel('{$comfirmationMessage}', '{$url}', '{$cancelReason}')", + 'class' => 'delete', + ) + ) + ); + $cancelview .= $this->getChildHtml('cancel'); + } + + return $cancelview; + } + + /** + * Get transaction information + * + * @param Varien_Object $profile + * @return Varien_Object + */ + public function getTransactionStatus($profile) + { + $transactionId = $profile->getReferenceId(); + // load transaction status information + $helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + return $transactionStatus; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order.php new file mode 100755 index 0000000..6cbe0af --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order.php @@ -0,0 +1,36 @@ +_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_sales_order'; + $this->_headerText = Mage::helper('novalnet_payment')->__('Orders'); + $this->removeButton('add'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Grid.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Grid.php new file mode 100755 index 0000000..5f9a863 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Grid.php @@ -0,0 +1,353 @@ +setId('novalnet_sales_order_grid'); + $this->setUseAjax(true); + $this->setDefaultSort('created_at'); + $this->setDefaultDir('DESC'); + $this->setSaveParametersInSession(true); + + // Novalnet + $novalnetPayment = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('paymentMethods'); + $novalPaymentMethods = array_keys($novalnetPayment); + + foreach ($novalPaymentMethods as $paymentCode) { + $paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title'); + $this->novalnetPayments[$paymentCode] = $paymentTitle; + } + + // Novalnet + // Customer groups + $this->groups = Mage::getResourceModel('customer/group_collection') + ->addFieldToFilter('customer_group_id', array('gt' => 0)) + ->load() + ->toOptionHash(); + // Customer groups + } + + /** + * Retrieve collection class + * + * @param none + * @return string + */ + protected function _getCollectionClass() + { + return 'sales/order_grid_collection'; + } + + /** + * Prepare order Collection for novalnet payments + * + * @param none + * @return Mage_Adminhtml_Block_Widget_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getResourceModel($this->_getCollectionClass()); + $tablePrefix = Mage::getConfig()->getTablePrefix(); + // For customer email filter + $collection->getSelect()->joinLeft( + array('email' => $tablePrefix . 'sales_flat_order'), + 'email.entity_id=main_table.entity_id', + array('email.customer_email') + ); + $collection->getSelect()->joinLeft( + array('cgroup' => $tablePrefix . 'sales_flat_order'), + 'cgroup.entity_id=main_table.entity_id', + array('cgroup.customer_group_id') + ); + + if (version_compare(Mage::helper('novalnet_payment')->getMagentoVersion(), '1.6.0.0', '>')) { + $collection->join(array('payment' => 'sales/order_payment'), 'main_table.entity_id = parent_id', 'method') + ->getSelect()->where("`payment`.`method` like '%novalnet%'"); + } else { + $flatOrderPayment = $collection->getTable('sales/order_payment'); + $collection->getSelect()->join( + array('payment' => $flatOrderPayment), 'main_table.entity_id = payment.parent_id', 'method' + )->where("`payment`.`method` like '%novalnet%'"); + } + + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * prepare column for order grid + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Sales_Order_Grid + */ + protected function _prepareColumns() + { + $this->addColumn( + 'real_order_id', array( + 'header' => Mage::helper('sales')->__('Order #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'increment_id', + 'filter_index' => 'main_table.increment_id' + ) + ); + + if (!Mage::app()->isSingleStoreMode()) { + $this->addColumn( + 'store_id', array( + 'header' => Mage::helper('sales')->__('Purchased From (Store)'), + 'index' => 'store_id', + 'type' => 'store', + 'store_view' => true, + 'display_deleted' => true, + 'filter_index' => 'main_table.store_id' + ) + ); + } + + $this->addColumn( + 'created_at', array( + 'header' => Mage::helper('sales')->__('Purchased On'), + 'index' => 'created_at', + 'type' => 'datetime', + 'width' => '100px', + 'filter_index' => 'main_table.created_at' + ) + ); + + $this->addColumn( + 'billing_name', array( + 'header' => Mage::helper('sales')->__('Bill to Name'), + 'index' => 'billing_name', + ) + ); + + $this->addColumn( + 'shipping_name', array( + 'header' => Mage::helper('sales')->__('Ship to Name'), + 'index' => 'shipping_name', + ) + ); + + $this->addColumn( + 'customer_email', array( + 'header' => Mage::helper('sales')->__('Email'), + 'index' => 'customer_email', + 'filter_index' => 'email.customer_email' + ) + ); + + $this->addColumn( + 'customer_group_id', array( + 'header' => Mage::helper('sales')->__('Group'), + 'index' => 'customer_group_id', + 'filter_index' => 'cgroup.customer_group_id', + 'type' => 'options', + 'options' => $this->groups, + ) + ); + + $this->addColumn( + 'base_grand_total', array( + 'header' => Mage::helper('sales')->__('G.T. (Base)'), + 'index' => 'base_grand_total', + 'type' => 'currency', + 'currency' => 'base_currency_code', + 'filter_index' => 'main_table.base_grand_total' + ) + ); + + $this->addColumn( + 'grand_total', array( + 'header' => Mage::helper('sales')->__('G.T. (Purchased)'), + 'index' => 'grand_total', + 'type' => 'currency', + 'currency' => 'order_currency_code', + 'filter_index' => 'main_table.grand_total' + ) + ); + + $orderStatus = Mage::getSingleton('sales/order_config')->getStatuses(); + uasort($orderStatus, 'strcasecmp'); + $this->addColumn( + 'status', array( + 'header' => Mage::helper('sales')->__('Status'), + 'index' => 'status', + 'type' => 'options', + 'width' => '70px', + 'options' => $orderStatus, + 'filter_index' => 'main_table.status' + ) + ); + + uasort($this->novalnetPayments, 'strcasecmp'); + $this->addColumn( + 'novalnet_method', array( + 'header' => Mage::helper('sales')->__('Payment Method'), + 'index' => 'method', + 'type' => 'options', + 'width' => '70px', + 'options' => $this->novalnetPayments, + ), 'method' + ); + + if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) { + $this->addColumn( + 'action', array( + 'header' => Mage::helper('sales')->__('Action'), + 'width' => '80px', + 'type' => 'action', + 'getter' => 'getId', + 'renderer' => 'novalnet_payment/adminhtml_sales_order_render_delete', + 'filter' => false, + 'sortable' => false, + 'index' => 'stores', + 'is_system' => true, + ) + ); + } + + $this->setDefaultSort('created_at'); + $this->setDefaultDir('DESC'); + + $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS')); + + parent::_prepareColumns(); + return $this; + } + + /** + * prepare column for massaction order grid + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Sales_Order_Grid + */ + protected function _prepareMassaction() + { + $this->setMassactionIdField('entity_id'); + $this->getMassactionBlock()->setFormFieldName('order_ids'); + $this->getMassactionBlock()->setUseSelectAll(false); + + if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) { + $this->getMassactionBlock()->addItem( + 'cancel_order', array( + 'label' => Mage::helper('sales')->__('Cancel'), + 'url' => $this->getUrl('*/*/massCancel'), + ) + ); + } + + if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) { + $this->getMassactionBlock()->addItem( + 'hold_order', array( + 'label' => Mage::helper('sales')->__('Hold'), + 'url' => $this->getUrl('*/*/massHold'), + ) + ); + } + + if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) { + $this->getMassactionBlock()->addItem( + 'unhold_order', array( + 'label' => Mage::helper('sales')->__('Unhold'), + 'url' => $this->getUrl('*/*/massUnhold'), + ) + ); + } + + $this->getMassactionBlock()->addItem( + 'pdfinvoices_order', array( + 'label' => Mage::helper('sales')->__('Print Invoices'), + 'url' => $this->getUrl('*/*/pdfinvoices'), + ) + ); + + $this->getMassactionBlock()->addItem( + 'pdfshipments_order', array( + 'label' => Mage::helper('sales')->__('Print Packingslips'), + 'url' => $this->getUrl('*/*/pdfshipments'), + ) + ); + + $this->getMassactionBlock()->addItem( + 'pdfcreditmemos_order', array( + 'label' => Mage::helper('sales')->__('Print Credit Memos'), + 'url' => $this->getUrl('*/*/pdfcreditmemos'), + ) + ); + + $this->getMassactionBlock()->addItem( + 'pdfdocs_order', array( + 'label' => Mage::helper('sales')->__('Print All'), + 'url' => $this->getUrl('*/*/pdfdocs'), + ) + ); + + $this->getMassactionBlock()->addItem( + 'print_shipping_label', array( + 'label' => Mage::helper('sales')->__('Print Shipping Labels'), + 'url' => $this->getUrl('adminhtml/sales_order_shipment/massPrintShippingLabel'), + ) + ); + + $this->getMassactionBlock()->addItem( + 'delete_order', array( + 'label' => Mage::helper('sales')->__('Delete Order'), + 'url' => $this->getUrl('adminhtml/novalnetpayment_sales_deleteorder/massDelete'), + 'confirm' => Mage::helper('sales')->__('Are you sure you want to delete order?') + ) + ); + + return $this; + } + + /** + * Return row url + * + * @param none + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId())); + } + + /** + * Return grid url + * + * @param none + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current' => true)); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Render/Delete.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Render/Delete.php new file mode 100755 index 0000000..c1a4561 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/Render/Delete.php @@ -0,0 +1,45 @@ +getData(); + $orderId = $info['entity_id']; + $message = Mage::helper('sales')->__('Are you sure you want to delete this order?'); + $viewLink = $this->getUrl('adminhtml/sales_order/view', array('order_id' => $orderId)); + $deleteLink = $this->getUrl( + 'adminhtml/novalnetpayment_sales_deleteorder/delete', array('order_id' => $orderId) + ); + $result = 'View'; + $result .= '    '; + $result .= 'Delete'; + return $result; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/Instalment.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/Instalment.php new file mode 100755 index 0000000..032e24e --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/Instalment.php @@ -0,0 +1,174 @@ +setTemplate('novalnet/sales/order/view/tab/instalment.phtml'); + } + + /** + * Return tab label + * + * @param none + * @return string + */ + public function getTabLabel() + { + return $this->novalnetHelper()->__('Instalment'); + } + + /** + * Return tab title + * + * @param none + * @return string + */ + public function getTabTitle() + { + return $this->novalnetHelper()->__('Instalment'); + } + + /** + * Can show tab + * + * @param none + * @return boolean + */ + public function canShowTab() + { + $order = $this->getOrder(); + $payment = $order->getPayment(); + $paymentCode = $payment->getMethodInstance()->getCode(); + if (in_array($paymentCode, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT))) { + $helper = $this->novalnetHelper(); + $additionalData = unserialize($payment->getAdditionalData()); + $transactionId = !empty($payment->getLastTransId()) ? $payment->getLastTransId() : $additionalData['NnTid']; + + if (!empty($transactionId)) { + // Get current transaction status information + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $helper->makeValidNumber($transactionId)); // Get payment original transaction status + return ($transactionStatus->getTransactionStatus() == 100) ? true : false; + } + } + + return false; + } + + /** + * Tab is hidden + * + * @param none + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Return tab class + * + * @param none + * @return string + */ + public function getTabClass() + { + return 'ajax novalnet-widget-tab'; + } + + /** + * Get current order + * + * @param none + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_order'); + } + + /** + * Get URL to edit the customer. + * + * @return string + */ + public function getCustomerViewUrl() + { + if ($this->getOrder()->getCustomerIsGuest() || !$this->getOrder()->getCustomerId()) { + return ''; + } + + return Mage::helper('adminhtml')->getUrl('adminhtml/customer/edit', array('id' => $this->getOrder()->getCustomerId())); + } + + /** + * Get order store name + * + * @return null|string + */ + public function getOrderStoreName() + { + if ($this->getOrder()) { + $storeId = $this->getOrder()->getStoreId(); + if ($storeId === null) { + $deleted = __(' [deleted]'); + return nl2br($this->getOrder()->getStoreName()) . $deleted; + } + $store = Mage::app()->getStore($storeId); + $name = array($store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()); + return implode('
', $name); + } + + return null; + } + + /** + * Get payment additional data + * + * @return null|string + */ + public function getAdditionalData($key) + { + $payment = $this->getOrder()->getPayment(); + $details = unserialize($payment->getAdditionalData()); + if (is_array($details)) { + return (!empty($key) && isset($details[$key])) ? $details[$key] : ''; + } + } + + /** + * Get Novalnet payment helper + * + * @param none + * @return Novalnet_Payment_Helper_Data + */ + protected function novalnetHelper() + { + return Mage::helper('novalnet_payment'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionOverview.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionOverview.php new file mode 100755 index 0000000..1b068e8 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionOverview.php @@ -0,0 +1,246 @@ +setId('novalnet_payment_block_adminhtml_sales_order_view_tab_transactionoverview'); + $this->setDefaultSort('created_at'); + $this->setDefaultDir('DESC'); + $this->setSaveParametersInSession(true); + $this->setUseAjax(true); + $this->setSkipGenerateContent(true); + } + + /** + * Return Tab label + * + * @param none + * @return string + */ + public function getTabLabel() + { + return $this->novalnetHelper()->__('Novalnet - Transaction Overview'); + } + + /** + * Return Tab title + * + * @param none + * @return string + */ + public function getTabTitle() + { + return $this->novalnetHelper()->__('Novalnet - Transaction Overview'); + } + + /** + * Can show tab in tabs + * + * @param none + * @return boolean + */ + public function canShowTab() + { + $order = $this->getOrder(); + $paymentCode = $order->getPayment()->getMethodInstance()->getCode(); + return (bool)(preg_match("/novalnet/i", $paymentCode)); + } + + /** + * Tab is hidden + * + * @param none + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Return Tab class + * + * @param none + * @return string + */ + public function getTabClass() + { + return 'ajax novalnet-widget-tab'; + } + + /** + * Get current order + * + * @param none + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_order'); + } + + /** + * Return tab url + * + * @param none + * @return string + */ + public function getTabUrl() + { + return $this->getUrl( + 'adminhtml/novalnetpayment_sales_order/transactionOverviewGrid', array( + '_current' => true + ) + ); + } + + /** + * Return grid url + * + * @param none + * @return string + */ + public function getGridUrl() + { + return $this->getUrl( + 'adminhtml/novalnetpayment_sales_order/transactionOverviewGrid', array('_current' => true) + ); + } + + /** + * Return row url + * + * @param mixed $row + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl('adminhtml/novalnetpayment_transactionoverview/view', array('nntxn_id' => $row->getId())); + } + + /** + * Prepare order Collection for transaction status + * + * @param none + * @return Novalnet_Payment_Model_TransactionStatus + */ + protected function _prepareCollection() + { + $collection = $this->getTransactionStatusCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Prepare order Collection for transaction status + * + * @param none + * @return mixed $collection + */ + public function getTransactionStatusCollection() + { + $collection = Mage::getModel('novalnet_payment/Mysql4_TransactionStatus')->getCollection(); + $collection->getByOrder($this->getOrder()); + return $collection; + } + + /** + * Define transaction status grid + * + * @param none + * @return mixed + */ + protected function _prepareColumns() + { + $helper = $this->novalnetHelper(); + $this->setColumn( + 'order_id', array( + 'header' => $helper->__('Order No'), + 'width' => '200px', + 'type' => 'text', + 'index' => 'order_id', + ) + ); + $this->setColumn( + 'txid', array( + 'header' => $helper->__('Transaction Id'), + 'width' => '200px', + 'type' => 'text', + 'index' => 'transaction_no', + ) + ); + $this->setColumn( + 'transaction_status', array( + 'header' => $helper->__('Transaction Status'), + 'width' => '200px', + 'type' => 'text', + 'index' => 'transaction_status', + ) + ); + $this->setColumn( + 'customer_id', array( + 'header' => $helper->__('Customer Id'), + 'width' => '200px', + 'type' => 'text', + 'index' => 'customer_id', + ) + ); + $this->setColumn( + 'store_id', array( + 'header' => $helper->__('Store Id'), + 'width' => '200px', + 'type' => 'text', + 'index' => 'store_id', + ) + ); + + return parent::_prepareColumns(); + } + + /** + * Add coumn + * + * @param none + * @return null + */ + protected function setColumn($field, $fieldColumnMap) + { + $this->addColumn($field, $fieldColumnMap); + } + + /** + * Get Novalnet payment helper + * + * @param none + * @return Novalnet_Payment_Helper_Data + */ + protected function novalnetHelper() + { + return Mage::helper('novalnet_payment'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionTraces.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionTraces.php new file mode 100755 index 0000000..f671044 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Sales/Order/View/Tab/TransactionTraces.php @@ -0,0 +1,129 @@ +setTemplate('novalnet/sales/order/view/tab/transactiontraces.phtml'); + } + + /** + * Return tab label + * + * @param none + * @return string + */ + public function getTabLabel() + { + return $this->novalnetHelper()->__('Novalnet - Transaction Log'); + } + + /** + * Return tab title + * + * @param none + * @return string + */ + public function getTabTitle() + { + return $this->novalnetHelper()->__('Novalnet - Transaction Log'); + } + + /** + * Can show tab + * + * @param none + * @return boolean + */ + public function canShowTab() + { + $order = $this->getOrder(); + $paymentCode = $order->getPayment()->getMethodInstance()->getCode(); + return (bool)(preg_match("/novalnet/i", $paymentCode)); + } + + /** + * Tab is hidden + * + * @param none + * @return boolean + */ + public function isHidden() + { + return false; + } + + /** + * Return tab class + * + * @param none + * @return string + */ + public function getTabClass() + { + return 'ajax novalnet-widget-tab'; + } + + /** + * Get current order + * + * @param none + * @return Mage_Sales_Model_Order + */ + public function getOrder() + { + return Mage::registry('current_order'); + } + + /** + * Get transaction overview + * + * @param none + * @return mixed + */ + public function getTransactionTraces() + { + if (!Mage::registry('novalnet_payment_transactiontraces_collection')) { + $order = $this->getOrder(); + $collection = Mage::getModel('novalnet_payment/Mysql4_TransactionTraces')->getCollection(); + $collection->getByOrder($order); + Mage::register('novalnet_payment_transactiontraces_collection', $collection); + } + + return Mage::registry('novalnet_payment_transactiontraces_collection'); + } + + /** + * Get Novalnet payment helper + * + * @param none + * @return Novalnet_Payment_Helper_Data + */ + protected function novalnetHelper() + { + return Mage::helper('novalnet_payment'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/CreditcardStyle.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/CreditcardStyle.php new file mode 100755 index 0000000..cfb1acf --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/CreditcardStyle.php @@ -0,0 +1,66 @@ + 'font-family: Raleway,Helvetica Neue,Verdana,Arial,sans-serif;font-size: 13px;font-weight: 600;color: #636363;line-height: 1.5;', + 'standard_style_input' => 'color: #636363;font-family: Helvetica Neue,Verdana,Arial,sans-serif;font-size: 14px;', + 'standard_style_css' => '' + ); + + /** + * Constructor + */ + public function __construct() + { + $this->addColumn( + 'regexp', array( + 'label' => Mage::helper('adminhtml')->__('Matched Expression'), + 'style' => 'width:120px', + ) + ); + parent::__construct(); + $this->setTemplate('novalnet/system/creditcardStyle.phtml'); + } + + /** + * Retrieve Novalnet Credit Card form style + * + * @param string $param + * @return string + */ + public function getCcStyleValue($param) + { + $values = $this->getElement()->getValue(); + if (isset($values[$param])) { + return $values[$param]; + } elseif (isset($this->ccLocalFormConfig[$param])) { + return $this->ccLocalFormConfig[$param]; + } + + return ''; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/GuaranteeInfo.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/GuaranteeInfo.php new file mode 100755 index 0000000..98d7505 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/GuaranteeInfo.php @@ -0,0 +1,38 @@ +

%s

%s', + $element->getHtmlId(), $element->getHtmlId(), $element->getLabel(), $element->getComment() + ); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/ReadOnly.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/ReadOnly.php new file mode 100755 index 0000000..8664be9 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/ReadOnly.php @@ -0,0 +1,33 @@ +setReadonly(true); + return parent::_getElementHtml($element); + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/VendorConfig.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/VendorConfig.php new file mode 100755 index 0000000..6e1e0d4 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/System/Config/Form/Field/VendorConfig.php @@ -0,0 +1,82 @@ +addColumn( + 'regexp', array( + 'label' => Mage::helper('adminhtml')->__('Matched Expression'), + 'style' => 'width:120px', + ) + ); + parent::__construct(); + $this->setTemplate('novalnet/system/vendorConfig.phtml'); + } + + /** + * Return element html + * + * @return string + */ + protected function _getElementHtml($element) + { + $this->setElements($element); + return $this->_toHtml(); + } + + /** + * Return element value + * + * @param none + * @return object + */ + public function getElement() + { + return $this->getElements(); + } + + /** + * Remove scope label + * + * @return string + */ + public function render(Varien_Data_Form_Element_Abstract $element) + { + $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); + return parent::render($element); + } + + /** + * Retrieve Novalnet Public key Value + * + * @param string $param + * @return string|null + */ + public function getElementValue() + { + return $this->getElement()->getValue(); + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview.php new file mode 100755 index 0000000..d63133a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview.php @@ -0,0 +1,37 @@ +_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_transactionoverview'; + $this->_headerText = Mage::helper('novalnet_payment')->__('Novalnet Transactions Overview'); + $this->setSaveParametersInSession(true); + parent::__construct(); + $this->removeButton('add'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/Grid.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/Grid.php new file mode 100755 index 0000000..4b89159 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/Grid.php @@ -0,0 +1,127 @@ +setId('novalnet_transaction_grid'); + $this->setUseAjax(true); + $this->setDefaultSort('order_id'); + $this->setDefaultDir('desc'); + } + + /** + * Prepare order Collection for Novalnet transaction status + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Transaction_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getModel('novalnet_payment/Mysql4_TransactionStatus')->getCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * prepare column for massaction order grid + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Transaction_Grid + */ + protected function _prepareColumns() + { + $this->addColumn( + 'order_id', array( + 'header' => Mage::helper('sales')->__('Order No #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'order_id', + ) + ); + $this->addColumn( + 'transaction_no', array( + 'header' => Mage::helper('sales')->__('Transaction Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'transaction_no', + ) + ); + $this->addColumn( + 'transaction_status', array( + 'header' => Mage::helper('sales')->__('Transaction Status #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'transaction_status', + ) + ); + $this->addColumn( + 'customer_id', array( + 'header' => Mage::helper('sales')->__('Customer Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'customer_id', + ) + ); + $this->addColumn( + 'store_id', array( + 'header' => Mage::helper('sales')->__('Store Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'store_id', + ) + ); + parent::_prepareColumns(); + return $this; + } + + /** + * Return row url + * + * @param mixed $row + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl( + 'adminhtml/novalnetpayment_transactionoverview/view', array( + 'nntxn_id' => $row->getId() + ) + ); + } + + /** + * Return grid url + * + * @param none + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current' => true)); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View.php new file mode 100755 index 0000000..1ee469e --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View.php @@ -0,0 +1,108 @@ +_objectId = 'nntxn_id'; + $this->_mode = 'view'; + $this->_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_transactionoverview'; + + parent::__construct(); + + $this->setId('transaction_view'); + $this->_removeButton('reset'); + $this->_removeButton('delete'); + $this->_removeButton('save'); + } + + /** + * Retrieve invoice model instance + * + * @param none + * @return Mage_Sales_Model_Order_Invoice + */ + public function getOrder() + { + return Mage::registry('current_order'); + } + + /** + * Get Novalnet transaction status + * + * @param none + * @return string + */ + public function getTransactionStatus() + { + return Mage::registry('novalnet_payment_transactionoverview'); + } + + /** + * Get order currency code + * + * @param none + * @return string + */ + public function getCurrencyCode() + { + $order = Mage::getModel("sales/order")->loadByIncrementId( + trim($this->getTransactionStatus()->getOrderId()) + ); + return $order->getOrderCurrencyCode(); + } + + /** + * Get payment method title + * + * @param none + * @return string + */ + public function getPaymentTitle() + { + $transactionStatus = $this->getTransactionStatus(); + $title = Mage::helper("novalnet_payment") + ->getPaymentModel($transactionStatus->getPaymentName()) + ->getConfigData('title'); + return $title; + } + + /** + * Get header text of transaction status + * + * @param none + * @return string + */ + public function getHeaderText() + { + $transStatus = $this->getTransactionStatus(); + $text = Mage::helper('novalnet_payment')->__( + 'Order #%s | TID : %s ', $transStatus->getOrderId(), $transStatus->getTransactionNo() + ); + return $text; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View/Form.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View/Form.php new file mode 100755 index 0000000..4c3f6e1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactionoverview/View/Form.php @@ -0,0 +1,35 @@ +_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_transactionoverview'; + $this->_headerText = Mage::helper('novalnet_payment')->__('Transactions'); + parent::__construct(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces.php new file mode 100755 index 0000000..5d17f4d --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces.php @@ -0,0 +1,38 @@ +_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_transactiontraces'; + $this->_headerText = Mage::helper('novalnet_payment')->__('Novalnet - Transaction Log'); + $this->setSaveParametersInSession(true); + + parent::__construct(); + $this->removeButton('add'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/Grid.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/Grid.php new file mode 100755 index 0000000..d4375c1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/Grid.php @@ -0,0 +1,121 @@ +setId('novalnet_transactiontraces_grid'); + $this->setUseAjax(true); + $this->setDefaultSort('order_id'); + $this->setDefaultDir('DESC'); + } + + /** + * Prepare order Collection for novalnet transaction overview + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Transactiontraces_Grid + */ + protected function _prepareCollection() + { + $collection = Mage::getModel('novalnet_payment/Mysql4_TransactionTraces')->getCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * prepare column for transaction overview grid + * + * @param none + * @return Novalnet_Payment_Block_Adminhtml_Transactionoverview_Grid + */ + protected function _prepareColumns() + { + $helper = Mage::helper('novalnet_payment'); + + $this->addColumn( + 'order_id', array( + 'header' => $helper->__('Order No #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'order_id', + ) + ); + $this->addColumn( + 'transaction_no', array( + 'header' => $helper->__('Transaction Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'transaction_id', + ) + ); + $this->addColumn( + 'customer_id', array( + 'header' => Mage::helper('sales')->__('Customer Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'customer_id', + ) + ); + $this->addColumn( + 'id', array( + 'header' => $helper->__('Store Id #'), + 'width' => '80px', + 'type' => 'text', + 'index' => 'store_id', + ) + ); + + return parent::_prepareColumns(); + } + + /** + * Return row url + * + * @param mixed $row + * @return string + */ + public function getRowUrl($row) + { + return $this->getUrl( + 'adminhtml/novalnetpayment_transactiontraces/view', array( + 'nnlog_id' => $row->getId() + ) + ); + } + + /** + * Return grid url + * + * @param none + * @return string + */ + public function getGridUrl() + { + return $this->getUrl('*/*/grid', array('_current' => true)); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View.php new file mode 100755 index 0000000..50958fa --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View.php @@ -0,0 +1,90 @@ +_objectId = 'nnlog_id'; + $this->_mode = 'view'; + $this->_blockGroup = 'novalnet_payment'; + $this->_controller = 'adminhtml_transactiontraces'; + + parent::__construct(); + + $this->setId('transactiontraces_view'); + $this->setUseAjax(true); + $this->setDefaultSort('created_date'); + $this->setDefaultDir('DESC'); + + $this->_removeButton('reset'); + $this->_removeButton('delete'); + $this->_removeButton('save'); + } + + /** + * Get Novalnet transaction traces + * + * @param none + * @return string + */ + public function getTransactionTraces() + { + return Mage::registry('novalnet_payment_transactiontraces'); + } + + /** + * Get payment method title + * + * @param none + * @return string + */ + public function getPaymentTitle() + { + $title = ''; + $order = Mage::getModel("sales/order")->loadByIncrementId(trim($this->getTransactionTraces()->getOrderId())); + if ($order->getPayment()) { + $paymentMethod = $order->getPayment()->getMethod(); + $title = Mage::helper("novalnet_payment")->getPaymentModel($paymentMethod)->getConfigData('title'); + } + + return $title; + } + + /** + * Get header text of transaction traces + * + * @param none + * @return string + */ + public function getHeaderText() + { + $transStatus = $this->getTransactionTraces(); + $text = Mage::helper('novalnet_payment')->__( + 'Order #%s | TID : %s ', $transStatus->getOrderId(), $transStatus->getTransactionId() + ); + return $text; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View/Form.php b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View/Form.php new file mode 100755 index 0000000..e4b0e1f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Adminhtml/Transactiontraces/View/Form.php @@ -0,0 +1,33 @@ +_headerText = Mage::helper('novalnet_payment')->__('Transaction Traces'); + parent::__construct(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Banktransfer.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Banktransfer.php new file mode 100755 index 0000000..432be54 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Banktransfer.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Banktransfer.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Cashpayment.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Cashpayment.php new file mode 100755 index 0000000..882d229 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Cashpayment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Cashpayment.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Cc.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Cc.php new file mode 100755 index 0000000..af20104 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Cc.php @@ -0,0 +1,216 @@ +setTemplate('novalnet/method/form/Cc.phtml'); + } + + /** + * Retrieve availables Credit Card types + * + * @param none + * @return array + */ + public function getCcAvailableTypes() + { + $types = array(); + $defaultTypes = array( + 'VI' => 'Visa', + 'MC' => 'MasterCard' + ); + $availableTypes = Mage::getStoreConfig('payment/novalnetCc/cc_types'); + if ($availableTypes) { + $availableTypes = explode(',', $availableTypes); + foreach ($availableTypes as $code => $name) { + $types[$name] = $name; + } + } + return array_merge($defaultTypes,$types); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + + /** + * Get form style configuration + * + * @param string $param + * @return string + */ + public function getStyleConfig($param) + { + $creditCardStyle = unserialize($this->getMethod()->getConfigData('cc_style')); + if (isset($creditCardStyle[$param])) { + return $creditCardStyle[$param]; + } + + return ''; + } + + /** + * Get payment one click shopping + * + * @param none + * @return boolean + */ + public function getOneClickShopping() + { + $isCustomerLoggedIn = Mage::helper('novalnet_payment')->getCustomerSession()->isLoggedIn(); + return $this->getMethod()->getConfigData('cc_shop_type') && $isCustomerLoggedIn; + } + + /** + * Get client key + * + * @param none + * @return string + */ + public function getClientKey() + { + $clientKey = Mage::getStoreConfig('novalnet_global/novalnet/client_key'); + return $clientKey; + } + + /** + * Get creditcard form layout + * + * @param none + * @return boolean + */ + public function getCcFormLayout() + { + return $this->getMethod()->getConfigData('inline_form'); + } + + /** + * Get payment request object + * + * @param none + * @return array + */ + public function getCcRequestObj() + { + $quote = Mage::helper('novalnet_payment')->checkIsAdmin() ? + Mage::getSingleton('adminhtml/session_quote')->getQuote() : + Mage::helper('checkout/cart')->getCart()->getQuote(); + + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + $testMode = (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? 1 : 0; + $recurringAmount = 0; + foreach($quote->getAllItems() as $item) { + if($item->isNominal()) { + $recurringAmount = $item->getNominalRowTotal(); + } + } + //get Customer address from quote + $customer['first_name'] = $quote->getBillingAddress()->getFirstname(); + $customer['last_name'] = $quote->getBillingAddress()->getLastname(); + $customer['email'] = $quote->getBillingAddress()->getEmail(); + $customer['billing']['street'] = (implode(',', $quote->getBillingAddress()->getStreet())); + $customer['billing']['city'] = $quote->getBillingAddress()->getCity(); + $customer['billing']['zip'] = $quote->getBillingAddress()->getPostcode(); + $customer['billing']['country_code'] = $quote->getBillingAddress()->getCountryId(); + $customer = $this->getShippingAddress($quote, $customer); + //get transction params + $transaction['amount'] = ($recurringAmount) ? $this->getFormatedAmount($recurringAmount) : $this->getFormatedAmount($quote->getBaseGrandTotal()); + $transaction['test_mode'] = $testMode; + $transaction['currency'] = $quote->getBaseCurrencyCode(); + $transaction['enforce_3d'] = ($this->getMethod()->getConfigData('enforce_3d')) ? 1 : 0; + $data = ['customer' => $customer, 'transaction' => $transaction]; + + return json_encode($data); + } + + /** + * Address validation for guarantee payments + * + * @param Varien_Object $quote + * @return boolean + */ + public function getShippingAddress($quote, $customer) + { + $billing = $quote->getBillingAddress(); // Get end-customer billing address + $shipping = !$quote->getIsVirtual() ? $quote->getShippingAddress() : ''; // Get end-customer shipping address + + if ($shipping == '') { + $customer['shipping']['same_as_billing'] = 1; + } elseif (($billing->getCity() != $shipping->getCity()) + || (implode(',', $billing->getStreet()) != implode(',', $shipping->getStreet())) + || ($billing->getPostcode() != $shipping->getPostcode()) + || ($billing->getCountry() != $shipping->getCountry()) + ) { + $customer['shipping']['street'] = (implode(',', $quote->getShippingAddress()->getStreet())); + $customer['shipping']['city'] = $quote->getShippingAddress()->getCity(); + $customer['shipping']['zip'] = $quote->getShippingAddress()->getPostcode(); + $customer['shipping']['country_code'] = $quote->getShippingAddress()->getCountryId(); + } else { + $customer['shipping']['same_as_billing'] = 1; + } + return $customer; + } + + /** + * get formated amount + * + * @param $amount, $type + * @return int + */ + public function getFormatedAmount($amount, $type = 'CENT') + { + return ($type == 'RAW') ? $amount / 100 : round($amount, 2) * 100; + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Eps.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Eps.php new file mode 100755 index 0000000..06cade3 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Eps.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Eps.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Giropay.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Giropay.php new file mode 100755 index 0000000..395499b --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Giropay.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Giropay.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Ideal.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Ideal.php new file mode 100755 index 0000000..dc92caf --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Ideal.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Ideal.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Invoice.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Invoice.php new file mode 100755 index 0000000..d12db34 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Invoice.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Invoice.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/InvoiceInstalment.php b/app/code/community/Novalnet/Payment/Block/Method/Form/InvoiceInstalment.php new file mode 100755 index 0000000..0c0e59d --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/InvoiceInstalment.php @@ -0,0 +1,86 @@ +setTemplate('novalnet/method/form/InvoiceInstalment.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + + /** + * Get Novalnet Guarantee instalment cycle periods + * + * @return null|string + */ + public function getInstalmentCycle() + { + return $this->getMethod()->getConfigData('instalment_cycle_periods'); + } + + /** + * Get Novalnet Guarantee instalment total periods + * + * @return null|string + */ + public function getInstalmentTotal() + { + return $this->getMethod()->getConfigData('instalment_total_period'); + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Paypal.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Paypal.php new file mode 100755 index 0000000..cc2f545 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Paypal.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Paypal.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Prepayment.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Prepayment.php new file mode 100755 index 0000000..1bd953f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Prepayment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Prepayment.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Przelewy.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Przelewy.php new file mode 100755 index 0000000..1fff9cd --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Przelewy.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/form/Przelewy.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/Sepa.php b/app/code/community/Novalnet/Payment/Block/Method/Form/Sepa.php new file mode 100755 index 0000000..7f4e7b1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/Sepa.php @@ -0,0 +1,89 @@ +setTemplate('novalnet/method/form/Sepa.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get billing address information + * + * @param none + * @return array + */ + public function getBillingInfo() + { + $checkoutSession = Mage::helper('novalnet_payment')->getCheckout(); + return $checkoutSession->getQuote()->getBillingAddress(); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + + /** + * Get payment one click shopping + * + * @param none + * @return boolean + */ + public function getOneClickShopping() + { + return $this->getMethod()->getConfigData('sepa_shop_type'); + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Form/SepaInstalment.php b/app/code/community/Novalnet/Payment/Block/Method/Form/SepaInstalment.php new file mode 100755 index 0000000..9cf0d43 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Form/SepaInstalment.php @@ -0,0 +1,98 @@ +setTemplate('novalnet/method/form/SepaInstalment.phtml'); + } + + /** + * Get information to end user from config + * + * @param none + * @return string + */ + public function getUserInfo() + { + return trim(strip_tags($this->getMethod()->getConfigData('booking_reference'))); + } + + /** + * Get billing address information + * + * @param none + * @return array + */ + public function getBillingInfo() + { + $checkoutSession = Mage::helper('novalnet_payment')->getCheckout(); + return $checkoutSession->getQuote()->getBillingAddress(); + } + + /** + * Get payment logo available status + * + * @param none + * @return boolean + */ + public function logoAvailableStatus() + { + return Mage::getStoreConfig('novalnet_global/novalnet/enable_payment_logo'); + } + + /** + * Get payment mode (test/live) + * + * @param none + * @return boolean + */ + public function getPaymentMode() + { + $paymentMethod = Mage::getStoreConfig('novalnet_global/novalnet/live_mode'); + return (!preg_match('/' . $this->getMethodCode() . '/i', $paymentMethod)) ? false : true; + } + + /** + * Get Novalnet Guarantee instalment cycle periods + * + * @return null|string + */ + public function getInstalmentCycle() + { + return $this->getMethod()->getConfigData('instalment_cycle_periods'); + } + + /** + * Get Novalnet Guarantee instalment total periods + * + * @return null|string + */ + public function getInstalmentTotal() + { + return $this->getMethod()->getConfigData('instalment_total_period'); + } +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Banktransfer.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Banktransfer.php new file mode 100755 index 0000000..8dbf17f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Banktransfer.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Banktransfer.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Banktransfer.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Cashpayment.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Cashpayment.php new file mode 100755 index 0000000..2912ea0 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Cashpayment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Cashpayment.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Cashpayment.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Cc.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Cc.php new file mode 100755 index 0000000..457992a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Cc.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Cc.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Cc.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Eps.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Eps.php new file mode 100755 index 0000000..a8d18b9 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Eps.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Eps.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Eps.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Giropay.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Giropay.php new file mode 100755 index 0000000..e8090b0 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Giropay.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Giropay.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Giropay.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Ideal.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Ideal.php new file mode 100755 index 0000000..39ccf1a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Ideal.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Ideal.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Ideal.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Invoice.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Invoice.php new file mode 100755 index 0000000..6bdfdd9 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Invoice.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Invoice.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Invoice.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/InvoiceInstalment.php b/app/code/community/Novalnet/Payment/Block/Method/Info/InvoiceInstalment.php new file mode 100755 index 0000000..954378f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/InvoiceInstalment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/InvoiceInstalment.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/InvoiceInstalment.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Paypal.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Paypal.php new file mode 100755 index 0000000..da1a880 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Paypal.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Paypal.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Paypal.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Prepayment.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Prepayment.php new file mode 100755 index 0000000..42ce845 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Prepayment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Prepayment.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Prepayment.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Przelewy.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Przelewy.php new file mode 100755 index 0000000..fa30014 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Przelewy.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Przelewy.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Przelewy.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/Sepa.php b/app/code/community/Novalnet/Payment/Block/Method/Info/Sepa.php new file mode 100755 index 0000000..916c8e7 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/Sepa.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/Sepa.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/Sepa.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Info/SepaInstalment.php b/app/code/community/Novalnet/Payment/Block/Method/Info/SepaInstalment.php new file mode 100755 index 0000000..c6f7feb --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Info/SepaInstalment.php @@ -0,0 +1,67 @@ +setTemplate('novalnet/method/info/SepaInstalment.phtml'); + } + + /** + * Render as PDF + * + * @param none + * @return string + */ + public function toPdf() + { + $this->setTemplate('novalnet/method/pdf/SepaInstalment.phtml'); + return $this->toHtml(); + } + + /** + * Get some specific information + * + * @param string $key + * @return array + */ + public function getAdditionalData($key) + { + return Mage::helper('novalnet_payment')->getAdditionalData($this->getInfo(), $key); + } + + /** + * Retrieve payment method model + * + * @param none + * @return Mage_Payment_Model_Method_Abstract + */ + public function getMethod() + { + return $this->getInfo()->getMethodInstance(); + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Method/Redirect.php b/app/code/community/Novalnet/Payment/Block/Method/Redirect.php new file mode 100755 index 0000000..f4cdca4 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Method/Redirect.php @@ -0,0 +1,73 @@ +getOrder()->getPayment()->getMethodInstance()->getCode(); // Get payment method code + $actionUrl = $helper->getPayportUrl('redirect', $paymentCode); // Get Novalnet payport URL + $params = $helper->getMethodSession($paymentCode)->getPaymentReqData(); // Get payment method session + $currentLang = array('nnLang' => Mage::getSingleton('core/translate')->getLocale()); + $this->getOrder()->getPayment()->setAdditionalData(serialize($currentLang))->save(); + + // Create form + $form = new Varien_Data_Form(); + $form->setAction($actionUrl) + ->setId($paymentCode) + ->setName($paymentCode) + ->setMethod(Novalnet_Payment_Model_Config::NOVALNET_RETURN_METHOD) + ->setUseContainer(true); + foreach ($params->getData() as $field => $value) { + $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); + } + + // Save payment transaction request data + $request = $helper->getModel('Service_Api_Response')->removeSensitiveData($params, $paymentCode); + $transactionTraces = $helper->getModel('Mysql4_TransactionTraces'); + $transactionTraces->setOrderId($request->getOrderNo()) + ->setRequestData(base64_encode(serialize($request->getData()))) + ->setCreatedDate($helper->getCurrentDateTime()) + ->save(); + + $submitButton = new Varien_Data_Form_Element_Submit( + array( + 'value' => $this->__('Click here if you are not redirected within 10 seconds...'), + ) + ); + $submitButton->setId("submit_to_{$paymentCode}_button"); + $form->addElement($submitButton); + + $html = ''; + $html.= $this->__('You will be redirected to Novalnet AG in a few seconds.'); + $html.= $form->toHtml(); + $html.= ''; + $html.= ''; + return $html; + } + +} diff --git a/app/code/community/Novalnet/Payment/Block/Recurring/Profile/View.php b/app/code/community/Novalnet/Payment/Block/Recurring/Profile/View.php new file mode 100755 index 0000000..058fe79 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Block/Recurring/Profile/View.php @@ -0,0 +1,135 @@ +_profile->getMethodCode())) { + $this->setTemplate('novalnet/recurring/profile/view.phtml'); + } + + $helper = Mage::helper('novalnet_payment'); + $lang = array($helper->__("Please select reason"), $helper->__("Product is costly"), $helper->__("Cheating"), + $helper->__("Partner interfered"), $helper->__("Financial problem"), + $helper->__("Content does not match my likes"), $helper->__("Content is not enough"), + $helper->__("Interested only for a trial"), $helper->__("Page is very slow"), + $helper->__("Satisfied customer"), $helper->__("Logging in problems"), $helper->__("Other reasons")); + + $select = Mage::app()->getLayout()->createBlock('core/html_select') + ->setName("cancel_reason") + ->setId("reason-unsubscribe") + ->setOptions($lang); + + $this->addData( + array( + 'reference_id' => $this->_profile->getReferenceId(), + 'can_cancel' => $this->_profile->canCancel(), + 'cancel_url' => $this->getUrl( + '*/*/updateState', array('profile' => $this->_profile->getId(), + 'action' => 'cancel') + ), + 'can_suspend' => $this->_profile->canSuspend(), + 'suspend_url' => $this->getUrl( + '*/*/updateState', array('profile' => $this->_profile->getId(), + 'action' => 'suspend') + ), + 'can_activate' => $this->_profile->canActivate(), + 'activate_url' => $this->getUrl( + '*/*/updateState', array('profile' => $this->_profile->getId(), + 'action' => 'activate') + ), + 'can_update' => $this->_profile->canFetchUpdate(), + 'update_url' => $this->getUrl('*/*/updateProfile', array('profile' => $this->_profile->getId())), + 'back_url' => $this->getUrl('*/*/'), + 'confirmation_message' => Mage::helper('sales')->__('Are you sure you want to do this?'), + 'cancel_reason' => $select->getHtml(), + ) + ); + } + + /** + * Prepare profile schedule info + * + * @param none + * @return none + */ + public function prepareScheduleInfo() + { + $this->_shouldRenderInfo = true; + $paymentCode = $this->_profile->getMethodCode(); + $recurringPayments = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('recurringPayments'); + + $subscriptionFlag = 0; + if (!in_array($paymentCode, $recurringPayments)) { + $subscriptionFlag = 1; + foreach (array('start_datetime', 'suspension_threshold') as $key) { + $this->_addInfo( + array( + 'label' => $this->_profile->getFieldLabel($key), + 'value' => $this->_profile->renderData($key), + ) + ); + } + } + + foreach ($this->_profile->exportScheduleInfo() as $i) { + if (!$subscriptionFlag && $i->getTitle() != 'Trial Period') { + $this->_addInfo( + array( + 'label' => $i->getTitle(), + 'value' => $i->getSchedule(), + ) + ); + } else if ($subscriptionFlag == 1) { + $this->_addInfo( + array( + 'label' => $i->getTitle(), + 'value' => $i->getSchedule(), + ) + ); + } + } + } + + /** + * Get transaction information + * + * @param none + * @return Varien_Object + */ + public function getTransactionStatus() + { + $transactionId = $this->getReferenceId(); + // load transaction status information + $helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + return $transactionStatus; + } + +} diff --git a/app/code/community/Novalnet/Payment/Helper/Data.php b/app/code/community/Novalnet/Payment/Helper/Data.php new file mode 100755 index 0000000..83136b9 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Helper/Data.php @@ -0,0 +1,543 @@ +getStoreId(); + if ($this->checkIsAdmin()) { + $storeId = $this->getAdminCheckoutSession()->getStoreId(); + } + + return $storeId; + } + + /** + * Get current admin scope id + * + * @param none + * @return int + */ + public function getScopeId() + { + $getStore = Mage::getSingleton('adminhtml/config_data')->getStore(); + $getWebsite = Mage::getSingleton('adminhtml/config_data')->getWebsite(); + if ($getStore) { + $scopeId = Mage::getModel('core/store')->load($getStore)->getId(); + } elseif ($getWebsite) { + $websiteId = Mage::getModel('core/website')->load($getWebsite)->getId(); + $scopeId = Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId(); + } else { + $scopeId = 0; + } + + return $scopeId; + } + + /** + * Get customer id from current session + * + * @param none + * @return int|string + */ + public function getCustomerId() + { + if ($this->checkIsAdmin()) { + $quoteCustomerNo = $this->getAdminCheckoutSession()->getQuote()->getCustomerId(); + $customerNo = $quoteCustomerNo ? $quoteCustomerNo : 'guest'; + } else { + if ($this->getCustomerSession()->isLoggedIn()) { + $customerNo = $this->getCustomerSession()->getCustomerId(); + } else { + $customerNo = 'guest'; + } + } + + return $customerNo; + } + + /** + * Get checkout session + * + * @param none + * @return Mage_Sales_Model_Order + */ + public function getCheckout() + { + if ($this->checkIsAdmin()) { + return $this->getAdminCheckoutSession(); // Get admin checkout session + } else { + return $this->getCheckoutSession(); // Get frontend checkout session + } + } + + /** + * Get Magento core session + * + * @param none + * @return Mage_Core_Model_Session + */ + public function getCoreSession() + { + return Mage::getSingleton('core/session'); + } + + /** + * Get frontend checkout session + * + * @param none + * @return Mage_Checkout_Model_Session + */ + public function getCheckoutSession() + { + return Mage::getSingleton('checkout/session'); + } + + /** + * Get admin checkout session + * + * @param none + * @return Mage_adminhtml_Model_Session_quote + */ + public function getAdminCheckoutSession() + { + return Mage::getSingleton('adminhtml/session_quote'); + } + + /** + * Get customer session + * + * @param none + * @return Mage_customer_Model_Session + */ + public function getCustomerSession() + { + return Mage::getSingleton('customer/session'); + } + + /** + * Check whether logged in as admin + * + * @param none + * @return boolean + */ + public function checkIsAdmin() + { + return (bool)(Mage::app()->getStore()->isAdmin()); + } + + /** + * Get shop default language + * + * @param none + * @return string + */ + public function getDefaultLanguage() + { + $locale = explode('_', Mage::app()->getLocale()->getLocaleCode()); + if (!empty($locale) && is_array($locale)) { + $locale = $locale[0]; + } else { + $locale = 'en'; + } + + return $locale; + } + + /** + * Get shop base url + * + * @param none + * @return string + */ + public function getBaseUrl() + { + $protocol = Mage::app()->getStore()->isCurrentlySecure() ? 'https' : 'http'; // Get protocol + $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); // Get base URL + $secureBaseUrl = Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL); + return ($protocol == 'https' && $secureBaseUrl) + ? str_replace('index.php/', '', $secureBaseUrl) : str_replace('index.php/', '', $baseUrl); + } + + /** + * Get Remote IP address + * + * @param none + * @return int + */ + public function getRealIpAddr() + { + $serverVariables = Mage::app()->getRequest()->getServer(); + $remoteAddrHeaders = array('HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', + 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); + + foreach ($remoteAddrHeaders as $header) { + if (array_key_exists($header, $serverVariables) === true) { + return $serverVariables[$header]; + } + } + } + + /** + * Get Server IP address + * + * @param none + * @return int + */ + public function getServerAddr() + { + return Mage::helper('core/http')->getServerAddr(); + } + + /** + * Get Novalnet payment model + * + * @param string $modelclass + * @return Varien_Object + */ + public function getPaymentModel($modelclass) + { + return Mage::getModel('novalnet_payment/method_' . $modelclass); + } + + /** + * Get Novalnet model + * + * @param string $model + * @return Varien_Object + */ + public function getModel($model) + { + return Mage::getModel('novalnet_payment/' . $model); + } + + /** + * Get payment logo URL + * + * @param none + * @return string $imageUrl + */ + public function getPaymentLogoUrl() + { + $skinBaseUrl = Mage::getBaseUrl('skin'); + return $skinBaseUrl . 'frontend/base/default/images/novalnet/'; + } + + /** + * Get custom payment logo URL + * + * @param none + * @return string $imageUrl + */ + public function getCustomPaymentLogoUrl() + { + $mediaBaseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); + return $mediaBaseUrl . 'novalnet/payment/'; + } + + /** + * Get current Magento version + * + * @param none + * @return int + */ + public function getMagentoVersion() + { + return Mage::getVersion(); + } + + /** + * Get current Novalnet version + * + * @param none + * @return string + */ + public function getNovalnetVersion() + { + $versionInfo = (string) Mage::getConfig()->getNode('modules/Novalnet_Payment/version'); + return "NN({$versionInfo})"; + } + + /** + * Show expection + * + * @param string $text + * @param boolean $lang + * @return Mage_Payment_Model_Info_Exception + */ + public function showException($text, $lang = true) + { + if ($lang) { + $text = $this->__($text); + } + + // Exception log for reference + Mage::log($text, null, 'nn_exception.log', true); + // Show payment exception + return Mage::throwException($text); + } + + /** + * Get Novalnet payment key + * + * @param string $code + * @return int + */ + public function getPaymentId($code) + { + $getPaymentId = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('paymentKey'); + return $getPaymentId[$code]; + } + + /** + * Get the formatted amount in Cents/Euro + * + * @param float $amount + * @param string $type + * @return int + */ + public function getFormatedAmount($amount, $type = 'CENT') + { + return ($type == 'RAW') ? $amount / 100 : round($amount, 2) * 100; + } + + /** + * Get the respective payport url + * + * @param string $reqType + * @param string $paymentCode + * @return string + */ + public function getPayportUrl($reqType, $paymentCode = null) + { + if ($paymentCode && $reqType == 'redirect') { // For redirect payment methods + $redirectUrl = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('redirectPayportUrl'); + $payportUrl = $redirectUrl[$paymentCode]; + } else { // For direct payment methods + $urlType = array( + 'paygate' => Novalnet_Payment_Model_Config::PAYPORT_URL, + 'infoport' => Novalnet_Payment_Model_Config::INFO_REQUEST_URL + ); + $payportUrl = $urlType[$reqType]; + } + + return 'https://payport.novalnet.de/' . $payportUrl; + } + + /** + * Get payment method session + * + * @param string $paymentCode + * @return mixed + */ + public function getMethodSession($paymentCode = null) + { + $checkoutSession = $this->getCheckout(); + if ($paymentCode != null && !$checkoutSession->hasData($paymentCode)) { + $checkoutSession->setData($paymentCode, new Varien_Object()); + } + + return $checkoutSession->getData($paymentCode); + } + + /** + * Unset payment method session + * + * @param string $paymentCode + * @return none + */ + public function unsetMethodSession($paymentCode) + { + $checkoutSession = $this->getCheckout(); + $checkoutSession->unsetData($paymentCode); + } + + /** + * Extract data from additional data array + * + * @param string $info + * @param string $key + * @return mixed + */ + public function getAdditionalData($info, $key = null) + { + $data = array(); + if ($info->getAdditionalData()) { + $data = unserialize($info->getAdditionalData()); + } + + return ($key && isset($data[$key])) ? $data[$key] : ''; + } + + /** + * Replace strings from the value passed + * + * @param mixed $value + * @return integer + */ + public function makeValidNumber($value) + { + return preg_replace('/[^0-9]+/', '', $value); + } + + /** + * Get store URL + * + * @param string $route + * @param array $params + * @return string + */ + public function getUrl($route, $params = array()) + { + $params['_type'] = Mage_Core_Model_Store::URL_TYPE_LINK; + if (isset($params['is_secure'])) { + $params['_secure'] = (bool) $params['is_secure']; + } elseif ($this->getMagentoStore()->isCurrentlySecure()) { + $params['_secure'] = true; + } + + return parent::_getUrl($route, $params); + } + + /** + * Get current store details + * + * @param none + * @return Mage_Core_Model_Store + */ + public function getMagentoStore() + { + return Mage::app()->getStore(); + } + + /** + * Get shop's date and time + * + * @param none + * @return mixed + */ + public function getCurrentDateTime() + { + return Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'); + } + + /** + * Check the order item is nominal or not + * + * @param Varien_Object $order + * @return boolean $nominalItem + */ + public function checkNominalItem($order) + { + $orderItems = $order->getAllItems(); + $nominalItem = ''; + + foreach ($orderItems as $orderItemsValue) { + if ($orderItemsValue) { + $nominalItem = $orderItemsValue->getIsNominal(); + break; + } + } + + return $nominalItem; + } + + /** + * Assign E-mail address + * + * @param string $emailaddr + * @param mixed $mail + * @param string $addr + * @return string + */ + public function assignEmailAddress($emailaddr, $mail, $addr) + { + $email = explode(',', $emailaddr); + $emailValidator = new Zend_Validate_EmailAddress(); + + foreach ($email as $emailAddrVal) { + if ($emailValidator->isValid(trim($emailAddrVal))) { + ($addr == 'To') ? $mail->addTo($emailAddrVal) : $mail->addBcc($emailAddrVal); + } + } + + return $mail; + } + + /** + * Get End customer company value + * + * @param none + * @return string + */ + public function getEndUserCompany() + { + $billingInfo = $this->getCheckout()->getQuote()->getBillingAddress(); + $shipping = !$this->getCheckout()->getQuote()->getIsVirtual() ? $this->getCheckout()->getQuote()->getShippingAddress() : ''; + return $billingInfo->getCompany() ? $billingInfo->getCompany() + : ($shipping && $shipping->getCompany() ? $shipping->getCompany() : ''); + } + + /** + * Check whether string is serialized + * + * @param mixed $data + * @return boolean + */ + public function is_serialized($data) + { + $data = trim($data); + if ($data == 'N;') { + return true; + } + + $lastChar = substr($data, -1); + if (!is_string($data) || strlen($data) < 4 || $data[1] !== ':' + || ($lastChar !== ';' && $lastChar !== '}')) { + return false; + } + + $token = $data[0]; + switch ($token) { + case 's' : + if (substr($data, -2, 1) !== '"') { + return false; + } + + case 'a' : + case 'O' : + return (bool) preg_match("/^{$token}:[0-9]+:/s", $data); + case 'b' : + case 'i' : + case 'd' : + return (bool) preg_match("/^{$token}:[0-9.E-]+;$/", $data); + } + + return false; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Config.php b/app/code/community/Novalnet/Payment/Model/Config.php new file mode 100755 index 0000000..e671a96 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Config.php @@ -0,0 +1,205 @@ + 6, 'novalnetSepa' => 37, 'novalnetInvoice' => 27, + 'novalnetPrepayment' => 27, 'novalnetCashpayment' => 59, 'novalnetPaypal' => 34, 'novalnetBanktransfer' => 33, + 'novalnetIdeal' => 49, 'novalnetEps' => 50, 'novalnetGiropay' => 69, 'novalnetPrzelewy' => 78, + 'novalnetInvoiceInstalment' => 96, 'novalnetSepaInstalment' => 97); + protected $_paymentMethods = array('novalnetCc' => 'Novalnet Credit Card', + 'novalnetSepa' => 'Novalnet Direct Debit SEPA', 'novalnetInvoice' => 'Novalnet Invoice', + 'novalnetPrepayment' => 'Novalnet Prepayment', 'novalnetCashpayment' => 'Novalnet Cashpayment', + 'novalnetPaypal' => 'Novalnet PayPal', 'novalnetBanktransfer' => 'Novalnet Instant Bank Transfer', + 'novalnetIdeal' => 'Novalnet iDEAL', 'novalnetEps' => 'Novalnet eps', + 'novalnetGiropay' => 'Novalnet giropay', 'novalnetPrzelewy' => 'Novalnet Przelewy24', + 'novalnetInvoiceInstalment' => 'Novalnet Guaranteed Invoice Instalment', + 'novalnetSepaInstalment' => 'Novalnet Guaranteed Direct Debit SEPA Instalment'); + protected $_paymentTypes = array('novalnetCc' => 'CREDITCARD', 'novalnetSepa' => 'DIRECT_DEBIT_SEPA', + 'novalnetInvoice' => 'INVOICE', 'novalnetPrepayment' => 'PREPAYMENT', 'novalnetCashpayment' => 'CASHPAYMENT', + 'novalnetPaypal' => 'PAYPAL', 'novalnetBanktransfer' => 'ONLINE_TRANSFER', 'novalnetIdeal' => 'IDEAL', + 'novalnetEps' => 'EPS', 'novalnetGiropay' => 'GIROPAY', 'novalnetPrzelewy' => 'PRZELEWY24', + 'novalnetInvoiceInstalment' => 'INSTALMENT_INVOICE', 'novalnetSepaInstalment' => 'INSTALMENT_DIRECT_DEBIT_SEPA'); + protected $_redirectPayportUrl = array('novalnetPaypal' => 'paypal_payport', + 'novalnetBanktransfer' => 'online_transfer_payport', 'novalnetIdeal' => 'online_transfer_payport', + 'novalnetEps' => 'giropay', 'novalnetGiropay' => 'giropay', 'novalnetCc' => 'pci_payport', + 'novalnetPrzelewy' => 'globalbank_transfer'); + protected $_redirectPayments = array('novalnetPaypal', 'novalnetBanktransfer', 'novalnetIdeal', 'novalnetEps', + 'novalnetGiropay', 'novalnetPrzelewy'); + protected $_recurringPayments = array('novalnetCc', 'novalnetSepa', 'novalnetInvoice', 'novalnetPrepayment', + 'novalnetPaypal'); + protected $_hashParams = array('auth_code', 'product', 'tariff', 'amount', 'test_mode'); + protected $_onHoldPayments = array('novalnetCc', 'novalnetSepa', 'novalnetInvoice', 'novalnetPaypal', 'novalnetInvoiceInstalment', 'novalnetSepaInstalment'); + protected $_allowedCountry = array('AT', 'DE', 'CH'); + + const RESPONSE_CODE_APPROVED = '100'; + const CC_ONHOLD_STATUS = '98'; + const PAYPAL_PENDING_STATUS = '90'; + const PAYPAL_ONHOLD_STATUS = '85'; + const PRZELEWY_PENDING_STATUS = '86'; + const GUARANTEE_PENDING_STATUS = '75'; + const PAYMENT_VOID_STATUS = '103'; + const METHOD_DISABLE_CODE = '0529006'; + const MAXPIN_DISABLE_CODE = '0529008'; + const PIN_STATUS = 'PIN_STATUS'; + const TRANSMIT_PIN_AGAIN = 'TRANSMIT_PIN_AGAIN'; + const NOVALNET_RETURN_METHOD = 'POST'; + const NOVALNET_REDIRECT_BLOCK = 'novalnet_payment/method_redirect'; + const GATEWAY_REDIRECT_URL = 'novalnet_payment/gateway/redirect'; + const GATEWAY_RETURN_URL = 'novalnet_payment/gateway/return'; + const GATEWAY_ERROR_RETURN_URL = 'novalnet_payment/gateway/error'; + const PAYPORT_URL = 'paygate.jsp'; + const INFO_REQUEST_URL = 'nn_infoport.xml'; + const SUBS_PAUSE = 'SUBSCRIPTION_PAUSE'; + const PREPAYMENT_PAYMENT_TYPE = 'Prepayment'; + const INVOICE_PAYMENT_TYPE = 'Invoice'; + const INVOICE_PAYMENT_GUARANTEE_TYPE = 'GUARANTEED_INVOICE'; + const INVOICE_PAYMENT_GUARANTEE_KEY = '41'; + const SEPA_PAYMENT_GUARANTEE_TYPE = 'GUARANTEED_DIRECT_DEBIT_SEPA'; + const SEPA_PAYMENT_GUARANTEE_KEY = '40'; + + /**********************************************/ + /* NOVALNET CREDIT CARD PARAMS */ + /**********************************************/ + const NN_CC = 'novalnetCc'; + const NN_CC_CAN_AUTHORIZE = true; + const NN_CC_FORM_BLOCK = 'novalnet_payment/method_form_Cc'; + const NN_CC_INFO_BLOCK = 'novalnet_payment/method_info_Cc'; + + /**********************************************/ + /* NOVALNET DIRECT DEBIT SEPA PARAMS */ + /**********************************************/ + const NN_SEPA = 'novalnetSepa'; + const NN_SEPA_CAN_AUTHORIZE = true; + const NN_SEPA_FORM_BLOCK = 'novalnet_payment/method_form_Sepa'; + const NN_SEPA_INFO_BLOCK = 'novalnet_payment/method_info_Sepa'; + + /**********************************************/ + /* NOVALNET INVOICE PARAMS */ + /**********************************************/ + const NN_INVOICE = 'novalnetInvoice'; + const NN_INVOICE_CAN_AUTHORIZE = true; + const NN_INVOICE_FORM_BLOCK = 'novalnet_payment/method_form_Invoice'; + const NN_INVOICE_INFO_BLOCK = 'novalnet_payment/method_info_Invoice'; + + /**********************************************/ + /* NOVALNET PREPAYMENT PARAMS */ + /**********************************************/ + const NN_PREPAYMENT = 'novalnetPrepayment'; + const NN_PREPAYMENT_CAN_AUTHORIZE = true; + const NN_PREPAYMENT_FORM_BLOCK = 'novalnet_payment/method_form_Prepayment'; + const NN_PREPAYMENT_INFO_BLOCK = 'novalnet_payment/method_info_Prepayment'; + + /**********************************************/ + /* NOVALNET CASHPAYMENT PARAMS */ + /**********************************************/ + const NN_CASHPAYMENT = 'novalnetCashpayment'; + const NN_CASHPAYMENT_CAN_AUTHORIZE = true; + const NN_CASHPAYMENT_FORM_BLOCK = 'novalnet_payment/method_form_Cashpayment'; + const NN_CASHPAYMENT_INFO_BLOCK = 'novalnet_payment/method_info_Cashpayment'; + + /**********************************************/ + /* NOVALNET PAYPAL PARAMS */ + /**********************************************/ + const NN_PAYPAL = 'novalnetPaypal'; + const NN_PAYPAL_CAN_AUTHORIZE = true; + const NN_PAYPAL_CAN_USE_INTERNAL = false; + const NN_PAYPAL_FORM_BLOCK = 'novalnet_payment/method_form_Paypal'; + const NN_PAYPAL_INFO_BLOCK = 'novalnet_payment/method_info_Paypal'; + + /**********************************************/ + /* NOVALNET ONLINE BANK TRANSFER PARAMS */ + /**********************************************/ + const NN_BANKTRANSFER = 'novalnetBanktransfer'; + const NN_BANKTRANSFER_CAN_USE_INTERNAL = false; + const NN_BANKTRANSFER_FORM_BLOCK = 'novalnet_payment/method_form_Banktransfer'; + const NN_BANKTRANSFER_INFO_BLOCK = 'novalnet_payment/method_info_Banktransfer'; + + /**********************************************/ + /* NOVALNET IDEAL PARAMS */ + /**********************************************/ + const NN_IDEAL = 'novalnetIdeal'; + const NN_IDEAL_CAN_USE_INTERNAL = false; + const NN_IDEAL_FORM_BLOCK = 'novalnet_payment/method_form_Ideal'; + const NN_IDEAL_INFO_BLOCK = 'novalnet_payment/method_info_Ideal'; + + /**********************************************/ + /* NOVALNET EPS PARAMS */ + /**********************************************/ + const NN_EPS = 'novalnetEps'; + const NN_EPS_CAN_USE_INTERNAL = false; + const NN_EPS_FORM_BLOCK = 'novalnet_payment/method_form_Eps'; + const NN_EPS_INFO_BLOCK = 'novalnet_payment/method_info_Eps'; + + /**********************************************/ + /* NOVALNET GIROPAY PARAMS */ + /**********************************************/ + const NN_GIROPAY = 'novalnetGiropay'; + const NN_GIROPAY_CAN_USE_INTERNAL = false; + const NN_GIROPAY_FORM_BLOCK = 'novalnet_payment/method_form_Giropay'; + const NN_GIROPAY_INFO_BLOCK = 'novalnet_payment/method_info_Giropay'; + + /**********************************************/ + /* NOVALNET PRZELEWY24 PARAMS */ + /**********************************************/ + const NN_PRZELEWY = 'novalnetPrzelewy'; + const NN_PRZELEWY_CAN_USE_INTERNAL = false; + const NN_PRZELEWY_FORM_BLOCK = 'novalnet_payment/method_form_Przelewy'; + const NN_PRZELEWY_INFO_BLOCK = 'novalnet_payment/method_info_Przelewy'; + + /**********************************************/ + /* NOVALNET INVOICE INSTALMENT PARAMS */ + /**********************************************/ + const NN_INVOICE_INSTALMENT = 'novalnetInvoiceInstalment'; + const NN_INVOICE_INSTALMENT_CAN_AUTHORIZE = true; + const NN_INVOICE_INSTALMENT_FORM_BLOCK = 'novalnet_payment/method_form_InvoiceInstalment'; + const NN_INVOICE_INSTALMENT_INFO_BLOCK = 'novalnet_payment/method_info_InvoiceInstalment'; + + /**********************************************/ + /* NOVALNET DIRECT DEBIT SEPA INSTALMENT PARAMS */ + /**********************************************/ + const NN_SEPA_INSTALMENT = 'novalnetSepaInstalment'; + const NN_SEPA_INSTALMENT_CAN_AUTHORIZE = true; + const NN_SEPA_INSTALMENT_FORM_BLOCK = 'novalnet_payment/method_form_SepaInstalment'; + const NN_SEPA_INSTALMENT_INFO_BLOCK = 'novalnet_payment/method_info_SepaInstalment'; + + /**********************************************/ + /* NOVALNET ABSTRACT FUNCTIONS */ + /**********************************************/ + + static public function getInstance() + { + if (!isset(self::$_instance)) { + self::$_instance = new self; + } + + return self::$_instance; + } + + public function getNovalnetVariable($key) + { + return $this->{'_' . $key}; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/Abstract.php b/app/code/community/Novalnet/Payment/Model/Method/Abstract.php new file mode 100755 index 0000000..75246fd --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/Abstract.php @@ -0,0 +1,341 @@ +helper) { + $this->helper = Mage::helper('novalnet_payment'); + } + } + + /** + * Check whether payment method can be used + * + * @param Mage_Sales_Model_Quote|null $quote + * @return boolean + */ + public function isAvailable($quote = null) + { + if (Mage::registry('payment_code')) { + Mage::unregister('payment_code'); // Unregister existing payment method code + } + + Mage::register('payment_code', $this->_code); // Register payment method code for payment process + // Get Novalnet payment validation model + $this->validateModel = $this->helper->getModel('Service_Validate_PaymentCheck'); + // Check whether payment method can be used + if (!$this->validateModel->checkVisibility($quote, $this->_code)) { + return false; + } + + // verify Novalnet payment method session values + $this->validateModel->checkMethodSession(); + return parent::isAvailable($quote); + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Payment method instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { // Sales quote payment instance + // Validate the Novalnet basic params and billing informations + $this->validateModel->validateNovalnetParams($info); + $this->validateModel->checkMethodSession(); // verify Novalnet payment method session values + } elseif ($info instanceof Mage_Sales_Model_Order_Payment) { // Sales order payment instance + $this->buildRequest($info); // Build Novalnet payport request params + } + + return $this; + } + + /** + * Prepare request to gateway + * + * @param Varien_Object $info + * @return none + */ + public function buildRequest($info) + { + $requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->getPayportParams($info, $this->_code); // Get Novalnet payport request params + $methodSession = $this->helper->getMethodSession($this->_code); // Get current payment method session + $methodSession->setPaymentReqData($request); // Assign Novalnet payport request params to method session + } + + /** + * Send payment request to Novalnet gateway + * + * @param Varien_Object $request + * @return Varien_Object $result + */ + public function postRequest(Varien_Object $request) + { + $result = new Varien_Object(); + // Get Novalnet payment validation model + $validateModel = $this->helper->getModel('Service_Validate_PaymentCheck'); + + $payportUrl = $this->helper->getPayportUrl('paygate'); // Get payport url + $gatewayModel = $this->helper->getModel('Service_Api_Gateway'); // Get Novalnet gateway model + $response = $gatewayModel->payportRequestCall($request->getData(), $payportUrl); + parse_str($response->getBody(), $data); + $result->addData($data); + + return $result; + } + + /** + * Capture the payment transaction + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function capture(Varien_Object $payment, $amount) + { + $paymentStatus = $this->getPaymentStatus($payment); // Get current payment transaction status + $transStatus = $paymentStatus->getTransactionStatus(); + $redirectPayments = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('redirectPayments'); + if (($paycodeKey = array_search(Novalnet_Payment_Model_Config::NN_PAYPAL, $redirectPayments)) !== false) { + unset($redirectPayments[$paycodeKey]); + } + + $currentUrl = Mage::helper('core/url')->getCurrentUrl(); + + if ($this->canCapture() && !preg_match("/callback/i", $currentUrl) + && !in_array($this->_code, $redirectPayments) && $transStatus + && $transStatus != Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + $requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->buildProcessRequest($payment, 'capture'); // Build capture process request + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->postProcessRequest($request, $payment, 'capture'); // Send capture process request + } + + return $this; + } + + /** + * Void the payment transaction + * + * @param Varien_Object $payment + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function void(Varien_Object $payment) + { + if ($this->canVoid($payment)) { + $requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->buildProcessRequest($payment, 'void'); // Build void process request + + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->postProcessRequest($request, $payment, 'void'); // Send void process request + } + + return $this; + } + + /** + * Refund the transaction amount + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function refund(Varien_Object $payment, $amount) + { + if ($this->canRefund()) { + $requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->buildProcessRequest($payment, 'refund', $amount); // Build refund process request + + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->postProcessRequest($request, $payment, 'refund', $amount); // Send refund process request + } + + return $this; + } + + /** + * Get original payment transaction status + * + * @param Varien_Object $payment + * @return Varien_Object $paymentStatus + */ + public function getPaymentStatus(Varien_Object $payment) + { + // Get payment Novalnet transaction id + $transactionId = $this->helper->makeValidNumber($payment->getLastTransId()); + $paymentStatus = $this->helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); // Get given payment transaction status + return $paymentStatus; + } + + /** + * Validate recurring profile data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return boolean + */ + public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + return true; + } + + /** + * Fetch recurring profile details + * + * @param string $referenceId + * @param Varien_Object $result + * @return boolean + */ + public function getRecurringProfileDetails($referenceId, Varien_Object $result) + { + return true; + } + + /** + * Check whether can get recurring profile details + * + * @param none + * @return boolean + */ + public function canGetRecurringProfileDetails() + { + return true; + } + + /** + * Update recurring profile data + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return boolean + */ + public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) + { + return true; + } + + /** + * Submit recurring profile + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Mage_Payment_Model_Info $paymentInfo + * @return none + */ + public function submitRecurringProfile( + Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo + ) { + if ($profile->getTrialPeriodUnit() && $profile->getTrialPeriodFrequency()) { + $this->helper->showException('Trial Billing Cycles are not support Novalnet payment'); + } + + // Submit recurring profile request to Novalnet gateway + $this->helper->getModel('Recurring_Payment')->submitRecurringProfile($profile, $paymentInfo); + } + + /** + * Manage recurring profile status + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return none + */ + public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) + { + $recurringModel = $this->helper->getModel('Mysql4_Recurring'); // Get Novalnet recurring model + // Get recurring profile order number (related orders) + $orderNo = $recurringModel->getRecurringOrderNo($profile); + $order = $recurringModel->getOrderByIncrementId($orderNo[0]); // Get order object + + $requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->buildRecurringApiRequest($order, $profile); // Get Novalnet recurring process request + + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + // Send Novalnet recurring process request + $responseModel->postRecurringApiRequest($order, $profile->getNewState(), $request); + } + + /** + * Get existing transaction details (card/account) + * + * @param none + * @return Varien_Object $paymentValues + */ + public function getExistingTransInfo() + { + $paymentValues = ''; + $customerId = $this->helper->getCustomerId(); // Get customer id + + if ($customerId) { + // Get transaction informations if available for the customer + $collection = $this->helper->getModel('Mysql4_TransactionStatus')->getCollection() + ->addFieldToFilter('customer_id', $customerId) + ->addFieldToFilter('payment_name', $this->_code) + ->addFieldToFilter('reference_transaction', 0) + ->addFieldToFilter('transaction_status', array('in' => array(100, 98, 99, 103))) + ->addFieldToSelect('novalnet_acc_details'); + $paymentValues = $collection->getLastItem()->hasNovalnetAccDetails() + ? $collection->getLastItem()->getNovalnetAccDetails() : ''; + if ($paymentValues) { + $isSerialized = $this->helper->is_serialized($paymentValues); + $paymentValues = ($isSerialized === true) ? unserialize($paymentValues) + : unserialize(base64_decode($paymentValues)); + } + } + + return $paymentValues; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetBanktransfer.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetBanktransfer.php new file mode 100755 index 0000000..ecfb878 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetBanktransfer.php @@ -0,0 +1,55 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetCashpayment.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetCashpayment.php new file mode 100755 index 0000000..8a3489e --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetCashpayment.php @@ -0,0 +1,64 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetCc.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetCc.php new file mode 100755 index 0000000..6ac1011 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetCc.php @@ -0,0 +1,137 @@ +hasNominalItems() && $this->helper->checkIsAdmin()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + if ($data) { + if (!($data instanceof Varien_Object)) { + $data = new Varien_Object($data); + } + + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = Mage::app()->getRequest()->getPost(); + + if ($this->getFormValues('cc_oneclick_shopping') && !$this->getFormValues('nn_pan_hash')) { + $maskedCardInfo = $this->getExistingTransInfo(); + $methodSession->setNnCcTid($maskedCardInfo['nn_tid']); + } else { + $methodSession->setNnCcHash($this->getFormValues('nn_pan_hash')) + ->setNnCcUniqId($this->getFormValues('nn_cc_uniqueid')) + ->setNnCcSaveCard((int)isset($request['nn_cc_save_card'])) + ->setNnCcDoRedirect($this->getFormValues('nn_cc_do_redirect')) + ->unsNnCcTid(); + } + } + + return $this; + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Current payment instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + $this->validateModel->validateFormInfo(); // Validate the form values + } + + return $this; + } + + /** + * Get the credit card informations + * + * @param string $param + * @return string + */ + public function getFormValues($param) + { + return Mage::app()->getRequest()->getPost($param); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string $actionUrl + */ + public function getOrderPlaceRedirectUrl() + { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + if ($methodSession->getNnCcDoRedirect() == 1) { + // Credit Card 3D Secure payment redirect url + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + if ($this->canAuthorize() && ($methodSession->getNnCcDoRedirect() != 1)) { + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetEps.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetEps.php new file mode 100755 index 0000000..2fc28bf --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetEps.php @@ -0,0 +1,55 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetGiropay.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetGiropay.php new file mode 100755 index 0000000..6a43237 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetGiropay.php @@ -0,0 +1,55 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetIdeal.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetIdeal.php new file mode 100755 index 0000000..76b60f0 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetIdeal.php @@ -0,0 +1,55 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoice.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoice.php new file mode 100755 index 0000000..50ecf9c --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoice.php @@ -0,0 +1,119 @@ +helper->getModel('Service_Validate_PaymentCheck'); + if (!empty($quote)) { + $validateModel->getPaymentGuaranteeStatus($quote, $this->_code); + } + + if (!empty($quote) && $quote->hasNominalItems() && $this->helper->checkIsAdmin()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + if ($data) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + + if (!($data instanceof Varien_Object)) { + $data = new Varien_Object($data); + } + + $company = $this->helper->getEndUserCompany(); + // Assign customer DOB + if ($methodSession->getPaymentGuaranteeFlag() && (!$data->getDobDate() && !$data->getDobMonth() && !$data->getDobYear() && !$company)) { + $methodSession->setPaymentGuaranteeFlag(0); + } elseif ($methodSession->getPaymentGuaranteeFlag() && $data->getDobDate() && $data->getDobMonth() && $data->getDobYear()) { + $birthDate = $data->getDobDate().'.'.$data->getDobMonth().'.'.$data->getDobYear(); + $birthDate = str_replace(str_split('\\/.,-_ '), '-', $birthDate); + $birthDate = Mage::getModel('core/date')->date('Y-m-d', strtotime($birthDate)); + $methodSession->setCustomerDob($birthDate); + } + + $this->helper->getCheckoutSession()->setNnPaymentCode($this->_code); + } + + return $this; + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Current payment instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + $this->validateModel->validateFormInfo(); // Validate the form values + } + + return $this; + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoiceInstalment.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoiceInstalment.php new file mode 100755 index 0000000..5ad1c96 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetInvoiceInstalment.php @@ -0,0 +1,125 @@ +helper->getModel('Service_Validate_PaymentCheck'); + + if (!empty($quote) && (!$validateModel->getPaymentGuaranteeStatus($quote, $this->_code) || $quote->hasNominalItems())) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + if ($data) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + + if (!($data instanceof Varien_Object)) { + $data = new Varien_Object($data); + } + + if ($data->getDobDate() && $data->getDobMonth() && $data->getDobYear()) { + $birthDate = $data->getDobDate().'.'.$data->getDobMonth().'.'.$data->getDobYear(); + $birthDate = str_replace(str_split('\\/.,-_ '), '-', $birthDate); + $birthDate = Mage::getModel('core/date')->date('Y-m-d', strtotime($birthDate)); + $methodSession->setInvoiceCustomerDob($birthDate); + } + + $instalmentPeriod = $this->getFormValues('novalnet_invoice_instalment_period'); + $methodSession->setInvoiceInstalment($instalmentPeriod); + + $this->helper->getCheckoutSession()->setNnPaymentCode($this->_code); + } + + return $this; + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Current payment instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + $this->validateModel->validateFormInfo(); // Validate the form values + } + + return $this; + } + + /** + * Get the bank account informations + * + * @param string $param + * @return string + */ + public function getFormValues($param) + { + return Mage::app()->getRequest()->getPost($param); + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetPaypal.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPaypal.php new file mode 100755 index 0000000..8d5be26 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPaypal.php @@ -0,0 +1,106 @@ +helper->getMethodSession($this->_code); // Get payment method session + + if ($this->getFormValues('paypal_oneclick_shopping') && $this->getFormValues('paypal_ref_trans')) { + $transAccInfo = $this->getExistingTransInfo(); + $methodSession->setNnRefTid($transAccInfo['nn_tid']); + } else { + $methodSession->unsNnRefTid(); + $methodSession->unsNnPaypalSaveAccount(); + if ($this->getFormValues('nn_paypal_save_account')) { + $methodSession->setNnPaypalSaveAccount(true); + } + } + } + + return $this; + } + + /** + * Get the paypal informations + * + * @param string $param + * @return string + */ + public function getFormValues($param) + { + return Mage::app()->getRequest()->getPost($param); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string $actionUrl + */ + public function getOrderPlaceRedirectUrl() + { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + + if ($methodSession->hasPaymentReqData()) { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + if ($this->canAuthorize() && $methodSession->getPaymentReqData()->hasPaymentRef()) { + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrepayment.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrepayment.php new file mode 100755 index 0000000..1f79330 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrepayment.php @@ -0,0 +1,64 @@ +hasNominalItems() && $this->helper->checkIsAdmin()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrzelewy.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrzelewy.php new file mode 100755 index 0000000..e1dae3f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetPrzelewy.php @@ -0,0 +1,55 @@ +hasNominalItems()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Get Novalnet payment redirect URL + * + * @param none + * @return string + */ + public function getOrderPlaceRedirectUrl() + { + return $this->helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepa.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepa.php new file mode 100755 index 0000000..5d49f4a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepa.php @@ -0,0 +1,147 @@ +helper->getModel('Service_Validate_PaymentCheck'); + if (!empty($quote)) { + $validateModel->getPaymentGuaranteeStatus($quote, $this->_code); + } + + if (!empty($quote) && $quote->hasNominalItems() && $this->helper->checkIsAdmin()) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Current payment instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + $this->validateModel->validateFormInfo(); // Validate the form values + } + + return $this; + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + if ($data) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + + if (!($data instanceof Varien_Object)) { + $data = new Varien_Object($data); + } + + $request = Mage::app()->getRequest()->getPost(); + $company = $this->helper->getEndUserCompany(); + + // Assign customer DOB + if ($methodSession->getPaymentGuaranteeFlag() && (!$data->getDobDate() && !$data->getDobMonth() && !$data->getDobYear() && !$company)) { + $methodSession->setPaymentGuaranteeFlag(0); + } elseif ($methodSession->getPaymentGuaranteeFlag() && $data->getDobDate() && $data->getDobMonth() && $data->getDobYear()) { + $birthDate = $data->getDobDate().'.'.$data->getDobMonth().'.'.$data->getDobYear(); + $birthDate = str_replace(str_split('\\/.,-_ '), '-', $birthDate); + $birthDate = Mage::getModel('core/date')->date('Y-m-d', strtotime($birthDate)); + $methodSession->setCustomerDob($birthDate); + } + + $methodSession->setSepaHolder($this->getFormValues('novalnetSepa_account_holder')) + ->setSepaIban($this->getFormValues('novalnetSepa_account_number')) + ->setSepaSaveAccount((int)isset($request['nn_sepa_save_account'])) + ->setSepaNewForm(1); + + if ($this->getFormValues('nnSepa_oneclick_shopping') && !$this->getFormValues('nnSepa_new_form') + ) { + $maskedAccountInfo = $this->getExistingTransInfo(); + $methodSession->setSepaNewForm(0) + ->setNnSepaTid($maskedAccountInfo['nn_tid']); + } else { + $methodSession->unsNnSepaTid(); + } + + $this->helper->getCheckoutSession()->setNnPaymentCode($this->_code); + } + + return $this; + } + + /** + * Get the bank account informations + * + * @param string $param + * @return string + */ + public function getFormValues($param) + { + return Mage::app()->getRequest()->getPost($param); + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepaInstalment.php b/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepaInstalment.php new file mode 100755 index 0000000..111b70b --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Method/NovalnetSepaInstalment.php @@ -0,0 +1,128 @@ +helper->getModel('Service_Validate_PaymentCheck'); + + if (!empty($quote) && (!$validateModel->getPaymentGuaranteeStatus($quote, $this->_code) || $quote->hasNominalItems())) { + return false; + } + + return parent::isAvailable($quote); + } + + /** + * Validate payment method information object + * + * @param none + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function validate() + { + parent::validate(); + $info = $this->getInfoInstance(); // Current payment instance + + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + $this->validateModel->validateFormInfo(); // Validate the form values + } + + return $this; + } + + /** + * Assign data to info model instance + * + * @param mixed $data + * @return Mage_Payment_Model_Info + */ + public function assignData($data) + { + if ($data) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + + if (!($data instanceof Varien_Object)) { + $data = new Varien_Object($data); + } + + if ($data->getDobDate() && $data->getDobMonth() && $data->getDobYear()) { + $birthDate = $data->getDobDate().'.'.$data->getDobMonth().'.'.$data->getDobYear(); + $birthDate = str_replace(str_split('\\/.,-_ '), '-', $birthDate); + $birthDate = Mage::getModel('core/date')->date('Y-m-d', strtotime($birthDate)); + $methodSession->setSepaInstalmentCustomerDob($birthDate); + } + + $request = Mage::app()->getRequest()->getPost(); + $methodSession->setSepaInstalmentHolder($this->getFormValues('novalnetSepaInstalment_account_holder')) + ->setSepaInstalmentIban($this->getFormValues('novalnetSepaInstalment_account_number')) + ->setSepaSaveAccount((int)isset($request['nn_sepa_save_account'])) + ->setSepaInstalment($this->getFormValues('novalnet_sepa_instalment_period')) + ->setSepaNewForm(1); + $this->helper->getCheckoutSession()->setNnPaymentCode($this->_code); + } + + return $this; + } + + /** + * Get the bank account informations + * + * @param string $param + * @return string + */ + public function getFormValues($param) + { + return Mage::app()->getRequest()->getPost($param); + } + + /** + * Authorize + * + * @param Varien_Object $payment + * @param float $amount + * @return Novalnet_Payment_Model_Method_Abstract + */ + public function authorize(Varien_Object $payment, $amount) + { + if ($this->canAuthorize()) { + $methodSession = $this->helper->getMethodSession($this->_code); // Get payment method session + $request = $methodSession->getPaymentReqData(); // Get Novalnet payment request data + $response = $this->postRequest($request); // Send payment request to Novalnet gateway + $responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->validateResponse($payment, $request, $response); // Validate Novalnet payment response + } + + return $this; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateInfo.php b/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateInfo.php new file mode 100755 index 0000000..2ac51d2 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateInfo.php @@ -0,0 +1,46 @@ +_init('novalnet_payment/affiliateInfo'); + } + + /** + * Load affiliate by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Novalnet_Payment_Model_Mysql4_AffiliateInfo + */ + public function loadByAttribute($attribute, $value) + { + $this->load($value, $attribute); + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateUser.php b/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateUser.php new file mode 100755 index 0000000..68b12f7 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/AffiliateUser.php @@ -0,0 +1,46 @@ +_init('novalnet_payment/affiliateUser'); + } + + /** + * Load affiliate user information by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Novalnet_Payment_Model_Mysql4_AffiliateUser + */ + public function loadByAttribute($attribute, $value) + { + $this->load($value, $attribute); + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Callback.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Callback.php new file mode 100755 index 0000000..1fe7c65 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Callback.php @@ -0,0 +1,58 @@ +_init('novalnet_payment/callback'); + } + + /** + * Load callback details by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Novalnet_Payment_Model_Mysql4_Callback + */ + public function loadByAttribute($attribute, $value) + { + $this->load($value, $attribute); + return $this; + } + + /** + * Load order callback status by order id + * + * @param $orderId + * @return Novalnet_Payment_Model_Mysql4_Callback + */ + public function loadLogByOrderId($orderId) + { + $this->load($orderId, 'order_id'); + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Recurring.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Recurring.php new file mode 100755 index 0000000..477c892 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Recurring.php @@ -0,0 +1,63 @@ +_init('novalnet_payment/recurring'); + } + + /** + * Get recurring profile increment id + * + * @param Varien_Object $profile + * @return int $incrementId + */ + public function getRecurringOrderNo($profile) + { + $incrementId = array(); + $recurringCollection = Mage::getResourceModel('sales/order_grid_collection') + ->addRecurringProfilesFilter($profile->getId()); + foreach ($recurringCollection as $profileValue) { + $incrementId[] = $profileValue->getIncrementId(); + } + + return $incrementId; + } + + /** + * Get sales order + * + * @param int $incrementId + * @return Varien_Object $order + */ + public function getOrderByIncrementId($incrementId) + { + $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); + return $order; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo.php new file mode 100755 index 0000000..914d7fc --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/affiliate_info', 'id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo/Collection.php new file mode 100755 index 0000000..a45abbc --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateInfo/Collection.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/mysql4_affiliateInfo'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser.php new file mode 100755 index 0000000..a2eebe8 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/affiliate_user', 'id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser/Collection.php new file mode 100755 index 0000000..c22228a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/AffiliateUser/Collection.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/mysql4_affiliateUser'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback.php new file mode 100755 index 0000000..4f01e6d --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/callback', 'id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback/Collection.php new file mode 100755 index 0000000..7bf7f9b --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Callback/Collection.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/mysql4_callback'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring.php new file mode 100755 index 0000000..56e372a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/recurring', 'id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring/Collection.php new file mode 100755 index 0000000..b8dce08 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/Recurring/Collection.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/mysql4_recurring'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus.php new file mode 100755 index 0000000..5c5cc41 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/transaction_status', 'nn_txn_id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus/Collection.php new file mode 100755 index 0000000..7c32b51 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionStatus/Collection.php @@ -0,0 +1,43 @@ +_init('novalnet_payment/mysql4_transactionStatus'); + } + + /** + * Get order by using increment id + * + * @param Mage_Sales_Model_Order $order + * @return none + */ + public function getByOrder(Mage_Sales_Model_Order $order) + { + $this->addFieldToFilter('order_id', $order->getIncrementId()); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces.php new file mode 100755 index 0000000..0c23c95 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces.php @@ -0,0 +1,32 @@ +_init('novalnet_payment/transaction_traces', 'nn_log_id'); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces/Collection.php b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces/Collection.php new file mode 100755 index 0000000..f072757 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/Resource/TransactionTraces/Collection.php @@ -0,0 +1,43 @@ +_init('novalnet_payment/mysql4_transactionTraces'); + } + + /** + * Get order by using increment id + * + * @param Mage_Sales_Model_Order $order + * @return none + */ + public function getByOrder(Mage_Sales_Model_Order $order) + { + $this->addFieldToFilter('order_id', $order->getIncrementId()); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionStatus.php b/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionStatus.php new file mode 100755 index 0000000..6ded575 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionStatus.php @@ -0,0 +1,61 @@ +_init('novalnet_payment/transactionStatus'); + } + + /** + * Load order transaction status by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Novalnet_Payment_Model_Mysql4_TransactionStatus + */ + public function loadByAttribute($attribute, $value) + { + $this->load($value, $attribute); + return $this; + } + + /** + * Load order transaction status by transaction id + * + * @param mixed $transactionStatus + * @return Novalnet_Payment_Model_Mysql4_TransactionStatus + */ + public function loadByTransactionStatusId(Novalnet_Payment_Model_Mysql4_TransactionStatus $transactionStatus) + { + $this->load($transactionStatus->getNnTxnId(), 'nn_txn_id'); + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionTraces.php b/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionTraces.php new file mode 100755 index 0000000..dfa6b5f --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Mysql4/TransactionTraces.php @@ -0,0 +1,58 @@ +_init('novalnet_payment/transactionTraces'); + } + + /** + * Load order transaction traces by custom attribute value. Attribute value should be unique + * + * @param string $attribute + * @param string $value + * @return Novalnet_Payment_Model_Mysql4_TransactionTraces + */ + public function loadByAttribute($attribute, $value) + { + $this->load($value, $attribute); + return $this; + } + + /** + * Load order transaction traces by log id + * + * @param mixed $orderLog + * @return Novalnet_Payment_Model_Mysql4_TransactionTraces + */ + public function loadByOrderLogId(Novalnet_Payment_Model_Mysql4_TransactionTraces $orderLog) + { + $this->load($orderLog->getNnLogId(), 'nn_log_id'); + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Observer/InvoiceView.php b/app/code/community/Novalnet/Payment/Model/Observer/InvoiceView.php new file mode 100755 index 0000000..d7dad24 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Observer/InvoiceView.php @@ -0,0 +1,94 @@ +getEvent()->getBlock(); + + // Add buttons to sales order view (single order) + if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Invoice_View) { + $order = $block->getInvoice()->getOrder(); // Get current order + $orderPayment = $order->getPayment(); // Get order payment + $paymentCode = $order->getPayment()->getMethodInstance()->getCode(); // Get payment method code + // Allow only for Novalnet payment methods + if (preg_match("/novalnet/i", $paymentCode)) { + $block->removeButton('print'); + $block->removeButton('capture'); + + if ($block->getInvoice()->getOrder()->canCreditmemo()) { + if (($orderPayment->canRefundPartialPerInvoice() + && $orderPayment->getAmountPaid() > $orderPayment->getAmountRefunded() + ) || ($orderPayment->canRefund() && !$block->getInvoice()->getIsUsedForRefund()) + ) { + $this->getCreditMemoButton($block); + } + } + + if ($block->getInvoice()->getId()) { + $this->getPrintButton($block); + } + } + } + } + + /** + * Add creditmemo button + * + * @param Mage_Adminhtml_Block_Sales_Order_Invoice_View $block + * @return none + */ + public function getCreditMemoButton($block) + { + $block->addButton( + 'capture', array(// capture? + 'label' => Mage::helper('sales')->__('Credit Memo'), + 'class' => 'go', + 'onclick' => 'setLocation(\'' . $block->getCreditMemoUrl() . '\')' + ) + ); + } + + /** + * Add print button + * + * @param Mage_Adminhtml_Block_Sales_Order_Invoice_View $block + * @return none + */ + public function getPrintButton($block) + { + $block->addButton( + 'print', array( + 'label' => Mage::helper('sales')->__('Print'), + 'class' => 'save', + 'onclick' => 'setLocation(\'' . $block->getPrintUrl() . '\')' + ) + ); + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Observer/OrderView.php b/app/code/community/Novalnet/Payment/Model/Observer/OrderView.php new file mode 100755 index 0000000..a45b76d --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Observer/OrderView.php @@ -0,0 +1,114 @@ +getEvent()->getBlock(); + + // Add buttons to sales order view (single order) + if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) { + $order = $block->getOrder(); // Get current order + $paymentCode = $order->getPayment()->getMethodInstance()->getCode(); // Get payment method code + $helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + // Get Novalnet payment additional data if exist + $additionalData = (preg_match("/novalnet/i", $paymentCode)) + ? unserialize($order->getPayment()->getAdditionalData()) : ''; + // Get payment Novalnet transaction id if exist + $transactionId = !empty($additionalData['NnTid']) ? $helper->makeValidNumber($additionalData['NnTid']) : ''; + + if (!empty($transactionId)) { // allow only for Novalnet payment methods + // Get current transaction status information + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status + // Get payment transaction amount + $transactionAmount = (int) str_replace(array('.', ','), '', $transactionStatus->getAmount()); + + if ($paymentStatus) { + // Rename invoice button for Novalnet payment orders + $block->updateButton('order_invoice', 'label', $helper->__('Capture')); + // Removes offline credit memo button in order history + $block->removeButton('order_creditmemo'); + } + + // Removes void button for success payment status + if ($paymentStatus + && (!$transactionAmount + || in_array($paymentStatus, array(Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED, Novalnet_Payment_Model_Config::PRZELEWY_PENDING_STATUS, Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS, Novalnet_Payment_Model_Config::PAYMENT_VOID_STATUS, Novalnet_Payment_Model_Config::GUARANTEE_PENDING_STATUS))) + ) { + $block->removeButton('void_payment'); + } + + // Removes order invoice button + if ($paymentStatus + && (in_array($paymentStatus, array(Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS, Novalnet_Payment_Model_Config::PRZELEWY_PENDING_STATUS, Novalnet_Payment_Model_Config::PAYMENT_VOID_STATUS, Novalnet_Payment_Model_Config::GUARANTEE_PENDING_STATUS)) + || in_array( + $paymentCode, array(Novalnet_Payment_Model_Config::NN_INVOICE, + Novalnet_Payment_Model_Config::NN_PREPAYMENT, + Novalnet_Payment_Model_Config::NN_CASHPAYMENT) + ) || !$transactionAmount)) { + $block->removeButton('order_invoice'); + } + + // Add confirm button for Novalnet invoice payments (Invoice/Prepayment) + if ($order->canInvoice() && $paymentStatus == 91 + && $paymentCode != Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT) { + $confirmUrl = $block->getUrl( + 'adminhtml/novalnetpayment_sales_order/confirm', array('_current' => true) + ); + $message = Mage::helper('sales')->__('Are you sure you want to capture the payment?'); + $block->addButton( + 'novalnet_confirm', array( + 'label' => Mage::helper('novalnet_payment')->__('Novalnet Capture'), + 'onclick' => "confirmSetLocation('{$message}', '{$confirmUrl}')", + ) + ); + } + + $guranteePayments = array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, + Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT, + Novalnet_Payment_Model_Config::NN_SEPA, + Novalnet_Payment_Model_Config::NN_INVOICE); + if ( $paymentStatus == 75 + && in_array($paymentCode, $guranteePayments)) { + $cancelUrl = $block->getUrl('adminhtml/novalnetpayment_sales_order/cancel', array('_current' => true)); + $message = Mage::helper('sales')->__('Are you sure you want to cancel the payment?'); + $block->removeButton('order_cancel'); + $block->addButton( + 'novalnet_cancel', array( + 'label' => Mage::helper('novalnet_payment')->__('Cancel'), + 'onclick' => "confirmSetLocation('{$message}', '{$cancelUrl}')", + ) + ); + } + } + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Observer/Recurring.php b/app/code/community/Novalnet/Payment/Model/Observer/Recurring.php new file mode 100755 index 0000000..afb8602 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Observer/Recurring.php @@ -0,0 +1,138 @@ +getEvent()->getCart()->getQuote(); // Get quote object + + foreach ($quote->getAllItems() as $items) { + if ($items->getProduct()->isRecurring()) { + $recurringProfile = $items->getProduct()->getRecurringProfile(); // Get profile object + // Get recurring profile period values + Mage::getSingleton('checkout/session')->setNnPeriodUnit($recurringProfile['period_unit']) + ->setNnPeriodFrequency($recurringProfile['period_frequency']); + } + } + } + + /** + * Set redirect url for recurring payment + * + * @param varien_object $observer + * @return Novalnet_Payment_Model_Observer_Recurring + */ + public function setPaymentRedirectUrl(Varien_Event_Observer $observer) + { + $quote = $observer->getEvent()->getQuote(); // Get quote object + $paymentCode = $quote->getPayment()->getMethodInstance()->getCode(); // Get payment method code + if (preg_match("/novalnet/i", $paymentCode)) { + $helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $checkoutSession = $helper->getCheckoutSession(); // Get checkout session + // Get recurring profile id + $profileIds = $checkoutSession->getLastRecurringProfileIds(); + $recurringProfileIds = !empty($profileIds) ? array_filter($profileIds) : ''; + $redirectPayments = array(Novalnet_Payment_Model_Config::NN_CC, Novalnet_Payment_Model_Config::NN_PAYPAL); + + if (!empty($recurringProfileIds) && in_array($paymentCode, $redirectPayments)) { + $coreSession = $helper->getCoreSession(); + if (in_array($paymentCode, array(Novalnet_Payment_Model_Config::NN_CC, Novalnet_Payment_Model_Config::NN_PAYPAL)) && !$coreSession->hasDirectRp() + ) { + $redirectUrl = $helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_REDIRECT_URL); + $checkoutSession->setLastOrderId($coreSession->getOrderId()) + ->setLastRealOrderId($coreSession->getIncrementId()) + ->setRedirectUrl($redirectUrl); + } + + $coreSession->unsOrderId() + ->unsIncrementId() + ->unsDirectRp(); + } + + $order = $observer->getEvent()->getOrder(); + if (is_object($order)) { + $setAfterStatus = false; + if ($paymentCode == Novalnet_Payment_Model_Config::NN_INVOICE || Novalnet_Payment_Model_Config::NN_SEPA) { + $additionalData = $order->getPayment()->getAdditionalData(); + $additionalData = unserialize($additionalData); + $transactionId = !empty($additionalData['NnTid']) ? $helper->makeValidNumber($additionalData['NnTid']) : ''; + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status + $paymentObj = $order->getPayment()->getMethodInstance(); + + if ($paymentStatus == 75) { + $setAfterStatus = true; + $guaranteePending = $paymentObj->getConfigData('guarantee_pending_status') + ? $paymentObj->getConfigData('guarantee_pending_status') + : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; + } + } + + if ($paymentCode == Novalnet_Payment_Model_Config::NN_PAYPAL + && $order->getPayment()->getLastTransId() + && $order->getPayment()->getAdditionalInformation('novalnetPaypal_redirectAction') != 1) { + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $order->getPayment()->getLastTransId()); + $setAfterStatus = ($transactionStatus->getTransactionStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) + ? true : false; + } + + if ($setAfterStatus) { + $status = $guaranteePending ? $guaranteePending : ($paymentObj->getConfigData('order_status_after_payment') + ? $paymentObj->getConfigData('order_status_after_payment') + : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT); + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $status, '', true); + $order->save(); + } + } + } + } + + /** + * Set affiliate id if exist + * + * @param varien_object $observer + * @return Novalnet_Payment_Model_Observer_Recurring + */ + public function setAffiliateProcess(Varien_Event_Observer $observer) + { + if (!Mage::app()->getStore()->isAdmin()) { + // Novalnet payment helper + $helper = Mage::helper('novalnet_payment'); + + $affiliateId = Mage::app()->getRequest()->getParam('nn_aff_id'); + if ($affiliateId) { + $helper->getCoreSession()->setAffiliateId(trim($affiliateId)); + } + } + + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Observer/SalesEmails.php b/app/code/community/Novalnet/Payment/Model/Observer/SalesEmails.php new file mode 100755 index 0000000..b6059c9 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Observer/SalesEmails.php @@ -0,0 +1,164 @@ +getEvent()->getOrder(); + if (!$order->getEmailSent() && $order->getId()) { + try { + $order->sendNewOrderEmail() + ->setEmailSent(true) + ->save(); + } catch (Mage_Core_Exception $e) { + Mage::log($e->getMessage()); + } + } + + return $this; + } + + /** + * Send order invoice mail + * + * @param Varien_Object $observer + * @return Novalnet_Payment_Model_Observer_SalesEmails + */ + public function sendInvoiceEmail($observer) + { + try { + /* $order Magento_Sales_Model_Order_Invoice */ + $invoice = $observer->getEvent()->getInvoice(); + // Get payment method code + $paymentCode = $invoice->getOrder()->getPayment()->getMethodInstance()->getCode(); + $currentUrl = Mage::helper('core/url')->getCurrentUrl(); + $coreSession = Mage::helper('novalnet_payment')->getCoreSession(); + // Set capture status for Novalnet payments + if (Mage::app()->getStore()->isAdmin() && !preg_match("/sales_order_create/i", $currentUrl) + ) { + $this->setCaptureOrderStatus($invoice->getOrder(), $paymentCode); + } + + // Set order invoice status as pending for Novalnet invoice payment + if ($paymentCode == Novalnet_Payment_Model_Config::NN_INVOICE + && !Mage::app()->getRequest()->getParam('tid_payment') + ) { + $additionalData = $invoice->getOrder()->getPayment()->getAdditionalData(); + $additionalData = unserialize($additionalData); + if (!isset($additionalData['NnGuarantee'])) { + $invoice->setState(1); + } + } elseif ($paymentCode == Novalnet_Payment_Model_Config::NN_PAYPAL && $coreSession->hasPaypalOnholdFlag()) { + $invoice->setState(1); + $coreSession->unsPaypalOnholdFlag(); + } + + $invoice->save(); + $invoice->sendEmail($invoice); + } catch (Mage_Core_Exception $e) { + Mage::log($e->getMessage()); + } + + return $this; + } + + /** + * Send order creditmemo mail + * + * @param Varien_Object $observer + * @return Novalnet_Payment_Model_Observer_SalesEmails + */ + public function sendCreditmemoEmail($observer) + { + try { + /* $order Magento_Sales_Model_Order_Creditmemo */ + $refund = $observer->getEvent()->getCreditmemo(); + $refund->save(); + $refund->sendEmail($refund); + } catch (Mage_Core_Exception $e) { + Mage::logException($e->getMessage()); + } + + return $this; + } + + /** + * Set canceled/VOID status for Novalnet payments + * + * @param Varien_Object $observer + * @param none + */ + public function setVoidOrderStatus($observer) + { + /* $order Magento_Sales_Model_Order */ + $payment = $observer->getEvent()->getPayment(); + $order = $payment->getOrder(); // Get order object + + if (preg_match("/novalnet/i", $payment->getMethodInstance()->getCode())) { + $voidOrderStatus = Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/void_status', $order->getStoreId() + ) ? Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/void_status', $order->getStoreId() + ) : Mage_Sales_Model_Order::STATE_CANCELED; + $order->setState( + Mage_Sales_Model_Order::STATE_PROCESSING, + $voidOrderStatus, + Mage::helper('novalnet_payment')->__('Order was canceled'), true + )->save(); + } + } + + /** + * Set capture status for Novalnet payments + * + * @param Varien_Object $order + * @param string $paymentCode + * @param none + */ + protected function setCaptureOrderStatus($order, $paymentCode) + { + if (preg_match("/novalnet/i", $paymentCode)) { + $paymentObj = $order->getPayment()->getMethodInstance(); + $additionalData = unserialize($order->getPayment()->getAdditionalData()); + + if (($paymentCode == Novalnet_Payment_Model_Config::NN_INVOICE && !empty($additionalData['NnGuarantee'])) || $paymentCode == Novalnet_Payment_Model_Config::NN_PAYPAL) { + $captureOrderStatus = $paymentObj->getConfigData('order_status_after_payment'); + } else { + $captureOrderStatus = $paymentObj->getConfigData('order_status'); + } + + $order->setState( + Mage_Sales_Model_Order::STATE_PROCESSING, + $captureOrderStatus, + Mage::helper('novalnet_payment')->__('The transaction has been confirmed'), true + )->save(); + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Observer/UpdateOrderStatus.php b/app/code/community/Novalnet/Payment/Model/Observer/UpdateOrderStatus.php new file mode 100755 index 0000000..3b7c469 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Observer/UpdateOrderStatus.php @@ -0,0 +1,73 @@ +getEvent()->getOrder(); + if ($order && preg_match('/novalnet/', $order->getPayment()->getMethod())) { + $paymentMethod = $order->getPayment()->getMethod(); + $paymentObj = $order->getPayment()->getMethodInstance(); + $redirectPayments = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('redirectPayments'); + $additionalData = unserialize($order->getPayment()->getAdditionalData()); + $transactionId = !empty($additionalData['NnTid']) ? Mage::helper('novalnet_payment')->makeValidNumber($additionalData['NnTid']) : ''; + + $transactionStatus = Mage::helper('novalnet_payment')->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); + + if (!in_array($paymentMethod, $redirectPayments) + || ($paymentMethod == 'novalnetCc') && ($paymentObj->getConfigData('enable_cc3d') || $paymentObj->getConfigData('cc3d_validation'))) { + $setOrderStatus = Mage_Sales_Model_Order::STATE_PROCESSING; + // Assigns order status based on payment configured + if (in_array( + $paymentMethod, + array('novalnetCc', 'novalnetInvoice', 'novalnetSepa', 'novalnetInvoiceInstalment', 'novalnetSepaInstalment') + )) { + // Guaranteed pending payment status + if ($paymentStatus == 75) { + $setOrderStatus = $paymentObj->getConfigData('guarantee_pending_status'); + } elseif (in_array($paymentStatus, array(91, 99, 98))) { + $setOrderStatus = Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/order_status', + $order->getStoreId() + ); + } elseif ($paymentStatus == 100 && $paymentMethod == Novalnet_Payment_Model_Config::NN_INVOICE && !empty($additionalData['NnGuarantee'])) { + $setOrderStatus = $paymentObj->getConfigData('order_status_after_payment'); + } elseif ($paymentStatus == 100) { + $setOrderStatus = $paymentObj->getConfigData('order_status'); + } + } + + // Verifies and sets order status + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING) + ->setStatus($setOrderStatus); + $order->save(); + } + } + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Quote/Address/Total/Nominal.php b/app/code/community/Novalnet/Payment/Model/Quote/Address/Total/Nominal.php new file mode 100755 index 0000000..2a7276e --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Quote/Address/Total/Nominal.php @@ -0,0 +1,118 @@ + $address->getQuote()->getStore()) + ); + + // invoke nominal totals + foreach ($collector->getCollectors() as $model) { + $model->collect($address); + } + + // aggregate collected amounts into one to have sort of grand total per item + $total = 0; + foreach ($address->getAllNominalItems() as $item) { + $rowTotal = 0; + $baseRowTotal = 0; + $totalDetails = array(); + foreach ($collector->getCollectors() as $model) { + $itemRowTotal = $model->getItemRowTotal($item); + if ($model->getIsItemRowTotalCompoundable($item)) { + $rowTotal += $itemRowTotal; + $baseRowTotal += $model->getItemBaseRowTotal($item); + $isCompounded = true; + } else { + $isCompounded = false; + } + + if ((float) $itemRowTotal > 0) { + $label = $model->getLabel(); + $helper = Mage::helper('novalnet_payment'); + $regularPayment = $helper->__('Regular Payment'); + $shipping = $helper->__('Shipping'); + $tax = $helper->__('Tax'); + if ($label == $regularPayment || $label == $shipping || $label == $tax) { + $total = $total + $itemRowTotal; + } + + $totalDetails[] = new Varien_Object( + array( + 'label' => $label, + 'amount' => $itemRowTotal, + 'is_compounded' => $isCompounded, + ) + ); + } + } + + $item->setNominalRowTotal($rowTotal); + $item->setBaseNominalRowTotal($baseRowTotal); + $item->setNominalTotalDetails($totalDetails); + // Assign recurring payment amount for Novalnet subscription process (fraud prevention) + Mage::getSingleton('checkout/session')->setNnRegularAmount($total) + ->setNnRowAmount($rowTotal); + } + + return $this; + } + + /** + * Fetch collected nominal items + * + * @param Mage_Sales_Model_Quote_Address $address + * @return Mage_Sales_Model_Quote_Address_Total_Nominal + */ + public function fetch(Mage_Sales_Model_Quote_Address $address) + { + $items = $address->getAllNominalItems(); + if ($items) { + $address->addTotal( + array( + 'code' => $this->getCode(), + 'title' => Mage::helper('sales')->__('Nominal Items'), + 'items' => $items, + 'area' => 'footer', + ) + ); + } + + return $this; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Recurring/Payment.php b/app/code/community/Novalnet/Payment/Model/Recurring/Payment.php new file mode 100755 index 0000000..19d9edf --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Recurring/Payment.php @@ -0,0 +1,284 @@ +helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $this->paymentInfo = $paymentInfo; // Get current payment instance + $this->requestModel = $this->helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $this->responseModel = $this->helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + + $this->payment = $paymentInfo->getQuote()->getPayment(); // Get payment object + $this->code = $this->payment->getMethodInstance()->getCode(); // Payment method code + $methodSession = $this->helper->getMethodSession($this->code); // Payment method session + + if ($methodSession->hasOrderAmount()) { + $request = $methodSession->getPaymentReqData(); // Recurring profile payment request + $response = $methodSession->getPaymentResData(); // Recurring profile payment response + } else { + $request = $this->buildRecurringRequest($profile); // Get RP payment request + $coreSession = $this->helper->getCoreSession(); // Get core session + $coreSession->unsDirectRp(); + + if (($this->code == Novalnet_Payment_Model_Config::NN_PAYPAL && !$request->hasPaymentRef()) + || ($this->code == Novalnet_Payment_Model_Config::NN_CC && $methodSession->getNnCcDoRedirect() == 1)) { + $order = $this->setOriginalPrice($profile); // Get order with original product price values + $methodSession->setPaymentReqData($request); + $coreSession->setOrderId($order->getId()) + ->setIncrementId($order->getIncrementId()); + $status = $this->requestModel->getNovalnetConfig('order_status'); // Set order status + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $status, '', true)->save(); + return true; + } else { + // Send RP payment request to Novalnet gateway + $coreSession->setDirectRp(1); + $methodSession->setPaymentReqData($request); + $response = $this->payment->getMethodInstance()->postRequest($request); + } + } + + $this->validateRecurringResponse($profile, $request, $response); // Validate the RP response + } + + /** + * Prepare RP payment request + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return Varien_Object $request + */ + protected function buildRecurringRequest($profile) + { + $subsequentPeriod = $this->requestModel->getNovalnetConfig('subsequent_period', true); + $tariffPeriod = $this->getRecurringPeriod($profile); // Get subscription payment periods + $subsequentPeriod = $subsequentPeriod ? $subsequentPeriod : $tariffPeriod; + // Get RP order amount + $subsequentAmount = $amount = round( + ($profile->getBillingAmount() + $profile->getShippingAmount() + $profile->getTaxAmount()), 2 + ) * 100; + if ($profile->getInitAmount()) { // Add initial fees if exist + $amount = round( + ($profile->getInitAmount() + $profile->getBillingAmount() + + $profile->getShippingAmount() + $profile->getTaxAmount() + ), 2 + ) * 100; + } + + // Build RP payment request + $request = $this->requestModel->getPayportParams($this->paymentInfo, $this->code, $amount); + if ($request->getUniqid()) { + $tariffPeriod = $this->requestModel->encode($tariffPeriod, $request->getUniqid()); + $subsequentPeriod = $this->requestModel->encode($subsequentPeriod, $request->getUniqid()); + $subsequentAmount = $this->requestModel->encode($subsequentAmount, $request->getUniqid()); + } + + $request->setTariffPeriod($tariffPeriod) + ->setTariffPeriod2($subsequentPeriod) + ->setTariffPeriod2Amount($subsequentAmount) + ->setInput4('profile_id') + ->setInputval4($profile->getId()); + + return $request; + } + + /** + * Get subscription payment periods + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return string $tariffPeriod + */ + protected function getRecurringPeriod($profile) + { + // Get recurring profile period informations + $periodUnitFormat = array("day" => "d", "month" => "m", "year" => "y"); + + if ($profile->getPeriodUnit() == "semi_month") { + $tariffPeriod = "14d"; + } elseif ($profile->getPeriodUnit() == "week") { + $tariffPeriod = ($profile->getPeriodFrequency() * 7) . "d"; + } else { + $tariffPeriod = $profile->getPeriodFrequency() . $periodUnitFormat[$profile->getPeriodUnit()]; + } + + return $tariffPeriod; + } + + /** + * Verify the RP payment process + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Varien_Object $request + * @param Varien_Object $response + * @return none + */ + protected function validateRecurringResponse($profile, $request, $response) + { + $profile->setReferenceId(trim($response->getTid())); // Set profile reference id + // Novalnet successful transaction + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE); + $this->recurringPaymentCapture($profile, $request, $response); // Capture RP payment + $this->helper->unsetMethodSession($this->code); // Unset current payment method session + $this->updateInventory($this->paymentInfo->getQuote()); // Update the product inventory + $statusText = $this->responseModel->getStatusText($response); // Get payment transaction status message + $this->helper->getCoreSession()->addSuccess($statusText); + } else { // Novalnet unsuccessful transaction + // Get payment transaction status message + $statusText = $this->responseModel->getUnSuccessPaymentText($response); + $this->helper->showException($statusText); + } + } + + /** + * Capture the RP payment + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Varien_Object $request + * @param Varien_Object $response + * @return none + */ + protected function recurringPaymentCapture($profile, $request, $response) + { + $order = $this->setOriginalPrice($profile); // Get order with original product price values + $status = $this->requestModel->getNovalnetConfig('order_status'); // Set order status + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $status, 'Payment was successful')->save(); + $payment = $order->getPayment(); // Get payment object + + $this->responseModel->logTransactionStatus($response, $order); // Log Novalnet payment transaction informations + // Log Novalnet payment transaction traces informations + $this->responseModel->logTransactionTraces($request, $response, $order); + + // Novalnet payment transaction mode in Novalnet global configuration + $shopMode = $this->requestModel->getNovalnetConfig('live_mode', true); + $testMode = (int)($response->getTestMode() == 1 || $shopMode == 0); // Get Novalnet payment transaction mode + // Get Novalnet payment additional informations + $data = $this->responseModel->getPaymentAddtionaldata($response, $request, $testMode); + $paidUntil = $response->getNextSubsCycle() ? $response->getNextSubsCycle() : $response->getPaidUntil(); + $data['paidUntil'] = $paidUntil ? Mage::helper('core')->formatDate($paidUntil) : ''; + + // Save the additional transaction informations for reference + $payment->setPreparedMessage($this->createIpnComment($response->getTidStatus(), $order)) + ->setAdditionalData(serialize($data)) + ->setAdditionalInformation('subs_id', $response->getSubsId()) + ->save(); + + // Save the transaction informations + $this->responseModel->capturePayment($order, $response); + $orderStatus = ($this->code == Novalnet_Payment_Model_Config::NN_PAYPAL || + ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE && !empty($data['NnGuarantee']))) + ? $this->requestModel->getNovalnetConfig('order_status_after_payment') + : $this->requestModel->getNovalnetConfig('order_status'); + // If after status is empty set default status + $status = Mage_Sales_Model_Order::STATE_PROCESSING; + $setOrderStatus = $orderStatus ? $orderStatus : $status; + $order->setState($status, $setOrderStatus, $this->helper->__('Payment was successful'), true); + $order->save(); + // Log affiliate user informations + $this->responseModel->logAffiliateUserInfo($request); + + // Send order email for successful Novalnet transaction + Mage::dispatchEvent('novalnet_sales_order_email', array('order' => $order)); + } + + /** + * Generate an "IPN" comment with additional explanation. + * Returns the generated comment or order status history object + * + * @param string $paymentStatus + * @param Varien_Object $order + * @param string $comment + * @param boolean $addToHistory + * @return string + */ + public function createIpnComment($paymentStatus, $order, $comment = '', $addToHistory = false) + { + $message = Mage::helper('novalnet_payment')->__('IPN "%s".', $paymentStatus); + if ($comment) { + $message .= ' ' . $comment; + } + + if ($addToHistory) { + $message = $order->addStatusHistoryComment($message); + $message->setIsCustomerNotified(null); + } + + return $message; + } + + /** + * Create order with original product price values + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return Varien_Object $order + */ + protected function setOriginalPrice($profile) + { + $productItemInfo = new Varien_Object; + $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR); + $productItemInfo->setTaxAmount($profile->getTaxAmount()); + $productItemInfo->setShippingAmount($profile->getShippingAmount()); + $productItemInfo->setPrice($profile->getBillingAmount()); + // Create an order with respected price values + $order = $profile->createOrder($productItemInfo); + $order->save(); + // Add related orders to profile + $profile->addOrderRelation($order->getId()); + + return $order; + } + + /** + * Update the product inventory (stock) + * + * @param Varien_Object $quote + * @return none + */ + protected function updateInventory($quote) + { + foreach ($quote->getAllVisibleItems() as $quoteItem) { + $itemsQtyOrdered = $quoteItem->getQty(); + $productId = $quoteItem->getProductId(); + break; + } + + if ($productId) { + $stockObj = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); + $productQtyBefore = (int) $stockObj->getQty(); + } + + if (isset($productQtyBefore) && $productQtyBefore > 0) { + $productQtyAfter = (int) ($productQtyBefore - $itemsQtyOrdered); + $stockObj->setQty($productQtyAfter); + $stockObj->save(); + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Recurring/Profile.php b/app/code/community/Novalnet/Payment/Model/Recurring/Profile.php new file mode 100755 index 0000000..a60a746 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Recurring/Profile.php @@ -0,0 +1,151 @@ +_getItem($itemInfo); + $billingAmount += $item->getPrice(); + $shippingAmount += $item->getShippingAmount(); + $taxAmount += $item->getTaxAmount(); + $weight += $item->getWeight(); + if (!$item->getIsVirtual()) { + $isVirtual = 0; + } + + $items[] = $item; + } + + $qtyOrdered = $this->getInfoValue('order_info', 'items_qty'); + if ($qtyOrdered > 1) { + $billingAmount = ($billingAmount * $qtyOrdered); + } + + $grandTotal = $billingAmount + $shippingAmount + $taxAmount; + + $order = Mage::getModel('sales/order'); + + $billingAddress = Mage::getModel('sales/order_address') + ->setData($this->getBillingAddressInfo()) + ->setId(null); + + $shippingInfo = $this->getShippingAddressInfo(); + $shippingAddress = Mage::getModel('sales/order_address') + ->setData($shippingInfo) + ->setId(null); + + $payment = Mage::getModel('sales/order_payment') + ->setMethod($this->getMethodCode()); + + $transferDataKeys = array( + 'store_id', 'store_name', 'customer_id', 'customer_email', + 'customer_firstname', 'customer_lastname', 'customer_middlename', 'customer_prefix', + 'customer_suffix', 'customer_taxvat', 'customer_gender', 'customer_is_guest', + 'customer_note_notify', 'customer_group_id', 'customer_note', 'shipping_method', + 'shipping_description', 'base_currency_code', 'global_currency_code', + 'order_currency_code', + 'store_currency_code', 'base_to_global_rate', 'base_to_order_rate', 'store_to_base_rate', + 'store_to_order_rate' + ); + + $orderInfo = $this->getOrderInfo(); + foreach ($transferDataKeys as $key) { + if (isset($orderInfo[$key])) { + $order->setData($key, $orderInfo[$key]); + } elseif (isset($shippingInfo[$key])) { + $order->setData($key, $shippingInfo[$key]); + } + } + + $order->setStoreId($this->getStoreId()) + ->setState(Mage_Sales_Model_Order::STATE_NEW) + ->setBaseToOrderRate($this->getInfoValue('order_info', 'base_to_quote_rate')) + ->setStoreToOrderRate($this->getInfoValue('order_info', 'store_to_quote_rate')) + ->setOrderCurrencyCode($this->getInfoValue('order_info', 'quote_currency_code')) + ->setBaseSubtotal($billingAmount) + ->setSubtotal($billingAmount) + ->setBaseShippingAmount($shippingAmount) + ->setShippingAmount($shippingAmount) + ->setBaseTaxAmount($taxAmount) + ->setTaxAmount($taxAmount) + ->setBaseGrandTotal($grandTotal) + ->setGrandTotal($grandTotal) + ->setIsVirtual($isVirtual) + ->setWeight($weight) + ->setTotalQtyOrdered($this->getInfoValue('order_info', 'items_qty')) + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setPayment($payment); + + foreach ($items as $item) { + $order->addItem($item); + } + + return $order; + } + + /** + * Get the reqular order items + * + * @param varien_object $itemInfo + * @return mixed + */ + protected function _getRegularItem($itemInfo) + { + $price = $itemInfo->getPrice() ? $itemInfo->getPrice() : $this->getBillingAmount(); + $shippingAmount = $itemInfo->getShippingAmount() ? $itemInfo->getShippingAmount() : $this->getShippingAmount(); + $taxAmount = $itemInfo->getTaxAmount() ? $itemInfo->getTaxAmount() : $this->getTaxAmount(); + + $qtyOrdered = $this->getInfoValue('order_info', 'items_qty'); + $priceValue = ($price / $qtyOrdered); + + $item = Mage::getModel('sales/order_item') + ->setData($this->getOrderItemInfo()) + ->setQtyOrdered($this->getInfoValue('order_item_info', 'qty')) + ->setBaseOriginalPrice($this->getInfoValue('order_item_info', 'price')) + ->setPrice($priceValue) + ->setBasePrice($priceValue) + ->setRowTotal($price) + ->setBaseRowTotal($price) + ->setTaxAmount($taxAmount) + ->setShippingAmount($shippingAmount) + ->setId(null); + return $item; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Abstract.php b/app/code/community/Novalnet/Payment/Model/Service/Abstract.php new file mode 100755 index 0000000..8076eb2 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Abstract.php @@ -0,0 +1,337 @@ +code = Mage::registry('payment_code'); + // Assign Novalnet helper + $this->assignUtilities(); + // Assign basic vendor informations + $this->setVendorInfo(); + } + + /** + * Assign utilities (Novalnet payment helper) + * + * @param none + * @return Novalnet helper + */ + public function assignUtilities() + { + // Assign helper + if (!$this->_helper) { + $this->_helper = Mage::helper('novalnet_payment'); + } + + // Assign store id + if (!$this->_storeId) { + $this->_storeId = $this->_helper->getMagentoStoreId(); + } + } + + /** + * Set merchant configuration details + * + * @param none + * @return none + */ + protected function setVendorInfo() + { + $this->vendorId = $this->getNovalnetConfig('merchant_id', true); + $this->authcode = $this->getNovalnetConfig('auth_code', true); + $this->productId = $this->getNovalnetConfig('product_id', true); + $this->tariffId = $this->getNovalnetConfig('tariff_id', true); + $this->recurringTariffId = $this->getNovalnetConfig('subscrib_tariff_id', true); + $this->accessKey = $this->getNovalnetConfig('password', true); + $this->loadAffiliateInfo(); // Re-assign merchant params based on affiliate + } + + /** + * Get affiliate account/user detail + * + * @param null + * @return mixed + */ + public function loadAffiliateInfo() + { + $affiliateId = $this->_helper->getCoreSession()->getAffiliateId(); // Get affiliate user id if exist + $customerId = $this->_helper->getCustomerId(); // Get current customer id + + if (!$affiliateId && $customerId != 'guest') { // Get affiliate id for existing customer (if available) + $collection = $this->_helper->getModel('Mysql4_AffiliateUser')->getCollection() + ->addFieldToFilter('customer_no', $customerId) + ->addFieldToSelect('aff_id'); + $affiliateId = $collection->getLastItem()->getAffId() ? $collection->getLastItem()->getAffId() : null; + $this->_helper->getCoreSession()->setAffiliateId($affiliateId); + } + + if ($affiliateId) { // Get affiliate configuration values (if affiliate user id exist) + $orderCollection = $this->_helper->getModel('Mysql4_AffiliateInfo')->getCollection() + ->addFieldToFilter('aff_id', $affiliateId) + ->addFieldToSelect('aff_authcode') + ->addFieldToSelect('aff_accesskey'); + if ($orderCollection->getLastItem()->getAffAuthcode() + && $orderCollection->getLastItem()->getAffAccesskey()) { + $this->vendorId = $affiliateId; + $this->authcode = $orderCollection->getLastItem()->getAffAuthcode(); + $this->accessKey = $orderCollection->getLastItem()->getAffAccesskey(); + } + } + } + + /** + * Get the Novalnet configuration (global/payment) + * + * @param string $field + * @param boolean $global + * @return mixed|null + */ + public function getNovalnetConfig($field, $global = false) + { + $path = 'novalnet_global/novalnet/' . $field; // Global config value path + + if ($field == 'live_mode') { // Novalnet payment mode + $paymentMethod = Mage::getStoreConfig($path, $this->_storeId); + return (!preg_match('/' . $this->code . '/i', $paymentMethod)) ? false : true; + } elseif ($field !== null) { // Get Novalnet payment/global configuration + return ($global != false) + ? trim(Mage::getStoreConfig($path, $this->_storeId)) + : trim(Mage::getStoreConfig('payment/' . $this->code . '/' . $field, $this->_storeId)); + } + + return null; + } + + /** + * Whether current operation is order placement + * + * @param Varien_Object $info + * @return boolean + */ + protected function _isPlaceOrder($info) + { + if ($info instanceof Mage_Sales_Model_Quote_Payment) { + return false; + } elseif ($info instanceof Mage_Sales_Model_Order_Payment) { + return true; + } + } + + /** + * Get current order/quote object + * + * @param Varien_Object $info + * @return Mage_Payment_Model_Method_Abstract + */ + protected function _getInfoObject($info) + { + return ($this->_isPlaceOrder($info)) ? $info->getOrder() : $info->getQuote(); + } + + /** + * Check the email id is valid + * + * @param mixed $emailId + * @return boolean + */ + public function validateEmail($emailId) + { + $validatorEmail = new Zend_Validate_EmailAddress(); + return (bool)($validatorEmail->isValid($emailId)); + } + + /** + * Check the value contains special characters + * + * @param mixed $value + * @return boolean + */ + public function checkIsValid($value) + { + return (!$value || preg_match('/[#%\^<>@$=*!]/', $value)) ? false : true; + } + + /** + * Get grand total amount + * + * @param Varien_Object $info + * @return double + */ + protected function _getAmount($info) + { + return ($this->_isPlaceOrder($info)) + ? (double) $info->getOrder()->getBaseGrandTotal() : (double) $info->getQuote()->getBaseGrandTotal(); + } + + /** + * Get order increment id + * + * @param none + * @return int + */ + protected function _getIncrementId() + { + $storeId = $this->_helper->getMagentoStoreId(); // Get store id + $orders = Mage::getModel('sales/order')->getCollection() + ->addAttributeToFilter('store_id', $storeId) + ->setOrder('entity_id', 'DESC') + ->setPageSize(1); // Get order collection + $lastIncrementId = $orders->getFirstItem()->getIncrementId(); + return !empty($lastIncrementId) + ? ++$lastIncrementId : $storeId . Mage::getModel('eav/entity_increment_numeric')->getNextId(); + } + + /** + * Encoded the requested data + * + * @param string $data + * @return string + */ + public function encode($data, $uniqid) + { + $data = trim($data); + if ($data == null) { + return'Error: no data'; + } + + try { + return htmlentities(base64_encode(openssl_encrypt($data, "aes-256-cbc", $this->accessKey, true, $uniqid))); + } catch (Exception $e) { + Mage::logException('Error: ' . $e); + } + } + + /** + * Decoded the requested data + * + * @param string $data + * @return string + */ + public function decode($data, $uniqid) + { + $data = trim($data); + if ($data == null) { + return'Error: no data'; + } + + try { + return openssl_decrypt(base64_decode($data), "aes-256-cbc", $this->accessKey, true, $uniqid); + } catch (Exception $e) { + Mage::logException('Error: ' . $e); + } + } + + /** + * Hash value getter + * + * @param array $request + * @return string + */ + public function getHash($request) + { + if (empty($request)) { + return'Error: no data'; + } + + // Hash generation using sha256 and encoded merchant details + return hash('sha256', + ($request->getAuthCode() . $request->getProduct() . $request->getTariff() . + $request->getAmount() . $request->getTestMode() . $request->getUniqid() . strrev($this->accessKey)) + ); + } + + /** + * Check Hash value + * + * @param array $response + * @return boolean + */ + public function checkHash($response) + { + if (!$response) { + return false; + } + + if ($response->hasHash2() && $response->getHash2() != $this->getHash($response) + ) { + return false; + } + + return true; + } + + /** + * Get encoded payment data + * + * @param Varien_Object $request + * @return none + */ + public function getEncodedParams($request) + { + $params = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('hashParams'); + $uniqid = $request->getUniqid(); + + foreach ($params as $value) { + $data = $request->$value; + $data = $this->encode($data, $uniqid); + $request->$value = $data; + } + + $request->setHash($this->getHash($request)); + } + + /** + * Get decoded payment data + * + * @param Varien_Object $response + * @param int|null $storeId + * @return none + */ + public function getDecodedParams($response, $storeId = null) + { + $this->_storeId = ($storeId !== null) ? $storeId : $this->_storeId; + $params = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('hashParams'); + $uniqid = $response->getUniqid(); + + foreach ($params as $value) { + $data = $response->$value; + $data = $this->decode($data, $uniqid); + $response->$value = $data; + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Api/FraudPrevention.php b/app/code/community/Novalnet/Payment/Model/Service/Api/FraudPrevention.php new file mode 100755 index 0000000..43c8f33 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Api/FraudPrevention.php @@ -0,0 +1,303 @@ +_helper->getMethodSession($this->code); // Get current payment method session + $callbackStatus = $this->getFraudPreventionStatus($info); // Check fraud prevention availability + $this->_verifyCallbackOrderNo($info, $methodSession, $callbackStatus); // Check whether increment id is valid + $this->_verifyCallbackInfo($info, $methodSession); // Validate fraud prevention informations + $this->_verifyCallbackPinInfo($methodSession, $callbackStatus); // Validate the fraud prevention data + // Send fraud prevention PIN (New/Forget) request + $this->_performCallbackProcess($info, $methodSession, $callbackStatus); + if ($this->_isPlaceOrder($info)) { + $this->validateCallbackProcess($methodSession); // Validate fraud prevention response process + } + } + + /** + * Check fraud prevention availability + * + * @param Varien_Object $info + * @param string|null $code + * @return boolean + */ + public function getFraudPreventionStatus($info, $code = null) + { + $this->code = ($code !== null) ? $code : $this->code; // Payment method code + $orderAmount = (string) $this->_helper->getFormatedAmount($this->_getAmount($info)); // Get order amount + $callBackMinimum = (string) $this->getNovalnetConfig('callback_minimum_amount'); + $countryCode = strtoupper($this->_getInfoObject($info)->getBillingAddress()->getCountryId()); + $callbackPayment = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('fraudCheckPayment'); + $methodSession = $this->_helper->getMethodSession($this->code); + + if ((!$this->getNovalnetConfig('callback') || !$this->isCallbackTypeAllowed($countryCode)) + || ($callBackMinimum && $orderAmount < $callBackMinimum) || (!in_array($this->code, $callbackPayment)) + || $methodSession->getPaymentGuaranteeFlag() + || (!$this->getNovalnetConfig('payment_guarantee_force') && $this->getNovalnetConfig('enable_guarantee')) + ) { + return false; + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_SEPA + && $methodSession->hasSepaNewForm() && !$methodSession->getSepaNewForm() + ) { + return false; + } + + return true; + } + + /** + * Check whether increment id is valid + * + * @param Varien_Object $info + * @param Varien_Object $methodSession + * @param boolean $callbackStatus + * @return none + */ + protected function _verifyCallbackOrderNo($info, $methodSession, $callbackStatus) + { + $callbackOrderNo = 'getCallbackOrderNo' . ucfirst($this->code); + $callbackIncrementId = $methodSession->$callbackOrderNo(); + $incrementId = $this->_getIncrementId(); // Get order increment id + // Check whether increment id is valid + if (!$this->_isPlaceOrder($info) && $callbackStatus && $incrementId + && $callbackIncrementId && ($incrementId != $callbackIncrementId) + ) { + $this->_helper->unsetMethodSession($this->code); // Unset the payment method session + } + } + + /** + * Validate order amount is getting changed after callback initiation + * + * @param Varien_Object $info + * @param Varien_Object $methodSession + * @return throw Mage Exception|none + */ + protected function _verifyCallbackInfo($info, $methodSession) + { + // Callback initiated transaction id + $callbackTid = 'hasCallbackTid' . ucfirst($this->code); + + if ($methodSession->$callbackTid()) { + // Get order total amount + $checkoutSession = $this->_helper->getCheckoutSession(); + $amount = $checkoutSession->getQuote()->hasNominalItems() + ? $this->_helper->getFormatedAmount($checkoutSession->getNnRowAmount()) + : $this->_helper->getFormatedAmount($this->_getAmount($info)); + // Get payment method order amount if available + $orderAmount = $methodSession->getOrderAmount(); + // Get payment method disable time if available + $paymentDisableTime = 'getPaymentDisableTime' . ucfirst($this->code); + + if ($checkoutSession->$paymentDisableTime() && (Mage::getSingleton('core/date')->gmtTimestamp() > $checkoutSession->$paymentDisableTime()) + ) { + $this->_helper->unsetMethodSession($this->code); // Unset the payment method session + } elseif ($orderAmount && $orderAmount != $amount) { + $this->_helper->unsetMethodSession($this->code); // Unset the payment method session + if (!$this->_isPlaceOrder($info)) { + $this->_helper->showException('The order amount has been changed'); + } + } + } + } + + /** + * Validate the fraud prevention data + * + * @param Varien_Object $methodSession + * @param boolean $callbackStatus + * @return throw Mage Exception|none + */ + protected function _verifyCallbackPinInfo($methodSession, $callbackStatus) + { + $paymentCode = ucfirst($this->code); + $callbackTid = 'getCallbackTid' . $paymentCode; + $callbackPin = 'getCallbackPin' . $paymentCode; + + if ($callbackStatus && $methodSession->getCallbackPinFlag() && $methodSession->$callbackTid() + ) { + $callbackPin = $methodSession->$callbackPin(); + $callbackNewPin = 'getCallbackNewPin' . $paymentCode; + + if (!$methodSession->$callbackNewPin() && empty($callbackPin)) { + $this->_helper->showException('Enter your PIN'); + } elseif (!$methodSession->$callbackNewPin() && !$this->checkIsValid($callbackPin)) { + $this->_helper->showException('The PIN you entered is incorrect'); + } + } + } + + /** + * Send fraud prevention PIN (New/Forget) request + * + * @param Varien_Object $info + * @param Varien_Object $methodSession + * @param boolean $callbackStatus + * @return none + */ + protected function _performCallbackProcess($info, $methodSession, $callbackStatus) + { + if ($callbackStatus && !$this->_isPlaceOrder($info)) { + $paymentCode = ucfirst($this->code); + $callbackTid = 'getCallbackTid' . $paymentCode; + + if ($methodSession->$callbackTid() && $this->getNovalnetConfig('callback')) { + $callbackPin = 'getCallbackPin' . $paymentCode; + $callbackNewPin = 'getCallbackNewPin' . $paymentCode; + $setcallbackPin = 'setCallbackPin' . $paymentCode; + $methodSession->$callbackNewPin() + ? $this->_regenerateCallbackPin($methodSession) + : $methodSession->$setcallbackPin($methodSession->$callbackPin()); + } elseif (!$methodSession->$callbackTid()) { + $this->_generateCallbackPin($info, $paymentCode, $methodSession); + } + } + } + + /** + * Make callback request and validate response + * + * @param Varien_Object $info + * @param string $paymentCode + * @param Varien_Object $methodSession + * @return throw Mage Exception|none + */ + protected function _generateCallbackPin($info, $paymentCode, $methodSession) + { + $callbackTid = 'setCallbackTid' . $paymentCode; + $callbackOrderNo = 'setCallbackOrderNo' . $paymentCode; + $nominalItem = $this->_helper->getCheckoutSession()->getQuote()->hasNominalItems(); + + // Prepare payport request params + $requestModel = $this->_helper->getModel('Service_Api_Request'); + $request = $requestModel->getPayportParams($info, $this->code); + $requestModel->setFraudModuleParams($request, $methodSession); + if ($nominalItem) { + $requestModel->getCallbackProfileParams($request); + } + + $methodSession->setPaymentReqData($request); + // Receive payport response params + $paymentModel = $this->_helper->getPaymentModel($this->code); + $response = $paymentModel->postRequest($request); + $methodSession->setPaymentResData($response); + // Novalnet successful transaction status + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $methodSession->$callbackTid(trim($response->getTid())) + ->$callbackOrderNo(trim($response->getOrderNo())) + ->setNnTestMode(trim($response->getTestMode())) + ->setOrderAmount($request->getAmount()) + ->setCallbackSuccessState(true); + if ($this->getNovalnetConfig('callback') == 1) { + $text = $this->_helper->showException('You will shortly receive a transaction PIN'); + } elseif ($this->getNovalnetConfig('callback') == 2) { + $text = $this->_helper->showException('You will shortly receive an SMS'); + } + } else { // Novalnet unsuccessful transaction status + $text = $this->_helper->htmlEscape($response->getStatusDesc()); + } + + $this->_helper->showException($text, false); + } + + /** + * Regenerate new PIN for fraud prevention process + * + * @param Varien_Object $methodSession + * @return throw Mage Exception + */ + protected function _regenerateCallbackPin($methodSession) + { + // Callback request data re-assign + $request = $methodSession->getPaymentReqData(); + $response = $methodSession->getPaymentResData(); + + $responseModel = $this->_helper->getModel('Service_Api_Response'); // Get Novalnet api response model + $response = $responseModel->pinStatusCall( + $request, $response->getTid(), Novalnet_Payment_Model_Config::TRANSMIT_PIN_AGAIN + ); + // Novalnet successful transaction status + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $text = $this->_helper->showException('You will shortly receive an SMS'); + } else { // Novalnet unsuccessful transaction status + $text = $this->_helper->htmlEscape($response->getStatusMessage()); // Status_message + if ($response->getStatus() == Novalnet_Payment_Model_Config::MAXPIN_DISABLE_CODE) { + $this->_helper->unsetMethodSession($this->code); + } + } + + $this->_helper->showException($text, false); + } + + /** + * Validate fraud prevention response process + * + * @param Varien_Object $methodSession + * @return none + */ + public function validateCallbackProcess($methodSession) + { + if ($methodSession->getCallbackSuccessState()) { // Fraud prevention process success state + $paymentCode = ucfirst($this->code); + $callbackPin = 'getCallbackPin' . $paymentCode; + $type = Novalnet_Payment_Model_Config::PIN_STATUS; + $extraOption = '' . $methodSession->$callbackPin() . ''; + + // Verify entered PIN via API request + $responseModel = $this->_helper->getModel('Service_Api_Response'); + $tid = $methodSession->getPaymentResData()->getTid(); + $result = $responseModel->pinStatusCall($methodSession->getPaymentReqData(), $tid, $type, $extraOption); + $callbackTid = 'getCallbackTid' . $paymentCode; + $result->setTid($methodSession->$callbackTid()); + $result->setTestMode($methodSession->getNnTestMode()); + $methodSession->getPaymentResData()->setTidStatus($result->getTidStatus()); + + // Verify the response from Novalnet + if ($result->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $methodSession->setCallbackSuccessState(false); + } else { // Novalnet unsuccessful transaction status + if ($result->getStatus() == Novalnet_Payment_Model_Config::METHOD_DISABLE_CODE) { + $paymentDisableTime = 'setPaymentDisableTime' . $paymentCode; + $this->_helper->getCheckoutSession()->$paymentDisableTime(Mage::getSingleton('core/date')->gmtTimestamp() + (30 * 60)); + } + + $getMessage = $result->getStatusMessage(); + if (!$getMessage) { + $getMessage = $result->getPinStatus(); + $getMessage = isset($getMessage['status_message']) ? $getMessage['status_message'] : ''; + } + + $statusMessage = $this->_helper->htmlEscape($getMessage); + $this->_helper->showException($statusMessage, false); + } + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Api/Gateway.php b/app/code/community/Novalnet/Payment/Model/Service/Api/Gateway.php new file mode 100755 index 0000000..04ad2c1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Api/Gateway.php @@ -0,0 +1,68 @@ +_helper->showException('Server Request URL is Empty', false); + } + + $httpClientConfig = array('maxredirects' => 0); + $client = new Varien_Http_Client($requestUrl, $httpClientConfig); + // Assign post payport params + if ($type == 'XML') { + $client->setUri($requestUrl); + $client->setRawData($requestData)->setMethod(Varien_Http_Client::POST); + } else { + $client->setParameterPost($requestData)->setMethod(Varien_Http_Client::POST); + } + + // Get response from payment gateway + try { + $response = $client->request(); + } catch (Exception $e) { + $this->_helper->showException($e->getMessage(), false); + } + + // Show exception if payment unsuccessful + if (!$response->isSuccessful()) { + $this->_helper->showException($this->_helper->__('Gateway request error: %s', $response->getMessage()), false); + } + + // Convert xml response to array + if ($type == 'XML') { + $result = new Varien_Simplexml_Element($response->getRawBody()); + $response = new Varien_Object($result->asArray()); + } + + return $response; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Api/Request.php b/app/code/community/Novalnet/Payment/Model/Service/Api/Request.php new file mode 100755 index 0000000..00bf4d5 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Api/Request.php @@ -0,0 +1,658 @@ +code = ($code !== null) ? $code : $this->code; + $request = new Varien_Object(); + $this->getVendorInfo($request); // Get Novalnet merchant authentication informations + $this->getBillingInfo($request, $infoObject); // Get customer billing infromations + $this->getCommonInfo($request, $infoObject, $amount); // Get common params for Novalnet payment api request + $this->getPaymentInfo($request); // Get needed Novalnet payment params + return $request; + } + + /** + * Assign Novalnet authentication Data + * + * @param Varien_Object $request + * @return Varien_Object $request + */ + public function getVendorInfo(Varien_Object $request) + { + $testMode = $this->getNovalnetConfig('live_mode', true); // Novalnet payment mode configuration + $request->setVendor($this->vendorId) + ->setAuthCode($this->authcode) + ->setProduct($this->productId) + ->setTariff($this->tariffId) + ->setKey($this->_helper->getPaymentId($this->code)) + ->setTestMode((int)!$testMode); + + $checkoutSession = $this->_helper->getCheckoutSession(); // Get checkout session + if ($checkoutSession->getQuote()->hasNominalItems()) { + $request->setTariff($this->recurringTariffId); + } + + return $request; + } + + /** + * Get end-customer billing informations + * + * @param Varien_Object $request + * @param Varien_Object $info + * @return mixed + */ + public function getBillingInfo(Varien_Object $request, $info) + { + $infoObject = $this->_getInfoObject($info); // Get current payment object informations + $billing = $infoObject->getBillingAddress(); // Get end-customer billing address + $shipping = !$infoObject->getIsVirtual() ? $infoObject->getShippingAddress() : ''; + // Get company param if exist either billing/shipping address + $company = $billing->getCompany() + ? $billing->getCompany() + : ($shipping && $shipping->getCompany() ? $shipping->getCompany() : ''); + $request->setFirstName($billing->getFirstname()) + ->setLastName($billing->getLastname()) + ->setEmail($billing->getEmail() ? $billing->getEmail() : $infoObject->getCustomerEmail()) + ->setCity($billing->getCity()) + ->setZip($billing->getPostcode()) + ->setTel($billing->getTelephone()) + ->setSearchInStreet(1) + ->setStreet(implode(',', $billing->getStreet())) + ->setCountryCode($billing->getCountry()); + + $request = $company ? $request->setCompany($company) : $request; // Set company param if exist + if($billing->getFax()){ + $request->setFax($billing->getFax()); + } + + // Check and assigns shipping details + $this->setShippingDetails($request, $billing, $shipping); + + } + + /** + * Get end-customer shipping informations + * + * @param Varien_Object $request + * @param Varien_Object $info + * @return mixed + */ + public function setShippingDetails(Varien_Object $request, $billing, $shipping) + { + if (!empty($shipping)) { + if (($billing->getFirstname() != $shipping->getFirstname()) || ($billing->getLastname() != $shipping->getLastname()) + || ($billing->getCity() != $shipping->getCity()) || ($billing->getStreet() !== $shipping->getStreet()) + || ($billing->getPostcode() != $shipping->getPostcode()) || ($billing->getCountry() != $shipping->getCountry()) + || ($billing->getTelephone() != $shipping->getTelephone()) + ) { + $request->setSFirstName($shipping->getFirstname()) + ->setSLastName($shipping->getLastname()) + ->setSEmail($request->getEmail()) + ->setSStreet(implode(',', $shipping->getStreet())) + ->setSCity($shipping->getCity()) + ->setSZip($shipping->getPostcode()) + ->setSCountryCode($shipping->getCountryId()) + ->setSTel($shipping->getTelephone()); + // Checks and assigns company parameter + if ($shipping->getCompany()) { + $request->setSCompany($shipping->getCompany()); + } + } else { + $request->setShipAddSab(1); + } + } + } + + /** + * Get common params for Novalnet payment API request + * + * @param Varien_Object $request + * @param Varien_Object $info + * @param int|null $amount + * @return mixed + */ + public function getCommonInfo(Varien_Object $request, $info, $amount = null) + { + $this->getReferenceParams($request); // Get payment reference params like referer id/reference value + $infoObject = $this->_getInfoObject($info); // Get current payment object informations + $amount = $amount ? $amount : $this->_helper->getFormatedAmount($this->_getAmount($info)); + $vendorScriptUrl = Mage::getStoreConfig('novalnet_global/merchant_script/vendor_script_url'); + $request->setAmount($amount) + ->setCurrency($infoObject->getBaseCurrencyCode()) + ->setCustomerNo($this->_helper->getCustomerId()) + ->setLang(strtoupper($this->_helper->getDefaultLanguage())) + ->setRemoteIp($this->_helper->getRealIpAddr()) + ->setSystemIp($this->_helper->getServerAddr()) + ->setSystemUrl($this->_helper->getBaseUrl()) + ->setSystemName('Magento') + ->setSystemVersion($this->_helper->getMagentoVersion() . '-' . $this->_helper->getNovalnetVersion()) + ->setOrderNo($this->getOrderId($info)); + + if ($vendorScriptUrl) { + $request->setNotifyUrl($vendorScriptUrl); // Get vendor script url + } + + if ($this->getNovalnetConfig('paymentaction')) { + $setOnholdPayments = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('onHoldPayments'); + + if (in_array($this->code, $setOnholdPayments) && + (string) $request->getAmount() >= (string) $this->getNovalnetConfig('manual_checking_amount') + ) { + $request->setOnHold(1); // Set payment status as onHold + } + } + } + + /** + * Set additional payment reference params + * + * @param Varien_Object $request + * @return mixed + */ + public function getReferenceParams(Varien_Object $request) + { + $referenceOne = trim(strip_tags($this->getNovalnetConfig('reference_one'))); + // Assign reference value if exist + ($referenceOne) ? $request->setInput1('reference1')->setInputval1($referenceOne) : ''; + $referenceTwo = trim(strip_tags($this->getNovalnetConfig('reference_two'))); + // Assign reference value if exist + ($referenceTwo) ? $request->setInput2('reference2')->setInputval2($referenceTwo) : ''; + $adminUserId = ($this->_helper->checkIsAdmin()) + ? Mage::getSingleton('admin/session')->getUser()->getUserId() : ''; + // Assign admin order reference value if exist + ($adminUserId) ? $request->setInput3('admin_user')->setInputval3($adminUserId) : ''; + } + + /** + * Get order increment id + * + * @param Varien_Object $info + * @return int + */ + public function getOrderId($info) + { + return ($this->_isPlaceOrder($info)) ? $info->getOrder()->getIncrementId() : $this->_getIncrementId(); + } + + /** + * Assign Novalnet payment data + * + * @param Varien_Object $request + * @return none + */ + public function getPaymentInfo(Varien_Object $request) + { + $methodSession = $this->_helper->getMethodSession($this->code); // Get current payment method session + $request->setPaymentType($this->getPaymentType($this->code)); // Set payment type param in payment request + + switch ($this->code) { + case Novalnet_Payment_Model_Config::NN_CC: + $this->getCcFormParams($request, $methodSession); + // Add Credit Card 3D Secure payment process params + if ($methodSession->getNnCcDoRedirect() == 1) { + $this->getCcSecureParams($request); + $request->unsUserVariable_0(); + } + break; + case Novalnet_Payment_Model_Config::NN_SEPA: + $this->getSepaFormParams($request, $methodSession); + // Assign params for SEPA payment guarantee + $helper = Mage::helper('novalnet_payment'); + $company = $helper->getEndUserCompany(); + if ($methodSession->getPaymentGuaranteeFlag() && ($methodSession->getCustomerDob() || $company)) { + $request->setPaymentType(Novalnet_Payment_Model_Config::SEPA_PAYMENT_GUARANTEE_TYPE) + ->setKey(Novalnet_Payment_Model_Config::SEPA_PAYMENT_GUARANTEE_KEY); + if ($methodSession->getCustomerDob()) { + $request->setBirthDate($methodSession->getCustomerDob()); + } + } + + if ($paymentDuration = $this->getNovalnetConfig('sepa_duedate')) { // Retrieves SEPA payment due date + $sepaDueDate = date('Y-m-d', strtotime('+' . $paymentDuration . ' days')); + $request->setSepaDueDate($sepaDueDate); + } + break; + case Novalnet_Payment_Model_Config::NN_INVOICE: + $request->setInvoiceType(Novalnet_Payment_Model_Config::INVOICE_PAYMENT_TYPE) + ->setInvoiceRef('BNR-' . $request->getProduct() . '-' . $request->getOrderNo()); + // Assign invoice payment due date + if ($dueDate = $this->getPaymentDueDate()) { + $request->setDueDate($dueDate); + } + + // Assign params for invoice payment guarantee + $helper = Mage::helper('novalnet_payment'); + $company = $helper->getEndUserCompany(); + if ($methodSession->getPaymentGuaranteeFlag() && ($methodSession->getCustomerDob() || $company)) { + $request->setPaymentType(Novalnet_Payment_Model_Config::INVOICE_PAYMENT_GUARANTEE_TYPE) + ->setKey(Novalnet_Payment_Model_Config::INVOICE_PAYMENT_GUARANTEE_KEY); + + if ($methodSession->getCustomerDob()) { + $request->setBirthDate($methodSession->getCustomerDob()); + } + } + break; + case Novalnet_Payment_Model_Config::NN_PREPAYMENT: + $request->setInvoiceType(Novalnet_Payment_Model_Config::PREPAYMENT_PAYMENT_TYPE) + ->setInvoiceRef('BNR-' . $request->getProduct() . '-' . $request->getOrderNo()); + // Assign prepayment payment due date + if ($dueDate = $this->getPaymentDueDate()) { + $request->setDueDate($dueDate); + } + break; + case Novalnet_Payment_Model_Config::NN_CASHPAYMENT: + // Assign cashpayment due date + if ($dueDate = $this->getPaymentDueDate()) { + $request->setCpDueDate($dueDate); + } + break; + case Novalnet_Payment_Model_Config::NN_PAYPAL: + if ($methodSession->getNnRefTid()) { + $request->setPaymentRef($methodSession->getNnRefTid()); + } else { + if ($methodSession->getNnPaypalSaveAccount()) { + $request->setCreatePaymentRef(1); + } + + $this->getRedirectPaymentParams($request); + } + break; + case Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT: + if ($methodSession->getInvoiceCustomerDob()) { + $request->setBirthDate($methodSession->getInvoiceCustomerDob()); + } + + $request->setInvoiceType(Novalnet_Payment_Model_Config::INVOICE_PAYMENT_TYPE) + ->setInvoiceRef('BNR-'.$request->getProduct().'-'.$request->getOrderNo()) + ->setInstalmentPeriod($this->getNovalnetConfig('instalment_cycle_periods') . 'm') + ->setInstalmentCycles($methodSession->getInvoiceInstalment()); + break; + case Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT: + if ($methodSession->getSepaInstalmentCustomerDob()) { + $request->setBirthDate($methodSession->getSepaInstalmentCustomerDob()); + } + + if ($paymentDuration = $this->getNovalnetConfig('sepa_duedate')) { // Retrieves Instalment SEPA payment due date + $sepaDueDate = date('Y-m-d', strtotime('+' . $paymentDuration . ' days')); + $request->setSepaDueDate($sepaDueDate); + } + + $request->setBankAccountHolder($methodSession->getSepaInstalmentHolder()) + ->setIban($methodSession->getSepaInstalmentIban()) + ->setInstalmentPeriod($this->getNovalnetConfig('instalment_cycle_periods') . 'm') + ->setInstalmentCycles($methodSession->getSepaInstalment()); + break; + case Novalnet_Payment_Model_Config::NN_BANKTRANSFER: + case Novalnet_Payment_Model_Config::NN_IDEAL: + case Novalnet_Payment_Model_Config::NN_EPS: + case Novalnet_Payment_Model_Config::NN_GIROPAY: + case Novalnet_Payment_Model_Config::NN_PRZELEWY: + $this->getRedirectPaymentParams($request); + break; + } + } + + /** + * Get payment form informations + * + * @param Varien_Object $request + * @param Varien_Object $methodSession + * @return none + */ + public function getCcFormParams($request, $methodSession) + { + if ($methodSession->getNnCcTid()) { + $request->setPaymentRef($methodSession->getNnCcTid()); + } else { + if ($this->getNovalnetConfig('cc_shop_type') + && $methodSession->getNnCcSaveCard() + && !$this->_helper->checkIsAdmin() + ) { + $request->setCreatePaymentRef(1); + } + + $request->setPanHash($methodSession->getNnCcHash()) + ->setUniqueId($methodSession->getNnCcUniqId()) + ->setNnIt('iframe'); + } + } + + /** + * Get SEPA form informations + * + * @param Varien_Object $request + * @param Varien_Object $methodSession + * @return none + */ + public function getSepaFormParams($request, $methodSession) + { + if ($methodSession->getNnSepaTid()) { + $request->setPaymentRef($methodSession->getNnSepaTid()); + } else { + if ($methodSession->getSepaSaveAccount() && !$this->_helper->checkIsAdmin() + ) { + $request->setCreatePaymentRef(1); + } + + $request->setBankAccountHolder($methodSession->getSepaHolder()) + ->setIban($methodSession->getSepaIban()); + } + } + + /** + * Get due date for invoice payment + * + * @param none + * @return int + */ + public function getPaymentDueDate() + { + $dueDate = ''; + if ($paymentDuration = trim($this->getNovalnetConfig('payment_duration'))) { + $dueDate = Mage::getSingleton('core/date') + ->gmtDate('Y-m-d', '+' . (int) $paymentDuration . ' days'); + } + + return $dueDate; + } + + /** + * Get Credit Card 3D Secure payment params + * + * @param Varien_Object $request + * @return none + */ + public function getCcSecureParams($request) + { + $request->setUniqid($this->getUniqid()) + ->setSession(session_id()) + ->setImplementation('ENC'); + + if($this->getNovalnetConfig('enforce_3d')) { + $request->setData('enforce_3d',1); + } + $this->getMethodAndUrlInfo($request); + $this->getEncodedParams($request); + } + + /** + * Get redirect payment params + * + * @param Varien_Object $request + * @return none + */ + public function getRedirectPaymentParams($request) + { + $request->setUniqid($this->getUniqid()) + ->setSession(session_id()) + ->setImplementation('ENC'); + $this->getMethodAndUrlInfo($request); + $this->getEncodedParams($request); + } + + /** + * Gets the Unique Id + * + * @return string + */ + public function getUniqid() + { + $randomArray = array('8','7','6','5','4','3','2','1','9','0','9','7','6','1','2','3','4','5','6','7','8','9','0'); + shuffle($randomArray); + return substr(implode($randomArray, ''), 0, 16); + } + + /** + * Retrieve Novalnet payment type + * + * @param string $code + * @return string + */ + public function getPaymentType($code) + { + $arrPaymentType = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('paymentTypes'); + return $arrPaymentType[$code]; + } + + /** + * Get method and url infromations for redirect payments + * + * @param Varien_Object $request + * @return mixed + */ + public function getMethodAndUrlInfo($request) + { + $request->setUserVariable_0(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)) + ->setReturnMethod(Novalnet_Payment_Model_Config::NOVALNET_RETURN_METHOD) + ->setErrorReturnMethod(Novalnet_Payment_Model_Config::NOVALNET_RETURN_METHOD) + ->setReturnUrl($this->_helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_RETURN_URL)) + ->setErrorReturnUrl($this->_helper->getUrl(Novalnet_Payment_Model_Config::GATEWAY_ERROR_RETURN_URL)); + } + + /** + * build process (capture/void/refund) request + * + * @param Varien_Object $payment + * @param string $type + * @param float|NULL $amount + * @return Varien_Object $request + */ + public function buildProcessRequest(Varien_Object $payment, $type, $amount = null) + { + $request = $this->getprocessVendorInfo($payment); // Get Novalnet merchant authentication informations + $request->setRemoteIp($this->_helper->getRealIpAddr()); + + if (in_array($type, array('void', 'capture'))) { // Assign needed capture/void process request params + $getTid = $this->_helper->makeValidNumber($payment->getLastTransId()); + $status = ($type == 'capture') + ? Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + : Novalnet_Payment_Model_Config::PAYMENT_VOID_STATUS; + $request->setTid($getTid) + ->setStatus($status) + ->setEditStatus(true); + } else { // Assign needed refund process request params + // Refund validation for Invoice payment method + $refundTid = $this->_helper->makeValidNumber($payment->getRefundTransactionId()); + $paymentCode = $payment->getMethodInstance()->getCode(); // Get payment method code + + $refundAmount = $this->_helper->getFormatedAmount($amount); // Refund amount in cents + $request->setTid($refundTid) + ->setRefundRequest(true) + ->setRefundParam($refundAmount); + if (in_array($payment->getMethodInstance()->getCode(), array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT)) + && $this->_helper->getFormatedAmount($payment->getOrder()->getBaseGrandTotal()) == $this->_helper->getFormatedAmount($amount)) { + $request->setRefundParam('DEACTIVATE'); + } + + // Get reference value for refund process + $refundRef = Mage::app()->getRequest()->getParam('nn_refund_ref'); + if ($refundRef && !preg_match('/[#%\^<>@$=*!]/', $refundRef)) { + $request->setRefundRef($refundRef); // Add reference param + } + } + + if (in_array($payment->getMethodInstance()->getCode(), array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT))) { + $request->setTid($this->_helper->makeValidNumber($payment->getLastTransId())); + } + + return $request; + } + + /** + * Assign Novalnet authentication Data + * + * @param Varien_Object $payment + * @return Varien_Object $request + */ + public function getprocessVendorInfo($payment) + { + $data = unserialize($payment->getAdditionalData()); // Get payment additional data + $paymentCode = $payment->getMethodInstance()->getCode(); // Get payment method code + $paymentId = $this->_helper->getPaymentId($paymentCode); + + $request = new Varien_Object(); + $request->setVendor(!empty($data['vendor']) ? trim($data['vendor']) : $this->vendorId) + ->setAuthCode(!empty($data['auth_code']) ? trim($data['auth_code']) : $this->authcode) + ->setProduct(!empty($data['product']) ? trim($data['product']) : $this->productId) + ->setTariff(!empty($data['tariff']) ? trim($data['tariff']) : $this->tariffId) + ->setKey(!empty($data['payment_id']) ? trim($data['payment_id']) : $paymentId); + return $request; + } + + /** + * build recurring API process (cancel/suspend/active) request + * + * @param Varien_Object $order + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return Varien_Object $request + */ + public function buildRecurringApiRequest(Varien_Object $order, $profile) + { + $request = new Varien_Object(); + // Get Novalnet merchant authentication informations + $request = $this->getprocessVendorInfo($order->getPayment()); + + if ($profile->getNewState() == 'canceled') { + $getRequest = Mage::app()->getRequest()->getQuery(); + $request->setNnLang(strtoupper($this->_helper->getDefaultLanguage())) + ->setCancelSub(1) + ->setCancelReason($getRequest['reason']) + ->setTid($profile->getReferenceId()) + ->setRemoteIp($this->_helper->getRealIpAddr()); + } elseif (in_array($profile->getNewState(), array('suspended', 'active'))) { + $request = $this->recurringActiveSuspendRequest($order->getPayment(), $profile, $request); + } + + return $request; + } + + /** + * build recurring API process (suspend/active) request + * + * @param Varien_Object $payment + * @param Mage_Payment_Model_Recurring_Profile $profile + * @param Varien_Object $request + * @return Varien_Object $params + */ + public function recurringActiveSuspendRequest(Varien_Object $payment, $profile, $request) + { + $type = $profile->getNewState(); // Get recurring profile state + $periodInfo = $this->getPeriodValues($profile); // Get subscription period frequency and unit + $subsIdRequest = $payment->getAdditionalInformation('subs_id'); // Get subsId + $suspend = (int)($type == 'suspended'); + $pausePeriod = ''; + + if ($suspend != 1) { + $data = unserialize($payment->getAdditionalData()); + $nextSubsCycle = $preNextSubsCycle = Mage::getSingleton('core/date')->gmtDate('Y-m-d', $data['paidUntil']); + $currentDate = Mage::getSingleton('core/date')->gmtDate('Y-m-d'); + + if (strtotime($currentDate) > strtotime($nextSubsCycle)) { + for ($i = 0; $i >= 0; $i++) { + if ($periodInfo['periodUnit'] == 'm') { + $nextSubsCycle = Mage::getSingleton('core/date')->gmtDate( + 'Y-m-d', $nextSubsCycle . '+' . $periodInfo['periodFrequency'] . ' months' + ); + } elseif ($periodInfo['periodUnit'] == 'd') { + $nextSubsCycle = Mage::getSingleton('core/date')->gmtDate( + 'Y-m-d', $nextSubsCycle . '+' . $periodInfo['periodFrequency'] . ' days' + ); + } elseif ($periodInfo['periodUnit'] == 'y') { + $nextSubsCycle = Mage::getSingleton('core/date')->gmtDate( + 'Y-m-d', $nextSubsCycle . '+' . $periodInfo['periodFrequency'] . ' years' + ); + } + + if (strtotime($nextSubsCycle) > strtotime($currentDate)) { + break; + } + } + + $subsCycleOne = new DateTime($preNextSubsCycle); + $subsCycleTwo = new DateTime($nextSubsCycle); + $difference = $subsCycleOne->diff($subsCycleTwo); + + $pausePeriod = $difference->days; + } + } + + $params = ''; + $params .= ''; + $params .= '' . $request->getVendor() . ''; + $params .= '' . $request->getAuthCode() . ''; + $params .= '' . Novalnet_Payment_Model_Config::SUBS_PAUSE . ''; + $params .= '' . $request->getProduct() . ''; + $params .= '' . $profile->getReferenceId() . ''; + $params .= '' . $subsIdRequest . ''; + if (!empty($pausePeriod)) { + $params .= '' . $pausePeriod . ''; + $params .= 'd'; + } + + $params .= '' . $suspend . ''; + $params .= '' . $this->_helper->getRealIpAddr() . ''; + $params .= ''; + + return $params; + } + + /** + * Get subscription period frequency and unit + * + * @param Mage_Payment_Model_Recurring_Profile $profile + * @return string + */ + public function getPeriodValues($profile) + { + $periodFrequency = $profile->getperiodFrequency(); + $periodUnit = $this->_helper->__(ucfirst($profile->getperiodUnit())); + $periodUnitFormat = array( + $this->_helper->__('Day') => 'd', + $this->_helper->__('Month') => 'm', + $this->_helper->__('Year') => 'y' + ); + + if ($periodUnit == 'Semi_month') { + $tariffPeriod = array('periodFrequency' => '14', 'periodUnit' => 'd'); + } elseif ($periodUnit == 'Week') { + $tariffPeriod = array('periodFrequency' => ($periodFrequency * 7), 'periodUnit' => 'd'); + } else { + $tariffPeriod = array( + 'periodFrequency' => $periodFrequency, + 'periodUnit' => $periodUnitFormat[$periodUnit] + ); + } + + return $tariffPeriod; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Api/Response.php b/app/code/community/Novalnet/Payment/Model/Service/Api/Response.php new file mode 100755 index 0000000..725a94a --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Api/Response.php @@ -0,0 +1,982 @@ +getStatus(), + array(Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED, Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS))) { + $order = $payment->getOrder(); // Get payment order + $this->code = $payment->getMethodInstance()->getCode(); // Get payment method code + + // Novalnet payment mode from global configuration + $shopMode = $this->getNovalnetConfig('live_mode', true); + // Get Novalnet payment transaction mode + $testMode = (int)($response->getTestMode() == 1 || $shopMode == 0); + $this->logTransactionStatus($response, $order); // Log Novalnet payment transaction informations + // Log Novalnet payment transaction traces informations + $this->logTransactionTraces($request, $response, $order); + + // Get Novalnet transaction details + $data = $this->getPaymentAddtionaldata($response, $request, $testMode); + $this->saveAdditionalData($order, $data); // Save Novalnet payment additional informations + $this->setRecurringState($response, $order); // Assign recurring profile state if profile exist + $this->paymentAuthorize($order, $response); // Capture the payment based on real transaction status + $this->logAffiliateUserInfo($request); // Log affiliate user information + $statusText = $this->getStatusText($response); // Get payment transaction status message + $this->_helper->getCoreSession()->addSuccess($statusText); + $this->_helper->unsetMethodSession($this->code); + return $this; + } else {// Novalnet unsuccessful transaction status + $statusMessage = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $this->_helper->showException($statusMessage); + } + } + + /** + * Authorize payment + * + * @param Varien_Object $order + * @param Varien_Object $response + * @return none + */ + public function paymentAuthorize($order, $response) + { + $payment = $order->getPayment(); // Get payment object + $transactionId = $response->getTid(); // Get Novalnet transaction id + $payment->setIsTransactionClosed(false)->save(); + + // Capture the payment only if status (original status - tid_status) is 100 + if ($order->canInvoice() + && (!in_array($this->code, array(Novalnet_Payment_Model_Config::NN_PREPAYMENT, Novalnet_Payment_Model_Config::NN_CASHPAYMENT))) + && $response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + $payment->setParentTransactionId($transactionId) + ->setIsTransactionClosed(true) // Close the transaction + ->capture(null) + ->save(); + } + + // Save TID details + $payment->setTransactionId($transactionId) + ->setLastTransId($transactionId) + ->setParentTransactionId(null) + ->save(); + } + + /** + * Log affiliate user details + * + * @param Varien_Object $request + * @return none + */ + public function logAffiliateUserInfo($request) + { + if ($affiliateId = $this->_helper->getCoreSession()->getAffiliateId()) { // Get affiliate user id if exist + $affiliateUserInfo = $this->_helper->getModel('Mysql4_AffiliateUser'); + $affiliateUserInfo->setAffId($affiliateId) + ->setCustomerNo($request->getCustomerNo()) + ->setAffOrderNo($request->getOrderNo()) + ->save(); + $this->_helper->getCoresession()->unsAffiliateId(); + } + } + + /** + * Get Payment method additional informations + * + * @param Varien_Object $response + * @param Varien_Object $request + * @param int $testMode + * @param array + */ + public function getPaymentAddtionaldata($response, $request, $testMode) + { + $data = array('NnTestOrder' => $testMode, 'NnTid' => trim($response->getTid()), + 'vendor' => $request->getVendor(), 'auth_code' => $request->getAuthCode(), + 'product' => $request->getProduct(), 'tariff' => $request->getTariff(), + 'payment_id' => $request->getKey(), 'accessKey' => $this->accessKey, + 'nnLang' => Mage::getSingleton('core/translate')->getLocale() + ); + if (in_array($this->code, array(Novalnet_Payment_Model_Config::NN_INVOICE, Novalnet_Payment_Model_Config::NN_PREPAYMENT, Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT))) { + $amount = Mage::helper('core')->currency($response->getInstalmentCycleAmount() ? $response->getInstalmentCycleAmount() : $response->getAmount(), true, false); + $data['NnNote'] = $this->getInvoicePaymentNote($response); + $data['NnDueDate'] = $response->getDueDate(); + $data['NnNoteAmount'] = 'NN_Amount: ' . $amount; + $data['NnNoteTID'] = $this->getReferenceDetails($response, $request); + } + + if (in_array($request->getKey(), array(Novalnet_Payment_Model_Config::INVOICE_PAYMENT_GUARANTEE_KEY, Novalnet_Payment_Model_Config::SEPA_PAYMENT_GUARANTEE_KEY))) { + $data['NnGuarantee'] = 1; + } + + if ($this->code == Novalnet_Payment_Model_Config::NN_CASHPAYMENT) { + $data['CpDueDate'] = Mage::helper('core')->formatDate($response->getCpDueDate()); + $data['cpCheckoutToken'] = $response->getCpCheckoutToken(); + $strnos = ''; + $cashpaymentStores = array(); + foreach ($response->getData() as $key => $val) { + if (strpos($key, 'nearest_store_title') !== FALSE){ + $strnos++; + } + } + + for ($i = 1; $i <= $strnos; $i++) { + $countryName = !empty($response['nearest_store_country_' . $i]) + ? Mage::getModel('directory/country')->loadByCode($response['nearest_store_country_' . $i])->getName() + : ''; + $cashpaymentStores[] = array( + 'title' => $response['nearest_store_title_' . $i], + 'country' => $countryName, + 'street' => $response['nearest_store_street_'. $i], + 'city' => $response['nearest_store_city_' . $i], + 'zipcode' => $response['nearest_store_zipcode_' . $i] + ); + } + + $data['CashpaymentStores'] = $cashpaymentStores; + } + + if (in_array($this->code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT))) { + $data['InstallPaidAmount'] = $response->getInstalmentCycleAmount(); + $data['InstallDueAmount'] = $this->_helper->getFormatedAmount($request->getAmount(), 'RAW') - $response->getInstalmentCycleAmount(); + $data['PaidInstall'] = $response->getInstalmentCyclesExecuted(); + $data['DueInstall'] = $response->getDueInstalmentCycles(); + $data['NextCycle'] = $response->getNextInstalmentDate(); + $data['InstallCycleAmount'] = $response->getInstalmentCycleAmount(); + + if ($futureInstalment = $response->getFutureInstalmentDates()) { + $futureInstalments = explode('|', $futureInstalment); + foreach ($futureInstalments as $futureInstalment) { + $cycle = strtok($futureInstalment, "-"); + $cycleDate = explode('-', $futureInstalment, 2); + $data['InstalmentDetails'][$cycle] = array('amount' => $response->getInstalmentCycleAmount(), + 'nextCycle' => $cycleDate[1], + 'paidDate' => ($cycle == 1) ? date('Y-m-d') : '', + 'status' => ($cycle == 1) ? 'Paid' : 'Pending', + 'reference' => ($cycle == 1) ? $response->getTid() : ''); + } + } + + $data['InstalmentDetails'][1] = array('amount' => $response->getInstalmentCycleAmount(), + 'nextCycle' => $response->getNextInstalmentDate(), + 'paidDate' => date('Y-m-d'), + 'status' => 'Paid', + 'reference' => $response->getTid()); + } + + return $data; + } + + /** + * Get Novalnet invoice payments bank account details + * + * @param array $response + * @return mixed + */ + public function getInvoicePaymentNote($response) + { + $dueDate = $response->getDueDate() ? Mage::helper('core')->formatDate($response->getDueDate()) : ''; + $note = null; + $note .= 'Due Date: ' . $dueDate . '|NN Account Holder: ' . $response->getInvoiceAccountHolder(); + $note .= '|IBAN: ' . $response->getInvoiceIban(); + $note .= '|BIC: ' . $response->getInvoiceBic(); + $note .= '|NN_Bank: ' . $response->getInvoiceBankname() . ' ' . $response->getInvoiceBankplace(); + return $note; + } + + /** + * Get Novalnet invoice payment reference details + * + * @param Varien_Object $response + * @param Varien_Object $request + * @return string + */ + public function getReferenceDetails($response, $request) + { + $transactionId = trim($response->getTid()); + $note = "NN_Reference_desc1:|NN_Reference1:TID $transactionId"; + if (!$response->getInstalmentCycleAmount()) { + $invoiceRef = $request->getInvoiceRef(); + $note .= "|NN_Reference2:$invoiceRef"; + } + + return $note; + } + + /** + * Remove sensitive data form Novalnet request + * + * @param Varien_Object $request + * @param string $paymentCode + * @return Varien_Object $request + */ + public function removeSensitiveData($request, $paymentCode) + { + if ($paymentCode) { + switch ($paymentCode) { + case Novalnet_Payment_Model_Config::NN_CC: + $request->unsPanHash() + ->unsUniqueId(); + break; + case Novalnet_Payment_Model_Config::NN_SEPA: + $request->unsBankAccountHolder() + ->unsIban(); + break; + } + } + + return $request; + } + + /** + * Save payment additional informations + * + * @param Varien_Object $order + * @param array $data + * @return none + */ + public function saveAdditionalData($order, $data) + { + $payment = $order->getPayment(); // Get payment object + // Save additional transaction informations + $payment->setIsTransactionClosed(false) + ->setAdditionalData(serialize($data)) + ->save(); + $order->setPayment($payment); + $order->save(); + } + + /** + * Save payment informations + * + * @param Varien_Object $order + * @param Varien_Object $response + * @return none + */ + public function capturePayment($order, $response) + { + $payment = $order->getPayment(); // Get payment object + $paymentCode = $payment->getMethodInstance()->getCode(); // Payment method code + $transactionId = $response->getTid(); // Get Novalnet transaction id + // Save TID details + $payment->setTransactionId($transactionId) + ->setLastTransId($transactionId) + ->setParentTransactionId(null); + // Capture the payment only if status (original status - tid_status) is 100 + if ($order->canInvoice() + && (!in_array($paymentCode, array(Novalnet_Payment_Model_Config::NN_PREPAYMENT, Novalnet_Payment_Model_Config::NN_CASHPAYMENT))) + && $response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + $captureMode = (version_compare($this->_helper->getMagentoVersion(), '1.6', '<')) ? false : true; + $payment->setTransactionId($transactionId) // Add capture text to make the new transaction + ->setIsTransactionClosed($captureMode) // Close the transaction + ->capture(null); + } + + $payment->save(); + $order->setPayment($payment)->save(); + + if (in_array($response->getTidStatus(), array(85, 91, 98, 99))) { + $payment->setTransactionId($transactionId) + ->setIsTransactionClosed(false); + $transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, null, false); + $transaction->setParentTxnId(null) + ->save(); + } + } + + /** + * Get response status message + * + * @param Varien_Object $result + * @return string + */ + public function getStatusText(Varien_Object $result) + { + return $result->getStatusMessage() + ? $result->getStatusMessage() + : ($result->getStatusDesc() + ? $result->getStatusDesc() + : ($result->getStatusText() ? $result->getStatusText() : $this->_helper->__('successful')) + ); + } + + /** + * Get response status message for failure payments + * + * @param Varien_Object $result + * @return string + */ + public function getUnSuccessPaymentText(Varien_Object $result) + { + return $result->getStatusMessage() + ? $result->getStatusMessage() + : ($result->getStatusDesc() + ? $result->getStatusDesc() + : ($result->getStatusText() + ? $result->getStatusText() + : $this->_helper->__('Payment was not successfull') + ) + ); + } + + /** + * Save canceled payment transaction + * + * @param Varien_Object $response + * @param Varien_Object $order + * @param int $testMode + * @return none + */ + public function saveCanceledOrder($response, $order, $testMode) + { + $payment = $order->getPayment(); + $statusMessage = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $payStatus = "" . $this->_helper->__('Payment Failed') . + " - " . $statusMessage . ""; + $data = unserialize($payment->getAdditionalData()); + $data['NnTid'] = $response->getTid(); + $data['NnTestOrder'] = $testMode; + $data['NnComments'] = empty($data['NnComments']) ? $payStatus : $data['NnComments'] . '
' . $payStatus; + $payment->setLastTransId($response->getTid()) + ->setAdditionalData(serialize($data)) + ->save(); + $order->registerCancellation($statusMessage) + ->save(); + Mage::dispatchEvent('sales_order_payment_void', array('payment' => $payment)); + } + + /** + * Checking Novalnet response data for redirect payments + * + * @param Varien_Object $response + * @param Varien_Object $order + * @return boolean + */ + public function checkReturnedData($response, $order) + { + $status = false; + $payment = $order->getPayment(); // Get payment object + $paymentObj = $payment->getMethodInstance(); // Get payment method instance + $this->code = $paymentObj->getCode(); // Get payment method code + $this->_helper->getCheckout()->getQuote()->setIsActive(true)->save(); + + // Unhold an order + if ($order->canUnhold()) { + $order->unhold()->save(); + } + + $checkHash = $this->checkHash($response); // Validate hash value if exist + $this->getDecodedParams($response); // Get decoded payment params if exist + $shopMode = $this->getNovalnetConfig('live_mode', true); // Novalnet payment mode from global configuration + $testMode = (int)($response->getTestMode() == 1 || $shopMode == 0); // Get Novalnet payment mode + + if (!$checkHash) { // Cancel the order when hash value mismatched + $response->setStatusMessage($this->_helper->__('checkHash failed')); + $this->saveCanceledOrder($response, $order, $testMode); // Cancel the order for failure transaction + $this->_helper->getCoreSession()->addError($response->getStatusMessage()); + return false; + } + + $request = $this->_helper->getMethodSession($this->code)->getPaymentReqData(); // Get payment request params + $this->logTransactionStatus($response, $order); // Log Novalnet payment transaction informations + + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + || $response->getTidStatus() == Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS + ) { // Novalnet successful transaction status + $successActionFlag = $this->code . '_successAction'; + if ($payment->getAdditionalInformation($successActionFlag) != 1) { + $payment->setAdditionalInformation($successActionFlag, 1)->save(); + // Assign recurring profile state if profile exist + $this->setRecurringState($response, $order); + // save payment additional informations + $data = array('NnTestOrder' => $testMode, 'NnTid' => trim($response->getTid()), + 'vendor' => $response->getVendor(), + 'auth_code' => $response->getAuthCode(), + 'product' => $response->getProduct(), + 'tariff' => $response->getTariff(), + 'payment_id' => $request->getKey(), 'accessKey' => $this->accessKey, + 'nnLang' => Mage::getSingleton('core/translate')->getLocale() + ); + $paidUntil = $response->getNextSubsCycle() + ? $response->getNextSubsCycle() + : ($response->getPaidUntil() ? $response->getPaidUntil() : ''); + $data['paidUntil'] = $paidUntil ? Mage::helper('core')->formatDate($paidUntil) : ''; + $this->saveAdditionalData($order, $data); + // save transaction informations to order + $this->saveSuccessOrder($order, $request, $response); + } + + $status = true; + } else { // Novalnet unsuccessful transaction status + $this->setRecurringState($response, '', 'canceled'); // Assign recurring profile state if profile exist + $this->saveCanceledOrder($response, $order, $testMode); // Cancel the order for failure transaction + $statusMessage = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $this->_helper->getCoreSession()->addError($statusMessage); + $status = false; + } + + $this->_helper->unsetMethodSession($this->code); // Unset payment method session + Mage::unregister('payment_code'); // Unregister the payment code + $order->save(); + return $status; + } + + /** + * validate the Novalnet response and save the order + * + * @param Varien_Object $order + * @param Varien_Object $request + * @param Varien_Object $response + * @return none + */ + public function saveSuccessOrder($order, $request, $response) + { + $payment = $order->getPayment(); // Get payment object + $paymentObj = $payment->getMethodInstance(); // Get payment method instance + $this->code = $paymentObj->getCode(); + $this->capturePayment($order, $response); // Capture the transaction + $this->logAffiliateUserInfo($request); // Log affiliate user information + if($this->code == Novalnet_Payment_Model_Config::NN_CC) { + $orderStatus = $this->getNovalnetConfig('order_status') + ? $this->getNovalnetConfig('order_status') + : Mage_Sales_Model_Order::STATE_PROCESSING; + } else { + $orderStatus = $this->getNovalnetConfig('order_status_after_payment') + ? $this->getNovalnetConfig('order_status_after_payment') + : Mage_Sales_Model_Order::STATE_PROCESSING; + } + if (in_array( + $response->getTidStatus(), array(Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS, + Novalnet_Payment_Model_Config::PAYPAL_ONHOLD_STATUS, + Novalnet_Payment_Model_Config::PRZELEWY_PENDING_STATUS) + )) { + $orderStatus = $this->getNovalnetConfig('order_status') + ? $this->getNovalnetConfig('order_status') : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; + + if ($response->getTidStatus() == Novalnet_Payment_Model_Config::PAYPAL_ONHOLD_STATUS) { + $orderStatus = Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/order_status', + $order->getStoreId() + ); + } + } elseif ($response->getTidStatus() == Novalnet_Payment_Model_Config::CC_ONHOLD_STATUS) { + $orderStatus = Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/order_status', + $order->getStoreId() + ); + } + + $message = $this->_helper->__('Customer successfully returned from Novalnet'); + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $orderStatus, $message, true)->save(); + $statusText = $this->getStatusText($response); // Get payment response status text + $this->_helper->getCoreSession()->addSuccess($statusText); + } + + /** + * Save the failure transaction + * + * @param Varien_Object $response + * @param Varien_Object $order + * @return none + */ + public function checkErrorReturnedData($response, $order) + { + $payment = $order->getPayment(); // Get payment object + $this->code = $payment->getMethodInstance()->getCode(); // Get payment method code + $this->_helper->getCheckout()->getQuote()->setIsActive(false)->save(); + $this->getDecodedParams($response); // Get decoded payment data + $shopMode = $this->getNovalnetConfig('live_mode', true); // Novalnet payment mode from global configuration + $testMode = (int)($response->getTestMode() == 1 || $shopMode == 0); // Get Novalnet payment mode + //Unhold an order + if ($order->canUnhold()) { + $order->unhold()->save(); + } + + // Assign recurring profile state if profile exist + $this->setRecurringState($response, '', 'canceled'); + + // Cancel the order + $errorActionFlag = $this->code . '_errorAction'; + if ($payment->getAdditionalInformation($errorActionFlag) != 1) { + $this->logTransactionStatus($response, $order); // Log Novalnet payment transaction informations + $payment->setAdditionalInformation($errorActionFlag, 1); // Get payment request params + $this->saveCanceledOrder($response, $order, $testMode); // Cancel the order for failure transaction + $statusMessage = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $this->_helper->getCoreSession()->addError($statusMessage); + $this->_helper->unsetMethodSession($this->code); // Unset payment method session + Mage::unregister('payment_code'); // Unregister the payment code + } + } + + /** + * Set recurring profile state + * + * @param Varien_Object $response + * @param Varien_Object|null $order + * @param string|null $state + * @return none + */ + public function setRecurringState($response, $order, $state = 'Active') + { + $profileId = $response->hasProfileId() + ? $response->getProfileId() + : ($response->hasInput4() && $response->getInput4() == 'profile_id' ? $response->getInputval4() : ''); + + if ($profileId) { + $profile = Mage::getModel('sales/recurring_profile')->load($profileId, 'profile_id'); + + if ($state == 'Active') { + $payment = $order->getPayment(); + $recurringModel = $this->_helper->getModel('Recurring_Payment'); + $message = $recurringModel->createIpnComment($response->getTidStatus(), $order); + $payment->setPreparedMessage($message) + ->setAdditionalInformation('subs_id', $response->getSubsId())->save(); + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE); + } else { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED); + } + + $profile->setReferenceId($response->getTid())->save(); + } + } + + /** + * Log Novalnet transaction status data + * + * @param Varien_Object $response + * @param Varien_Object $order + * @return none + */ + public function logTransactionStatus($response, $order) + { + $amount = str_replace(array('.', ','), '', $response->getAmount()); // Get amount + $maskedAccountInfo = $this->saveMaskedAccountInfo($response); // Get masked card/account data + $transactionStatus = $this->_helper->getModel('Mysql4_TransactionStatus'); // Get transaction status model + $paymentCode = $order->getPayment()->getMethodInstance()->getCode(); // Get payment method code + $transactionStatus->setTransactionNo(trim($response->getTid())) + ->setOrderId($order->getIncrementId()) + ->setTransactionStatus($response->getTidStatus()) + ->setNcNo($response->getNcNo()) + ->setCustomerId($order->getCustomerId()) + ->setPaymentName($paymentCode) + ->setAmount($amount) + ->setRemoteIp($this->_helper->getRealIpAddr()) + ->setStoreId($order->getStoreId()) + ->setShopUrl($this->_helper->getBaseUrl()) + ->setCreatedDate($this->_helper->getCurrentDateTime()) + ->setNovalnetAccDetails($maskedAccountInfo) + ->setReferenceTransaction($this->refTransaction) + ->save(); + } + + /** + * Get masked card/account data + * + * @param Varien_Object $response + * @return array $maskedInfo + */ + public function saveMaskedAccountInfo($response) + { + $maskedInfo = ''; + $methodSession = $this->_helper->getMethodSession($this->code); + $this->refTransaction = 1; + + if ($this->code == Novalnet_Payment_Model_Config::NN_CC + && $methodSession->getNnCcSaveCard() + && $this->getNovalnetConfig('cc_shop_type') + && !$this->_helper->checkIsAdmin() + && in_array($response->getTidStatus(), array(100, 98)) + ) { + $this->refTransaction = (int)(bool)($methodSession->getNnCcTid()); + $maskedInfo = $this->getMaskedCardInfo($response); // Get masked card data + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_SEPA + && !$this->_helper->checkIsAdmin() + && $methodSession->getSepaSaveAccount() + && $methodSession->getPaymentReqData()->hasIban() + && in_array($response->getTidStatus(), array(100, 99, 75)) + ) { + $this->refTransaction = (int)(bool)($methodSession->getNnSepaTid()); + $maskedInfo = $this->getMaskedAccountInfo($response, $methodSession); // Get masked account data + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_PAYPAL + && $this->getNovalnetConfig('paypal_shop_type') + && in_array($response->getTidStatus(), array(100, 90, 85)) + ) { + $this->refTransaction = (int)(bool)($methodSession->getNnRefTid()); + $transAccInfo = array( + 'paypal_tid' => $response->getPaypalTransactionId(), + 'nn_tid' => $response->getTid() + ); + $maskedInfo = base64_encode(serialize($transAccInfo)); + } + + return $maskedInfo; + } + + /** + * Get masked card data + * + * @param Varien_Object $response + * @return string $maskedCardInfo + */ + public function getMaskedCardInfo($response) + { + $maskedCardInfo = array( + 'card_type' => $response->getCcCardType(), + 'card_holder' => $response->getCcHolder(), + 'cc_no' => $response->getCcNo(), + 'exp_month' => $response->getCcExpMonth(), + 'exp_year' => $response->getCcExpYear(), + 'nn_tid' => $response->getTid(), + 'nn_amount' => $response->getAmount() + ); + return base64_encode(serialize($maskedCardInfo)); + } + + /** + * Get masked account data + * + * @param Varien_Object $response + * @param Varien_Object $methodSession + * @return string $maskedAccountInfo + */ + public function getMaskedAccountInfo($response, $methodSession) + { + $maskedAccountInfo = array( + 'account_holder' => $response->getBankaccountHolder(), + 'iban' => $response->getIban(), + 'nn_tid' => $response->getTid(), + 'nn_amount' => $response->getAmount() + ); + return base64_encode(serialize($maskedAccountInfo)); + } + + /** + * Log Novalnet payment response data + * + * @param Varien_Object $request + * @param Varien_Object $response + * @param Varien_Object $order + * @param string $transactionId + * @return none + */ + public function logTransactionTraces($request, $response, $order, $transactionId = null) + { + $transactionId = ($transactionId != null) ? $transactionId : $response->getTid(); // Novalnet transaction id + // Remove the sensitive data from payment request + $request = $this->removeSensitiveData($request, $order->getPayment()->getMethodInstance()->getCode()); + $transactionTraces = $this->_helper->getModel('Mysql4_TransactionTraces'); // Get transaction traces model + $transactionTraces->setTransactionId(trim($transactionId)) + ->setOrderId($order->getIncrementId()) + ->setRequestData(base64_encode(serialize($request->getData()))) + ->setResponseData(base64_encode(serialize($response->getData()))) + ->setCustomerId($order->getCustomerId()) + ->setStatus($response->getStatus()) + ->setStoreId($order->getStoreId()) + ->setShopUrl($request->getSystemUrl()) + ->setCreatedDate($this->_helper->getCurrentDateTime()) + ->save(); + } + + /** + * Send process (capture/void/refund) request + * + * @param Varien_Object $request + * @param Varien_Object $payment + * @param string $type + * @param float|NULL $amount + * @return none + */ + public function postProcessRequest($request, $payment, $type, $amount = null) + { + $paymentObj = $payment->getMethodInstance(); // Get payment method instance + $this->code = $paymentObj->getCode(); // Get payment method code + $response = $paymentObj->postRequest($request); // send process request to Novalnet gateway + // log payment capture traces + $this->logTransactionTraces($request, $response, $payment->getOrder(), $request->getTid()); + // set profile state + $nominalItem = $this->_helper->checkNominalItem($payment->getOrder()); + if ($nominalItem && $response->getTidStatus() == Novalnet_Payment_Model_Config::PAYMENT_VOID_STATUS + ) { + $profile = Mage::getModel('sales/recurring_profile')->load($request->getTid(), 'reference_id'); + if ($profile->hasReferenceId()) { + $profile->setState('canceled')->save(); // Set profile status as canceled + } + } + + // Novalnet successful transaction status + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + if ($type == 'capture' || $type == 'void') { + // get current payment status + $transactionId = $this->_helper->makeValidNumber($payment->getLastTransId()); // payment transaction id + $transactionStatusModel = $this->_helper->getModel('Mysql4_TransactionStatus'); + $transactionStatus = $transactionStatusModel->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); + + if ($type == 'capture') { + $data = unserialize($payment->getAdditionalData()); + if ($response->getInstalmentCyclesExecuted()) { + $data['PaidInstall'] = $response->getInstalmentCyclesExecuted(); + $data['DueInstall'] = $response->getDueInstalmentCycles(); + $data['NextCycle'] = $response->getNextInstalmentDate(); + if ($futureInstalment = $response->getFutureInstalmentDates()) { + $futureInstalments = explode('|', $futureInstalment); + foreach ($futureInstalments as $futureInstalment) { + $cycle = strtok($futureInstalment, "-"); + $cycleDate = explode('-', $futureInstalment, 2); + $data['InstalmentDetails'][$cycle] = array('amount' => $data['InstallPaidAmount'], + 'nextCycle' => $cycleDate[1], + 'paidDate' => ($cycle == 1) ? date('Y-m-d') : '', + 'status' => ($cycle == 1) ? 'Paid' : 'Pending', + 'reference' => ($cycle == 1) ? $request->getTid() : ''); + } + } + + $data['InstalmentDetails'][1]['nextCycle'] = $response->getNextInstalmentDate(); + } + + if ($payment->getMethodInstance()->getCode() == Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT + && $response->getDueDate()) { + $formatDate = Mage::helper('core')->formatDate($response->getDueDate()); + $note = explode('|', $data['NnNote']); + $note[0] = 'Due Date: ' . $formatDate; + $data['NnNote'] = implode('|', $note); + $data['NnDueDate'] = $response->getDueDate(); + } + + $payment->setAdditionalData(serialize($data)); + } + + // set payment transaction informations + $this->saveProcessTransInfo($payment, $paymentStatus, $request, $type); + // reset payment transaction status + $transactionStatus->setTransactionStatus($response->getTidStatus()); + if ($this->code == Novalnet_Payment_Model_Config::NN_PAYPAL) { + if ($this->getNovalnetConfig('paypal_shop_type') && $response->getPaypalTransactionId()) { + $transAccInfo = array( + 'paypal_tid' => $response->getPaypalTransactionId(), + 'nn_tid' => $request->getTid() + ); + $transactionStatus->setNovalnetAccDetails(base64_encode(serialize($transAccInfo))) + ->setReferenceTransaction(0); + } + + if ($response->getTidStatus() == Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS) { + $coreSession = $this->_helper->getCoreSession(); + $coreSession->setPaypalOnholdFlag(1); + } + } + + $transactionStatus->save(); + } else { + // set payment refund transaction informations + $this->saveRefundTransInfo($payment, $amount, $request, $response); + } + } else { // Novalnet unsuccessful transaction status + $statusMessage = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $this->_helper->showException($statusMessage); + } + } + + /** + * Verify the process (capture/void) response + * + * @param Varien_Object $payment + * @param int $paymentStatus + * @param Varien_Object $request + * @param string $type + * @return none + */ + public function saveProcessTransInfo($payment, $paymentStatus, $request, $type) + { + $transactionId = $this->_helper->makeValidNumber($payment->getLastTransId()); // Novalnet transaction id + $magentoVersion = $this->_helper->getMagentoVersion(); // Get installed Magento shop system version + // Save additional informations + $data = unserialize($payment->getAdditionalData()); + $data[$type . 'Tid'] = $request->getTid(); + $data[$type . 'CreateAt'] = $this->_helper->getCurrentDateTime(); + $payment->setAdditionalData(serialize($data))->save(); + + if ($type == 'capture' && $paymentStatus != Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { // Novalnet successful transaction status + // Make capture transaction open for lower versions to make refund + if (version_compare($magentoVersion, '1.6', '<')) { + $payment->setIsTransactionClosed(false)->save(); + } + } elseif ($type == 'void') { + // Save void transaction information + $payment->setTransactionId($transactionId) + ->setLastTransId($transactionId) + ->save(); + } + } + + /** + * Save refund additional transaction information + * + * @param Varien_Object $payment + * @param float $amount + * @param Varien_Object $request + * @param Varien_Object $response + * @return none + */ + public function saveRefundTransInfo($payment, $amount, $request, $response) + { + $order = $payment->getOrder(); // Get order object + $parentTxnId = $this->_helper->makeValidNumber($payment->getRefundTransactionId()); // Get refund transaction id + $childTid = $response->hasTid() ? trim($response->getTid()) : ''; // Get child tid if exist + if (!$childTid) { // Save transaction information for full refund + $transactionStatusModel = $this->_helper->getModel('Mysql4_TransactionStatus'); + $transactionStatus = $transactionStatusModel->loadByAttribute('transaction_no', $parentTxnId); + $transactionStatus->setTransactionStatus($response->getTidStatus())->save(); + } + + // Save payment refund transaction additional information + $refundTid = !empty($childTid) ? $childTid : $payment->getLastTransId() . '-refund'; + $data = unserialize($payment->getAdditionalData()); + $data['fullRefund'] = (bool)((string) $order->getBaseGrandTotal() == (string) $amount); + $data = $this->getRefundTidInfo($amount, $data, $refundTid, $parentTxnId); + $payment->setTransactionId($refundTid) + ->setLastTransId($refundTid) + ->setAdditionalData(serialize($data)); + + // Make capture transaction open for lower versions to make refund + if (version_compare($this->_helper->getMagentoVersion(), '1.6', '<')) { + $payment->setIsTransactionClosed(true) // refund initiated by merchant + ->setShouldCloseParentTransaction(!$order->canCreditmemo()); + } + + $payment->save(); + + // Save refund child transaction informations + if ($childTid) { + $this->saveChildRefundTransInfo($order, $request, $response); + } + } + + /** + * Get refund transaction information + * + * @param float $amount + * @param array $data + * @param int $refundTid + * @param int $parentTxnId + * @return array + */ + public function getRefundTidInfo($amount, $data, $refundTid, $parentTxnId) + { + $refundAmount = Mage::helper('core')->currency($amount, true, false); + if (!isset($data['refunded_tid'])) { + $refundedTid = array('refunded_tid' => array($refundTid => array( + 'reftid' => $refundTid, + 'refamount' => $refundAmount, + 'reqtid' => $parentTxnId + ))); + $data = array_merge($data, $refundedTid); + } else { + $data['refunded_tid'][$refundTid]['reftid'] = $refundTid; + $data['refunded_tid'][$refundTid]['refamount'] = $refundAmount; + $data['refunded_tid'][$refundTid]['reqtid'] = $parentTxnId; + } + + return $data; + } + + /** + * Save refund child transaction information + * + * @param Varien_Object $order + * @param Varien_Object $request + * @param Varien_Object $response + * @return none + */ + public function saveChildRefundTransInfo($order, $request, $response) + { + // Refund child transaction information log + $transactionStatus = $this->_helper->getModel('Mysql4_TransactionStatus'); + $transactionStatus->setTransactionNo(trim($response->getTid())) + ->setOrderId($order->getIncrementId()) + ->setTransactionStatus($response->getTidStatus()) + ->setCustomerId($order->getCustomerId()) + ->setRemoteIp($this->_helper->getRealIpAddr()) + ->setShopUrl($this->_helper->getBaseUrl()) + ->setPaymentName($order->getPayment()->getMethodInstance()->getCode()) + ->setAmount($request->getRefundParam()) + ->setStoreId($order->getStoreId()) + ->setReferenceTransaction(1) + ->setCreatedDate($this->_helper->getCurrentDateTime()) + ->save(); + } + + /** + * Send recurring process (cancel/re-active/suspend) request + * + * @param Varien_Object $order + * @param string $type + * @param Varien_Object $request + * @return none + */ + public function postRecurringApiRequest($order, $type, $request) + { + $payment = $order->getPayment(); // Get payment object + $paymentObj = $payment->getMethodInstance(); // Get payment method instance + $data = unserialize($payment->getAdditionalData()); + + if ($type == 'canceled') { // For subscription cancel process + $response = $paymentObj->postRequest($request); + $data['subsCancelReason'] = $request->getCancelReason(); + $payment->setAdditionalData(serialize($data))->save(); + } elseif ($type == 'suspended' || $type == 'active') { // For subscription suspend/re-active process + $gatewayModel = $this->_helper->getModel('Service_Api_Gateway'); // Get Novalnet gateway model + $payportUrl = $this->_helper->getPayportUrl('infoport'); // Get Novalnet payport url + $response = $gatewayModel->payportRequestCall($request, $payportUrl, 'XML'); + // Convert xml request to array for transaction traces log + $xmlRequest = simplexml_load_string($request); + $decodedRequest = json_decode(json_encode($xmlRequest), true); + $request = new Varien_Object($decodedRequest['info_request']); + if ($type == 'active') { + $data['paidUntil'] = $response->getNextSubsCycle() + ? Mage::helper('core')->formatDate($response->getNextSubsCycle()) : ''; + $payment->setAdditionalData(serialize($data))->save(); + } + } + + // Log Novalnet payment transaction traces informations + $this->logTransactionTraces($request, $response, $order, $request->getTid()); + + if ($response->getStatus() != Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $statusText = $this->getUnSuccessPaymentText($response); // Get payment transaction status message + $this->_helper->showException($statusText, false); + } + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Service/Validate/PaymentCheck.php b/app/code/community/Novalnet/Payment/Model/Service/Validate/PaymentCheck.php new file mode 100755 index 0000000..fe17446 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Service/Validate/PaymentCheck.php @@ -0,0 +1,372 @@ +validateBasicParams() + || !$this->checkOrdersCount() + || !$this->checkCustomerAccess() + || (!empty($quote) && !$quote->hasNominalItems() && !$quote->getGrandTotal()) + ) { + return false; + } + + return true; + } + + /** + * Validate Novalnet basic params + * + * @param none + * @return boolean + */ + public function validateBasicParams() + { + return (bool)($this->getNovalnetConfig('public_key', true)); + } + + /** + * Check orders count by customer id + * + * @param none + * @return boolean + */ + public function checkOrdersCount() + { + // Load orders by customer id + $customerId = $this->_helper->getCustomerId(); + $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customerId); + $ordersCount = $orders->count(); + // Get orders count from payment configuration + $minOrderCount = $this->getNovalnetConfig('orders_count'); + return (bool)($ordersCount >= trim($minOrderCount)); + } + + /** + * Check whether current user have access to process the payment + * + * @param none + * @return boolean + */ + public function checkCustomerAccess() + { + // Excluded customer groups from payment configuration + $excludedGroups = $this->getNovalnetConfig('user_group_excluded'); + $excludedGroupsLength = strlen($excludedGroups); + + if (!$this->_helper->checkIsAdmin() && $excludedGroupsLength) { + $excludedGroups = explode(',', $excludedGroups); + $customerGroupId = $this->_helper->getCustomerSession()->getCustomerGroupId(); + return !in_array($customerGroupId, $excludedGroups); + } + + return true; + } + + /** + * validate Novalnet params to proceed checkout + * + * @param Varien_Object $info + * @return boolean + */ + public function validateNovalnetParams($info) + { + if (!$this->validateBasicParams()) { + $this->_helper->showException('Basic parameter not valid.'); + return false; + } elseif (!$this->validateBillingInfo($info)) { + $this->_helper->showException('Customer name/email fields are not valid'); + return false; + } + + return true; + } + + /** + * Validate billing information + * + * @param Varien_Object $info + * @return boolean + */ + public function validateBillingInfo($info) + { + $request = new Varien_Object(); + $requestModel = $this->_helper->getModel('Service_Api_Request'); + $requestModel->getBillingInfo($request, $info); + + if (!$this->validateEmail($request->getEmail()) || !$request->getFirstName() || !$request->getLastName() + ) { + return false; + } + + return true; + } + + /** + * validate Novalnet form data + * + * @param none + * @return throw Mage Exception|none + */ + public function validateFormInfo() + { + $methodSession = $this->_helper->getMethodSession($this->code); + + if ($this->code == Novalnet_Payment_Model_Config::NN_SEPA) { + // Validate the Direct Debit SEPA form data + if ($methodSession->getSepaNewForm() + && (!$methodSession->getSepaHolder() || !$methodSession->getSepaIban()) + ) { + $this->_helper->showException('Your account details are invalid'); + } + // Verify the guarantee payment informations + $this->_validateGuaranteeInfo($methodSession); + } else if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE) { + // Verify the guarantee payment informations + $this->_validateGuaranteeInfo($methodSession); + } else if ($this->code == Novalnet_Payment_Model_Config::NN_CC) { + // Validate the Credit Card form data + if (!$methodSession->getNnCcTid() + && (!$methodSession->getNnCcHash() || !$methodSession->getNnCcUniqId()) + ) { + $this->_helper->showException('Your credit card details are invalid'); + } + } else if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT || $this->code == Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT) { + // Verify the guarantee payment informations + $this->_validateGuaranteeInfo($methodSession); + } + } + + /** + * Verify the guarantee payment informations + * + * @param Varien_Object $methodSession + * @return none + */ + private function _validateGuaranteeInfo($methodSession) + { + if ($methodSession->getGuaranteeErrorFlag()) { + $this->_helper->showException( + $methodSession->getGuaranteeErrorMessage() + ); + } + + // Validate DOB + if ($methodSession->getPaymentGuaranteeFlag() + || (in_array($this->code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT)))) { + if ($this->code == Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT) { + $customerDob = (string) $methodSession->getSepaInstalmentCustomerDob(); + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT) { + $customerDob = (string) $methodSession->getInvoiceCustomerDob(); + } else { + $customerDob = (string) $methodSession->getCustomerDob(); + } + + if ($customerDob && !$this->validateBirthDate($customerDob)) { + $methodSession->unsPaymentGuaranteeFlag(); + if (!$this->getNovalnetConfig('payment_guarantee_force')) { + $this->_helper->showException('You need to be at least 18 years old'); + } + } + } + } + + /** + * Verify the payment method values + * + * @param null + * @return null + */ + public function checkMethodSession() + { + if (!$this->_helper->checkIsAdmin()) { + $checkoutSession = $this->_helper->getCheckoutSession(); + $customerSession = $this->_helper->getCustomerSession(); + $previousPaymentCode = $checkoutSession->getNnPaymentCode(); + + // Unset payment method session (for pre-select Novalnet payment) + $paymentCode = $checkoutSession->getQuote()->getPayment()->getMethod(); + if ($paymentCode && $previousPaymentCode && $paymentCode != $previousPaymentCode + ) { + $this->_helper->unsetMethodSession($previousPaymentCode); + } + + $paymentSucess = $this->getNovalnetConfig('payment_last_success', true); + if (empty($paymentCode) && $customerSession->isLoggedIn() && $paymentSucess + ) { + $this->getLastSuccessOrderMethod($customerSession->getId(), $checkoutSession); + } + } + } + + /** + * Get last successful payment method + * + * @param int $customerId + * @param Mage_Checkout_Model_Session $checkoutSession + */ + public function getLastSuccessOrderMethod($customerId, $checkoutSession) + { + $tablePrefix = Mage::getConfig()->getTablePrefix(); + $orderTable = $tablePrefix . 'sales_flat_order'; + $onCondition = "main_table.parent_id = $orderTable.entity_id"; + $orderCollection = Mage::getModel('sales/order_payment')->getCollection() + ->addAttributeToSort('created_at', 'DESC') + ->addFieldToFilter('customer_id', $customerId) + ->addFieldToFilter('method', array('like' => '%novalnet%')) + ->addFieldToSelect('method') + ->setPageSize(1); + $orderCollection->getSelect()->join($orderTable, $onCondition); + $getSize = $orderCollection->getSize(); + if ($getSize > 0) { + foreach ($orderCollection as $order): + $paymentMethod = $order->getMethod(); + endforeach; + $checkoutSession->getQuote()->getPayment()->setMethod($paymentMethod); + } + } + + /** + * Check customer DOB is valid + * + * @param string $birthDate + * @return boolean + */ + public function validateBirthDate($birthDate) + { + $age = strtotime('+18 years', strtotime($birthDate)); + return (Mage::getSingleton('core/date')->gmtTimestamp() < $age) ? false : true; + } + + /** + * Check Novalnet invoice payment guarantee availability + * + * @param Mage_Sales_Model_Quote|null $quote + * @param string $code + * @return boolean + */ + public function getPaymentGuaranteeStatus($quote, $code) + { + $this->code = $code; // Payment method code + $methodSession = $this->_helper->getMethodSession($code); // Get payment method session + $methodSession->setPaymentGuaranteeFlag(0) + ->setGuaranteeErrorFlag(0); + + if ($this->getNovalnetConfig('enable_guarantee') || (in_array($code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT)))) { + $allowedCountryCode = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('allowedCountry'); + $countryCode = strtoupper($quote->getBillingAddress()->getCountryId()); // Get country code + $orderAmount = $this->_helper->getFormatedAmount($quote->getBaseGrandTotal()); // Get order amount + $guaranteeMinAmount = ($this->getNovalnetConfig('enable_guarantee') && $this->getNovalnetConfig('guarantee_min_order_total')) + ? $this->getNovalnetConfig('guarantee_min_order_total') : 999; + $validateAddr = $this->addressValidation($quote); // Validate end-customer address (billing & shipping) + if ($quote->hasNominalItems()) { + $checkoutSession = $this->_helper->getCheckoutSession(); // Get checkout session + // Get order amount (Add initial fees if exist) + $orderAmount = $this->_helper->getFormatedAmount($checkoutSession->getNnRowAmount()); + } + + $displayMinAmount = Mage::helper('core')->currency( + $this->_helper->getFormatedAmount($guaranteeMinAmount, 'RAW'), true, false + ); + + $errorText = ''; + $addressError = false; + $errorPaymentName = in_array($code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT)) + ? __('instalment payment') : __('payment guarantee'); + if (!in_array($countryCode, $allowedCountryCode)) { + $errorText = __('Only DE, CH countries allowed %s', $errorPaymentName); + } elseif ($orderAmount < $guaranteeMinAmount) { + $errorText = __('Minimum order amount should be %s %s', $errorPaymentName, $displayMinAmount); + } elseif ($quote->getBaseCurrencyCode() != 'EUR') { + $errorText = __('Only EUR currency allowed %s', $errorPaymentName); + } elseif ($validateAddr !== true) { + $errorText = __('The shipping address should be the same as the billing address %s', $errorPaymentName); + $addressError = true; + } + + if (in_array($code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT))) { + $option = false; + $allcycles = explode(',', $this->getNovalnetConfig('instalment_total_period')); + foreach ($allcycles as $allcycle) { + if ($allcycle != 0 && ($orderAmount / $allcycle) >= 999) { + $option = true; + } + } + + if (!$option) { + return false; + } + } + + if (empty($errorText)) { + $methodSession->setPaymentGuaranteeFlag(1) + ->setGuaranteeErrorFlag(0); + return true; + } elseif ($this->getNovalnetConfig('payment_guarantee_force')) { + $methodSession->setGuaranteeErrorFlag(0); + return true; + } + + $methodSession->setGuaranteeErrorFlag(1); + if ($errorText) { + $methodSession->setGuaranteeErrorMessage($errorText); + return (!$addressError) ? false : true; + } + + return false; + } + + return true; + } + + /** + * Address validation for guarantee payments + * + * @param Varien_Object $quote + * @return boolean + */ + public function addressValidation($quote) + { + $billing = $quote->getBillingAddress(); // Get end-customer billing address + $shipping = !$quote->getIsVirtual() ? $quote->getShippingAddress() : ''; // Get end-customer shipping address + + if ($shipping == '') { + return true; + } elseif (($billing->getCity() != $shipping->getCity()) + || (implode(',', $billing->getStreet()) != implode(',', $shipping->getStreet())) + || ($billing->getPostcode() != $shipping->getPostcode()) + || ($billing->getCountry() != $shipping->getCountry()) + ) { + return false; + } + + return true; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/ActiveMethods.php b/app/code/community/Novalnet/Payment/Model/Source/ActiveMethods.php new file mode 100755 index 0000000..5ba0540 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/ActiveMethods.php @@ -0,0 +1,62 @@ +getScopeId(); // Get store id + // Novalnet payment methods + $novalnetPayments = array_keys( + Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('paymentMethods') + ); + + foreach ($novalnetPayments as $paymentCode) { + $paymentActive = Mage::getStoreConfig("payment/$paymentCode/active", $scopeId); + if ($paymentActive == true) { + $paymentTitle = Mage::getStoreConfig("payment/$paymentCode/title", $scopeId); + $methods[$paymentCode] = array( + 'label' => $paymentTitle, + 'value' => $paymentCode, + ); + $activePayment = true; + } + } + + if (!$activePayment) { + $methods[$paymentCode] = array( + 'label' => Mage::helper('novalnet_payment')->__('No active payment method for this store'), + 'value' => false, + ); + } + + return $methods; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/CcCardTypes.php b/app/code/community/Novalnet/Payment/Model/Source/CcCardTypes.php new file mode 100755 index 0000000..a2feb9e --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/CcCardTypes.php @@ -0,0 +1,48 @@ + 'American Express', + 'TO' => 'Maestro', + ); + + $options = array(); + foreach ($cardTypes as $code => $name) { + $options[] = array( + 'value' => $code, + 'label' => $name + ); + } + + return $options; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/CustomerGroups.php b/app/code/community/Novalnet/Payment/Model/Source/CustomerGroups.php new file mode 100755 index 0000000..a2dfa92 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/CustomerGroups.php @@ -0,0 +1,55 @@ +getCollection(); + $groups = array(); + foreach ($collection as $group) { + $groupInfo = array( + 'customer_group_id' => $group->getCustomerGroupId(), + 'customer_group_code' => $group->getCustomerGroupCode(), + ); + + if ($groupInfo) { + array_push($groups, $groupInfo); + } + } + + foreach ($groups as $name) { + $options[] = array( + 'value' => $name['customer_group_id'], + 'label' => $name['customer_group_code'] + ); + } + + return $options; + } + +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/InstalmentCycle.php b/app/code/community/Novalnet/Payment/Model/Source/InstalmentCycle.php new file mode 100755 index 0000000..dc4ca19 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/InstalmentCycle.php @@ -0,0 +1,57 @@ + 1, + 'label' => __('Every month') + ), + array( + 'value' => 2, + 'label' => __('Every 2 months') + ), + array( + 'value' => 3, + 'label' => __('Every 3 months') + ), + array( + 'value' => 4, + 'label' => __('Every 4 months') + ), + array( + 'value' => 6, + 'label' => __('Every 6 months') + ) + ); + + return $options; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/InstalmentPeriod.php b/app/code/community/Novalnet/Payment/Model/Source/InstalmentPeriod.php new file mode 100755 index 0000000..a05c51c --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/InstalmentPeriod.php @@ -0,0 +1,53 @@ + 2 . __(' cycles'), + 3 => 3 . __(' cycles'), + 4 => 4 . __(' cycles'), + 6 => 6 . __(' cycles'), + 8 => 8 . __(' cycles'), + 9 => 9 . __(' cycles'), + 10 => 10 . __(' cycles'), + 12 => 12 . __(' cycles'), + 15 => 15 . __(' cycles'), + 18 => 18 . __(' cycles'), + 24 => 24 . __(' cycles') + ); + + foreach ($allCycles as $key => $value) { + $options[$key] = array('value' => $key, 'label' => $value); + } + + return $options; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/PaymentAction.php b/app/code/community/Novalnet/Payment/Model/Source/PaymentAction.php new file mode 100755 index 0000000..72aa732 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/PaymentAction.php @@ -0,0 +1,45 @@ + 1, + 'label' => __('Authorize') + ), + array( + 'value' => 0, + 'label' => __('Capture') + ) + ); + + return $options; + } +} diff --git a/app/code/community/Novalnet/Payment/Model/Source/VendorAutoConfig.php b/app/code/community/Novalnet/Payment/Model/Source/VendorAutoConfig.php new file mode 100755 index 0000000..ab3c2e6 --- /dev/null +++ b/app/code/community/Novalnet/Payment/Model/Source/VendorAutoConfig.php @@ -0,0 +1,35 @@ + Mage::helper('novalnet_payment')->__('NN None')); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/ApiController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/ApiController.php new file mode 100755 index 0000000..54b99ed --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/ApiController.php @@ -0,0 +1,56 @@ +getRequest()->getPost() + ? Mage::app()->getRequest()->getPost() : Mage::app()->getRequest()->getQuery(); + $payportUrl = 'https://payport.novalnet.de/autoconfig'; + + $request = new Varien_Object(); + $request->setHash($params['hash']) + ->setLang(strtoupper($helper->getDefaultLanguage())); + + $gatewayModel = $helper->getModel('Service_Api_Gateway'); // Get Novalnet gateway model + $response = $gatewayModel->payportRequestCall($request->getData(), $payportUrl); + $this->getResponse()->setBody($response->getBody()); + return $this; + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return true; + } +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/MerchantadminController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/MerchantadminController.php new file mode 100755 index 0000000..c737cd1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/MerchantadminController.php @@ -0,0 +1,42 @@ +_redirectUrl('https://admin.novalnet.de'); + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('novalnetpayment_information_merchantadmin'); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/ModuleController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/ModuleController.php new file mode 100755 index 0000000..410f0e3 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Information/ModuleController.php @@ -0,0 +1,45 @@ +_redirectUrl('https://www.novalnet.de/modul/magento-payment-module'); + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('novalnetpayment_information_module'); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/DeleteorderController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/DeleteorderController.php new file mode 100755 index 0000000..2339ac2 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/DeleteorderController.php @@ -0,0 +1,190 @@ +getRequest()->getParam('order_id'); + $order = Mage::getModel('sales/order')->load($orderId); + + if (!$order->getId()) { + $this->_getSession()->addError($this->__('This order no longer exists.')); + $this->_redirect('*/*/'); + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + return false; + } + + Mage::register('sales_order', $order); + Mage::register('current_order', $order); + return $order; + } + + /** + * Delete single order + * + * @param none + * @return none + */ + public function deleteAction() + { + if ($order = $this->_initOrder()) { + try { + if ($this->removeOrderRelatedItems($order)) { + $message = Mage::helper('novalnet_payment')->__('Order was successfully deleted'); + $url = Mage::helper('adminhtml')->getUrl('adminhtml/novalnetpayment_sales_order/index'); + Mage::getSingleton('adminhtml/session')->addSuccess($message); + $this->_redirectUrl($url); + } + } catch (Exception $e) { + Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); + $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('order_ids'))); + } + } + + $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/novalnetpayment_sales_order/index')); + } + + /** + * Delete multiple orders + * + * @param none + * @return none + */ + public function massDeleteAction() + { + $orderIds = $this->getRequest()->getParam('order_ids'); + $adminSession = Mage::getSingleton('adminhtml/session'); + + if (!is_array($orderIds)) { + $adminSession->addError(Mage::helper('novalnet_payment')->__('Please select the orders')); + } else { + try { + foreach ($orderIds as $orderId) { + $order = Mage::getModel('sales/order')->load($orderId); + $this->removeOrderRelatedItems($order); + } + + $message = Mage::helper('novalnet_payment')->__( + 'Total of %d order(s) were successfully deleted', count($orderIds) + ); + $adminSession->addSuccess($message); + } catch (Exception $e) { + $adminSession->addError($e->getMessage()); + } + } + + $this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/novalnetpayment_sales_order/index')); + } + + /** + * Delete the order related informations (invoice, creditmemo, shipment) + * + * @param Varien_Object $order + * @return boolean + */ + public function removeOrderRelatedItems($order) + { + // delete order invoice + $this->removeInvoice($order); + // delete order creditmemo + $this->removeCreditmemo($order); + // delete order shipment + $this->removeShipment($order); + //delete order + $order->delete(); + return true; + } + + /** + * delete the order invoice + * + * @param Varien_Object $order + * @return none + */ + public function removeInvoice($order) + { + $collection = $order->getInvoiceCollection(); + foreach ($collection as $invoice) { + $items = $invoice->getAllItems(); + foreach ($items as $item) { + $item->delete(); + } + + $invoice->delete(); + } + } + + /** + * delete the order creditmemo + * + * @param Varien_Object $order + * @return none + */ + public function removeCreditmemo($order) + { + $collection = $order->getCreditmemosCollection(); + foreach ($collection as $creditmemo) { + $items = $creditmemo->getAllItems(); + foreach ($items as $item) { + $item->delete(); + } + + $creditmemo->delete(); + } + } + + /** + * delete the order shipment + * + * @param Varien_Object $order + * @return none + */ + public function removeShipment($order) + { + $collection = $order->getShipmentsCollection(); + foreach ($collection as $shipment) { + $items = $shipment->getAllItems(); + foreach ($items as $item) { + $item->delete(); + } + + $shipment->delete(); + } + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('novalnetpayment_sales_deleteorder'); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/OrderController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/OrderController.php new file mode 100755 index 0000000..7e84f41 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/OrderController.php @@ -0,0 +1,320 @@ +loadLayout() + ->setUsedModuleName('novalnet_payment') + ->_setActiveMenu('novalnet') + ->_addBreadcrumb($this->__('Novalnet'), $this->__('Orders')); + + return $this; + } + + /** + * Novalnet payments order grid + * + * @param none + * @return none + */ + public function indexAction() + { + $this->_title($this->__('Novalnet'))->_title($this->__('Orders')); + + $this->_initAction() + ->renderLayout(); + } + + /** + * Create sales order block for Novalnet payments + * + * @param none + * @return none + */ + public function gridAction() + { + $this->getResponse()->setBody( + $this->getLayout()->createBlock('novalnet_payment/adminhtml_sales_order_grid')->toHtml() + ); + } + + /** + * Set transactionoverview grid in sales order view page + * + * @param none + * @return none + */ + public function transactionOverviewGridAction() + { + $this->_initOrder(); + $this->getResponse()->setBody( + Mage::getBlockSingleton('novalnet_payment/adminhtml_sales_order_view_tab_transactionOverview')->toHtml() + ); + } + + /** + * Set transactionoverview grid in sales order view page + * + * @param none + * @return none + */ + public function transactionTracesGridAction() + { + $this->_initOrder(); + $this->getResponse()->setBody( + Mage::getBlockSingleton('novalnet_payment/adminhtml_sales_order_view_tab_transactionTraces')->toHtml() + ); + } + + /** + * Order confirm process for Novalnet invoice payments (Invoice/Prepayment) + * + * @param none + * @return none + */ + public function confirmAction() + { + $order = $this->_initOrder(); // Get order object + $paymentObj = $order->getPayment()->getMethodInstance(); // Get payment method instance + $this->code = $paymentObj->getCode(); // Get payment method code + $this->helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + // Get payment last transaction id + $transactionId = $this->helper->makeValidNumber($order->getPayment()->getLastTransId()); + // Build confirm payment request + $request = $this->helper->getModel('Service_Api_Request') + ->getprocessVendorInfo($order->getPayment()); // Get Novalnet authentication Data + $request->setTid($transactionId) + ->setStatus(100) + ->setEditStatus(true) + ->setRemoteIp($this->helper->getRealIpAddr()); + $response = $paymentObj->postRequest($request); // Send confirm payment request + $this->validateConfirmResponse($response, $order, $transactionId); // Validate the payport response + // Save the transaction traces + $responseModel = $this->helper->getModel('Service_Api_Response'); + $responseModel->logTransactionTraces($request, $response, $order, $transactionId); + if ($response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $this->_getSession()->addSuccess($this->__('The order has been updated.')); + } else { + $message = $this->__('Error in your process request. Status Code : ' . $response->getStatus()); + $this->_getSession()->addError($message); + } + + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + + /** + * Validate the confirm payment response data + * + * @param Varien_Object $response + * @param Varien_Object $order + * @param string $transactionId + * @return none + */ + public function validateConfirmResponse($response, $order, $transactionId) + { + if ($response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $payment = $order->getPayment(); // Get payment object + // Save payment additional transaction details + $data = unserialize($payment->getAdditionalData()); + $data['captureTid'] = $transactionId; + $data['captureCreateAt'] = Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'); + // Due date update + if ($response->getDueDate()) { + $formatDate = Mage::helper('core')->formatDate($response->getDueDate()); + $note = explode('|', $data['NnNote']); + $note[0] = 'Due Date: ' . $formatDate; + $data['NnNote'] = implode('|', $note); + $data['NnDueDate'] = $formatDate; + } + + $payment->setAdditionalData(serialize($data))->save(); + + // Add transaction status information + $transactionStatus = $this->helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $transactionStatus->setTransactionStatus($response->getTidStatus())->save(); + + // Create order invoice + if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE && $order->canInvoice()) { + $this->saveOrderInvoice($order, $transactionId); + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_PREPAYMENT) { + $captureOrderStatus = Mage::getStoreConfig( + 'novalnet_global/order_status_mapping/order_status', $order->getStoreId() + ) ? Mage::getStoreConfig('novalnet_global/order_status_mapping/order_status', $order->getStoreId()) + : Mage_Sales_Model_Order::STATE_PROCESSING; + $message = Mage::helper('novalnet_payment')->__('The transaction has been confirmed'); + $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $captureOrderStatus, $message, true)->save(); + } + } + } + + /** + * Save order invoice + * + * @param varien_object $order + * @param int $transactionId + * @return none + */ + protected function saveOrderInvoice($order, $transactionId) + { + $transMode = (version_compare($this->helper->getMagentoVersion(), '1.6', '<')) ? false : true; + $order->getPayment()->setIsTransactionClosed($transMode)->save(); + $data = unserialize($order->getPayment()->getAdditionalData()); + // Create order invoice + $invoice = $order->prepareInvoice(); + $invoice->setTransactionId($transactionId); + $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE) + ->register(); + if (!isset($data['NnGuarantee'])) { + $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_OPEN) + ->save(); + } + + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + } + + /** + * Duedate update process + * + * @param none + * @return none + */ + public function duedateupdateAction() + { + $invoiceDuedate = $this->getRequest()->getParam('invoice_duedate'); + $order = $this->_initOrder(); + $helper = Mage::helper('novalnet_payment'); + + try { + if ($invoiceDuedate && (strtotime($invoiceDuedate) < strtotime(date('Y-m-d')))) { + $this->_getSession()->addError($helper->__('The date should be in future')); + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + return false; + } + + if ($order) { + $payment = $order->getPayment(); + $paymentObj = $payment->getMethodInstance(); + $paymentCode = $paymentObj->getCode(); + $request = new Varien_Object(); + $requestModel = $helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->getprocessVendorInfo($payment); // Get Novalnet recurring process request + $additionalData = unserialize($payment->getAdditionalData()); + $transactionId = !empty($additionalData['NnTid']) + ? $helper->makeValidNumber($additionalData['NnTid']) + : $helper->makeValidNumber($payment->getLastTransId()); + + $request->setTid($transactionId) + ->setStatus(100) + ->setEditStatus(true) + ->setUpdateInvAmount(1) + ->setDueDate($invoiceDuedate) + ->setRemoteIp($helper->getRealIpAddr()); + + $response = $paymentObj->postRequest($request); // send process request to Novalnet gateway + $responseModel = $helper->getModel('Service_Api_Response'); + $responseModel->logTransactionTraces($request, $response, $order, $transactionId); + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $data = unserialize($payment->getAdditionalData()); + $formatDate = Mage::helper('core')->formatDate($invoiceDuedate); + if (in_array($paymentCode, array(Novalnet_Payment_Model_Config::NN_INVOICE, Novalnet_Payment_Model_Config::NN_PREPAYMENT))) { + $note = explode('|', $data['NnNote']); + $note[0] = 'Due Date: ' . $formatDate; + $data['NnNote'] = implode('|', $note); + $data['NnDueDate'] = $formatDate; + $successMessage = $this->__('The transaction has been updated with due date %s', $formatDate); + } elseif ($paymentCode == Novalnet_Payment_Model_Config::NN_CASHPAYMENT) { + $data['CpDueDate'] = $formatDate; + $successMessage = $this->__('The transaction has been updated with slip expiry date %s', $formatDate); + } + + $data['dueDateUpdateAt'] = Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'); + $payment->setAdditionalData(serialize($data)) + ->save(); + $this->_getSession()->addSuccess($successMessage); + } else { + $this->_getSession()->addError($response->getStatusDesc()); + } + } + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + + /** + * Order cancel process for Novalnet Guarantee payments + * + * @param none + * @return none + */ + public function cancelAction() + { + try { + $order = $this->_initOrder(); // Get order object + $paymentObj = $order->getPayment()->getMethodInstance(); + $payment = $order->getPayment(); + $response = $paymentObj->void($payment); + $this->helper = Mage::helper('novalnet_payment'); + $tid = $this->helper->makeValidNumber($payment->getLastTransId()); + $statusMessage =$this->helper->__('Novalnet callback received. The transaction has been canceled on %s', + $this->currentTime + ); + $payment = $order->getPayment(); + $shopMode = $paymentObj->getNovalnetConfig('live_mode', true); + $testMode = ($response->getTestMode() == 1 || $shopMode == 0) ? 1 : 0; + $data = $payment->getAdditionalData() ? unserialize($payment->getAdditionalData()) : []; + $data['NnTid'] = $tid; + $data['NnStatus'] = $response->getTidStatus(); + $data['NnTestMode'] = $testMode; + $payment->setLastTransId($tid) + ->setAdditionalData(serialize($data)) + ->save(); + // Cancels the order with the cancel text + $order->registerCancellation($statusMessage) + ->save(); + $successMessage = __('The order has been cancelled.'); + $this->_getSession()->addSuccess($successMessage); + } catch (Mage_Core_Exception $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + } + + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/Recurring/ProfileController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/Recurring/ProfileController.php new file mode 100755 index 0000000..6232a88 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/Recurring/ProfileController.php @@ -0,0 +1,52 @@ +_title($helper->__('Sales'))->_title($helper->__('Novalnet Recurring Profiles')) + ->loadLayout() + ->_setActiveMenu('novalnet') + ->renderLayout(); + return $this; + } + + /** + * Profiles ajax grid + */ + public function gridAction() + { + $this->getResponse()->setBody( + $this->getLayout()->createBlock('novalnet_payment/adminhtml_recurring_profile_grid')->toHtml() + ); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/RefundController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/RefundController.php new file mode 100755 index 0000000..20e85f4 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/Sales/RefundController.php @@ -0,0 +1,80 @@ +getRequest()->getParams(); + $refundAmount = $params['nn-refund-amount']; + $refundTid = $params['nn-refund-tid']; + $order = $this->_initOrder(); + $helper = Mage::helper('novalnet_payment'); + + if (!$refundAmount || !$refundTid) { + $message = $this->__('The Amount should be in future'); + $this->_getSession()->addError($message); + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + return false; + } + + if ($order) { + $payment = $order->getPayment(); + $paymentObj = $payment->getMethodInstance(); + $paymentCode = $paymentObj->getCode(); + $request = new Varien_Object(); + $requestModel = $helper->getModel('Service_Api_Request'); // Get Novalnet Api request model + $request = $requestModel->buildProcessRequest($payment, 'refund', $refundAmount); // Get Novalnet recurring process request + $request->setTid($refundTid) + ->setRefundParam($refundAmount); + + $response = $paymentObj->postRequest($request); // send process request to Novalnet gateway + $responseModel = $helper->getModel('Service_Api_Response'); + $responseModel->logTransactionTraces($request, $response, $order, $refundTid); + + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $refundKey = $params['nn-refund-key']; + $data = unserialize($payment->getAdditionalData()); + $data['InstalmentDetails'][$refundKey]['Refund'][] = array('tid' => $response->getTid(), 'amount' => $refundAmount / 100); + $data = $responseModel->getRefundTidInfo(($refundAmount / 100), $data, ($response->getTid() ? $response->getTid() : $refundTid), $refundTid); + $payment->setAdditionalData(serialize($data))->save(); + + $message = $this->__('The Refund executed properly'); + $this->_getSession()->addSuccess($message); + } else { + $message = $this->__($response['status_text']); + $this->_getSession()->addError($message); + } + + $this->_redirect('*/sales_order/view', array('order_id' => $order->getId())); + return false; + } + $this->_redirect('*/sales_order'); + return false; + } +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactionoverviewController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactionoverviewController.php new file mode 100755 index 0000000..e417089 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactionoverviewController.php @@ -0,0 +1,98 @@ +loadLayout() + ->setUsedModuleName('novalnet_payment') + ->_setActiveMenu('novalnet/transactionstatus') + ->_addBreadcrumb($this->__('Novalnet'), $this->__('Transaction')); + + return $this; + } + + /** + * Transaction status overview + * + * @param none + * @return none + */ + public function indexAction() + { + $this->_initAction(); + $this->renderLayout(); + } + + /** + * Create transaction status block + * + * @param none + * @return none + */ + public function gridAction() + { + $this->getResponse()->setBody( + $this->getLayout()->createBlock('novalnet_payment/adminhtml_transactionoverview_grid')->toHtml() + ); + } + + /** + * Get the transaction status information + * + * @param none + * @return none + */ + public function viewAction() + { + $nnTxnId = $this->getRequest()->getParam('nntxn_id'); + $transactionStatus = Mage::getModel('novalnet_payment/Mysql4_TransactionStatus'); + $statusCollection = $transactionStatus->load($nnTxnId); + + if (empty($nnTxnId) || !$statusCollection->getNnTxnId()) { + $this->_forward('noRoute'); + } + + $this->_title(sprintf("#%s", $statusCollection->getTransactionNo())); + $transactionStatus->loadByTransactionStatusId($statusCollection); + Mage::register('novalnet_payment_transactionoverview', $transactionStatus); + $this->_initAction(); + $this->renderLayout(); + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('novalnetpayment_transactionoverview'); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactiontracesController.php b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactiontracesController.php new file mode 100755 index 0000000..c2d76f1 --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Adminhtml/Novalnetpayment/TransactiontracesController.php @@ -0,0 +1,101 @@ +loadLayout() + ->setUsedModuleName('novalnet_payment') + ->_setActiveMenu('novalnet/transactiontraces') + ->_addBreadcrumb($this->__('Novalnet'), $this->__('Transaction Traces')); + + return $this; + } + + /** + * Transaction traces overview + * + * @param none + * @return none + */ + public function indexAction() + { + $this->_initAction(); + $this->renderLayout(); + } + + /** + * Create transaction traces block + * + * @param none + * @return none + */ + public function gridAction() + { + $this->getResponse()->setBody( + $this->getLayout()->createBlock('novalnet_payment/adminhtml_transactiontraces_grid')->toHtml() + ); + } + + /** + * Get the transaction traces information + * + * @param none + * @return none + */ + public function viewAction() + { + $nnLogId = $this->getRequest()->getParam('nnlog_id'); + $transactionTraces = Mage::getModel('novalnet_payment/Mysql4_TransactionTraces'); + $tracesCollection = $transactionTraces->load($nnLogId); + + if (empty($nnLogId) || !$tracesCollection->getNnLogId()) { + $this->_forward('noRoute'); + } + + $this->_title(sprintf("#%s", $tracesCollection->getTransactionId())); + + $transactionTraces->loadByOrderLogId($tracesCollection); + + Mage::register('novalnet_payment_transactiontraces', $tracesCollection); + + $this->_initAction(); + $this->renderLayout(); + } + + /** + * Check admin permissions for this controller + * + * @return bool + */ + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isAllowed('novalnetpayment_transactiontraces'); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/CallbackController.php b/app/code/community/Novalnet/Payment/controllers/CallbackController.php new file mode 100755 index 0000000..2c6c2ff --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/CallbackController.php @@ -0,0 +1,2068 @@ + array('CREDITCARD', 'CREDITCARD_BOOKBACK', 'CREDITCARD_CHARGEBACK', + 'CREDIT_ENTRY_CREDITCARD', 'SUBSCRIPTION_STOP', 'DEBT_COLLECTION_CREDITCARD', 'SUBSCRIPTION_REACTIVATE', 'TRANSACTION_CANCELLATION'), + 'novalnetinvoice' => array('INVOICE_START', 'INVOICE_CREDIT', 'SUBSCRIPTION_STOP', 'GUARANTEED_INVOICE', + 'SUBSCRIPTION_REACTIVATE', 'REFUND_BY_BANK_TRANSFER_EU', 'TRANSACTION_CANCELLATION', + 'GUARANTEED_INVOICE_BOOKBACK', 'CREDIT_ENTRY_DE', 'DEBT_COLLECTION_DE'), + 'novalnetprepayment' => array('INVOICE_START', 'INVOICE_CREDIT', 'SUBSCRIPTION_STOP', + 'SUBSCRIPTION_REACTIVATE', 'REFUND_BY_BANK_TRANSFER_EU'), + 'novalnetideal' => array('IDEAL', 'REVERSAL', 'CREDIT_ENTRY_DE', 'DEBT_COLLECTION_DE', + 'ONLINE_TRANSFER_CREDIT', 'REFUND_BY_BANK_TRANSFER_EU'), + 'novalnetpaypal' => array('PAYPAL', 'PAYPAL_BOOKBACK', 'SUBSCRIPTION_STOP', 'SUBSCRIPTION_REACTIVATE', 'TRANSACTION_CANCELLATION'), + 'novalneteps' => array('EPS', 'CREDIT_ENTRY_DE', 'REVERSAL', 'DEBT_COLLECTION_DE', 'REFUND_BY_BANK_TRANSFER_EU', + 'ONLINE_TRANSFER_CREDIT'), + 'novalnetgiropay' => array('GIROPAY', 'REVERSAL', 'CREDIT_ENTRY_DE', 'DEBT_COLLECTION_DE', + 'REFUND_BY_BANK_TRANSFER_EU', 'ONLINE_TRANSFER_CREDIT'), + 'novalnetbanktransfer' => array('ONLINE_TRANSFER', 'REFUND_BY_BANK_TRANSFER_EU', + 'REVERSAL', 'CREDIT_ENTRY_DE', 'DEBT_COLLECTION_DE', 'ONLINE_TRANSFER_CREDIT'), + 'novalnetsepa' => array('DIRECT_DEBIT_SEPA', 'RETURN_DEBIT_SEPA', 'SUBSCRIPTION_STOP', + 'DEBT_COLLECTION_SEPA', 'CREDIT_ENTRY_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'REFUND_BY_BANK_TRANSFER_EU', + 'SUBSCRIPTION_REACTIVATE', 'TRANSACTION_CANCELLATION', 'GUARANTEED_SEPA_BOOKBACK'), + 'novalnetprzelewy' => array('PRZELEWY24', 'PRZELEWY24_REFUND'), + 'novalnetinvoiceinstalment' => array('INSTALMENT_INVOICE', 'INSTALMENT_INVOICE_BOOKBACK', + 'TRANSACTION_CANCELLATION'), + 'novalnetsepainstalment' => array('INSTALMENT_DIRECT_DEBIT_SEPA', 'INSTALMENT_SEPA_BOOKBACK', + 'TRANSACTION_CANCELLATION'), + 'novalnetcashpayment' => array('CASHPAYMENT', 'CASHPAYMENT_CREDIT', 'CASHPAYMENT_REFUND')); + protected $invoiceAllowed = array('INVOICE_CREDIT', 'INVOICE_START', 'CASHPAYMENT_CREDIT'); + protected $recurringAllowed = array('INVOICE_START', 'CREDITCARD', + 'DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'PAYPAL', 'GUARANTEED_INVOICE'); + // Array Type of payment available - Level : 0 + protected $paymentTypes = array('CREDITCARD', 'INVOICE_START', 'DIRECT_DEBIT_SEPA', + 'PAYPAL', 'ONLINE_TRANSFER', 'IDEAL', 'PRZELEWY24', + 'EPS', 'GIROPAY', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'GUARANTEED_INVOICE'); + // Array Type of Chargebacks available - Level : 1 + protected $chargebacks = array('REVERSAL', 'CREDITCARD_CHARGEBACK', 'RETURN_DEBIT_SEPA', + 'CREDITCARD_BOOKBACK', 'REFUND_BY_BANK_TRANSFER_EU', 'PAYPAL_BOOKBACK', 'PRZELEWY24_REFUND', + 'CASHPAYMENT_REFUND', 'GUARANTEED_INVOICE_BOOKBACK', 'GUARANTEED_SEPA_BOOKBACK', + 'INSTALMENT_INVOICE_BOOKBACK', 'INSTALMENT_SEPA_BOOKBACK'); + // Array Type of CreditEntry payment and Collections available - Level : 2 + protected $aryCollection = array('INVOICE_CREDIT', 'CREDIT_ENTRY_CREDITCARD', + 'CREDIT_ENTRY_SEPA', 'DEBT_COLLECTION_SEPA', 'CREDIT_ENTRY_DE', 'DEBT_COLLECTION_DE', + 'DEBT_COLLECTION_CREDITCARD', 'ONLINE_TRANSFER_CREDIT', 'CASHPAYMENT_CREDIT'); + protected $arySubscription = array('SUBSCRIPTION_STOP', 'SUBSCRIPTION_REACTIVATE'); + + protected $level; // Assign callback process level + protected $orderNo; // Assign order number + protected $order; // Assign order object + protected $storeId; // Assign store id + protected $payment; // Assign payment object + protected $code; // Assign payment method code + protected $paymentTxnId; // Assign payment last transaction id + protected $currency; // Assign order currency + protected $responseModel; // Assign Api response model + protected $test; // Assign callback test mode + protected $helper; // Assign Novalnet payment helper + protected $response; // Assign response params to object data + protected $currentTime; // Assign current time for callback process + protected $lineBreak; // Assign line break for callback comments + protected $callback; // Assign callback process flag + protected $recurring; // Assign recurring process flag + protected $emailFromAddr; // Assign callback email from address + protected $emailFromName; // Assign callback email from name + protected $emailToAddr; // Assign callback email To address + protected $emailToName; // Assign callback email To name + protected $emailSubject; // Assign callback email subject + protected $shopInfo; // Assign shop information + protected $emailBody; // Assign email body + protected $endTime; // Assign recurring end time + protected $parentOrder; // Assign parent order object + protected $parentPayment; // Assign parent payment + protected $parentPaymentObj; // Assign parent payment object + + /** + * Get Novalnet vendor script response + * + * @param none + * @return none + */ + public function indexAction() + { + $this->loadLayout(); + $block = $this->getLayout()->createBlock( + 'Mage_Core_Block_Template', 'Callback', array('template' => 'novalnet/method/form/Callback.phtml') + ); + $this->getLayout()->getBlock('content')->append($block); + if ($this->_assignGlobalParams()) { // Assign global params for callback process + // Make affiliate process + if ($this->response->getVendorActivation()) { + $this->affiliateProcess(); + return false; + } + + if (($this->level = $this->getCallbackProcessLevel()) === false) { // Assign callback process level + return false; + } + + if (($this->orderNo = $this->getOrderIncrementId()) === false) { // Assign order number + $this->sendCriticalErrorMail(); + return false; + } + + $this->order = Mage::getModel('sales/order')->loadByIncrementId($this->orderNo); // Get order object + if (!$this->order->getIncrementId()) { + $this->sendCriticalErrorMail(); + $this->showDebug('Transaction mapping failed'); + return false; + } + + $this->storeId = $this->order->getStoreId(); // Get order store id + $this->payment = $this->order->getPayment(); // Get payment object + $this->code = $this->payment->getMethodInstance()->getCode(); // Get payment method code + $additionalData = unserialize($this->payment->getAdditionalData()); + $orderLanguage = !empty($additionalData['nnLang']) ? $additionalData['nnLang'] : 'en_US'; + + if ($orderLanguage) { + Mage::app()->getLocale()->setLocaleCode($orderLanguage); + Mage::getSingleton('core/translate')->setLocale($orderLanguage)->init('frontend', true); + } + + $this->paymentTxnId = $this->payment->getLastTransId(); // Get payment last transaction id + $this->currency = $this->order->getOrderCurrencyCode(); // Get order currency + $this->responseModel = $this->helper->getModel('Service_Api_Response'); + + // Check the change payment method + if ($this->changePaymentMethod()) { + return false; + } + + // Complete the order in-case response failure from Novalnet server + if ($this->_handleCommunicationFailure()) { + return false; + } + + // Check transaction cancellation + if ($this->transactionCancellation()) { + return false; + } + + // Perform callback process for recurring and payment credit related process + if ($this->_checkParams() === true + && $this->_callbackProcess() === true) { + $this->sendCallbackMail(); // Send callback notification E-mail + } else { + return false; + } + } + + if (!$this->getLayout()->getBlock('Callback')->hasExitProcess()) { + $this->renderLayout(); + } + } + + /** + * Assign global params for callback process + * + * @param none + * @return none + */ + protected function _assignGlobalParams() + { + $this->test = Mage::getStoreConfig('novalnet_global/merchant_script/test_mode'); + $this->helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $this->technicNotifyMail = 'technic@novalnet.de'; + + if (!$this->checkIP()) { // Check whether the IP address is authorized + return false; + } + + // Get Novalnet callback response values + $params = Mage::app()->getRequest()->getPost() + ? Mage::app()->getRequest()->getPost() : Mage::app()->getRequest()->getQuery(); + $checkParams = array_filter($params); + + if (empty($checkParams)) { + $this->showDebug('Novalnet callback received. No params passed over!'); + return false; + } + + $this->response = new Varien_Object(); + $this->response->setData($params); // Assign response params to object data + // Get current time for callback process + $this->currentTime = Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'); + $httpHost = Mage::helper('core/http')->getHttpHost(); + $this->lineBreak = empty($httpHost) ? PHP_EOL : '
'; + $this->callback = $this->recurring = false; + + // Make reference log (Novalnet callback response) based on configuration settings + if (Mage::getStoreConfig('novalnet_global/merchant_script/vendor_script_log')) { + $fileName = 'novalnet_callback_script_' . $this->currentTime . '.log'; + Mage::log($this->response->getData(), null, $fileName, true); + } + + return true; + } + + /** + * Get email config + * + * @param none + * @return none + */ + public function getEmailConfig() + { + $this->emailFromAddr = Mage::getStoreConfig('trans_email/ident_general/email'); + $this->emailFromName = Mage::getStoreConfig('trans_email/ident_general/name'); + $this->emailToAddr = Mage::getStoreConfig('novalnet_global/merchant_script/mail_to_addr', $this->storeId); + $this->emailToName = 'store admin'; // Adapt for your need + $this->emailSubject = 'Novalnet Callback Script Access Report - ' . Mage::app()->getStore()->getFrontendName(); + //Reporting Email Addresses Settings + $this->shopInfo = 'Magento ' . $this->lineBreak; //mandatory;adapt for your need + } + + /** + * Log Affiliate account details + * + * @param none + * @return none + */ + public function affiliateProcess() + { + $paramsRequired = $this->getRequiredParams(); // Get required params for callback process + // Check the necessary params for callback script process + foreach ($paramsRequired as $param) { + if (!$this->response->getData($param)) { + $this->showDebug('Required param (' . $param . ') missing!'); + return false; + } + } + + $affiliateModel = $this->helper->getModel('Mysql4_AffiliateInfo'); + $affiliateModel->setVendorId($this->response->getVendorId()) + ->setVendorAuthcode($this->response->getVendorAuthcode()) + ->setProductId($this->response->getProductId()) + ->setProductUrl($this->response->getProductUrl()) + ->setActivationDate( + $this->response->hasActivationDate() ? $this->response->getActivationDate() : $this->currentTime + ) + ->setAffId($this->response->getAffId()) + ->setAffAuthcode($this->response->getAffAuthcode()) + ->setAffAccesskey($this->response->getAffAccesskey()) + ->save(); + // Send notification mail to Merchant + $message = 'Novalnet callback script executed successfully with Novalnet account activation information.'; + $this->emailBody = $message; + $this->sendCallbackMail(); // Send callback notification E-mail + } + + /** + * Complete the order in-case response failure from Novalnet server + * + * @param none + * @return none + */ + protected function _handleCommunicationFailure() + { + $successActionFlag = $this->code . '_successAction'; + + if (empty($this->paymentTxnId) && $this->payment->getAdditionalInformation($successActionFlag) != 1 + ) { + $this->payment->setAdditionalInformation($successActionFlag, 1)->save(); + // Unhold an order + if ($this->order->canUnhold()) { + $this->order->unhold()->save(); + } + + // Save transaction additional information + $transactionId = $this->response->getTid(); + // Get payment mode from Novalnet global configuration + $responsePaymentMode = $this->response->getTestMode(); + $shopMode = $this->_getConfig('live_mode'); // Get payment mode from callback response + $testMode = (int)($responsePaymentMode == 1 || $shopMode == 0); // Get payment process mode + $paymentId = $this->helper->getPaymentId($this->code); // Get payment key + $confirmText = $this->helper->__( + 'Novalnet Callback Script executed successfully on %s', $this->currentTime + ); + $data = array('NnTestOrder' => $testMode, 'NnTid' => $transactionId, + 'vendor' => $this->_getConfig('merchant_id'), + 'auth_code' => $this->_getConfig('auth_code'), + 'product' => $this->_getConfig('product_id'), + 'tariff' => $this->_getConfig('tariff_id'), + 'payment_id' => $paymentId + ); + $paidUntil = $this->response->hasNextSubsCycle() + ? $this->response->getNextSubsCycle() + : ($this->response->hasPaidUntil() ? $this->response->getPaidUntil() : ''); + $data['paidUntil'] = $paidUntil ? Mage::helper('core')->formatDate($paidUntil) : ''; + // Get payment additional information + $additionalData = unserialize($this->payment->getAdditionalData()); + // Merge payment additional information if exist + $data = $additionalData ? array_merge($additionalData, $data) : $data; + + // Save the payment transaction information + $this->payment->setTransactionId($transactionId) + ->setLastTransId($transactionId) + ->setParentTransactionId(null) + ->setAdditionalData(serialize($data)); + + // Capture the payment + if ($this->order->canInvoice() + && $this->response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + // Save payment information with invoice for Novalnet successful transaction + $this->payment->setIsTransactionClosed(true) + ->capture(null); + } + + $this->payment->save(); + + // Get payment request params + $request = new Varien_Object(); + $traces = $this->helper->getModel('Mysql4_TransactionTraces') + ->loadByAttribute('order_id', $this->orderNo); + $isSerialized = $this->helper->is_serialized($traces->getRequestData()); + $getrequestData = ($isSerialized === true) + ? unserialize($traces->getRequestData()) : unserialize(base64_decode($traces->getRequestData())); + $request->setData($getrequestData); + // Log Novalnet payment transaction informations + $this->responseModel->logTransactionStatus($this->response, $this->order); + $this->savePayportResponse(); // Log Novalnet payment transaction traces informations + // Set order status based on Novalnet transaction status + if (in_array($this->response->getStatus(), array(Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED, + Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS)) && + in_array($this->response->getTidStatus(), array(100, 90, 85, 86, 91, 98, 99, 75)) + ) { + $this->setRecurringProfileState(); // Assign recurring profile state if profile exist + $orderStatus = $this->getOrderStatus(); // Get order status + $this->order->setState( + Mage_Sales_Model_Order::STATE_PROCESSING, + $orderStatus, + $this->helper->__('Customer successfully returned from Novalnet'), + true + )->save(); + $this->paymentTxnId = $transactionId; // Get payment last transaction id + // Send order email for successful Novalnet transaction + Mage::dispatchEvent('novalnet_sales_order_email', array('order' => $this->order)); + } else { + $this->setRecurringProfileState('canceled'); // Assign recurring profile state if profile exist + // Cancel the order based on Novalnet transaction status + $this->responseModel->saveCanceledOrder($this->response, $this->order, $testMode); + } + + $this->order->save(); // Save the current order + $this->showDebug($confirmText); + return true; + } + + return false; + } + + /** + * Check the callback mandatory parameters. + * + * @param none + * @return boolean + */ + protected function _checkParams() + { + $paramsRequired = $this->getRequiredParams(); // Get required params for callback process + // Check the necessary params for callback script process + foreach ($paramsRequired as $param) { + if (!$this->response->getData($param)) { + $this->showDebug('Required param (' . $param . ') missing!
'); + return false; + } + } + + // Check whether Novalnet TID is valid + $transactionId = $this->getParentTid(); // Get the original/parent transaction id + + if (!preg_match('/^\d{17}$/', $transactionId)) { + $this->showDebug( + 'Novalnet callback received. Invalid TID [' . $transactionId . '] for Order :' . $this->orderNo + ); + return false; + } + + $referenceTid = ($transactionId != $this->response->getTid()) ? $this->response->getTid() : ''; + + if ($referenceTid && !preg_match('/^\d{17}$/', $referenceTid)) { + $this->showDebug( + 'Novalnet callback received. Invalid TID [' . $referenceTid . '] for Order :' . $this->orderNo + ); + return false; + } + + if ($this->recurring && $this->response->getSubsBilling() && $this->response->getSignupTid()) { + $profile = $this->getProfileInformation(); // Get the Recurring Profile Information + if ($profile->getState() == 'canceled') { + // Get parent order object for given recurring profile + $profileOrders = $this->helper->getModel('Mysql4_Recurring')->getRecurringOrderNo($profile); + $parentOrder = Mage::getModel('sales/order')->loadByIncrementId($profileOrders[0]); + $this->showDebug('Subscription already Cancelled. Refer Order : ' . $parentOrder->getIncrementId()); + return false; + } + } else { + $additionalData = unserialize($this->payment->getAdditionalData()); + $orderTid = (in_array($this->response->getPaymentType(), $this->chargebacks) && $additionalData['NnTid']) + ? $additionalData['NnTid'] : $this->paymentTxnId; + if (!preg_match('/^' . $transactionId . '/i', $orderTid) + && !in_array($this->response->getPaymentType(), array('INSTALMENT_SEPA_BOOKBACK', 'INSTALMENT_INVOICE_BOOKBACK'))) { + $this->showDebug('Novalnet callback received. Order no is not valid'); + return false; + } + } + + if ((in_array($this->response->getPaymentType(), array_merge($this->aryCollection, $this->chargebacks))) + && ($this->response->getStatus() != Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + || $this->response->getTidStatus() != Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) + ) { + $this->showDebug('Novalnet callback received. Status is not valid. Refer Order :' . $this->orderNo); + return false; + } + + return true; + } + + /** + * Get required params for callback process + * + * @param none + * @return array $paramsRequired + */ + public function getRequiredParams() + { + $paramsRequired = array('payment_type', 'status', 'tid_status', 'tid', 'vendor_id'); + + if ($this->response->getVendorActivation()) { + $paramsRequired = array('vendor_id', 'vendor_authcode', 'product_id', + 'product_url', 'activation_date', 'aff_id', 'aff_authcode', 'aff_accesskey' + ); + } elseif ($this->callback) { + $invoicePayments = array_merge($this->aryCollection, $this->chargebacks); + if (in_array($this->response->getPaymentType(), $invoicePayments)) { + array_push($paramsRequired, 'tid_payment'); + } + } elseif ($this->recurring) { + array_push($paramsRequired, 'signup_tid'); + } + + return $paramsRequired; + } + + /** + * Perform callback process + * + * @param none + * @return boolean + */ + protected function _callbackProcess() + { + if ($this->order) { + if ($this->level == 1 + && $this->response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { // Level 1 payments - Type of Chargebacks + $this->_refundProcess(); + return true; + } + + if ($this->response->getPaymentType() == 'SUBSCRIPTION_STOP') { // Cancellation of a subscription + $this->_subscriptionCancel(); + return true; + } + + if ($this->response->getPaymentType() == 'SUBSCRIPTION_REACTIVATE') { // Reactivate of a subscription + $profile = $this->getProfileInformation(); + if ($profile->getState() == 'canceled') { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE) + ->save(); + $script = $this->helper->__('Novalnet callback script received. Subscription has been reactivated + for the TID: %s on %s.', $this->getParentTid(), $this->currentTime) . $this->lineBreak; + $this->emailBody = $script; + $data = unserialize($this->payment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $subsCycleDate = $this->response->getNextSubsCycle() + ? $this->response->getNextSubsCycle() : $this->response->getPaidUntil(); + $this->payment->setAdditionalData(serialize($data))->save(); + $orderNo = $this->getRecurringOrderId(); + $lastOrder = Mage::getModel('sales/order')->loadByIncrementId($orderNo); + $payment = $lastOrder->getPayment(); + $lastOrderData = unserialize($payment->getAdditionalData()); + if ($subsCycleDate) { + $lastOrderData['paidUntil'] = Mage::helper('core')->formatDate($subsCycleDate); + $payment->setAdditionalData(serialize($lastOrderData)) + ->save(); + } + } + + return true; + } + + if ($this->level == 0) { + if ($this->recurring) { // Handle subscription process + $this->_recurringProcess(); + return true; + } + + $this->_initialPaymentProcess(); + return true; + } + + if ($this->level == 2) { + $saveInvoice = ''; + if ($this->response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + $saveInvoice = $this->_saveInvoice(); // Handle payment credit process + } + + $invoice = $this->order->getInvoiceCollection()->getFirstItem(); // Get order invoice items + if ($invoice && $saveInvoice) { // Handle payment credit process + $this->_updateOrderStatus(); // Update order status for payment credit process + } + + return true; + } + } else { + $this->showDebug("Novalnet Callback: No order for Increment-ID $this->orderNo found."); + return false; + } + } + + /** + * Handle payments initialiion process + * + * @param none + * @return none + */ + protected function _initialPaymentProcess() + { + $transactionId = $this->getParentTid(); + $transactionStatus = $this->helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status + + if ($this->response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && in_array($this->response->getPaymentType(), array('PAYPAL', 'PRZELEWY24'))) { + if ($this->order->canInvoice()) { + $transactionId = $this->getParentTid(); // Get the original/parent transaction id + // Create order invoice + $this->createInvoice($this->order, $transactionId); + $amount = $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + $this->emailBody = $this->helper->__('Novalnet callback received. The transaction has been confirmed on %s', $this->currentTime); + $transactionStatus->setTransactionStatus($this->response->getTidStatus())->save(); + if ($this->order->getInvoiceCollection()->getFirstItem()) { // Handle payment credit process + $this->_updateOrderStatus(); // Update order status for payment credit process + } + } else { + $this->showDebug('Novalnet callback received. Order already paid.'); + } + } elseif ($this->code == Novalnet_Payment_Model_Config::NN_PRZELEWY + && $this->response->getTidStatus() != Novalnet_Payment_Model_Config::PRZELEWY_PENDING_STATUS) { + // Get payment transaction status message + $statusMessage = $this->responseModel->getUnSuccessPaymentText($this->response); + $script = $this->emailBody = $this->helper->__( + 'The transaction has been canceled due to: %s', $statusMessage + ); + $data = unserialize($this->payment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) + ? $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + $this->order->registerCancellation($statusMessage)->save(); + } elseif (in_array($this->response->getPaymentType(), array('INVOICE_START', 'GUARANTEED_INVOICE', 'DIRECT_DEBIT_SEPA', + 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA', 'CREDITCARD')) + && in_array($paymentStatus, array(75, 91, 99, 98)) && in_array($this->response->getTidStatus(), array(91, 99, 100))) { + $statusApproved = (bool)($this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED); + $paymentObj = $this->payment->getMethodInstance(); // Payment method instance + $data = unserialize($this->payment->getAdditionalData()); + $orderStatus = ''; + $instalment = ''; + + + if ($statusApproved && in_array($paymentStatus, array(91, 99, 98))) { + $instalment = true; + $orderStatus = $paymentObj->getConfigData('order_status', $this->storeId) + ? $paymentObj->getConfigData('order_status', $this->storeId) + : Mage_Sales_Model_Order::STATE_COMPLETE; + if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE && $this->response->getPaymentType() == 'GUARANTEED_INVOICE') { + $orderStatus = $paymentObj->getConfigData('order_status_after_payment', $this->storeId) + ? $paymentObj->getConfigData('order_status_after_payment', $this->storeId) + : Mage_Sales_Model_Order::STATE_COMPLETE; + } + } elseif (in_array($this->code, array('novalnetInvoice', 'novalnetSepa')) && $paymentStatus == 75 + && in_array($this->response->getTidStatus(), array(91, 99, 100)) + ) { + $orderStatus = Mage::getStoreConfig('novalnet_global/order_status_mapping/order_status') + ? Mage::getStoreConfig('novalnet_global/order_status_mapping/order_status') + : Mage_Sales_Model_Order::STATE_PROCESSING; + + if ($this->code == 'novalnetInvoice' && $this->response->getTidStatus() == 100) { + $orderStatus = $paymentObj->getConfigData('order_status_after_payment', $this->storeId) + ? $paymentObj->getConfigData('order_status_after_payment', $this->storeId) + : Mage_Sales_Model_Order::STATE_COMPLETE; + } elseif ($this->code == 'novalnetSepa' && $this->response->getTidStatus() == 100) { + $orderStatus = $paymentObj->getConfigData('order_status', $this->storeId) + ? $paymentObj->getConfigData('order_status', $this->storeId) + : Mage_Sales_Model_Order::STATE_COMPLETE; + } + } elseif (in_array($this->code, array('novalnetInvoiceInstalment', 'novalnetSepaInstalment')) + && $paymentStatus == 75 && in_array($this->response->getTidStatus(), array(99, 91, 100)) + ) { + $instalment = true; + $orderStatus = Mage::getStoreConfig('novalnet_global/order_status_mapping/order_status') + ? Mage::getStoreConfig('novalnet_global/order_status_mapping/order_status') + : Mage_Sales_Model_Order::STATE_PROCESSING; + + if ($this->response->getTidStatus() == 100) { + $orderStatus = $paymentObj->getConfigData('order_status', $this->storeId) + ? $paymentObj->getConfigData('order_status', $this->storeId) + : Mage_Sales_Model_Order::STATE_COMPLETE; + } + } + + if ($instalment && in_array($this->code, array(Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, + Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT))) { + $data = unserialize($this->payment->getAdditionalData()); + $data['PaidInstall'] = $this->response->getInstalmentCyclesExecuted(); + $data['DueInstall'] = $this->response->getDueInstalmentCycles(); + $data['NextCycle'] = $this->response->getNextInstalmentDate(); + if ($futureInstalment = $this->response->getFutureInstalmentDates()) { + $futureInstalments = explode('|', $futureInstalment); + foreach ($futureInstalments as $futureInstalment) { + $cycle = strtok($futureInstalment, "-"); + $cycleDate = explode('-', $futureInstalment, 2); + $data['InstalmentDetails'][$cycle] = array('amount' => $data['InstallPaidAmount'], + 'nextCycle' => $cycleDate[1], + 'paidDate' => ($cycle == 1) ? date('Y-m-d') : '', + 'status' => ($cycle == 1) ? 'Paid' : 'Pending', + 'reference' => ($cycle == 1) ? $this->response->getTid() : ''); + } + } + $this->payment->setAdditionalData(serialize($data))->save(); + } + + if ($orderStatus) { + $this->saveConfirmStatus($transactionStatus); + // Create order invoice + if ($statusApproved && in_array($this->code, array(Novalnet_Payment_Model_Config::NN_INVOICE, + Novalnet_Payment_Model_Config::NN_SEPA, Novalnet_Payment_Model_Config::NN_INVOICE_INSTALMENT, + Novalnet_Payment_Model_Config::NN_SEPA_INSTALMENT, Novalnet_Payment_Model_Config::NN_CC))) { + $invoiceStatus = (bool)($this->response->getPaymentType() == 'GUARANTEED_INVOICE' + || $this->code == Novalnet_Payment_Model_Config::NN_SEPA); + $this->createInvoice($this->order, $transactionId, $invoiceStatus); + } + $message = $this->helper->__('The transaction has been confirmed'); + $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, $orderStatus, $message, true) + ->save(); + } else { + $this->showDebug('Novalnet Callbackscript received. Payment type ( ' . $this->response->getPaymentType() . ' ) is not + applicable for this process!'); + } + } elseif (in_array($this->response->getPaymentType(), array('INSTALMENT_INVOICE', 'INSTALMENT_DIRECT_DEBIT_SEPA')) + && $this->response->getInstalmentBilling() == 1 && $this->response->getInstalmentTid() + && $this->response->getStatus() == 100 && $this->response->getTidStatus() == 100) { + $data = unserialize($this->payment->getAdditionalData()); + $data['NnTid'] = $this->response->getTid(); + $paidAmount = $data['InstallPaidAmount'] + $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + $dueAmount = $data['InstallDueAmount'] - $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + $data['InstallPaidAmount'] = $paidAmount; + $data['InstallDueAmount'] = $dueAmount; + $data['PaidInstall'] = $this->response->getInstalmentCyclesExecuted(); + $data['DueInstall'] = $this->response->getDueInstalmentCycles(); + $data['NextCycle'] = $this->response->getNextInstalmentDate(); + $data['InstallCycleAmount'] = $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + if ($this->response->getPaymentType() == 'INSTALMENT_INVOICE') { + $note = explode('|', $data['NnNote']); + if ($this->response->getDueDate()) { + $formatDate = Mage::helper('core')->formatDate($this->response->getDueDate()); + $note[0] = 'Due Date: ' . $formatDate; + $data['NnDueDate'] = $this->response->getDueDate(); + } + + $data['NnNote'] = implode('|', $note); + $referenceNote = explode('|', $data['NnNoteTID']); + $referenceNote[1] = 'NN_Reference1:TID ' . $this->response->getTid(); + $data['NnNoteTID'] = implode('|', $referenceNote); + } + + $data['InstalmentDetails'][$this->response->getInstalmentCyclesExecuted()] = array('amount' => $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'), + 'nextCycle' => $this->response->getNextInstalmentDate(), + 'paidDate' => date('Y-m-d'), + 'status' => 'Paid', + 'reference' => $this->response->getTid()); + $this->payment->setAdditionalData(serialize($data))->save(); + // Send instalment email to end customer + $this->sendInstalmentmail(); + $this->showDebug('Novalnet Callbackscript received. Instalment payment executed properly'); + } else { + $this->showDebug('Novalnet Callbackscript received. Payment type ( ' . $this->response->getPaymentType() . ' ) is + not applicable for this process!'); + } + } + + /** + * Save Guaranteed comments + * + * @param none + * @return none + */ + private function sendInstalmentmail() + { + $this->getEmailConfig(); + $emailTemplate = Mage::getModel('core/email_template') + ->loadDefault('novalnet_callback_instalment_email_template'); + $storeName = Mage::app()->getStore()->getFrontendName(); + $emailSubject = __('Instalment confirmation %s Order no: %s', $storeName, $this->orderNo); + + // Define some variables to assign to template + $templateParams = array(); + $templateParams['order'] = $this->order; + $templateParams['store'] = Mage::app()->getStore(); + $templateParams['payment_html'] = Mage::helper('payment')->getInfoBlock($this->order->getPayment(), Mage::app()->getStore()->getId())->toHtml(); + $templateParams['sepaPayment'] = ($this->response->getPaymentType() == 'INSTALMENT_DIRECT_DEBIT_SEPA') + ? __('The instalment amount for this cycle %s %s will be debited from your account in one - three business days.', $this->response->getAmount()/ 100, $this->currency) : ''; + $template = $emailTemplate->getProcessedTemplate($templateParams); + + $mail = new Zend_Mail('UTF-8'); + $mail->setBodyHtml($template); + $mail->setFrom($this->emailFromAddr, $this->emailFromName); + $this->helper->assignEmailAddress($this->order->getCustomerEmail(), $mail, 'To'); + $mail->setSubject($emailSubject); + + try { + $mail->send(); + $this->showDebug(__FUNCTION__ . ': Sending Email succeeded!' . $this->lineBreak, false); + } catch (Exception $e) { + Mage::getSingleton('core/session')->addError($this->helper->__('Unable to send email')); + $this->showDebug('Email sending failed: ', false); + return false; + } + } + + /** + * Change Invoice/Guaranteed Invoice due date + * + * @param Varien_Object $transactionStatus + * @param string $orderStatus + * @return none + */ + protected function saveConfirmStatus($transactionStatus) + { + $data = unserialize($this->payment->getAdditionalData()); + $this->emailBody = $script = $this->helper->__('Novalnet callback received. The transaction has been confirmed on %s', $this->currentTime); + if ($this->response->getDueDate()) { + $formatDate = Mage::helper('core')->formatDate($this->response->getDueDate()); + $note = explode('|', $data['NnNote']); + $note[0] = 'Due Date: ' . $formatDate; + $data['NnNote'] = implode('|', $note); + $data['NnDueDate'] = $formatDate; + } + + if ($transactionStatus->getTransactionStatus() == 75 && in_array($this->response->getTidStatus(), array(91, 99))) { + $this->emailBody = $script = $this->helper->__( + 'Novalnet callback received. The transaction status has been changed from pending to on hold for the TID: %s on %s.', + $this->getParentTid(), + $this->currentTime + ); + } + + $transactionStatus->setTransactionStatus($this->response->getTidStatus())->save(); + $message = $this->helper->__('The transaction has been confirmed'); + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script . '
' : $data['NnComments'] . '
' . $script . '
'; + $this->payment->setAdditionalData(serialize($data))->save(); + } + + /** + * Handle payment chargeback and bookback process + * + * @param none + * @return none + */ + protected function _refundProcess() + { + // Update callback comments for Chargebacks + $bookBack = array('CREDITCARD_BOOKBACK', 'PAYPAL_BOOKBACK', 'REFUND_BY_BANK_TRANSFER_EU', 'PRZELEWY24_REFUND', + 'CASHPAYMENT_REFUND', 'GUARANTEED_INVOICE_BOOKBACK', 'GUARANTEED_SEPA_BOOKBACK', 'INSTALMENT_INVOICE_BOOKBACK', 'INSTALMENT_SEPA_BOOKBACK'); + $transactionId = !$this->recurring ? $this->response->getTidPayment() : $this->response->getSignupTid(); + $this->emailBody = $script = (in_array($this->response->getPaymentType(), $bookBack)) ? $this->helper->__('Novalnet callback received. Refund/Bookback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s', $transactionId, ($this->response->getAmount()) / 100 . ' ' . $this->currency, $this->currentTime, $this->response->getTid()) : $this->helper->__('Novalnet callback received. Chargeback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s', $transactionId, ($this->response->getAmount()) / 100 . ' ' . $this->currency, $this->currentTime, $this->response->getTid()); + $data = unserialize($this->payment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script . '
' : $data['NnComments'] . '
' . $script . '
'; + $this->payment->setAdditionalData(serialize($data))->save(); + } + + /** + * Handle subscription cancel process + * + * @param none + * @return none + */ + protected function _subscriptionCancel() + { + // Update the status of the user subscription + $statusText = $this->response->getTerminationReason() + ? $this->response->getTerminationReason() : $this->responseModel->getStatusText($this->response); + $script = $this->helper->__( + 'Novalnet callback script received. Subscription has been stopped for the TID: %s on %s', + $this->response->getSignupTid(), + $this->currentTime + ); + $script .= $this->lineBreak . $this->helper->__('Subscription has been canceled due to: ') . $statusText; + $this->emailBody = $script; + $profile = $this->getProfileInformation(); // Get the Recurring Profile Information + $profile->setState('canceled')->save(); // Set profile status as canceled + // Get parent order object for given recurring profile + $profileOrders = $this->helper->getModel('Mysql4_Recurring')->getRecurringOrderNo($profile); + $parentOrder = Mage::getModel('sales/order')->loadByIncrementId($profileOrders[0]); + $parentPayment = $parentOrder->getPayment(); + + // Save additional transaction information + $data = unserialize($parentPayment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) ? '
' . $script : $data['NnComments'] . '
' . $script; + $parentPayment->setAdditionalData(serialize($data))->save(); + } + + /** + * Handle recurring payment process + * + * @param none + * @return boolean + */ + protected function _recurringProcess() + { + $profile = $this->getProfileInformation(); // Get the Recurring Profile Information + + if (in_array($this->response->getStatus(), array(Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED, Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS))) { + $script = $this->helper->__( + 'Novalnet Callback Script executed successfully for the subscription TID: %s with amount %s on %s', + $this->response->getSignupTid(), + ($this->response->getAmount()) / 100 . ' ' . $this->currency, + $this->currentTime + ); + // Save subscription callback values + $callbackCycle = $this->saveRecurringProcess($profile->getPeriodMaxCycles(), $profile->getId()); + // Verify subscription period (cycles) + $this->verifyRecurringCycle($profile, $callbackCycle); + // Create recurring payment order + $this->_createOrder($script, $profile->getId()); + } else { + if ($profile->getState() != 'canceled') { // Cancellation of a subscription + $this->_subscriptionCancel(); + } + } + + return true; + } + + /** + * Save subscription callback informations + * + * @param int $periodMaxCycles + * @param int $profileId + * @return int $callbackCycle + */ + public function saveRecurringProcess($periodMaxCycles, $profileId) + { + $recurringModel = $this->helper->getModel('Mysql4_Recurring'); + $recurringCollection = $recurringModel->getCollection(); + $recurringCollection->addFieldToFilter('profile_id', $profileId); + $recurringCollection->addFieldToSelect('callbackcycle'); + $countRecurring = count($recurringCollection); + if ($countRecurring == 0) { + $callbackCycle = 1; + $recurringModel->setProfileId($profileId) + ->setSignupTid($this->response->getSignupTid()) + ->setBillingcycle($periodMaxCycles) + ->setCallbackcycle($callbackCycle) + ->setCycleDatetime($this->currentTime) + ->save(); + } else { + foreach ($recurringCollection as $profile) { + $callbackCycle = $profile->getCallbackcycle(); + } + + $callbackCycle = ++$callbackCycle; + $recurring = $recurringModel->load($profileId, 'profile_id'); + $recurring->setCallbackcycle($callbackCycle) + ->setCycleDatetime($this->currentTime) + ->save(); + } + + return $callbackCycle; + } + + /** + * Verify subscription period (cycles) + * + * @param int $profile + * @param int $callbackCycle + * @return none + */ + public function verifyRecurringCycle($profile, $callbackCycle) + { + $periodMaxCycles = $profile->getPeriodMaxCycles(); + $this->endTime = 0; + + if ($callbackCycle == $periodMaxCycles) { + // Get parent order object for given recurring profile + $profileOrders = $this->helper->getModel('Mysql4_Recurring')->getRecurringOrderNo($profile); + $this->parentOrder = Mage::getModel('sales/order')->loadByIncrementId($profileOrders[0]); + $this->parentPayment = $this->parentOrder->getPayment(); + $this->parentPaymentObj = $this->parentPayment->getMethodInstance(); + + // Send subscription cancel request to Novalnet + $response = $this->initiateSubscriptionCancel(); + + // Save additional transaction information + $data = unserialize($this->parentPayment->getAdditionalData()); + $data['subsCancelReason'] = 'other'; + $this->parentPayment->setAdditionalData(serialize($data))->save(); + + if ($response->getStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED) { + $profile->setState('canceled')->save(); + $this->endTime = 1; + } else { + $this->endTime = 0; + } + } + } + + /** + * Send subscription cancel request to Novalnet + * + * @param none + * @return Varien_Object $response + */ + public function initiateSubscriptionCancel() + { + $traces = $this->helper->getModel('Mysql4_TransactionTraces') + ->loadByAttribute('order_id', $this->parentOrder->getIncrementId()); + $isSerialized = $this->helper->is_serialized($traces->getRequestData()); + $paymentRequest = ($isSerialized === true) + ? unserialize($traces->getRequestData()) : unserialize(base64_decode($traces->getRequestData())); + $additionalData = unserialize($this->parentPayment->getAdditionalData()); + // Build subscription cancel request + $request = new Varien_Object(); + $request->setVendor($additionalData['vendor']) + ->setAuthCode($additionalData['auth_code']) + ->setProduct($additionalData['product']) + ->setTariff($additionalData['tariff']) + ->setKey($paymentRequest['key']) + ->setNnLang($paymentRequest['lang']) + ->setCancelSub(1) + ->setCancelReason('other') + ->setTid($this->response->getSignupTid()) + ->setRemoteIp($this->helper->getRealIpAddr()); + // Send recurring cancel request to Novalnet gateway + $response = $this->parentPaymentObj->postRequest($request); + // Log Novalnet payment transaction informations + $this->responseModel->logTransactionTraces($request, $response, $this->parentOrder, $request->getTid()); + return $response; + } + + /** + * New order create process + * + * @param string $script + * @param int $profileId + * @return none + */ + protected function _createOrder($script, $profileId) + { + $this->setLanguageStore(); // Set the language by store id + $orderNew = Mage::getModel('sales/order') + ->setState('new'); + + $orderPayment = Mage::getModel('sales/order_payment') + ->setStoreId($this->storeId) + ->setMethod($this->code) + ->setPo_number('-'); + $orderNew->setPayment($orderPayment); + $orderNew = $this->setOrderDetails($this->order, $orderNew); + $billingAddress = Mage::getModel('sales/order_address'); + $getBillingAddress = Mage::getModel('sales/order_address')->load($this->order->getBillingAddress()->getId()); + if ($customerId = $this->order->getCustomerId()) { + $this->getCustomerAddress($customerId, $getBillingAddress, 'billing'); + } + + $orderNew = $this->setBillingShippingAddress($getBillingAddress, $billingAddress, $orderNew, $this->order); + if ($this->order->getIsVirtual() == 0) { + $shippingAddress = Mage::getModel('sales/order_address'); + $getShipping = Mage::getModel('sales/order_address')->load($this->order->getShippingAddress()->getId()); + if ($customerId) { + $this->getCustomerAddress($customerId, $getShipping, 'shipping'); + } + $orderNew = $this->setBillingShippingAddress($getShipping, $shippingAddress, $orderNew, $this->order); + } + + $orderNew = $this->setOrderItemsDetails($this->order, $orderNew); + $paymentNew = $orderNew->getPayment(); + $orderStatus = $this->getOrderStatus(); // Get order status + $message = $this->helper->__('Novalnet Recurring Callback script Executed Successfully'); + $orderNew->addStatusToHistory($orderStatus, $message, false)->save(); + $this->getLayout()->getBlock('Callback')->setNewOrderNumber($orderNew->getIncrementId()); + + $transactionId = trim($this->response->getTid()); + $data = $this->getPaymentAddtionaldata($orderNew, $script); + $additionalInfo = $this->payment->getAdditionalInformation(); + // Save payment transaction informations + $paymentNew->setTransactionId($transactionId) + ->setAdditionalData(serialize($data)) + ->setAdditionalInformation($additionalInfo) + ->setLastTransId($transactionId) + ->setParentTransactionId(null) + ->setIsTransactionClosed(false) + ->save(); + // Send new order email + $orderNew->sendNewOrderEmail() + ->setEmailSent(true) + ->setPayment($paymentNew) + ->save(); + + $this->insertOrderId($orderNew->getId(), $profileId); // Insert the order id in recurring order table + $this->updateInventory($this->order); // Update the product inventory (stock) + // Log Novalnet payment transaction informations + $this->responseModel->logTransactionStatus($this->response, $orderNew); + // Log Novalnet payment transaction traces informations + $transactionTraces = $this->helper->getModel('Mysql4_TransactionTraces'); + $transactionTraces->setOrderId($orderNew->getIncrementId()) + ->setTransactionId($this->response->getTid()) + ->setRequestData(null) + ->setCustomerId($orderNew->getCustomerId()) + ->setStatus($this->response->getStatus()) + ->setResponseData(base64_encode(serialize($this->response->getData()))) + ->setStoreId($orderNew->getStoreId()) + ->setShopUrl($this->helper->getBaseUrl()) + ->setCreatedDate($this->helper->getCurrentDateTime()) + ->save(); + + if ($orderNew->canInvoice() + && $this->code != Novalnet_Payment_Model_Config::NN_PREPAYMENT + && $this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + ) { + $this->createInvoice($orderNew, $transactionId); + } else { + $transaction = $paymentNew->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, null, false); + $transaction->setParentTxnId(null) + ->save(); + } + } + + /** + * Get customer details (default billing/shipping address) + * + * @param int $customerId + * @param Varien_Object $orderAddress + * @param string $addressType + */ + public function getCustomerAddress($customerId, $orderAddress, $addressType) + { + // Load customer details (default billing/shipping address) by customer id (if exist). + $customerData = Mage::getModel('customer/customer')->load($customerId); + $defaultCustomerAddress = ($addressType == 'billing') + ? $customerData->getPrimaryBillingAddress() : $customerData->getPrimaryShippingAddress(); + if ($defaultCustomerAddress) { + $orderAddress->setFirstname($defaultCustomerAddress->getFirstname()) + ->setMiddlename($defaultCustomerAddress->getMiddlename()) + ->setLastname($defaultCustomerAddress->getLastname()) + ->setPrefix($defaultCustomerAddress->getPrefix()) + ->setSuffix($defaultCustomerAddress->getSuffix()) + ->setCompany($defaultCustomerAddress->getCompany()) + ->setCity($defaultCustomerAddress->getCity()) + ->setCountryId($defaultCustomerAddress->getCountryId()) + ->setRegion($defaultCustomerAddress->getRegion()) + ->setPostcode($defaultCustomerAddress->getPostcode()) + ->setTelephone($defaultCustomerAddress->getTelephone()) + ->setFax($defaultCustomerAddress->getFax()) + ->setRegionId($defaultCustomerAddress->getRegionId()) + ->setStreet($defaultCustomerAddress->getStreet()); + } + } + + /** + * Get payment method additional informations + * + * @param Varien_Object $orderNew + * @param mixed $script + * @param array $data + */ + public function getPaymentAddtionaldata($orderNew, $script) + { + $parentOrderNo = $this->getOrderIdByTransId() ? $this->getOrderIdByTransId() : $orderNew->getIncrementId(); + $subsCycleDate = $this->response->getNextSubsCycle() + ? $this->response->getNextSubsCycle() : $this->response->getPaidUntil(); + $script .= $comments = '
' . $this->helper->__('Reference order id: %s', $parentOrderNo) . '
'; + $this->emailBody = $script; + + $parentAdditionalData = unserialize($this->payment->getAdditionalData()); + $language = !empty($parentAdditionalData['nnLang']) ? $parentAdditionalData['nnLang'] : 'en_US'; + $data = array('NnTestOrder' => $this->response->getTestMode(), + 'NnTid' => trim($this->response->getTid()), + 'NnComments' => ($comments), + 'vendor' => $parentAdditionalData['vendor'], + 'auth_code' => $parentAdditionalData['auth_code'], + 'product' => $parentAdditionalData['product'], + 'tariff' => $parentAdditionalData['tariff'], + 'payment_id' => $parentAdditionalData['payment_id'], + 'nnLang' => $language, + 'paidUntil' => $subsCycleDate ? Mage::helper('core')->formatDate($subsCycleDate) : '' + ); + + if (in_array($this->response->getPaymentType(), array('GUARANTEED_INVOICE', 'GUARANTEED_DIRECT_DEBIT_SEPA'))) { + $data['NnGuarantee'] = 1; + } + + if (in_array($this->code, array('novalnetInvoice', 'novalnetPrepayment'))) { + $amount = Mage::helper('core')->currency($this->response->getAmount() / 100, true, false); + $data['NnNote'] = $this->responseModel->getInvoicePaymentNote($this->response); + $data['NnDueDate'] = $this->response->getDueDate(); + $data['NnNoteAmount'] = 'NN_Amount: ' . $amount; + } + + return $data; + } + + /** + * Create order invoice + * + * @param Varien_Object $order + * @param int $transactionId + * @param boolean $pendingState + * @param none + */ + public function createInvoice($order, $transactionId, $pendingState = false) + { + $invoice = $order->prepareInvoice(); + $invoice->setTransactionId($transactionId); + $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE); + $invoice->setState( + ($pendingState == true) + ? Mage_Sales_Model_Order_Invoice::STATE_OPEN : Mage_Sales_Model_Order_Invoice::STATE_PAID + ); + $invoice->register(); + $invoice->save(); + + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($invoice->getOrder()) + ->save(); + + if ($pendingState == false) { + $transMode = (version_compare($this->helper->getMagentoVersion(), '1.6', '<')) ? false : true; + $payment = $order->getPayment(); + $payment->setTransactionId($transactionId) + ->setIsTransactionClosed($transMode); + $transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, null, false); + $transaction->setParentTxnId(null) + ->save(); + } + } + + /** + * Set the language based on store id + * + * @param none + * @return none + */ + public function setLanguageStore() + { + $app = Mage::app(); + $app->setCurrentStore($this->storeId); + $locale = Mage::getStoreConfig('general/locale/code', $this->storeId); + $app->getLocale()->setLocaleCode($locale); + Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true); + } + + /** + * Set order item and customer informations + * + * @param Varien_Object $order + * @param Varien_Object $orderNew + * @return Varien_Object $orderNew + */ + public function setOrderDetails($order, $orderNew) + { + if ($customerId = $order->getCustomerId()) { + // Get the latest customer details (Email, First name, Last name) from customer account information. + $customerData = Mage::getModel('customer/customer')->load($customerId); + $customerGroupId = $customerData->getGroupId(); + $email = $customerData->getEmail(); + $firstName = $customerData->getFirstname(); + $lastName = $customerData->getLastname(); + } + + $orderNew->setStoreId($order->getStoreId()) + ->setCustomerGroupId(!empty($customerGroupId) ? $customerGroupId : $order->getCustomerGroupId()) + ->setQuoteId(0) + ->setIsVirtual($order->getIsVirtual()) + ->setGlobalCurrencyCode($order->getGlobalCurrencyCode()) + ->setBaseCurrencyCode($order->getBaseCurrencyCode()) + ->setStoreCurrencyCode($order->getStoreCurrencyCode()) + ->setOrderCurrencyCode($order->getOrderCurrencyCode()) + ->setStoreName($order->getStoreName()) + ->setCustomerEmail(!empty($email) ? $email : $order->getCustomerEmail()) + ->setCustomerFirstname(!empty($firstName) ? $firstName : $order->getCustomerFirstname()) + ->setCustomerLastname(!empty($lastName) ? $lastName : $order->getCustomerLastname()) + ->setCustomerId($order->getCustomerId()) + ->setCustomerIsGuest($order->getCustomerIsGuest()) + ->setState('processing') + ->setStatus($order->getStatus()) + ->setSubtotal($order->getSubtotal()) + ->setBaseSubtotal($order->getBaseSubtotal()) + ->setSubtotalInclTax($order->getSubtotalInclTax()) + ->setBaseSubtotalInclTax($order->getBaseSubtotalInclTax()) + ->setShippingAmount($order->getShippingAmount()) + ->setBaseShippingAmount($order->getBaseShippingAmount()) + ->setGrandTotal($order->getGrandTotal()) + ->setBaseGrandTotal($order->getBaseGrandTotal()) + ->setTaxAmount($order->getTaxAmount()) + ->setTotalQtyOrdered($order->getTotalQtyOrdered()) + ->setBaseTaxAmount($order->getBaseTaxAmount()) + ->setBaseToGlobalRate($order->getBaseToGlobalRate()) + ->setBaseToOrderRate($order->getBaseToOrderRate()) + ->setStoreToBaseRate($order->getStoreToBaseRate()) + ->setStoreToOrderRate($order->getStoreToOrderRate()) + ->setWeight($order->getWeight()) + ->setCustomerNoteNotify($order->getCustomerNoteNotify()); + return $orderNew; + } + + /** + * Set billing and shipping address informations + * + * @param Varien_Object $getBillingAddress + * @param Varien_Object $billingAddress + * @param Varien_Object $orderNew + * @param Varien_Object $order + * @return mixed + */ + public function setBillingShippingAddress($getBillingAddress, $billingAddress, $orderNew, $order) + { + $addressType = $getBillingAddress->getAddressType(); + $billingStreet = $getBillingAddress->getStreet(); + $street = !empty($billingStreet[1]) ? array($billingStreet[0], $billingStreet[1]) : array($billingStreet[0]); + $billingAddress->setStoreId($order->getStoreId()) + ->setAddressType($addressType) + ->setPrefix($getBillingAddress->getPrefix()) + ->setFirstname($getBillingAddress->getFirstname()) + ->setLastname($getBillingAddress->getLastname()) + ->setMiddlename($getBillingAddress->getMiddlename()) + ->setSuffix($getBillingAddress->getSuffix()) + ->setCompany($getBillingAddress->getCompany()) + ->setStreet($street) + ->setCity($getBillingAddress->getCity()) + ->setCountryId($getBillingAddress->getCountryId()) + ->setRegionId($getBillingAddress->getRegionId()) + ->setTelephone($getBillingAddress->getTelephone()) + ->setFax($getBillingAddress->getFax()) + ->setVatId($getBillingAddress->getVatId()) + ->setPostcode($getBillingAddress->getPostcode()); + + if ($addressType == Mage_Sales_Model_Quote_Address::TYPE_BILLING) { + $orderNew->setBillingAddress($billingAddress); + } else { + $shippingMethod = $order->getShippingMethod(); + $shippingDescription = $order->getShippingDescription(); + $orderNew->setShippingAddress($billingAddress) + ->setShippingMethod($shippingMethod) + ->setShippingDescription($shippingDescription); + } + + return $orderNew; + } + + /** + * Set product informations (product, discount, tax, etc.,) + * + * @param Varien_Object $order + * @param Varien_Object $orderNew + * @return mixed + */ + public function setOrderItemsDetails($order, $orderNew) + { + foreach ($order->getAllItems() as $orderValue) { + $orderItem = Mage::getModel('sales/order_item') + ->setStoreId($orderValue->getStoreId()) + ->setQuoteItemId(0) + ->setQuoteParentItemId(null) + ->setQtyBackordered(null) + ->setQtyOrdered($orderValue->getQtyOrdered()) + ->setName($orderValue->getName()) + ->setIsVirtual($orderValue->getIsVirtual()) + ->setProductId($orderValue->getProductId()) + ->setProductType($orderValue->getProductType()) + ->setSku($orderValue->getSku()) + ->setWeight($orderValue->getWeight()) + ->setPrice($orderValue->getPrice()) + ->setBasePrice($orderValue->getBasePrice()) + ->setOriginalPrice($orderValue->getOriginalPrice()) + ->setTaxAmount($orderValue->getTaxAmount()) + ->setTaxPercent($orderValue->getTaxPercent()) + ->setIsNominal($orderValue->getIsNominal()) + ->setRowTotal($orderValue->getRowTotal()) + ->setBaseRowTotal($orderValue->getBaseRowTotal()) + ->setBaseWeeeTaxAppliedAmount($orderValue->getBaseWeeeTaxAppliedAmount()) + ->setWeeeTaxAppliedAmount($orderValue->getWeeeTaxAppliedAmount()) + ->setWeeeTaxAppliedRowAmount($orderValue->getWeeeTaxAppliedRowAmount()) + ->setWeeeTaxApplied($orderValue->getWeeeTaxApplied()) + ->setWeeeTaxDisposition($orderValue->getWeeeTaxDisposition()) + ->setWeeeTaxRowDisposition($orderValue->getWeeeTaxRowDisposition()) + ->setBaseWeeeTaxDisposition($orderValue->getBaseWeeeTaxDisposition()) + ->setBaseWeeeTaxRowDisposition($orderValue->getBaseWeeeTaxRowDisposition()); + $orderNew->addItem($orderItem); + } + + return $orderNew; + } + + /** + * Insert the order id in recurring order table + * + * @param int $newOrderId + * @param int $profileId + * @return none + */ + public function insertOrderId($newOrderId, $profileId) + { + if ($newOrderId && $profileId) { + $connection = Mage::getSingleton('core/resource')->getConnection('core_write'); + $connection->beginTransaction(); + $tablePrefix = Mage::getConfig()->getTablePrefix(); + $orderTable = $tablePrefix . 'sales_recurring_profile_order'; + $fields = array(); + $fields['profile_id'] = $profileId; + $fields['order_id'] = $newOrderId; + $connection->insert($orderTable, $fields); + $connection->commit(); + } + } + + /** + * Update the product inventory (stock) + * + * @param Varien_Object $order + * @return none + */ + public function updateInventory($order) + { + foreach ($order->getAllItems() as $orderValue) { + $itemsQtyOrdered = floor($orderValue->getQtyOrdered()); + $productId = $orderValue->getProductId(); + break; + } + + if ($productId) { + $stockObj = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); + $productQtyBefore = (int) $stockObj->getQty(); + } + + if (isset($productQtyBefore) && $productQtyBefore > 0) { + $productQtyAfter = (int) ($productQtyBefore - $itemsQtyOrdered); + $stockObj->setQty($productQtyAfter); + $stockObj->save(); + } + } + + /** + * Create invoice to order payment + * + * @param none + * @return boolean + */ + protected function _saveInvoice() + { + $amount = $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + if (in_array($this->response->getPaymentType(), array('INVOICE_CREDIT', 'ONLINE_TRANSFER_CREDIT', 'CASHPAYMENT_CREDIT'))) { + $data = unserialize($this->payment->getAdditionalData()); + $callbackModel = $this->helper->getModel('Mysql4_Callback')->loadLogByOrderId($this->orderNo); + $tidPayment = (!$this->recurring) ? $this->response->getTidPayment() : $this->response->getSignupTid(); + $totalAmount = sprintf(($this->response->getAmount() + $callbackModel->getCallbackAmount()), 0.2); + $grandTotal = round(sprintf(($this->order->getGrandTotal() * 100), 0.2)); + + $script = $this->helper->__('Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s
', $tidPayment, $amount . ' ' . $this->currency, $this->currentTime, $this->response->getTid()) . $this->lineBreak; + + if ($this->response->getPaymentType() == 'INVOICE_CREDIT' && $totalAmount < $grandTotal) { + $this->logCallbackInfo($callbackModel, $totalAmount, $this->orderNo); // Log callback data + $this->emailBody = $script; + $this->emailBody = $this->emailBody . $this->lineBreak; + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + return false; + } else { + $this->logCallbackInfo($callbackModel, $totalAmount, $this->orderNo); // Log callback data + if ($this->order->canInvoice()) { + $transactionId = $this->getParentTid(); // Get the original/parent transaction id + // Create order invoice + $this->createInvoice($this->order, $transactionId); + $this->emailBody = $script; + $this->emailBody = $this->emailBody . $this->lineBreak; + } else { + // Get order invoice collection + $invoice = $this->order->getInvoiceCollection()->getFirstItem(); + + if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE && $invoice->getState() == 1) { + $this->emailBody = $script; + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + $this->saveOrderStatus(); + return false; + } + + if ($this->code == Novalnet_Payment_Model_Config::NN_INVOICE && $this->response->getPaymentType() == 'INVOICE_CREDIT') { + $this->logCallbackInfo($callbackModel, $totalAmount, $this->orderNo); // Log callback data + $this->emailBody = $script; + $this->emailBody = $this->emailBody . $this->lineBreak; + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + return false; + } + + if ($this->response->getPaymentType() == 'ONLINE_TRANSFER_CREDIT') { + if ($totalAmount >= $grandTotal) { + $this->emailBody = $script . $this->lineBreak . $this->helper->__('The amount of %s for the order %s has been paid. Please verify received amount and TID details, and update the order status accordingly.', $amount . ' ' . $this->currency, $this->orderNo) . $this->lineBreak; + $script = $script . '
' . $this->helper->__('The amount of %s for the order %s has been paid. Please verify received amount and TID details, and update the order status accordingly.', $amount . ' ' . $this->currency, $this->orderNo) . '
'; + }else { + $this->emailBody = $script; + } + + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + return false; + } + + if (in_array($this->response->getPaymentType(), array('CASHPAYMENT_CREDIT'))) { + $this->showDebug( + 'Novalnet callback received. Callback Script executed already. Refer Order :' . $this->orderNo + ); + return false; + } else { + $this->showDebug('Novalnet Callbackscript received. Payment type ( ' . $this->response->getPaymentType() . ' ) is not applicable for this process!'); + return false; + } + } + } + } else { + $data = unserialize($this->payment->getAdditionalData()); + $tidPayment = (!$this->recurring) ? $this->response->getTidPayment() : $this->response->getSignupTid(); + + $script = $this->helper->__('Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s', $tidPayment, $amount . ' ' . $this->currency, $this->currentTime, $this->response->getTid()) . $this->lineBreak; + $this->emailBody = $script; + $this->emailBody = $this->emailBody . $this->lineBreak; + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + return false; + } + + return true; + } + + /** + * Update order and invoice status (Invoice & PayPal) + * + * @param none + * @return none + */ + public function saveOrderStatus() + { + $orderStatus = $this->getOrderStatus(); // Get order status + $orderState = Mage_Sales_Model_Order::STATE_PROCESSING; + $message = 'Novalnet callback set state ' . $orderState . ' for Order-ID = ' . $this->orderNo; + $this->order->setState($orderState, true, $message); + $this->order->addStatusToHistory($orderStatus, 'Novalnet callback added order status ' . $orderStatus); + $this->order->save(); + + $invoice = $this->order->getInvoiceCollection()->getFirstItem(); + $invoice->setState(Mage_Sales_Model_Order_Invoice::STATE_PAID); + $invoice->save(); + } + + /** + * Update order status and callback transaction details + * + * @param none + * @return none + */ + protected function _updateOrderStatus() + { + $orderStatus = $this->getOrderStatus(); // Get order status + $state = Mage_Sales_Model_Order::STATE_PROCESSING; + $message = 'Novalnet callback set state ' . $state . ' for Order-ID = ' . $this->orderNo; + $amount = $this->helper->getFormatedAmount($this->response->getAmount(), 'RAW'); + $this->order->setState($state, true, $message); + $this->order->addStatusToHistory($orderStatus, 'Novalnet callback added order status ' . $orderStatus); + $this->order->save(); + + if (in_array($this->response->getPaymentType(), $this->invoiceAllowed)) { + $script = $this->helper->__('Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s', $this->response->getTidPayment(), $amount . ' ' . $this->currency, $this->currentTime, $this->response->getTid()); + } else { + $script = $this->helper->__('Novalnet callback received. The transaction has been confirmed on %s', $this->currentTime); + } + + $data = unserialize($this->payment->getAdditionalData()); // Get payment additional information + $data['NnComments'] = empty($data['NnComments']) ? '
' . $script : $data['NnComments'] . '
' . $script; + $this->payment->setAdditionalData(serialize($data)); + $this->order->setPayment($this->payment)->save(); + } + + /** + * Log callback transaction information + * + * @param Novalnet_Payment_Model_Mysql4_Callback $callbackModel + * @param float $amount + * @param int $orderNo + * @return none + */ + public function logCallbackInfo($callbackModel, $amount, $orderNo) + { + $transactionId = $this->getParentTid(); // Get the original/parent transaction id + $reqUrl = Mage::helper('core/http')->getRequestUri(); + $callbackModel->setOrderId($orderNo) + ->setCallbackAmount($amount) + ->setReferenceTid($this->response->getTid()) + ->setCallbackTid($transactionId) + ->setCallbackDatetime($this->currentTime) + ->setCallbackLog($reqUrl) + ->save(); + } + + /** + * Get payment order status + * + * @param none + * @return string + */ + public function getOrderStatus() + { + $paymentObj = $this->payment->getMethodInstance(); // Payment method instance + $status = $paymentObj->getConfigData('order_status', $this->storeId); + $redirectPayments = Novalnet_Payment_Model_Config::getInstance()->getNovalnetVariable('redirectPayments'); + array_push($redirectPayments, Novalnet_Payment_Model_Config::NN_PREPAYMENT, Novalnet_Payment_Model_Config::NN_INVOICE, Novalnet_Payment_Model_Config::NN_CASHPAYMENT); + + // Redirect payment method order status + if ($this->response->getTidStatus() == Novalnet_Payment_Model_Config::RESPONSE_CODE_APPROVED + && $this->response->getPaymentType() != 'INVOICE_START' + && in_array($this->code, $redirectPayments) + ) { + $status = $paymentObj->getConfigData('order_status_after_payment', $this->storeId); + } + + // PayPal payment pending order status + if (($this->code == Novalnet_Payment_Model_Config::NN_PAYPAL && in_array($this->response->getTidStatus(), array(Novalnet_Payment_Model_Config::PAYPAL_PENDING_STATUS, Novalnet_Payment_Model_Config::PRZELEWY_PENDING_STATUS))) + || ($this->code == Novalnet_Payment_Model_Config::NN_CC) + ) { + $status = $paymentObj->getConfigData('order_status', $this->storeId) + ? $paymentObj->getConfigData('order_status', $this->storeId) + : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; + } + + return !empty($status) ? $status : Mage_Sales_Model_Order::STATE_PROCESSING; + } + + /** + * Log Novalnet callback response data + * + * @param none + * @return none + */ + public function savePayportResponse() + { + $transactionTraces = $this->helper->getModel('Mysql4_TransactionTraces') + ->loadByAttribute('order_id', $this->orderNo); // Get Novalnet transaction traces model + $transactionTraces->setTransactionId($this->response->getTid()) + ->setResponseData(base64_encode(serialize($this->response->getData()))) + ->setCustomerId($this->order->getCustomerId()) + ->setStatus($this->response->getTidStatus()) + ->setStoreId($this->storeId) + ->setShopUrl($this->response->getSystemUrl() ? $this->response->getSystemUrl() : '') + ->save(); + } + + /** + * Get Novalnet global configuration values + * + * @param string $field + * @return mixed $config + */ + protected function _getConfig($field) + { + $path = 'novalnet_global/novalnet/' . $field; // Global config value path + $config = null; + + if ($field == 'live_mode') { // Novalnet payment mode + $paymentMethod = Mage::getStoreConfig($path, $this->storeId); + $config = (bool)preg_match('/' . $this->code . '/i', $paymentMethod); + } elseif ($field !== null) { // Get Novalnet payment/global configuration + $config = Mage::getStoreConfig($path, $this->storeId); + } + + return $config; + } + + /* + * Assign callback process level + * + * @param none + * @return int + */ + + public function getCallbackProcessLevel() + { + if ($this->response->getPaymentType()) { + // Assign callback process flag + if (in_array($this->response->getPaymentType(), $this->arySubscription) + || (in_array($this->response->getPaymentType(), $this->recurringAllowed) + && ($this->response->hasSubsBilling() + && $this->response->getSubsBilling() == 1)) + ) { + $this->recurring = true; + } else { + $this->callback = true; + } + + // Assign callback process level + if (in_array($this->response->getPaymentType(), $this->paymentTypes)) { + return 0; + } else if (in_array($this->response->getPaymentType(), $this->chargebacks)) { + return 1; + } else if (in_array($this->response->getPaymentType(), $this->aryCollection)) { + return 2; + } + } else { + $this->showDebug('Required param (payment_type) missing!'); + return false; + } + } + + /** + * Get order increment id + * + * @param none + * @return int $orderNo + */ + public function getOrderIncrementId() + { + if ($this->recurring && !in_array($this->response->getPaymentType(), $this->arySubscription)) { // Get recurring profile increment id + $orderNo = $this->getRecurringOrderId(); + } else { // Get order increment id + $orderNo = $this->response->getOrderNo() ? $this->response->getOrderNo() : ''; + $orderNo = $orderNo ? $orderNo : $this->getOrderIdByTransId(); + } + + if (!empty($orderNo)) { + return $orderNo; + } else { + $this->showDebug('Required (Transaction ID) not Found!'); + return false; + } + } + + /** + * Get increment id based on payment last transaction id + * + * @param none + * @return int + */ + public function getOrderIdByTransId() + { + $parentTid = $this->getParentTid(); // Get the original/parent transaction id + $tablePrefix = Mage::getConfig()->getTablePrefix(); + + if (in_array($this->response->getPaymentType(), $this->chargebacks)) { + $orderPayment = $tablePrefix . 'sales_payment_transaction'; + $onCondition = "main_table.entity_id = $orderPayment.order_id"; + $orderCollection = Mage::getModel('sales/order')->getCollection() + ->addFieldToFilter('txn_id', array('like' => "%$parentTid%")) + ->addFieldToSelect('increment_id'); + } else { + $orderPayment = $tablePrefix . 'sales_flat_order_payment'; + $onCondition = "main_table.entity_id = $orderPayment.parent_id"; + $orderCollection = Mage::getModel('sales/order')->getCollection() + ->addFieldToFilter('last_trans_id', array('like' => "%$parentTid%")) + ->addFieldToSelect('increment_id'); + } + + // Get order collection + $orderCollection->getSelect()->join($orderPayment, $onCondition); + $getSize = $orderCollection->getSize(); + $orderId = ''; + + if ($getSize > 0) { + foreach ($orderCollection as $order) { + $orderId = $order->getIncrementId(); + } + } + + return $orderId; + } + + /** + * Get subscription payment increment id + * + * @param none + * @return int $orderNo + */ + public function getRecurringOrderId() + { + $orderNo = ''; + $profile = $this->getProfileInformation(); // Get the Recurring Profile Information + $profileCollection = Mage::getResourceModel('sales/order_grid_collection') + ->addRecurringProfilesFilter($profile->getId()); + foreach ($profileCollection as $profileValue) { + $orderNo = $profileValue->getIncrementId(); + } + + return $orderNo; + } + + /** + * Get the Recurring Profile Information + * + * @param none + * @return Varien_Object $profile + */ + public function getProfileInformation() + { + // Get the original/parent transaction id + $tid = ($this->response->getSignupTid()) ? $this->response->getSignupTid() : $this->response->getTid(); + return Mage::getModel('sales/recurring_profile')->load($tid, 'reference_id'); + } + + /** + * Get transaction id based on payment type + * + * @param none + * @return int $tid + */ + public function getParentTid() + { + // Get the original/parent transaction id + $tid = $this->response->getTid(); + + if (in_array($this->response->getPaymentType(), array_merge($this->chargebacks, $this->aryCollection))) { + $tid = $this->response->getTidPayment(); + } + + if (in_array($this->response->getPaymentType(), $this->arySubscription) + || ($this->response->getSignupTid() && in_array($this->response->getPaymentType(), $this->recurringAllowed))) { + $tid = trim($this->response->getSignupTid()); + } + + if ($this->response->getInstalmentTid()) { + $tid = $this->response->getInstalmentTid(); + } + + return $tid; + } + + /** + * Check whether the ip address is authorised + * + * @param none + * @return boolean + */ + public function checkIP() + { + $allowedIp = gethostbyname('pay-nn.de'); + + if (empty($allowedIp)) { + $this->showDebug('Novalnet HOST IP missing'); + return false; + } + + $callerIp = $this->helper->getRealIpAddr(); + + if ($callerIp != $allowedIp && !$this->test) { + $this->showDebug('Novalnet callback received. Unauthorised access from the IP [' . $callerIp . ']'); + return false; + } + + return true; + } + + /** + * Show callback process transaction comments + * + * @param string $text + * @param boolean $die + * @return none + */ + public function showDebug($text, $die = true) + { + $displayMessage = $this->getLayout()->getBlock('Callback')->hasAdditionMessage() + ? $this->getLayout()->getBlock('Callback')->getAdditionMessage() . $text : $text; + if ($die === false) { + $this->getLayout()->getBlock('Callback')->setAdditionMessage($text); + } + + $this->getLayout()->getBlock('Callback')->setDisplayError($displayMessage); + if ($die) { + $this->getLayout()->getBlock('Callback')->setExitProcess(true); + $this->renderLayout(); + } + } + + /** + * Send callback notification E-mail + * + * @param none + * @return none + */ + public function sendCallbackMail() + { + $this->getEmailConfig(); // Get email configuration settings + + if (!empty($this->emailBody) && $this->emailFromAddr && $this->emailToAddr) { + if (!$this->sendEmailMagento()) { + $this->showDebug('Mailing failed!' . $this->lineBreak, false); + $this->showDebug('This mail text should be sent: ', false); + } + } + + if (!empty($this->emailBody)) { + $this->showDebug($this->emailBody); + } + } + + /** + * Send callback notification E-mail (with callback template) + * + * @param none + * @return boolean + */ + public function sendEmailMagento() + { + /* + * Loads the html file named 'novalnet_callback_email.html' from + * E.G: app/locale/en_US/template/email/novalnet/novalnet_callback_email.html + * OR: app/locale/YourLanguage/template/email/novalnet/novalnet_callback_email.html + * Adapt the corresponding template if necessary + */ + $emailTemplate = Mage::getModel('core/email_template') + ->loadDefault('novalnet_callback_email_template'); + + // Define some variables to assign to template + $templateParams = array(); + $templateParams['fromName'] = $this->emailFromName; + $templateParams['fromEmail'] = $this->emailFromAddr; + $templateParams['toName'] = $this->emailToName; + $templateParams['toEmail'] = $this->emailToAddr; + $templateParams['subject'] = $this->emailSubject; + $templateParams['body'] = $this->emailBody; + $template = $emailTemplate->getProcessedTemplate($templateParams); + + $mail = new Zend_Mail('UTF-8'); + $mail->setBodyHtml($template); + $mail->setFrom($this->emailFromAddr, $this->emailFromName); + $this->helper->assignEmailAddress($this->emailToAddr, $mail, 'To'); + $mail->setSubject($this->emailSubject); + + try { + $mail->send(); + $this->showDebug(__FUNCTION__ . ': Sending Email succeeded!' . $this->lineBreak, false); + } catch (Exception $e) { + Mage::getSingleton('core/session')->addError($this->helper->__('Unable to send email')); + $this->showDebug('Email sending failed: ', false); + return false; + } + + return true; + } + + /** + * Set recurring profile state + * + * @param string|null $state + * @return none + */ + public function setRecurringProfileState($state = 'Active') + { + $profileId = $this->response->hasProfileId() + ? $this->response->getProfileId() + : ($this->response->hasInput4() && $this->response->getInput4() == 'profile_id' + ? $this->response->getInputval4() + : '' + ); + if ($profileId) { + $profile = Mage::getModel('sales/recurring_profile')->load($profileId, 'profile_id'); + + if ($state == 'Active') { + $status = $this->response->getTidStatus(); + $message = $this->helper->getModel('Recurring_Payment')->createIpnComment($status, $this->order); + $this->payment->setPreparedMessage($message) + ->setAdditionalInformation('subs_id', $this->response->getSubsId())->save(); + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE); //Set profile status as active + } else { + $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_CANCELED); //Set profile status as canceled + } + + $profile->setReferenceId($this->response->getTid())->save(); + } + } + + /** + * Check change payment method + * + * @param none + * @return boolean + */ + public function changePaymentMethod() + { + $paymentType = $this->allowedPayment[strtolower($this->code)]; + + if (!in_array($this->response->getPaymentType(), $paymentType)) { + if ($this->response->getSignupTid() && $this->response->getSubsBilling() != 1 + && in_array($this->response->getPaymentType(), $this->recurringAllowed) && $this->response->getStatus() == 100) { + $paymentList = array('INVOICE_START' => 'novalnetInvoice', 'CREDITCARD' => 'novalnetCc', + 'DIRECT_DEBIT_SEPA' => 'novalnetSepa', 'GUARANTEED_DIRECT_DEBIT_SEPA' => 'novalnetSepa', + 'PAYPAL' => 'novalnetPaypal', 'GUARANTEED_INVOICE' => 'novalnetInvoice'); + $newPaymentCode = $paymentList[$this->response->getPaymentType()]; + $newPaymentCode = ($newPaymentCode == 'novalnetInvoice' && strtolower($this->response->getInvoiceType()) == 'prepayment') + ? 'novalnetPrepayment' : $newPaymentCode; + $this->payment->setMethod($newPaymentCode) + ->save(); + $script = $this->helper->__('Novalnet callback script received. Subscription payment has been changed from %s to %s on %s.', $this->code, $newPaymentCode, $this->currentTime); + $data = unserialize($this->payment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script . '
' : $data['NnComments'] . '
' . $script . '
'; + $this->payment->setAdditionalData(serialize($data))->save(); + $newOrder = Mage::getModel('sales/order')->loadByIncrementId($this->orderNo); + $recurringProfile = $this->getProfileInformation(); + $recurringProfile->setMethodCode($newOrder->getPayment()->getMethodInstance()->getCode()) + ->save(); + $paidUntil = $this->response->hasNextSubsCycle() + ? $this->response->getNextSubsCycle() + : ($this->response->hasPaidUntil() ? $this->response->getPaidUntil() : ''); + + $orderNo = $this->getRecurringOrderId(); + $lastOrder = Mage::getModel('sales/order')->loadByIncrementId($orderNo); + $payment = $lastOrder->getPayment(); + $lastOrderData = unserialize($payment->getAdditionalData()); + if ($paidUntil) { + $lastOrderData['paidUntil'] = Mage::helper('core')->formatDate($paidUntil); + } + + $payment->setMethod($newPaymentCode) + ->setAdditionalData(serialize($lastOrderData)) + ->save(); + $lastOrder->save(); + $this->showDebug($script); + } else { + $this->showDebug( + 'Novalnet callback received. Payment type ( ' . $this->response->getPaymentType() + . ' ) is not matched with ' . $this->code . '!' + ); + } + + return true; + } + + return false; + } + + /** + * Send critical error mail to Novalnet + * + * @param none + * @return none + */ + public function sendCriticalErrorMail() + { + if (in_array($this->response->getStatus(), array(100, 90))) { + $this->getEmailConfig(); // Get email configuration settings + $emailTemplate = Mage::getModel('core/email_template') + ->loadDefault('novalnet_callback_critical_email_template'); + $mailSubject = 'Critical error on shop system ' . Mage::app()->getStore()->getFrontendName() . ': order not found for TID: ' . $this->getParentTid(); + + // Define some variables to assign to template + $templateParams = array( + 'toName' => 'Technic team', + 'message' => 'Please evaluate this transaction and contact our payment module team at Novalnet.', + 'merchantId' => $this->response->getVendorId(), + 'productId' => $this->response->getProductId(), + 'tid' => $this->response->getTid(), + 'tidStatus' => $this->response->getTidStatus(), + 'orderNo' => $this->response->getOrderNo(), + 'paymentType' => $this->response->getPaymentType(), + 'endUserMail' => $this->response->getEmail(), + 'regards' => 'Novalnet Team' + ); + $template = $emailTemplate->getProcessedTemplate($templateParams); + + $mail = new Zend_Mail('UTF-8'); + $mail->setBodyHtml($template); + $mail->setFrom($this->emailFromAddr, $this->emailFromName); + $this->helper->assignEmailAddress($this->technicNotifyMail, $mail, 'To'); + $mail->setSubject($this->emailSubject); + + try { + $mail->send(); + $this->showDebug(__FUNCTION__ . ': Sending Email succeeded!' . $this->lineBreak, false); + } catch (Exception $e) { + Mage::getSingleton('core/session')->addError($this->helper->__('Unable to send email')); + $this->showDebug('Email sending failed: ', false); + return false; + } + + return true; + } + } + + /** + * Check transaction cancellation + * + * @param none + * @return none + */ + public function transactionCancellation() + { + + $transactionId = $this->getParentTid(); + $transactionStatus = $this->helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status + if ($this->response->getPaymentType() == 'TRANSACTION_CANCELLATION' && $paymentStatus == '103') { + $this->showDebug('Novalnet callback received. Callback Script executed already. Refer Order :' . $this->orderNo); + return true; + } + if ($this->response->getPaymentType() == 'TRANSACTION_CANCELLATION' && $paymentStatus != '103') { + $this->responseModel->saveCanceledOrder($this->response, $this->order, $this->response->getTestMode()); + $script = $this->emailBody = $this->helper->__('Novalnet callback received. The transaction has been canceled on %s', + $this->currentTime + ); + $data = unserialize($this->payment->getAdditionalData()); + $data['NnComments'] = empty($data['NnComments']) + ? '
' . $script : $data['NnComments'] . '

' . $script; + $this->payment->setAdditionalData(serialize($data))->save(); + $transactionStatus->setTransactionStatus($this->response->getTidStatus())->save(); + $this->sendCallbackMail(); + return true; + } + + return false; + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/Checkout/OnepageController.php b/app/code/community/Novalnet/Payment/controllers/Checkout/OnepageController.php new file mode 100755 index 0000000..ecc832e --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/Checkout/OnepageController.php @@ -0,0 +1,131 @@ +getMagentoVersion(); + $quote = Mage::getModel('checkout/cart')->getQuote(); + $paymentCode = $quote->getPayment()->getMethodInstance()->getCode(); + + if (!preg_match("/novalnet/i", $paymentCode) + || !$quote->hasNominalItems() + || version_compare($magentoVersion, '1.7', '>=') + || version_compare($magentoVersion, '1.5', '<') + ) { + return parent::saveOrderAction(); + } + + if ($this->_expireAjax()) { + return; + } + + $result = array(); + try { + $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds(); + if ($requiredAgreements) { + $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array())); + $diff = array_diff($requiredAgreements, $postedAgreements); + if ($diff) { + $result['success'] = false; + $result['error'] = true; + $result['error_messages'] = $this->__( + 'Please agree to all the terms and conditions before placing the order.' + ); + $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); + return; + } + } + + if ($data = $this->getRequest()->getPost('payment', false)) { + $this->getOnepage()->getQuote()->getPayment()->importData($data); + } + + $this->getOnepage()->saveOrder(); + + $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl(); + $result['success'] = true; + $result['error'] = false; + } catch (Mage_Payment_Model_Info_Exception $e) { + $message = $e->getMessage(); + if (!empty($message)) { + $result['error_messages'] = $message; + } + + $result['goto_section'] = 'payment'; + $result['update_section'] = array( + 'name' => 'payment-method', + 'html' => $this->_getPaymentMethodsHtml() + ); + } catch (Mage_Core_Exception $e) { + Mage::logException($e); + Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage()); + $result['success'] = false; + $result['error'] = true; + $result['error_messages'] = $e->getMessage(); + + $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection(); + if ($gotoSection) { + $result['goto_section'] = $gotoSection; + $this->getOnepage()->getCheckout()->setGotoSection(null); + } + + $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection(); + if ($updateSection) { + if (isset($this->_sectionUpdateFunctions[$updateSection])) { + $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection]; + $result['update_section'] = array( + 'name' => $updateSection, + 'html' => $this->$updateSectionFunction() + ); + } + + $this->getOnepage()->getCheckout()->setUpdateSection(null); + } + } catch (Exception $e) { + Mage::logException($e); + Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage()); + $result['success'] = false; + $result['error'] = true; + $result['error_messages'] = $this->__( + 'There was an error processing your order. Please contact us or try again later.' + ); + } + + $this->getOnepage()->getQuote()->save(); + /** + * when there is redirect to third party, we don't want to save order yet. + * we will save the order in return action. + */ + if (isset($redirectUrl)) { + $result['redirect'] = $redirectUrl; + } + + $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); + } + +} diff --git a/app/code/community/Novalnet/Payment/controllers/GatewayController.php b/app/code/community/Novalnet/Payment/controllers/GatewayController.php new file mode 100755 index 0000000..0788a4e --- /dev/null +++ b/app/code/community/Novalnet/Payment/controllers/GatewayController.php @@ -0,0 +1,183 @@ +_getHelper(); // Get Novalnet payment helper + $session = $helper->getCheckoutSession(); // Get checkout session + + try { + $order = $this->_getOrder(); // Get order object + $payment = $order->getPayment(); // Get payment object + $paymentObj = $payment->getMethodInstance(); // Get payment method instance + $quoteId = $session->getQuoteId() ? $session->getQuoteId() : $session->getLastQuoteId(); + $items = Mage::getModel('sales/quote')->load($quoteId)->getItemsQty(); + $session->getQuote()->setIsActive(true)->save(); + $redirectActionFlag = $paymentObj->getCode() . '_redirectAction'; + + if ($payment->getAdditionalInformation($redirectActionFlag) != 1 && $session->getLastRealOrderId() && $items + ) { + $payment->setAdditionalInformation($redirectActionFlag, 1); + // Set order status as on-hold + $status = $state = Mage_Sales_Model_Order::STATE_HOLDED; + $order->setState($state, $status, $helper->__('Customer was redirected to Novalnet'), false)->save(); + $this->getResponse()->setBody( + $this->getLayout() + ->createBlock(Novalnet_Payment_Model_Config::NOVALNET_REDIRECT_BLOCK) + ->setOrder($order) + ->toHtml() + ); + } else { + $this->_redirect('checkout/cart'); + } + } catch (Mage_Core_Exception $e) { + $session->addError($e->getMessage()); + } catch (Exception $e) { + Mage::logException($e); + } + } + + /** + * Get Novalnet payment transaction response + * + * @param none + * @return none + */ + public function returnAction() + { + $params = $this->getRequest()->getParams(); + $sameSiteFix = !empty($params['sess_lost']) ? $params['sess_lost'] : ''; + if (empty($sameSiteFix)) { + header_remove('Set-Cookie'); + $params['sess_lost'] = 1; + return $this->_redirectUrl(Mage::getUrl('novalnet_payment/gateway/return', array('_query' => http_build_query($params)))); + } + $helper = $this->_getHelper(); // Get Novalnet payment helper + $order = $this->_getOrder(); // Get order object + $response = new Varien_Object(); + $response->setData($this->getRequest()->getParams()); // Get payment response data + $this->_savePayportResponse($response, $order); // Save payment response traces + $responseModel = $helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $status = $responseModel->checkReturnedData($response, $order); + if ($status) { + // Send order email for successful Novalnet transaction + Mage::dispatchEvent('novalnet_sales_order_email', array('order' => $order)); + } + + $helper->getCheckoutSession()->getQuote()->setIsActive(false)->save(); + $this->_redirect(!$status ? 'checkout/onepage/failure' : 'checkout/onepage/success'); + } + + /** + * Failure payment transaction + * + * @param none + * @return none + */ + public function errorAction() + { + $params = $this->getRequest()->getParams(); + $sameSiteFix = !empty($params['sess_lost']) ? $params['sess_lost'] : ''; + if (empty($sameSiteFix)) { + header_remove('Set-Cookie'); + $params['sess_lost'] = 1; + return $this->_redirectUrl(Mage::getUrl('novalnet_payment/gateway/error', array('_query' => http_build_query($params)))); + } + $helper = $this->_getHelper(); // Get Novalnet payment helper + $order = $this->_getOrder(); // Get order object + $response = new Varien_Object(); + $response->setData($this->getRequest()->getParams()); // Get payment response data + $this->_savePayportResponse($response, $order); // Save payment response traces + $responseModel = $helper->getModel('Service_Api_Response'); // Get Novalnet Api response model + $responseModel->checkErrorReturnedData($response, $order); // Verify the payment response data + + // Restore the cart items + if (Mage::getStoreConfig('novalnet_global/novalnet/restore_cart', Mage::app()->getStore()->getStoreId())) { + $order = $helper->getCheckoutSession()->getLastRealOrder(); + if ($order->getId()) { + $quote = Mage::getModel('sales/quote')->load($order->getQuoteId()); + if ($quote->getId()) { + $quote->setIsActive(1) + ->setReservedOrderId(null) + ->save(); + $helper->getCheckoutSession() + ->replaceQuote($quote) + ->unsLastRealOrderId(); + } + } + } + + $this->_redirect('checkout/onepage/failure', array('_secure' => true)); // Redirects to failure page + } + + /** + * Log Novalnet payment response data + * + * @param Varien_Object $response + * @param Varien_Object $order + * @return none + */ + protected function _savePayportResponse($response, $order) + { + // Get Novalnet transaction traces model + $transactionTraces = Mage::getModel('novalnet_payment/Mysql4_TransactionTraces') + ->loadByAttribute('order_id', $response->getOrderNo()); + $transactionTraces->setTransactionId($response->getTid()) + ->setResponseData(base64_encode(serialize($response->getData()))) + ->setCustomerId($order->getCustomerId()) + ->setStatus($response->getStatus()) //transaction status code + ->setStoreId($order->getStoreId()) + ->setShopUrl($response->getSystemUrl()) + ->save(); + } + + /** + * Get last placed order object + * + * @param none + * @return Varien_Object + */ + protected function _getOrder() + { + $incrementId = $this->_getHelper()->getCheckoutSession()->getLastRealOrderId(); + return Mage::getModel('sales/order')->loadByIncrementId($incrementId); + } + + /** + * Get Novalnet payment helper + * + * @param none + * @return Novalnet_Payment_Helper_Data + */ + protected function _getHelper() + { + return Mage::helper('novalnet_payment'); + } + +} diff --git a/app/code/community/Novalnet/Payment/etc/adminhtml.xml b/app/code/community/Novalnet/Payment/etc/adminhtml.xml new file mode 100755 index 0000000..816922f --- /dev/null +++ b/app/code/community/Novalnet/Payment/etc/adminhtml.xml @@ -0,0 +1,181 @@ + + + + + + + Novalnet + 100 + + + + Orders + 1 + adminhtml/novalnetpayment_sales_order + + + + Recurring Profiles + 2 + adminhtml/novalnetpayment_sales_recurring_profile + + + + Transactions + 3 + + + + Transactions Overview + 1 + adminhtml/novalnetpayment_transactionoverview + + + + Transactions Log + 2 + adminhtml/novalnetpayment_transactiontraces + + + + + + Configuration + 5 + + + + General + 1 + adminhtml/system_config/edit/section/novalnet_global/ + + + + Payment Methods + 2 + adminhtml/system_config/edit/section/novalnet_payments/ + + + + + + Information + 6 + + + + Novalnet Merchant Admin + 1 + adminhtml/novalnetpayment_information_merchantadmin + + + + Novalnet Magento Module + 2 + adminhtml/novalnetpayment_information_module/ + + + + + + + + + + + + + + + + + General + 1 + + + Payment + 2 + + + + + + + Novalnet + 100 + + + Orders + 1 + + + Recurring Profiles + 2 + + + Novalnet Transactions + 3 + + + Novalnet Transactions Overview + 1 + + + Novalnet - Transaction Log + 2 + + + + + Configuration + 5 + + + General + 1 + + + Payment Methods + 2 + + + + + Information + 6 + + + Novalnet Merchant Admin + 1 + + + Novalnet Magento Module + 2 + + + + + + + + + + diff --git a/app/code/community/Novalnet/Payment/etc/config.xml b/app/code/community/Novalnet/Payment/etc/config.xml new file mode 100755 index 0000000..aaf8bb4 --- /dev/null +++ b/app/code/community/Novalnet/Payment/etc/config.xml @@ -0,0 +1,455 @@ + + + + + + + 11.3.1 + + + + + + + + + Novalnet_Payment_Block + + + + Novalnet_Payment_Block_Recurring_Profile_View + + + + + + + Novalnet_Payment_Helper + + + + + + + Novalnet_Payment_Model_Recurring_Profile + Novalnet_Payment_Model_Quote_Address_Total_Nominal + + + + + Novalnet_Payment_Model + novalnet_payment_mysql4 + + + + Novalnet_Payment_Model_Mysql4_Resource + + + + novalnet_payment_transaction_status
+
+ + + novalnet_payment_order_log
+
+ + + novalnet_payment_aff_account_detail
+
+ + + novalnet_payment_aff_user_detail
+
+ + + novalnet_payment_callback
+
+ + + novalnet_payment_recurring
+
+
+
+
+ + + + + + + Novalnet_Payment + + + + + core_setup + + + + core_write + + + + + core_read + + + + + + + + + + singleton + Novalnet_Payment_Model_Observer_UpdateOrderStatus + setOnHoldOrderStatus + + + + + + + + singleton + Novalnet_Payment_Model_Observer_SalesEmails + sendOrderEmail + + + + + + + + singleton + Novalnet_Payment_Model_Observer_SalesEmails + sendInvoiceEmail + + + + + + + + singleton + Novalnet_Payment_Model_Observer_SalesEmails + sendCreditmemoEmail + + + + + + + + singleton + Novalnet_Payment_Model_Observer_SalesEmails + setVoidOrderStatus + + + + + + + + Novalnet_Payment_Model_Observer_Recurring + setAffiliateProcess + + + + + + + + singleton + Novalnet_Payment_Model_Observer_OrderView + addButton + + + + + + + + singleton + Novalnet_Payment_Model_Observer_InvoiceView + addButton + + + + + + + + singleton + Novalnet_Payment_Model_Observer_Recurring + getProfilePeriodValues + + + + + + + + singleton + Novalnet_Payment_Model_Observer_Recurring + setPaymentRedirectUrl + + + + + + +
+ + + + + + standard + + Novalnet_Payment + novalnet_payment + + + + + + Novalnet_Payment_Checkout + + + + + + + + + novalnet.xml + + + + + + + + + Novalnet_Payment.csv + + + + + + + + + + + + + Novalnet_Payment_Adminhtml + + + + + + + + + + + + novalnet.xml + + + + + + + + + Novalnet_Payment.csv + + + + + + + + + + + 1 + 0 + + + holded + canceled + + + + + 0 + Kredit- / Debitkarte + processing + processing + authorize + 1 + 0 + 0 + novalnet_payment/method_novalnetCc + + + 0 + SEPA-Lastschrift + processing + authorize + 0 + 0 + 0 + pending + 1 + novalnet_payment/method_novalnetSepa + + + 0 + Rechnung + processing + complete + authorize + 0 + 0 + 0 + pending + 1 + novalnet_payment/method_novalnetInvoice + + + 0 + Vorkasse + processing + complete + authorize + 0 + novalnet_payment/method_novalnetPrepayment + + + 0 + Barzahlen/viacash + processing + complete + authorize + 0 + novalnet_payment/method_novalnetCashpayment + + + 0 + PayPal + pending + complete + authorize + 0 + 0 + novalnet_payment/method_novalnetPaypal + + + 0 + SofortĂĽberweisung + pending + processing + 0 + novalnet_payment/method_novalnetBanktransfer + + + 0 + iDEAL + pending + processing + 0 + novalnet_payment/method_novalnetIdeal + + + 0 + eps + pending + processing + 0 + novalnet_payment/method_novalnetEps + + + 0 + giropay + pending + processing + 0 + novalnet_payment/method_novalnetGiropay + + + 0 + Przelewy24 + pending + processing + 0 + novalnet_payment/method_novalnetPrzelewy + + + 0 + Ratenzahlung per Rechnung + processing + pending + 0 + 0 + authorize + novalnet_payment/method_novalnetInvoiceInstalment + + + 0 + Ratenzahlung per SEPA-Lastschrift + processing + pending + 0 + 0 + authorize + novalnet_payment/method_novalnetSepaInstalment + + + +
diff --git a/app/code/community/Novalnet/Payment/etc/jstranslator.xml b/app/code/community/Novalnet/Payment/etc/jstranslator.xml new file mode 100755 index 0000000..1eebb6b --- /dev/null +++ b/app/code/community/Novalnet/Payment/etc/jstranslator.xml @@ -0,0 +1,39 @@ + + + + Your Novalnet Merchant details are now updated. Click the + + + button to complete the configuration & save all changes! + + + Instalment number + + + Instalment payment date + + + Monthly instalment amount + + + Instalment + + diff --git a/app/code/community/Novalnet/Payment/etc/system.xml b/app/code/community/Novalnet/Payment/etc/system.xml new file mode 100755 index 0000000..5af22bd --- /dev/null +++ b/app/code/community/Novalnet/Payment/etc/system.xml @@ -0,0 +1,2653 @@ + + + + + + + + 401 + + + + + + + novalnet + text + 1 + 1 + 1 + 1 + + + + + text + 1 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_vendorConfig + Novalnet Admin Portal: PROJECT > Choose your project > Shop Parameters > API Signature (Product activation key).]]> + text + required-entry + 1 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_readOnly + text + required-entry + 2 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_readOnly + text + required-entry + 3 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_readOnly + text + required-entry + 4 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_readOnly + 5 + 1 + 1 + 1 + + + + select + novalnet_payment/source_vendorAutoConfig + 6 + 1 + 1 + 1 + + + + select + novalnet_payment/source_vendorAutoConfig + 7 + 1 + 1 + 1 + + + + The period of the subsequent subscription cycle (E.g: 1d/1m/1y) + validate-alphanum validate-novalnet-subs-period + text + 8 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_readOnly + text + required-entry + 9 + 1 + 1 + 1 + + + + Selected payment methods will be in Live Mode + multiselect + novalnet_payment/source_activeMethods + 1 + 10 + 1 + 1 + 1 + + + + Payment last success description + select + adminhtml/system_config_source_yesno + 11 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 12 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 13 + 1 + 1 + 1 + + + + + + + text + 2 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + 1 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + 2 + 1 + 1 + 1 + + + + + + + text + 3 + 1 + 1 + 1 + + + + Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties + select + adminhtml/system_config_source_yesno + 2 + 1 + + + + Email To address description + text + 3 + 1 + 1 + 1 + + + + If yes, the merchant script log will be created + select + adminhtml/system_config_source_yesno + 4 + 1 + 1 + 1 + + + + Notification / Webhook URL is required to keep the merchant’s database/system synchronized with the Novalnet account (e.g. delivery status). Refer the Installation Guide for more information + text + 5 + 1 + 1 + 1 + + + + + + + + + + + novalnet + text + 2 + 1 + 1 + 1 + + + + + 1 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetCc/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetCc/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetCc/logo + 3 + 1 + 1 + 1 + + + + By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA. + select + payment/novalnetCc/enforce_3d + adminhtml/system_config_source_yesno + 4 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + payment/novalnetCc/order_status + adminhtml/system_config_source_order_status + 5 + 1 + 1 + 1 + + + + novalnet_payment/adminhtml_system_config_form_field_creditcardStyle + adminhtml/system_config_backend_serialized_array + payment/novalnetCc/cc_style + 6 + 1 + 1 + 1 + + + + select + payment/novalnetCc/inline_form + adminhtml/system_config_source_yesno + 7 + 1 + 1 + 1 + + + + select + one click payment description + payment/novalnetCc/cc_shop_type + adminhtml/system_config_source_yesno + 8 + 1 + 1 + 1 + + + + multiselect + payment/novalnetCc/cc_types + novalnet_payment/source_ccCardTypes + 1 + 9 + 1 + 1 + 1 + + + + select + payment/novalnetCc/paymentaction + novalnet_payment/source_paymentAction + 10 + 1 + 1 + 1 + + + + Manual checking of order description + text + validate-greater-than-zero validate-digits + payment/novalnetCc/manual_checking_amount + + 1 + + 11 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetCc/booking_reference + 12 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetCc/user_group_excluded + 1 + 13 + 1 + 1 + 1 + + + + select + payment/novalnetCc/allowspecific + 14 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetCc/specificcountry + 15 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetCc/min_order_total + validate-number + 16 + 1 + 1 + 1 + + + + text + payment/novalnetCc/max_order_total + 17 + validate-number + 1 + 1 + 1 + + + + text + payment/novalnetCc/orders_count + validate-digits + 18 + Novalnet Minimum Orders Count Desc + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetCc/sort_order + validate-digits + 19 + 1 + 1 + 1 + + + + + + + + 2 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetSepa/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetSepa/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetSepa/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetSepa/order_status + 4 + 1 + 1 + 1 + + + + select + one click payment description + payment/novalnetSepa/sepa_shop_type + adminhtml/system_config_source_yesno + 5 + 1 + 1 + 1 + + + + SEPA Payment duration in days description + text + payment/novalnetSepa/sepa_duedate + validate-digits validate-greater-than-zero validate-digits-range digits-range-2-14 + 6 + 1 + 1 + 1 + + + + select + payment/novalnetSepa/paymentaction + novalnet_payment/source_paymentAction + 7 + 1 + 1 + 1 + + + + Manual checking of order description + text + validate-greater-than-zero validate-digits + payment/novalnetSepa/manual_checking_amount + + 1 + + 8 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetSepa/booking_reference + 9 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetSepa/user_group_excluded + 1 + 10 + 1 + 1 + 1 + + + + select + payment/novalnetSepa/allowspecific + 11 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetSepa/specificcountry + 12 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetSepa/min_order_total + validate-number + 13 + 1 + 1 + 1 + + + + text + payment/novalnetSepa/max_order_total + validate-number + 14 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetSepa/orders_count + validate-digits + 15 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetSepa/sort_order + validate-digits + 16 + 1 + 1 + 1 + + + + Payment guarantee comments + text + 1 + 1 + 1 + 17 + novalnet_payment/adminhtml_system_config_form_field_guaranteeInfo + + + + select + adminhtml/system_config_source_yesno + payment/novalnetSepa/enable_guarantee + 18 + 1 + 1 + 1 + + + + select + payment/novalnetSepa/guarantee_pending_status + adminhtml/system_config_source_order_status + 19 + 1 + 1 + 1 + + 1 + + + + + This setting will override the default setting made in the minimum order amount. Note: Minimum amount should be greater than or equal to 9,99 EUR + text + validate-number validate-novalnet-minimum-amount + payment/novalnetSepa/guarantee_min_order_total + 20 + 1 + 1 + 1 + + 1 + + + + + If the payment guarantee is activated (True), but the above mentioned requirements are not met, the payment should be processed as non-guarantee payment. + select + adminhtml/system_config_source_yesno + payment/novalnetSepa/payment_guarantee_force + 21 + 1 + 1 + 1 + + 1 + + + + + + + + + 3 + 1 + 1 + 1 + + + + select + payment/novalnetInvoice/active + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetInvoice/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetInvoice/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + payment/novalnetInvoice/order_status + adminhtml/system_config_source_order_status + 4 + 1 + 1 + 1 + + + + select + payment/novalnetInvoice/order_status_after_payment + adminhtml/system_config_source_order_status + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetInvoice/booking_reference + 6 + 1 + 1 + 1 + + + + select + payment/novalnetInvoice/paymentaction + novalnet_payment/source_paymentAction + 7 + 1 + 1 + 1 + + + + Manual checking of order description + text + validate-greater-than-zero validate-digits + payment/novalnetInvoice/manual_checking_amount + + 1 + + 8 + 1 + 1 + 1 + + + + Invoice payment duration description + text + validate-digits validate-greater-than-zero validate-digits-range digits-range-7-9999999 + payment/novalnetInvoice/payment_duration + 9 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetInvoice/user_group_excluded + 1 + 10 + 1 + 1 + 1 + + + + select + payment/novalnetInvoice/allowspecific + 11 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetInvoice/specificcountry + 12 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetInvoice/min_order_total + validate-number + 13 + 1 + 1 + 1 + + + + text + payment/novalnetInvoice/max_order_total + validate-number + 14 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetInvoice/orders_count + validate-digits + 15 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetInvoice/sort_order + validate-digits + 16 + 1 + 1 + 1 + + + + Payment guarantee comments + text + novalnet_payment/adminhtml_system_config_form_field_guaranteeInfo + 1 + 1 + 1 + 17 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetInvoice/enable_guarantee + 18 + 1 + 1 + 1 + + + + select + payment/novalnetInvoice/guarantee_pending_status + adminhtml/system_config_source_order_status + 19 + 1 + 1 + 1 + + 1 + + + + + This setting will override the default setting made in the minimum order amount. Note: Minimum amount should be greater than or equal to 9,99 EUR + text + validate-number validate-novalnet-minimum-amount + payment/novalnetInvoice/guarantee_min_order_total + 20 + 1 + 1 + 1 + + 1 + + + + + If the payment guarantee is activated (True), but the above mentioned requirements are not met, the payment should be processed as non-guarantee payment. + select + adminhtml/system_config_source_yesno + payment/novalnetInvoice/payment_guarantee_force + 21 + 1 + 1 + 1 + + 1 + + + + + + + + + 4 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetPrepayment/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetPrepayment/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetPrepayment/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetPrepayment/order_status + 4 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + payment/novalnetPrepayment/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetPrepayment/booking_reference + 6 + 1 + 1 + 1 + + + + Prepayment payment duration description + text + validate-digits validate-greater-than-zero validate-digits-range digits-range-7-28 + payment/novalnetPrepayment/payment_duration + 7 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetPrepayment/user_group_excluded + 1 + 8 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetPrepayment/allowspecific + 9 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetPrepayment/specificcountry + 10 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetPrepayment/min_order_total + validate-number + 11 + 1 + 1 + 1 + + + + text + payment/novalnetPrepayment/max_order_total + validate-number + 12 + 1 + 1 + 1 + + + + text + payment/novalnetPrepayment/orders_count + validate-digits + 13 + Novalnet Minimum Orders Count Desc + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetPrepayment/sort_order + validate-digits + 14 + 1 + 1 + 1 + + + + + + + + 5 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetCashpayment/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetCashpayment/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetCashpayment/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetCashpayment/order_status + 4 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + payment/novalnetCashpayment/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetCashpayment/booking_reference + 6 + 1 + 1 + 1 + + + + Cashpayment duration description + text + validate-digits + payment/novalnetCashpayment/payment_duration + 7 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetCashpayment/user_group_excluded + 1 + 8 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetCashpayment/allowspecific + 9 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetCashpayment/specificcountry + 10 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetCashpayment/min_order_total + validate-number + 11 + 1 + 1 + 1 + + + + text + payment/novalnetCashpayment/max_order_total + validate-number + 12 + 1 + 1 + 1 + + + + text + payment/novalnetCashpayment/orders_count + validate-digits + 13 + Novalnet Minimum Orders Count Desc + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetCashpayment/sort_order + validate-digits + 14 + 1 + 1 + 1 + + + + + + + + text + 6 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetPaypal/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetPaypal/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetPaypal/logo + 3 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + payment/novalnetPaypal/order_status + 4 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetPaypal/order_status_after_payment + 5 + 1 + 1 + 1 + + + + one click payment description. In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal. + paypal onclick description + select + payment/novalnetPaypal/paypal_shop_type + adminhtml/system_config_source_yesno + 6 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetPaypal/booking_reference + 7 + 1 + 1 + 1 + + + + select + payment/novalnetPaypal/paymentaction + novalnet_payment/source_paymentAction + 8 + 1 + 1 + 1 + + + + Manual checking of paypal order description + text + validate-greater-than-zero validate-digits + payment/novalnetPaypal/manual_checking_amount + + 1 + + 9 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetPaypal/user_group_excluded + 1 + 10 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetPaypal/allowspecific + 11 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetPaypal/specificcountry + 12 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetPaypal/min_order_total + validate-number + 13 + 1 + 1 + 1 + + + + text + payment/novalnetPaypal/max_order_total + validate-number + 14 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetPaypal/orders_count + validate-digits + 15 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetPaypal/sort_order + validate-digits + 16 + 1 + 1 + 1 + + + + + + + + 7 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetBanktransfer/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetBanktransfer/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetBanktransfer/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetBanktransfer/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetBanktransfer/booking_reference + 6 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetBanktransfer/user_group_excluded + 1 + 7 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetBanktransfer/allowspecific + 8 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetBanktransfer/specificcountry + 9 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetBanktransfer/min_order_total + validate-number + 10 + 1 + 1 + 1 + + + + text + payment/novalnetBanktransfer/max_order_total + validate-number + 11 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetBanktransfer/orders_count + 12 + validate-digits + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetBanktransfer/sort_order + validate-digits + 13 + 1 + 1 + 1 + + + + + + + + text + 8 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + payment/novalnetIdeal/active + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetIdeal/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetIdeal/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetIdeal/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetIdeal/booking_reference + 6 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetIdeal/user_group_excluded + 1 + 7 + 1 + 1 + 1 + + + + select + payment/novalnetIdeal/allowspecific + 8 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetIdeal/specificcountry + 9 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetIdeal/min_order_total + validate-number + 10 + 1 + 1 + 1 + + + + text + payment/novalnetIdeal/max_order_total + validate-number + 11 + 1 + 1 + 1 + + + + text + payment/novalnetIdeal/orders_count + 12 + validate-digits + Novalnet Minimum Orders Count Desc + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetIdeal/sort_order + validate-digits + 13 + 1 + 1 + 1 + + + + + + + + text + 9 + 1 + 1 + 1 + + + + select + payment/novalnetEps/active + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetEps/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetEps/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetEps/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetEps/booking_reference + 6 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetEps/user_group_excluded + 1 + 7 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetEps/allowspecific + 8 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetEps/specificcountry + 9 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetEps/min_order_total + validate-number + 10 + 1 + 1 + 1 + + + + text + payment/novalnetEps/max_order_total + validate-number + 11 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetEps/orders_count + validate-digits + 12 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetEps/sort_order + validate-digits + 13 + 1 + 1 + 1 + + + + + + + + text + 10 + 1 + 1 + 1 + + + + select + payment/novalnetGiropay/active + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetGiropay/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetGiropay/logo + 3 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetGiropay/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetGiropay/booking_reference + 6 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetGiropay/user_group_excluded + 1 + 7 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetGiropay/allowspecific + 8 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetGiropay/specificcountry + 9 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetGiropay/min_order_total + validate-number + 10 + 1 + 1 + 1 + + + + text + payment/novalnetGiropay/max_order_total + validate-number + 11 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetGiropay/orders_count + validate-digits + 12 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetGiropay/sort_order + validate-digits + 13 + 1 + 1 + 1 + + + + + + + + text + 11 + 1 + 1 + 1 + + + + select + payment/novalnetPrzelewy/active + adminhtml/system_config_source_yesno + 1 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetPrzelewy/title</config_path> + <validate>required-entry</validate> + <sort_order>2</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetPrzelewy/logo + 3 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_order_status + payment/novalnetPrzelewy/order_status + 4 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + adminhtml/system_config_source_order_status + payment/novalnetPrzelewy/order_status_after_payment + 5 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetPrzelewy/booking_reference + 6 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetPrzelewy/user_group_excluded + 1 + 7 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_payment_allspecificcountries + payment/novalnetPrzelewy/allowspecific + 8 + 1 + 1 + 1 + + + + multiselect + adminhtml/system_config_source_country + payment/novalnetPrzelewy/specificcountry + 9 + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetPrzelewy/min_order_total + validate-number + 10 + 1 + 1 + 1 + + + + text + payment/novalnetPrzelewy/max_order_total + validate-number + 11 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetPrzelewy/orders_count + validate-digits + 12 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetPrzelewy/sort_order + validate-digits + 13 + 1 + 1 + 1 + + + + + + + + 12 + 1 + 1 + 1 + + + Payment instalment comments + text + 1 + 1 + 1 + 1 + novalnet_payment/adminhtml_system_config_form_field_guaranteeInfo + + + + select + payment/novalnetInvoiceInstalment/active + adminhtml/system_config_source_yesno + 2 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetInvoiceInstalment/title</config_path> + <validate>required-entry</validate> + <sort_order>3</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetInvoiceInstalment/logo + 4 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + payment/novalnetInvoiceInstalment/order_status + adminhtml/system_config_source_order_status + 5 + 1 + 1 + 1 + + + + select + payment/novalnetInvoiceInstalment/guarantee_pending_status + adminhtml/system_config_source_order_status + 6 + 1 + 1 + 1 + + + + On choosing an appropriate recurring period, each instalment cycle will be processed based on that + select + payment/novalnetInvoiceInstalment/instalment_cycle_periods + novalnet_payment/source_instalmentCycle + 7 + 1 + 1 + 1 + + + + Select the various instalment cycles that can be availed in the instalment plan + multiselect + payment/novalnetInvoiceInstalment/instalment_total_period + novalnet_payment/source_instalmentPeriod + 8 + required-entry + 1 + 1 + 1 + + + + select + payment/novalnetInvoiceInstalment/paymentaction + novalnet_payment/source_paymentAction + 9 + 1 + 1 + 1 + + + + Manual checking of order description + text + validate-greater-than-zero validate-digits + payment/novalnetInvoiceInstalment/manual_checking_amount + + 1 + + 10 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetInvoiceInstalment/booking_reference + 11 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetInvoiceInstalment/user_group_excluded + 1 + 12 + 1 + 1 + 1 + + + + select + payment/novalnetInvoiceInstalment/allowspecific + 13 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetInvoiceInstalment/specificcountry + 14 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetInvoiceInstalment/min_order_total + validate-number validate-novalnet-minimum-instalment-amount + 15 + 1 + 1 + 1 + + + + text + payment/novalnetInvoiceInstalment/max_order_total + validate-number + 16 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetInvoiceInstalment/orders_count + validate-digits + 17 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetInvoiceInstalment/sort_order + validate-digits + 18 + 1 + 1 + 1 + + + + + + + + 13 + 1 + 1 + 1 + + + Payment instalment comments + text + 1 + 1 + 1 + 1 + novalnet_payment/adminhtml_system_config_form_field_guaranteeInfo + + + + select + payment/novalnetSepaInstalment/active + adminhtml/system_config_source_yesno + 2 + 1 + 1 + 1 + + + <label>Novalnet Title</label> + <frontend_type>text</frontend_type> + <config_path>payment/novalnetSepaInstalment/title</config_path> + <validate>required-entry</validate> + <sort_order>3</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + Browse logo to be displayed with the payment name + image + adminhtml/system_config_backend_image + novalnet/payment/ + novalnet/payment/ + payment/novalnetSepaInstalment/logo + 4 + 1 + 1 + 1 + + + + select + Status to be used for successful orders + payment/novalnetSepaInstalment/order_status + adminhtml/system_config_source_order_status + 5 + 1 + 1 + 1 + + + + select + payment/novalnetSepaInstalment/guarantee_pending_status + adminhtml/system_config_source_order_status + 6 + 1 + 1 + 1 + + + + On choosing an appropriate recurring period, each instalment cycle will be processed based on that + select + payment/novalnetSepaInstalment/instalment_cycle_periods + novalnet_payment/source_instalmentCycle + 7 + 1 + 1 + 1 + + + + Select the various instalment cycles that can be availed in the instalment plan + multiselect + payment/novalnetSepaInstalment/instalment_total_period + novalnet_payment/source_instalmentPeriod + 8 + required-entry + 1 + 1 + 1 + + + + select + payment/novalnetSepaInstalment/paymentaction + novalnet_payment/source_paymentAction + 9 + 1 + 1 + 1 + + + + Manual checking of order description + text + validate-greater-than-zero validate-digits + payment/novalnetSepaInstalment/manual_checking_amount + + 1 + + 10 + 1 + 1 + 1 + + + + SEPA Payment duration in days description + text + payment/novalnetSepaInstalment/sepa_duedate + validate-digits validate-greater-than-zero validate-digits-range digits-range-2-14 + 11 + 1 + 1 + 1 + + + + The entered text will be displayed on the checkout page + textarea + validate-no-html-tags + payment/novalnetSepaInstalment/booking_reference + 12 + 1 + 1 + 1 + + + + multiselect + novalnet_payment/source_customerGroups + payment/novalnetSepaInstalment/user_group_excluded + 1 + 13 + 1 + 1 + 1 + + + + select + payment/novalnetSepaInstalment/allowspecific + 14 + adminhtml/system_config_source_payment_allspecificcountries + 1 + 1 + 1 + + + + multiselect + payment/novalnetSepaInstalment/specificcountry + 15 + adminhtml/system_config_source_country + 1 + 1 + 1 + + 1 + + + + + text + payment/novalnetSepaInstalment/min_order_total + validate-number validate-novalnet-minimum-instalment-amount + 16 + 1 + 1 + 1 + + + + text + payment/novalnetSepaInstalment/max_order_total + validate-number + 17 + 1 + 1 + 1 + + + + Novalnet Minimum Orders Count Desc + text + payment/novalnetSepaInstalment/orders_count + validate-digits + 18 + 1 + 1 + 1 + + + + Sort order of display. Lowest is displayed first. + text + payment/novalnetSepaInstalment/sort_order + validate-digits + 19 + 1 + 1 + 1 + + + + + + + + + diff --git a/app/code/community/Novalnet/Payment/freeware_license_agreement.txt b/app/code/community/Novalnet/Payment/freeware_license_agreement.txt new file mode 100755 index 0000000..48c90eb --- /dev/null +++ b/app/code/community/Novalnet/Payment/freeware_license_agreement.txt @@ -0,0 +1,50 @@ +Freeware-Lizenzvereinbarung + +Deutsch: + +Präambel: +Die nachfolgende Vereinbarung regelt die Rechte und die Haftung zwischen Ihnen (im Folgenden „Partner“) und der Novalnet AG (im Folgenden „Novalnet“) in Bezug auf die von Novalnet kostenlos bereitgestellten Softwarelösungen zur Anbindung von eCommerce-Systemen an die Payment Plattform von Novalnet. Von dieser Regelung ausdrücklich nicht betroffen sind die Leistungen, die Novalnet gemäß dem zwischen den Parteien geschlossenen Dienstleistungsvertrag gegenüber dem Partner erbringt. Mit der Installation und der Benutzung der Software bestätigen Sie automatisch, dass Sie diese Freeware-Lizenzvereinbarung gelesen haben und mit ihr einverstanden sind. Wenn Sie als Partner mit diesen Bedingungen nicht einverstanden sind, installieren und nutzen Sie die Software nicht. + +Lizenz: +Für die von Novalnet unentgeltlich bereitgestellten Payment Module sowie alle weiteren Module, die Novalnet anderweitig veröffentlicht, räumt Novalnet ein zeitlich auf die Dauer des zwischen den Parteien geschlossenen Dienstleistungsvertrages begrenztes, nicht ausschließliches, unentgeltliches Nutzungsrecht ein. Die Lizenzvereinbarung berechtigt Sie, die Software auf einem oder mehreren Rechnern zu installieren und zu nutzen. Die Lizenz für die Software ist kostenlos. Der Partner verpflichtet sich, die Payment Module und/oder Teile der Module ausschließlich für die Nutzung der von Novalnet gemäß dem Vertrag bereitgestellten Leistungen zu nutzen. Der Partner hat keinen Anspruch auf technische Unterstützung irgendwelcher Art. Novalnet ist insbesondere nicht verpflichtet, eine Wartung oder Überarbeitung der Software zu gewährleisten. + +Copyright: +Alle Rechtsansprüche, Besitzrechte und geistigen Eigentumsrechte an und auf die Software sowie alle Kopien davon und jede damit im Zusammenhang stehende Dokumentation sind Eigentum von Novalnet (www.novalnet.de). Alle Rechte sind vorbehalten. Novalnet behält sich rechtliche Schritte im Falle einer Verletzung dieser Lizenzvereinbarung vor. + +Gewährleistung und Haftung: +Die Payment Module werden ausdrücklich „so wie sie sind“ zur Verfügung gestellt. Für die fehlerfreie Funktion der Payment Module und/oder Teile der Payment Module übernimmt Novalnet keine Gewähr. Ebenso übernimmt Novalnet keine Haftung für Schäden und/oder Folgeschäden, die mittelbar oder unmittelbar mit dem Gebrauch und/oder der Nutzung der von Novalnet unentgeltlich zur Verfügung gestellten Payment Module in Verbindung gebracht werden können, es sei denn, dass der Schaden auf Vorsatz oder auf grobe Fahrlässigkeit beruht. Von diesem Haftungsausschluss nicht umfasst sind Schäden aus der Verletzung von Leib, Leben oder der Gesundheit. + +Rechtsansprüche und salvatorische Klausel: +Es gilt das Recht der Bundesrepublik Deutschland. Gerichtsstand ist München. Sollte eine gegenwärtige oder zukünftige Bestimmung der Vereinbarung ganz oder teilweise aus anderen Gründen als den §§ 305-310 des Bürgerlichen Gesetzbuchs (BGB) unwirksam/nichtig oder nicht durchführbar sein oder werden, so wird hiervon die Gültigkeit der übrigen Bestimmungen des Vereinbarung nicht berührt. Die Parteien werden die unwirksame/nichtige oder nicht durchführbare Bestimmung durch eine wirksame ersetzen, die in ihrem rechtlichen und wirtschaftlichen Gehalt der unwirksamen/nichtigen oder nicht durchführbaren Bestimmung und dem Gesamtzweck der Vereinbarung entspricht. Das gleiche gilt, wenn sich nach Abschluss der Vereinbarung eine ergänzungsbedürftige Lücke ergibt. Die Bestimmung des § 139 BGB (Teilnichtigkeit) wird ausdrücklich ausgeschlossen. + +Sollten Sie weitere Informationen benötigen, steht Ihnen der Technik-Service der Novalnet AG gerne zur Verfügung: + +Novalnet AG +Tel.: +49 89 9230683-20 +Fax: +1 914 8851686 +E-Mail: technic@novalnet.de + + +English: + +Preamble: +The following agreement governs the rights and responsibilities between you (the "Partner") and the Novalnet AG ("Novalnet") in relation to the cost-free software solutions Service and Support provided by Novalnet, by connecting your e-commerce systems to the payment platform of Novalnet. Services, which Novalnet offers in accordance with a service contract to its partners, are not affected explicitly by this agreement. From this particular agreement, is not explicitly affected the services Novalnet under the contract between the parties to the service contract partners are providing. By installing and using the software, you automatically confirm that you have read this freeware license agreement and agree with it. If you do not agree to these conditions, as a partner, please do not install and use the software. + +License: +Novalnet grants you a non-exclusive, free of charge right of usage on the payment modules provided by novalnet free of charge and all further modules Novalnet publishes elsewhere whose duration is limited to the duration of the service contract between the parties involved. According to the license agreement, you may install the software on one or more computers and use them. The license for the software is free. The partner agrees to the usage of the payment modules and / or parts of modules exclusively for the Novalnet-provided services, mentioned under the Treaty/agreement. The partner is not entitled to any technical support of any kind from Novalnet. Novalnet is therefore not obliged to ensure the maintenance or revision or development of the software. + +Copyright: +All title, ownership rights and intellectual property rights to and from the Software, as well as all copies of the software, and any related documentation, are the property of Novalnet (www.novalnet.de). All rights are reserved. Novalnet reserves legal measures in case of a breach of this Agreement. + +Guarantee and Liability: +The Payment modules will be explicitly made ​​available "as they are defined". For the correct functioning of the payment modules and / or parts of the payment modules, Novalnet does not provide guarantee. Similarly Novalnet assumes no liability for damages and / or consequential damages, directly or indirectly which can be associated with the use of Novalnet cost-free payment modules, unless the damage is intentional or through gross negligence. Not part of this disclaimer agreement, is damage caused from injury to life or health. + +Legal claims and severability clause: +The laws of the Federal Republic of Germany will be applicable. The place for court of law or going to court will be Munich. Should any present or future provision of the Agreement, in whole or in part, become invalid, for reasons other than the § § 305-310 of the Civil Code (BGB), the validity of the remaining provisions of the agreement will not be affected. The parties shall replace the ineffective, invalid or unenforceable provision by a valid one that will be void in its legal and economic substance, of the ineffective or not feasible provision, and also in compliance with the overall purpose of the agreement. The same applies, if after the conclusion of the agreement, there are gaps or loopholes found in the agreement. The provision of § 139 BGB (severability) is totally excluded. + +If you need further information, kindly contact our Technical service Team: + +Novalnet AG +Tel.: +49 89 9230683-20 +Fax: +49 89 9230683-11 +E-Mail: technic@novalnet.de diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-install-11.2.1.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-install-11.2.1.php new file mode 100755 index 0000000..294e02e --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-install-11.2.1.php @@ -0,0 +1,225 @@ +getTable('novalnet_payment/transaction_traces'); +$transactionStatus = $this->getTable('novalnet_payment/transaction_status'); +$callback = $this->getTable('novalnet_payment/callback'); +$recurring = $this->getTable('novalnet_payment/recurring'); +$affiliateInfo = $this->getTable('novalnet_payment/affiliate_info'); +$affiliateUserInfo = $this->getTable('novalnet_payment/affiliate_user'); + +/** + * + * magento tables + */ +$tableOrderPayment = $this->getTable('sales/order_payment'); +$tableConfigData = $this->getTable('core/config_data'); +$magentoVersion = Mage::getVersion(); + +$installer = $this; + +$installer->startSetup(); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_order_log +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$orderTraces}` ( + `nn_log_id` int(11) UNSIGNED NOT NULL auto_increment, + `request_data` TEXT NOT NULL DEFAULT '', + `response_data` TEXT NOT NULL DEFAULT '', + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `customer_id` VARCHAR(10) NOT NULL DEFAULT '', + `status` int(11) UNSIGNED NOT NULL, + `failed_reason` TEXT NOT NULL DEFAULT '', + `store_id` int(11) UNSIGNED NOT NULL, + `shop_url` VARCHAR(255) NOT NULL DEFAULT '', + `transaction_id` VARCHAR(50) NOT NULL, + `additional_data` TEXT NOT NULL DEFAULT '', + `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`nn_log_id`), + INDEX `NOVALNET_ORDER_LOG` (`order_id` ASC, `transaction_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$transactionStatus}` ( + `nn_txn_id` int(11) UNSIGNED NOT NULL auto_increment, + `transaction_no` VARCHAR(50) NOT NULL, + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `transaction_status` VARCHAR(20) NOT NULL DEFAULT 0, + `nc_no` VARCHAR(11) NOT NULL, + `customer_id` VARCHAR(10) NOT NULL DEFAULT '', + `payment_name` VARCHAR(50) NOT NULL DEFAULT '', + `amount` decimal(12,4) NOT NULL, + `remote_ip` VARCHAR(20) NOT NULL, + `store_id` int(11) UNSIGNED NOT NULL, + `shop_url` VARCHAR(255) NOT NULL DEFAULT '', + `additional_data` TEXT NOT NULL DEFAULT '', + `novalnet_acc_details` TEXT NULL DEFAULT '', + `reference_transaction` SMALLINT NOT NULL DEFAULT 0, + `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`nn_txn_id`), + INDEX `NOVALNET_TRANSACTION_STATUS` (`order_id` ASC, `transaction_no` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_callback +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$callback}` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `callback_amount` int(11) UNSIGNED NOT NULL, + `reference_tid` VARCHAR(50) NOT NULL, + `callback_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `callback_tid` VARCHAR(50) NOT NULL, + `callback_log` TEXT NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + INDEX `NOVALNET_CALLBACK` (`order_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_recurring +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$recurring}` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `profile_id` VARCHAR(50) NOT NULL DEFAULT '', + `signup_tid` VARCHAR(50) NOT NULL DEFAULT '', + `billingcycle` VARCHAR(50) NOT NULL, + `callbackcycle` VARCHAR(50) NOT NULL, + `cycle_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + INDEX `NOVALNET_RECURRING` (`profile_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_aff_account_detail +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$affiliateInfo}` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `vendor_id` int(11) unsigned NOT NULL, + `vendor_authcode` varchar(40) NOT NULL, + `product_id` int(11) unsigned NOT NULL, + `product_url` varchar(200) NOT NULL, + `activation_date` datetime NOT NULL, + `aff_id` int(11) unsigned DEFAULT NULL, + `aff_authcode` varchar(40) DEFAULT NULL, + `aff_accesskey` varchar(40) NOT NULL, + PRIMARY KEY (`id`), + KEY `vendor_id` (`vendor_id`), + KEY `product_id` (`product_id`), + KEY `aff_id` (`aff_id`), + INDEX `NOVALNET_AFFILIATE` (`aff_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_aff_user_detail +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$affiliateUserInfo}` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `aff_id` int(11) unsigned NULL, + `customer_no` varchar(40) NULL, + `aff_order_id` varchar(40) NULL, + `aff_order_no` varchar(40) NULL, + PRIMARY KEY (`id`), + KEY `aff_id` (`aff_id`), + KEY `customer_no` (`customer_no`), + KEY `aff_order_id` (`aff_order_id`), + KEY `aff_order_no` (`aff_order_no`), + INDEX `NOVALNET_AFFILIATE_USER` (`customer_no` ASC) + ); +" +); + +$methodFields = array(); +$methodData = array( + 'sofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetsofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetpaypal' => 'novalnetPaypal', + 'novalnetCcpci' => 'novalnetCc', + 'novalnet_secure' => 'novalnetCc', + 'novalnetSecure' => 'novalnetCc', + 'novalnetElvatpci' => 'novalnetSepa', + 'novalnetElvdepci' => 'novalnetSepa', + 'novalnetElvaustria' => 'novalnetSepa', + 'novalnetElvgerman' => 'novalnetSepa', + 'novalnetSofortueberweisung' => 'novalnetBanktransfer' +); + +foreach ($methodData as $variableId => $value) { + $methodFields['method'] = $value; + $installer->getConnection()->update( + $tableOrderPayment, $methodFields, array('method = ?' => $variableId) + ); +} + +if (version_compare($magentoVersion, '1.6', '<')) { + $nnPaypalFields = array(); + $pathData = array( + 'payment/novalnetpaypal/active' => 'payment/novalnetPaypal/active', + 'payment/novalnetpaypal/title' => 'payment/novalnetPaypal/title', + 'payment/novalnetpaypal/order_status' => 'payment/novalnetPaypal/order_status', + 'payment/novalnetpaypal/booking_reference' => 'payment/novalnetPaypal/booking_reference', + 'payment/novalnetpaypal/order_status_after_payment' => 'payment/novalnetPaypal/order_status_after_payment', + 'payment/novalnetpaypal/user_group_excluded' => 'payment/novalnetPaypal/user_group_excluded', + 'payment/novalnetpaypal/gateway_timeout' => 'payment/novalnetPaypal/gateway_timeout', + 'payment/novalnetpaypal/allowspecific' => 'payment/novalnetPaypal/allowspecific', + 'payment/novalnetpaypal/min_order_total' => 'payment/novalnetPaypal/min_order_total', + 'payment/novalnetpaypal/max_order_total' => 'payment/novalnetPaypal/max_order_total', + 'payment/novalnetpaypal/orderscount' => 'payment/novalnetPaypal/orderscount', + 'payment/novalnetpaypal/sort_order' => 'payment/novalnetPaypal/sort_order' + ); + + + foreach ($pathData as $variableId => $value) { + $nnPaypalFields['path'] = $value; + $installer->getConnection()->update( + $tableConfigData, $nnPaypalFields, array('path = ?' => $variableId) + ); + } +} + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-1.4.0-5.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-1.4.0-5.0.0.php new file mode 100755 index 0000000..b230121 --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-1.4.0-5.0.0.php @@ -0,0 +1,124 @@ +getTable('novalnet_payment/order_log'); +$transactionStatus = $this->getTable('novalnet_payment/transaction_status'); +$callback = $this->getTable('novalnet_payment/callback'); + +/** + * + * magento tables + */ +$tableOrderPayment = $this->getTable('sales/order_payment'); + +$installer = $this; + +$installer->startSetup(); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_order_log +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$orderTraces}` ( + `nn_log_id` int(11) UNSIGNED NOT NULL auto_increment, + `request_data` TEXT NOT NULL DEFAULT '', + `response_data` TEXT NOT NULL DEFAULT '', + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `customer_id` VARCHAR(10) NOT NULL DEFAULT '', + `status` int(11) UNSIGNED NOT NULL, + `failed_reason` TEXT NOT NULL DEFAULT '', + `store_id` int(11) UNSIGNED NOT NULL, + `shop_url` VARCHAR(255) NOT NULL DEFAULT '', + `transaction_id` bigint(20) NOT NULL, + `additional_data` TEXT NOT NULL DEFAULT '', + `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`nn_log_id`), + INDEX `NOVALNET_ORDER_LOG` (`order_id` ASC, `transaction_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$transactionStatus}` ( + `nn_txn_id` int(11) UNSIGNED NOT NULL auto_increment, + `transaction_no` VARCHAR(50) NOT NULL, + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `transaction_status` VARCHAR(20) NOT NULL DEFAULT 0, + `nc_no` VARCHAR(11) NOT NULL, + `customer_id` VARCHAR(10) NOT NULL DEFAULT '', + `payment_name` VARCHAR(50) NOT NULL DEFAULT '', + `amount` decimal(12,4) NOT NULL, + `remote_ip` VARCHAR(20) NOT NULL, + `store_id` int(11) UNSIGNED NOT NULL, + `shop_url` VARCHAR(255) NOT NULL DEFAULT '', + `additional_data` TEXT NOT NULL DEFAULT '', + `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`nn_txn_id`), + INDEX `NOVALNET_TRANSACTION_STATUS` (`order_id` ASC, `transaction_no` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_callback +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$callback}` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `callback_amount` int(11) UNSIGNED NOT NULL, + `reference_tid` VARCHAR(50) NOT NULL, + `callback_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `callback_tid` VARCHAR(50) NOT NULL, + `callback_log` TEXT NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + INDEX `NOVALNET_CALLBACK` (`order_id` ASC) + ); +" +); + +$methodFields = array(); +$methodData = array( + 'sofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetpaypal' => 'novalnetPaypal', + 'novalnetCcpci' => 'novalnetCc', + 'novalnet_secure' => 'novalnetCc', + 'novalnetElvatpci' => 'novalnetSepa', + 'novalnetElvdepci' => 'novalnetSepa' +); + +foreach ($methodData as $variableId => $value) { + $methodFields['method'] = $value; + $installer->getConnection()->update( + $tableOrderPayment, $methodFields, array('method = ?' => $variableId) + ); +} + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.0.0-11.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.0.0-11.0.0.php new file mode 100755 index 0000000..6665beb --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.0.0-11.0.0.php @@ -0,0 +1,73 @@ +getTable('novalnet_payment/transaction_status'); + +$installer = $this; + +$installer->startSetup(); + +// ---------------------------------------------------------------------- +// -- Drop Table novalnet_payment_amountchanged +// ---------------------------------------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_amountchanged; +" +); + +// --------------------------------------- +// -- Drop Table novalnet_payment_separefill +// --------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_separefill; +" +); + +$connection = $installer->getConnection(); + +// ----------------------------------------------------------------- +// -- Alter Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- + +$connection->addColumn( + $transactionStatus, 'novalnet_acc_details', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_TEXT, + 'NULLABLE' => true, + 'COMMENT' => 'novalnet_acc_details') +); + +$connection->addColumn( + $transactionStatus, 'reference_transaction', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, + 'LENGTH' => 6, + 'NULLABLE' => false, + 'COMMENT' => 'reference_transaction', + 'DEFAULT' => 0) +); + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.1.0-11.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.1.0-11.0.0.php new file mode 100755 index 0000000..6665beb --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.1.0-11.0.0.php @@ -0,0 +1,73 @@ +getTable('novalnet_payment/transaction_status'); + +$installer = $this; + +$installer->startSetup(); + +// ---------------------------------------------------------------------- +// -- Drop Table novalnet_payment_amountchanged +// ---------------------------------------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_amountchanged; +" +); + +// --------------------------------------- +// -- Drop Table novalnet_payment_separefill +// --------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_separefill; +" +); + +$connection = $installer->getConnection(); + +// ----------------------------------------------------------------- +// -- Alter Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- + +$connection->addColumn( + $transactionStatus, 'novalnet_acc_details', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_TEXT, + 'NULLABLE' => true, + 'COMMENT' => 'novalnet_acc_details') +); + +$connection->addColumn( + $transactionStatus, 'reference_transaction', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, + 'LENGTH' => 6, + 'NULLABLE' => false, + 'COMMENT' => 'reference_transaction', + 'DEFAULT' => 0) +); + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.0-11.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.0-11.0.0.php new file mode 100755 index 0000000..6665beb --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.0-11.0.0.php @@ -0,0 +1,73 @@ +getTable('novalnet_payment/transaction_status'); + +$installer = $this; + +$installer->startSetup(); + +// ---------------------------------------------------------------------- +// -- Drop Table novalnet_payment_amountchanged +// ---------------------------------------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_amountchanged; +" +); + +// --------------------------------------- +// -- Drop Table novalnet_payment_separefill +// --------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_separefill; +" +); + +$connection = $installer->getConnection(); + +// ----------------------------------------------------------------- +// -- Alter Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- + +$connection->addColumn( + $transactionStatus, 'novalnet_acc_details', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_TEXT, + 'NULLABLE' => true, + 'COMMENT' => 'novalnet_acc_details') +); + +$connection->addColumn( + $transactionStatus, 'reference_transaction', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, + 'LENGTH' => 6, + 'NULLABLE' => false, + 'COMMENT' => 'reference_transaction', + 'DEFAULT' => 0) +); + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.1-11.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.1-11.0.0.php new file mode 100755 index 0000000..6665beb --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-10.2.1-11.0.0.php @@ -0,0 +1,73 @@ +getTable('novalnet_payment/transaction_status'); + +$installer = $this; + +$installer->startSetup(); + +// ---------------------------------------------------------------------- +// -- Drop Table novalnet_payment_amountchanged +// ---------------------------------------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_amountchanged; +" +); + +// --------------------------------------- +// -- Drop Table novalnet_payment_separefill +// --------------------------------------- + +$installer->run( + " + DROP TABLE IF EXISTS novalnet_payment_separefill; +" +); + +$connection = $installer->getConnection(); + +// ----------------------------------------------------------------- +// -- Alter Table novalnet_payment_transaction_status +// ----------------------------------------------------------------- + +$connection->addColumn( + $transactionStatus, 'novalnet_acc_details', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_TEXT, + 'NULLABLE' => true, + 'COMMENT' => 'novalnet_acc_details') +); + +$connection->addColumn( + $transactionStatus, 'reference_transaction', array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, + 'LENGTH' => 6, + 'NULLABLE' => false, + 'COMMENT' => 'reference_transaction', + 'DEFAULT' => 0) +); + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.0-5.0.1.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.0-5.0.1.php new file mode 100755 index 0000000..7f84299 --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.0-5.0.1.php @@ -0,0 +1,45 @@ +getTable('sales/order_payment'); + +$installer = $this; + +$installer->startSetup(); + +$methodFields = array(); +$methodData = array( + 'novalnetsofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetpaypal' => 'novalnetPaypal', + 'novalnetideal' => 'novalnetIdeal' +); + +foreach ($methodData as $variableId => $value) { + $methodFields['method'] = $value; + $installer->getConnection()->update( + $tableOrderPayment, $methodFields, array('method = ?' => $variableId) + ); +} + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.1-5.0.2.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.1-5.0.2.php new file mode 100755 index 0000000..9d5371a --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.1-5.0.2.php @@ -0,0 +1,76 @@ +getTable('novalnet_payment/callback'); + +/** + * + * magento table + */ +$tableOrderPayment = $this->getTable('sales/order_payment'); + +$installer = $this; + +$installer->startSetup(); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_callback +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$callback}` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `order_id` VARCHAR(50) NOT NULL DEFAULT '', + `callback_amount` int(11) UNSIGNED NOT NULL, + `reference_tid` VARCHAR(50) NOT NULL, + `callback_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `callback_tid` VARCHAR(50) NOT NULL, + `callback_log` TEXT NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + INDEX `NOVALNET_CALLBACK` (`order_id` ASC) + ); +" +); + +$methodFields = array(); +$methodData = array( + 'sofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetsofortueberweisung' => 'novalnetSofortueberweisung', + 'novalnetpaypal' => 'novalnetPaypal', + 'novalnetideal' => 'novalnetIdeal', + 'novalnetCcpci' => 'novalnetCc', + 'novalnet_secure' => 'novalnetCc', + 'novalnetSecure' => 'novalnetCc', + 'novalnetElvatpci' => 'novalnetSepa', + 'novalnetElvdepci' => 'novalnetSepa' +); + +foreach ($methodData as $variableId => $value) { + $methodFields['method'] = $value; + $installer->getConnection()->update( + $tableOrderPayment, $methodFields, array('method = ?' => $variableId) + ); +} + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.2-5.0.3.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.2-5.0.3.php new file mode 100755 index 0000000..d0ba5b0 --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.2-5.0.3.php @@ -0,0 +1,45 @@ +getTable('sales/order_payment'); + +$installer = $this; + +$installer->startSetup(); + +$methodFields = array(); +$methodData = array( + 'novalnetElvaustria' => 'novalnetSepa', + 'novalnetElvgerman' => 'novalnetSepa', + 'novalnetSecure' => 'novalnetCc' +); + +foreach ($methodData as $variableId => $value) { + $methodFields['method'] = $value; + $installer->getConnection()->update( + $tableOrderPayment, $methodFields, array('method = ?' => $variableId) + ); +} + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.3-5.0.4.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.3-5.0.4.php new file mode 100755 index 0000000..d6ba328 --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.3-5.0.4.php @@ -0,0 +1,75 @@ +getTable('novalnet_payment/affiliate_info'); +$affiliateUserInfo = $this->getTable('novalnet_payment/affiliate_user'); + +$installer = $this; + +$installer->startSetup(); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_aff_account_detail +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$affiliateInfo}` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `vendor_id` int(11) unsigned NOT NULL, + `vendor_authcode` varchar(40) NOT NULL, + `product_id` int(11) unsigned NOT NULL, + `product_url` varchar(200) NOT NULL, + `activation_date` datetime NOT NULL, + `aff_id` int(11) unsigned DEFAULT NULL, + `aff_authcode` varchar(40) DEFAULT NULL, + `aff_accesskey` varchar(40) NOT NULL, + PRIMARY KEY (`id`), + KEY `vendor_id` (`vendor_id`), + KEY `product_id` (`product_id`), + KEY `aff_id` (`aff_id`), + INDEX `NOVALNET_AFFILIATE` (`aff_id` ASC) + ); +" +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_aff_user_detail +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$affiliateUserInfo}` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `aff_id` int(11) unsigned NULL, + `customer_no` varchar(40) NULL, + `aff_order_no` varchar(40) NULL, + PRIMARY KEY (`id`), + KEY `aff_id` (`aff_id`), + KEY `customer_no` (`customer_no`), + KEY `aff_order_no` (`aff_order_no`), + INDEX `NOVALNET_AFFILIATE_USER` (`customer_no` ASC) + ); +" +); + +$installer->endSetup(); diff --git a/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.4-10.0.0.php b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.4-10.0.0.php new file mode 100755 index 0000000..33810cf --- /dev/null +++ b/app/code/community/Novalnet/Payment/sql/novalnet_setup/mysql4-upgrade-5.0.4-10.0.0.php @@ -0,0 +1,62 @@ +getTable('sales/order_payment'); + +/** + * + * Novalnet tables + */ +$recurring = $this->getTable('novalnet_payment/recurring'); + +$installer = $this; + +$installer->startSetup(); + +$paymentMethod = array( + 'method' => 'novalnetBanktransfer', +); +$installer->getConnection()->update( + $tableOrderPayment, $paymentMethod, array('method = ?' => 'novalnetSofortueberweisung') +); + +// ----------------------------------------------------------------- +// -- Create Table novalnet_payment_recurring +// ----------------------------------------------------------------- +$installer->run( + " + CREATE TABLE IF NOT EXISTS `{$recurring}` ( + `id` int(11) UNSIGNED NOT NULL auto_increment, + `profile_id` VARCHAR(50) NOT NULL DEFAULT '', + `signup_tid` VARCHAR(50) NOT NULL DEFAULT '', + `billingcycle` VARCHAR(50) NOT NULL, + `callbackcycle` VARCHAR(50) NOT NULL, + `cycle_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + INDEX `NOVALNET_RECURRING` (`profile_id` ASC) + ); +" +); + +$installer->endSetup(); diff --git a/app/design/adminhtml/default/default/layout/novalnet.xml b/app/design/adminhtml/default/default/layout/novalnet.xml new file mode 100755 index 0000000..f3a9a6f --- /dev/null +++ b/app/design/adminhtml/default/default/layout/novalnet.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + novalnet.css + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + novalnet_payment_adminhtml_sales_order_view_tab_transactionOverview + novalnet_payment/adminhtml_sales_order_view_tab_transactionOverview + + + + + + novalnet_payment_adminhtml_sales_order_view_tab_transactionTraces + novalnet_payment/adminhtml_sales_order_view_tab_transactionTraces + + + + + + novalnet_payment_adminhtml_sales_order_view_tab_instalment + novalnet_payment/adminhtml_sales_order_view_tab_instalment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sales_recurring_profile_view + + + + + diff --git a/app/design/adminhtml/default/default/template/novalnet/config/form.phtml b/app/design/adminhtml/default/default/template/novalnet/config/form.phtml new file mode 100755 index 0000000..233bd05 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/config/form.phtml @@ -0,0 +1,74 @@ +getUrl('novalnet_payment/callback/'); +$apiKeyUrl = $helper->getUrl('adminhtml/novalnetpayment_api/'); +$scopeId = $helper->getScopeId(); +?> +
+ + + + + + + +
+ + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/Cashpayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/Cashpayment.phtml new file mode 100755 index 0000000..e064dc7 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/Cashpayment.phtml @@ -0,0 +1,65 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/Cc.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/Cc.phtml new file mode 100755 index 0000000..892667b --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/Cc.phtml @@ -0,0 +1,160 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); + +$vendorId = Mage::getStoreConfig('novalnet_global/novalnet/merchant_id'); +$productId = Mage::getStoreConfig('novalnet_global/novalnet/product_id'); +$currentLanguage = explode("_", Mage::app()->getLocale()->getLocaleCode()); +$encodedkey = base64_encode('vendor=' . $vendorId . '&product=' . $productId . '&server_ip=' . $helper->getServerAddr(). '&lang=' . $currentLanguage[0]); +$nnIframeSource = 'https://secure.novalnet.de/cc?api=' . $encodedkey; +?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/Invoice.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/Invoice.phtml new file mode 100755 index 0000000..2db1bd5 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/Invoice.phtml @@ -0,0 +1,117 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$customerSession = $helper->getAdminCheckoutSession(); +$dateOfBirth = ($customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/InvoiceInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/InvoiceInstalment.phtml new file mode 100755 index 0000000..f462356 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/InvoiceInstalment.phtml @@ -0,0 +1,152 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$customerSession = $helper->getAdminCheckoutSession(); +$dateOfBirth = ($customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/Prepayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/Prepayment.phtml new file mode 100755 index 0000000..5e37f9a --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/Prepayment.phtml @@ -0,0 +1,65 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/Sepa.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/Sepa.phtml new file mode 100755 index 0000000..587884d --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/Sepa.phtml @@ -0,0 +1,184 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$customerSession = $helper->getAdminCheckoutSession(); +$dateOfBirth = ($customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/form/SepaInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/form/SepaInstalment.phtml new file mode 100755 index 0000000..e619b26 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/form/SepaInstalment.phtml @@ -0,0 +1,218 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$customerSession = $helper->getAdminCheckoutSession(); +$dateOfBirth = ($customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Banktransfer.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Banktransfer.phtml new file mode 100755 index 0000000..feef822 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Banktransfer.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Cashpayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Cashpayment.phtml new file mode 100755 index 0000000..c80f83e --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Cashpayment.phtml @@ -0,0 +1,77 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('CpDueDate')): ?> + escapeHtml($this->__('Slip expiry date: %s', $this->getAdditionalData('CpDueDate'))) ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with slip expiry date %s', $this->getAdditionalData('CpDueDate')) + ) + ?>

+ + + getAdditionalData('CashpaymentStores')): ?> + __('Store(s) near you:'); ?>

+ + getAdditionalData('CashpaymentStores') as $key => $value): ?> + + + + + +
escapeHtml($value['title']) ?>
+ escapeHtml($value['street']) ?>
+ escapeHtml($value['city']) ?>
+ escapeHtml($value['country']) ?>
+ escapeHtml($value['zipcode']) ?>

+
+ + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Cc.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Cc.phtml new file mode 100755 index 0000000..755707d --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Cc.phtml @@ -0,0 +1,67 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> +escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Eps.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Eps.phtml new file mode 100755 index 0000000..f43c007 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Eps.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Giropay.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Giropay.phtml new file mode 100755 index 0000000..70679ed --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Giropay.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Ideal.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Ideal.phtml new file mode 100755 index 0000000..f43c007 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Ideal.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Invoice.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Invoice.phtml new file mode 100755 index 0000000..3779fbd --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Invoice.phtml @@ -0,0 +1,161 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('NnGuarantee')): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>

+ + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/InvoiceInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/InvoiceInstalment.phtml new file mode 100755 index 0000000..a63009c --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/InvoiceInstalment.phtml @@ -0,0 +1,149 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> +escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>

+ + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Paypal.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Paypal.phtml new file mode 100755 index 0000000..de26e7b --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Paypal.phtml @@ -0,0 +1,67 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> + getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Prepayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Prepayment.phtml new file mode 100755 index 0000000..9698627 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Prepayment.phtml @@ -0,0 +1,132 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); +?>

+ + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Przelewy.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Przelewy.phtml new file mode 100755 index 0000000..67f1ba7 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Przelewy.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> + getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), + $value['refamount'], + $helper->makeValidNumber($value['reftid']), + $value['refamount'] + ) + );?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/Sepa.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/Sepa.phtml new file mode 100755 index 0000000..ce25229 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/Sepa.phtml @@ -0,0 +1,88 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('NnGuarantee')): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>

+ + + escapeHtml($this->__('Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/info/SepaInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/info/SepaInstalment.phtml new file mode 100755 index 0000000..e912450 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/info/SepaInstalment.phtml @@ -0,0 +1,75 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Banktransfer.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Banktransfer.phtml new file mode 100755 index 0000000..2309488 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Banktransfer.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cashpayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cashpayment.phtml new file mode 100755 index 0000000..6379043 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cashpayment.phtml @@ -0,0 +1,69 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('CpDueDate')): ?> + escapeHtml($this->__('Slip expiry date: %s', $this->getAdditionalData('CpDueDate'))) ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with slip expiry date %s', $this->getAdditionalData('CpDueDate')) + ) + ?>{{pdf_row_separator}} + + +getAdditionalData('CashpaymentStores')): ?> + __('Store(s) near you:'); ?>{{pdf_row_separator}} + getAdditionalData('CashpaymentStores') as $key => $value): ?> + escapeHtml($value['title'] . ':') ?>{{pdf_row_separator}} + escapeHtml($value['street']) ?>{{pdf_row_separator}} + escapeHtml($value['city']) ?>{{pdf_row_separator}} + escapeHtml($value['country']) ?>{{pdf_row_separator}} + escapeHtml($value['zipcode']) ?>{{pdf_row_separator}} + + + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); +?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cc.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cc.phtml new file mode 100755 index 0000000..89d7d66 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Cc.phtml @@ -0,0 +1,65 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Eps.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Eps.phtml new file mode 100755 index 0000000..35f28eb --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Eps.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Giropay.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Giropay.phtml new file mode 100755 index 0000000..35f28eb --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Giropay.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Ideal.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Ideal.phtml new file mode 100755 index 0000000..23a07bf --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Ideal.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Invoice.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Invoice.phtml new file mode 100755 index 0000000..e5aa567 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Invoice.phtml @@ -0,0 +1,159 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('NnGuarantee') && $paymentStatus != 75): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + + {{pdf_row_separator}}escapeHtml($this->__($text)); ?> + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/InvoiceInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/InvoiceInstalment.phtml new file mode 100755 index 0000000..e62d6bd --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/InvoiceInstalment.phtml @@ -0,0 +1,145 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Paypal.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Paypal.phtml new file mode 100755 index 0000000..c41254d --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Paypal.phtml @@ -0,0 +1,65 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Prepayment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Prepayment.phtml new file mode 100755 index 0000000..415a798 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Prepayment.phtml @@ -0,0 +1,130 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + + {{pdf_row_separator}}escapeHtml($this->__($text)); ?> + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Przelewy.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Przelewy.phtml new file mode 100755 index 0000000..16b465e --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Przelewy.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> + getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), + $value['refamount'], + $helper->makeValidNumber($value['reftid']), + $value['refamount'] + ) + );?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/Sepa.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Sepa.phtml new file mode 100755 index 0000000..ada9265 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/Sepa.phtml @@ -0,0 +1,81 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('NnGuarantee') && $paymentStatus != 75): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/method/pdf/SepaInstalment.phtml b/app/design/adminhtml/default/default/template/novalnet/method/pdf/SepaInstalment.phtml new file mode 100755 index 0000000..71ee228 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/method/pdf/SepaInstalment.phtml @@ -0,0 +1,70 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('NnGuarantee') && $paymentStatus != 75): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/novalnetutility.phtml b/app/design/adminhtml/default/default/template/novalnet/novalnetutility.phtml new file mode 100755 index 0000000..ee99d3d --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/novalnetutility.phtml @@ -0,0 +1,20 @@ + + diff --git a/app/design/adminhtml/default/default/template/novalnet/recurring/profile/view.phtml b/app/design/adminhtml/default/default/template/novalnet/recurring/profile/view.phtml new file mode 100755 index 0000000..8e1f6ab --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/recurring/profile/view.phtml @@ -0,0 +1,95 @@ + +
+ + + + + +

escapeHtml($this->getHeaderText()) ?>

+
getButtonsHtml() ?>
+ +
+
+getViewHtml() ?> + + +getMessagesBlock()->getGroupedHtml() ?> + + +getChildGroup('info_tabs'); ?> + +
+
escapeHtml($this->__('About This Profile:')) ?>
+
+ +
+
+ +
+ +
+ diff --git a/app/design/adminhtml/default/default/template/novalnet/sales/order/view/info.phtml b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/info.phtml new file mode 100755 index 0000000..10f26db --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/info.phtml @@ -0,0 +1,303 @@ + +getOrder() ?> +formatDate($order->getCreatedAtDate(), 'medium', true); +$orderStoreDate = $this->formatDate($order->getCreatedAtStoreDate(), 'medium', true); +?> +
+ +
+ getEmailSent()) : + $email = Mage::helper('sales')->__('the order confirmation email was sent'); + else: + $email = Mage::helper('sales')->__('the order confirmation email is not sent'); + endif; + ?> +
+ getNoUseOrderLink()) : ?> + + + + escapeHtml(Mage::helper('sales')->__('Order # %s', $order->getRealOrderId())) ?> + + (escapeHtml($email) ?>) + +
+
+ + + + + + + + + + + + + + + + + + + + getRelationChildId()) : ?> + + + + + + getRelationParentId()) : ?> + + + + + + getRemoteIp()) : ?> + + + + + + getGlobalCurrencyCode() != $order->getBaseCurrencyCode()) : ?> + + + + + + getBaseCurrencyCode() != $order->getOrderCurrencyCode()) : ?> + + + + + +
+ + escapeHtml($orderAdminDate) ?>
+ + escapeHtml($orderStoreDate) ?>
+ + + + escapeHtml($order->getStatusLabel()) ?> + +
escapeHtml(($this->getOrderStoreName()), array('br')) ?>
+ + + + escapeHtml($order->getRelationChildRealId()) ?> + +
+ + + + escapeHtml($order->getRelationParentRealId()) ?> + +
+ + + + escapeHtml($order->getRemoteIp()); + echo ($order->getXForwardedFor()) ? + ' (' . $this->escapeHtml($order->getXForwardedFor()) . ')' : ''; + ?> + +
+ + + escapeHtml($order->getBaseToGlobalRate()) ?> +
+ + + escapeHtml($order->getBaseToOrderRate()) ?> +
+
+
+
+
+ +
+
+ +
escapeHtml($this->getAccountEditLink()) ?>
+
+
+
+ + + + + + + + + + getCustomerGroupName()) : ?> + + + + + + getCustomerAccountData() as $data): ?> + + + + + +
+ + + getCustomerViewUrl()) : ?> + + escapeHtml($order->getCustomerName()) ?> + + + escapeHtml($order->getCustomerName()) ?> + +
+ + + + escapeHtml($order->getCustomerEmail()) ?> + +
+ + escapeHtml($groupName) ?>
escapeHtml($data['value']) ?>
+
+
+
+
+
+ +
+ +
+
+

+ escapeHtml(Mage::helper('sales')->__('Billing Address')) ?> +

+
+ getAddressEditLink($order->getBillingAddress()) ?> +
+
+
+
escapeHtml(($order->getBillingAddress()->getFormated(true)), array('br')) ?>
+
+
+
+getOrder()->getIsVirtual()) : ?> +
+ +
+
+

+ escapeHtml(Mage::helper('sales')->__('Shipping Address')); ?> +

+
+ getAddressEditLink($order->getShippingAddress()) ?> +
+
+
+
escapeHtml(($order->getShippingAddress()->getFormated(true)), array('br')) ?>
+
+
+
+ +
+gmtDate('Y-m-d', $order->getCreatedAt())); +if (strtotime(Mage::getSingleton('core/date')->gmtDate('Y-m-d')) > $orderDate) : + ?> +
+
+
+

+ escapeHtml(Mage::helper('sales')->__('Refund reference')) ?> +

+
+
+ + + + + +
escapeHtml($this->__('Refund reference')) ?> : + +
+
+
+
+
+ +getOrder()->getIsVirtual()) : ?> +
+ diff --git a/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/info.phtml b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/info.phtml new file mode 100755 index 0000000..a98f108 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/info.phtml @@ -0,0 +1,227 @@ + + +getOrder() ?> +getPayment(); +$paymentName = $payment->getMethodInstance()->getCode(); +if (preg_match("/novalnet/i", $paymentName)) { + $helper = Mage::helper('novalnet_payment'); // Novalnet payment helper + $additionalData = unserialize($payment->getAdditionalData()); + $transactionId = !empty($additionalData['NnTid']) ? $helper->makeValidNumber($additionalData['NnTid']) : ''; + if (!empty($transactionId)) { + // Get current transaction status information + $transactionStatus = $helper->getModel('Mysql4_TransactionStatus') + ->loadByAttribute('transaction_no', $transactionId); + $paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status + } + $invoice = $_order->getInvoiceCollection()->getFirstItem(); + $paid = $invoice->getState(); +} +?> +
+
+ getChildHtml('order_messages') ?> +
+ getChildHtml('order_info') ?> + + getIsVirtual()): ?> +
+ +
+ + +
+
+

__('Payment Information') ?>

+
+
+ getPaymentHtml() ?> +
__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?>
+
+
+ + + date('Y-m-d', $dueDate); + ?> +
+
+

+ + __('Change the slip expiry date') ?> + + __('Change the due date') ?> + + +

+
+
+ + + + + + + + +
+ + __('Slip expiry date') ?>: + + __('Transaction due date') ?>: + +
+
+
+
+ +
+ getIsVirtual()): ?> +
+ +
+
+

__('Shipping & Handling Information') ?>

+
+
+ getTracksCollection()->count()) : ?> + __('Track Order') ?> +
+ + getShippingDescription()): ?> + escapeHtml($_order->getShippingDescription()) ?> + + helper('tax')->displayShippingPriceIncludingTax()): ?> + displayShippingPriceInclTax($_order); ?> + + displayPriceAttribute('shipping_amount', false, ' '); ?> + + displayShippingPriceInclTax($_order); ?> + + + helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?> + (__('Incl. Tax'); ?> ) + + + helper('sales')->__('No shipping information available'); ?> + +
+
+
+ +
+ getGiftOptionsHtml() ?> +
+
+
+

__('Items Ordered') ?>

+
+
+ getItemsHtml() ?> +
+ +
+
+
+

__('Comments History') ?>

+
+
getChildHtml('order_history') ?>
+
+
+
+

__('Order Totals') ?>

+
getChildHtml('order_totals') ?>
+
+
+
+ +getChildHtml('popup_window');?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/instalment.phtml b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/instalment.phtml new file mode 100755 index 0000000..1ea1b8d --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/instalment.phtml @@ -0,0 +1,182 @@ +getOrder(); +$customerUrl = $this->getCustomerViewUrl(); +$currencyInterface = Mage::helper('core'); +$helper = Mage::helper('novalnet_payment'); +?> + +
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + +
+ + + + escapeHtml($order->getCustomerName()) ?> + +
+ + + + escapeHtml($order->getCustomerEmail()) ?> + +
+ + + escapeHtml($this->getOrderStoreName(), array('br')) ?> +
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ currency($this->getAdditionalData('InstallPaidAmount'), true, false); ?> +
getAdditionalData('InstallCycleAmount') ? $currencyInterface->currency($this->getAdditionalData('InstallCycleAmount')) : '-' ?>
getAdditionalData('PaidInstall') ?>
getAdditionalData('DueInstall') ? $this->getAdditionalData('DueInstall') : 0?>
getAdditionalData('NextCycle') ? Mage::helper('core')->formatDate($this->getAdditionalData('NextCycle')) : '-' ?>
+
+
+
+
+
+
+ +
+
+
+

escapeHtml(__('Instalment Summary')) ?>

+
+
+ +
+
+ + + + + + + + + + + + + getAdditionalData('InstalmentDetails') as $key => $value): ?> + + + + + + + + + + + + + + +
+
+ currency($value['amount'], true, false) ?> + + + +
+ +
formatDate($value['paidDate']) : '-' ?>formatDate($value['nextCycle']) : '-' ?>

+
+
+ \ No newline at end of file diff --git a/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/transactiontraces.phtml b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/transactiontraces.phtml new file mode 100755 index 0000000..110205a --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/sales/order/view/tab/transactiontraces.phtml @@ -0,0 +1,165 @@ +getTransactionTraces(); +$i = 1; +foreach ($tracesCollection as $transactioOverviewId => $data) { + ?> + +
+ +
+
+

+ escapeHtml($helper->__('Novalnet Order Information')) ?> +

+
+
+ + + + + + + + + +
+ + + escapeHtml($data->getStoreId()) ?> +
+ + + escapeHtml($data->getOrderId()) ?> +
+
+
+
+ +
+ +
+
+

+ escapeHtml($helper->__('Novalnet Additional Information')) ?> +

+
+
+ + + + + + + + + +
+ + + escapeHtml($data->getCustomerId()) ?> +
+ + + escapeHtml($data->getShopUrl()) ?> +
+
+
+
+ + + +
+
+
+

+ escapeHtml($helper->__('Novalnet Request Data')) ?> + + escapeHtml($data->getTransactionId()) ?> + +

+
+
+ + + + +
+
+ getRequestData(); + $isSerialized = $helper->is_serialized($request); + $getrequestData = ($isSerialized === true) ? unserialize($request) : + unserialize(base64_decode($request)); + if ($getrequestData) { + ?> +
+ "; + print_r($getrequestData); + echo ""; + ?> +
+ +
+
+
+
+ +
+
+
+

+ escapeHtml($helper->__('Novalnet Response Data')) ?> + + escapeHtml($data->getTransactionId()) ?> + +

+
+
+ + + + +
+
+ getResponseData(); + $isSerialized = $helper->is_serialized($response); + $getresponseData = ($isSerialized === true) ? unserialize($response) : + unserialize(base64_decode($response)); + if ($getresponseData) { + ?> +
+ "; + print_r($getresponseData); + echo ""; + ?> +
+ +
+
+
+
+ diff --git a/app/design/adminhtml/default/default/template/novalnet/system/creditcardStyle.phtml b/app/design/adminhtml/default/default/template/novalnet/system/creditcardStyle.phtml new file mode 100755 index 0000000..5efece2 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/system/creditcardStyle.phtml @@ -0,0 +1,91 @@ + + + + + + + escapeHtml(Mage::helper('novalnet_payment')->__('Custom CSS Settings')) ?> + + diff --git a/app/design/adminhtml/default/default/template/novalnet/system/vendorConfig.phtml b/app/design/adminhtml/default/default/template/novalnet/system/vendorConfig.phtml new file mode 100755 index 0000000..707c251 --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/system/vendorConfig.phtml @@ -0,0 +1,33 @@ + + + +
+ + +
diff --git a/app/design/adminhtml/default/default/template/novalnet/transaction/view/status.phtml b/app/design/adminhtml/default/default/template/novalnet/transaction/view/status.phtml new file mode 100755 index 0000000..bd5cd0b --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/transaction/view/status.phtml @@ -0,0 +1,191 @@ +getTransactionStatus(); +?> + +
+ + + + + +
getHeaderHtml(); ?> + getButtonsHtml(); ?> +
+
+ + +
+ +
+
+

+ escapeHtml(Mage::helper('novalnet_payment')->__('Novalnet Order Information')) ?> +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + loadByIncrementId($data->getOrderId())->getId(); + $orderViewUrl = Mage::helper('adminhtml')->getUrl( + 'adminhtml/sales_order/view', array( + 'order_id' => $orderViewId) + ); + ?> + + + escapeHtml($data->getOrderId()) ?> + + +
+ + + escapeHtml($data->getStoreId()) ?> +
+ + + escapeHtml($this->getPaymentTitle()) ?> +
+ + + escapeHtml($data->getTransactionNo()) ?> +
+ + + escapeHtml($data->getTransactionStatus()) ?> +
+ + + + escapeHtml(($data->getAmount() / 100) . " " . $this->getCurrencyCode()) ?> + +
+
+
+
+
+ +
+
+

+ escapeHtml(Mage::helper('novalnet_payment')->__('Novalnet Shop Information')) ?> +

+
+
+ + getShopUrl()) : ?> + + + + + +
+ + + escapeHtml($data->getShopUrl()) ?> +
+
+
+
+ +
+ +
+
+

+ escapeHtml(Mage::helper('novalnet_payment')->__('Novalnet Additional Information')) ?> +

+
+
+ + + + + + + + + + getNcNo()) : ?> + + + + + +
+ + + escapeHtml($data->getRemoteIp()) ?> +
+ + + escapeHtml($data->getCustomerId()) ?> +
+ + + escapeHtml($data->getNcNo()) ?> +
+
+
+
diff --git a/app/design/adminhtml/default/default/template/novalnet/transaction/view/traces.phtml b/app/design/adminhtml/default/default/template/novalnet/transaction/view/traces.phtml new file mode 100755 index 0000000..5eaa2ec --- /dev/null +++ b/app/design/adminhtml/default/default/template/novalnet/transaction/view/traces.phtml @@ -0,0 +1,194 @@ +getTransactionTraces(); +?> +
+ + + + + +
getHeaderHtml(); ?> + getButtonsHtml(); ?> +
+
+ +
+ +
+
+

+ escapeHtml($helper->__('Novalnet Order Information')) ?> +

+
+
+ + + + + + + + + + + + + + + + + +
+ + + loadByIncrementId($data->getOrderId())->getId(); + $orderViewUrl = Mage::helper('adminhtml')->getUrl( + 'adminhtml/sales_order/view', array( + 'order_id' => $orderViewId) + ); + ?> + + + escapeHtml($data->getOrderId()) ?> + + +
+ + + escapeHtml($data->getStoreId()) ?> +
+ + + escapeHtml($data->getTransactionId()) ?> +
+ + + escapeHtml($this->getPaymentTitle()) ?> +
+
+
+
+ + +
+ +
+
+

+ escapeHtml($helper->__('Novalnet Shop Information')) ?> +

+
+
+ + + + + +
+ + + escapeHtml($data->getShopUrl()) ?> +
+
+
+
+ +
+ +
+
+

+ escapeHtml($helper->__('Novalnet Additional Information')) ?> +

+
+
+ + + + + +
+ + + escapeHtml($data->getCustomerId()) ?> +
+
+
+
+ +
+
+
+

+ escapeHtml($helper->__('Novalnet Request Data')) ?> +

+
+
+ + + + +
+
+
getRequestData(); + $isSerialized = $helper->is_serialized($request); + $getrequestData = ($isSerialized === true) ? unserialize($request) : + unserialize(base64_decode($request)); + echo "
";
+                                print_r($getrequestData);
+                                echo "
"; + ?>
+
+
+
+
+
+ +
+
+
+

+ escapeHtml($helper->__('Novalnet Response Data')) ?> +

+
+
+ + + + +
+
+
getResponseData(); + $isSerialized = $helper->is_serialized($response); + $getresponseData = ($isSerialized === true) ? unserialize($response) : + unserialize(base64_decode($response)); + echo "
";
+                                print_r($getresponseData);
+                                echo "
"; + ?>
+
+
+
+
+
diff --git a/app/design/frontend/base/default/layout/novalnet.xml b/app/design/frontend/base/default/layout/novalnet.xml new file mode 100755 index 0000000..60c2b30 --- /dev/null +++ b/app/design/frontend/base/default/layout/novalnet.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + ]]> + + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + + + + + + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Banktransfer.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Banktransfer.phtml new file mode 100755 index 0000000..ba06a07 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Banktransfer.phtml @@ -0,0 +1,69 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Callback.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Callback.phtml new file mode 100755 index 0000000..9d6b936 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Callback.phtml @@ -0,0 +1,26 @@ +escapeHtml($this->getDisplayError(), array('br')); // display the message +if ($orderNo = $this->getNewOrderNumber()) { + echo 'message=' . $message . '&order_no=' . $orderNo; +} else { + echo 'message=' . $message; +} + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Cashpayment.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Cashpayment.phtml new file mode 100755 index 0000000..b8810ef --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Cashpayment.phtml @@ -0,0 +1,67 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Cc.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Cc.phtml new file mode 100755 index 0000000..659ae26 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Cc.phtml @@ -0,0 +1,239 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); + +$vendorId = Mage::getStoreConfig('novalnet_global/novalnet/merchant_id'); +$productId = Mage::getStoreConfig('novalnet_global/novalnet/product_id'); +$currentLanguage = explode("_", Mage::app()->getLocale()->getLocaleCode()); +$encodedkey = base64_encode('vendor=' . $vendorId . '&product=' . $productId . '&server_ip=' . $helper->getServerAddr() . '&lang=' . $currentLanguage[0]); +$nnIframeSource = 'https://secure.novalnet.de/cc?api=' . $encodedkey; + +$maskedCardInfo = $this->getMethod()->getExistingTransInfo(); +$oneClickShopping = ($this->getMethod()->getConfigData('cc_shop_type') == 1 && $maskedCardInfo) ? 1 : ''; +?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Eps.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Eps.phtml new file mode 100755 index 0000000..97b981e --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Eps.phtml @@ -0,0 +1,69 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Giropay.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Giropay.phtml new file mode 100755 index 0000000..56bed14 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Giropay.phtml @@ -0,0 +1,69 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Ideal.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Ideal.phtml new file mode 100755 index 0000000..028485c --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Ideal.phtml @@ -0,0 +1,69 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Invoice.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Invoice.phtml new file mode 100755 index 0000000..543b865 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Invoice.phtml @@ -0,0 +1,124 @@ +escapeHtml($this->getMethodCode()); +$helper = Mage::helper('novalnet_payment'); +$billingInfo = $helper->getCheckout()->getQuote()->getBillingAddress(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/InvoiceInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/form/InvoiceInstalment.phtml new file mode 100755 index 0000000..58923de --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/InvoiceInstalment.phtml @@ -0,0 +1,163 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$billingInfo = $helper->getCheckout()->getQuote()->getBillingAddress(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Paypal.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Paypal.phtml new file mode 100755 index 0000000..6bea325 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Paypal.phtml @@ -0,0 +1,139 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$prevTransInfo = $this->getMethod()->getExistingTransInfo(); +$oneClickShopping = ($this->getMethod()->getConfigData('paypal_shop_type') == 1 && $prevTransInfo) ? 1 : ''; +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Prepayment.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Prepayment.phtml new file mode 100755 index 0000000..d2fa38f --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Prepayment.phtml @@ -0,0 +1,67 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Przelewy.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Przelewy.phtml new file mode 100755 index 0000000..009c05b --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Przelewy.phtml @@ -0,0 +1,69 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/Sepa.phtml b/app/design/frontend/base/default/template/novalnet/method/form/Sepa.phtml new file mode 100755 index 0000000..083e2a8 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/Sepa.phtml @@ -0,0 +1,235 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$maskedAccountInfo = $this->getMethod()->getExistingTransInfo(); +$oneClickShopping = ($this->getMethod()->getConfigData('sepa_shop_type') == 1 && $maskedAccountInfo) ? 1 : ''; +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + + diff --git a/app/design/frontend/base/default/template/novalnet/method/form/SepaInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/form/SepaInstalment.phtml new file mode 100755 index 0000000..4b62dea --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/form/SepaInstalment.phtml @@ -0,0 +1,241 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Banktransfer.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Banktransfer.phtml new file mode 100755 index 0000000..5b88e1d --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Banktransfer.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Cashpayment.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Cashpayment.phtml new file mode 100755 index 0000000..8e60577 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Cashpayment.phtml @@ -0,0 +1,77 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('CpDueDate')): ?> + escapeHtml($this->__('Slip expiry date: %s', $this->getAdditionalData('CpDueDate'))) ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with slip expiry date %s', $this->getAdditionalData('CpDueDate')) + ) + ?>

+ + + getAdditionalData('CashpaymentStores')): ?> + __('Store(s) near you:'); ?>

+ + getAdditionalData('CashpaymentStores') as $key => $value): ?> + + + + + +
escapeHtml($value['title']) ?>
+ escapeHtml($value['street']) ?>
+ escapeHtml($value['city']) ?>
+ escapeHtml($value['country']) ?>
+ escapeHtml($value['zipcode']) ?>

+
+ + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/CashpaymentSuccess.phtml b/app/design/frontend/base/default/template/novalnet/method/info/CashpaymentSuccess.phtml new file mode 100755 index 0000000..9675056 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/CashpaymentSuccess.phtml @@ -0,0 +1,43 @@ +getOrderId(); +$cpCheckoutToken = ''; +if ($orderId) { + $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); + $payment = $order->getPayment(); + $paymentCode = $payment->getMethodInstance()->getCode(); + if ($paymentCode == 'novalnetCashpayment') { + $data = unserialize($order->getPayment()->getAdditionalData()); + $cpCheckoutToken = !empty($data['cpCheckoutToken']) ? $data['cpCheckoutToken'] : ''; + $checkoutUrl = !empty($data['NnTestOrder']) + ? 'https://cdn.barzahlen.de/js/v2/checkout-sandbox.js' : 'https://cdn.barzahlen.de/js/v2/checkout.js'; + } +} +?> + + + + + __('Pay now with Barzahlen'); ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Cc.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Cc.phtml new file mode 100755 index 0000000..d18396f --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Cc.phtml @@ -0,0 +1,67 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Eps.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Eps.phtml new file mode 100755 index 0000000..f43c007 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Eps.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Giropay.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Giropay.phtml new file mode 100755 index 0000000..f43c007 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Giropay.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Ideal.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Ideal.phtml new file mode 100755 index 0000000..f43c007 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Ideal.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Invoice.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Invoice.phtml new file mode 100755 index 0000000..90459ab --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Invoice.phtml @@ -0,0 +1,161 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('NnGuarantee')): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>

+ + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/InvoiceInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/info/InvoiceInstalment.phtml new file mode 100755 index 0000000..fcf4e3f --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/InvoiceInstalment.phtml @@ -0,0 +1,168 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + + getAdditionalData('PaidInstall') && ($paymentStatus == 100)): ?> +
+
+

+ + + + + + + + + + + + + + + + + + +
: getAdditionalData('PaidInstall') ?>
: getAdditionalData('DueInstall') ? $this->getAdditionalData('DueInstall') : 0 ?>
: getAdditionalData('InstallCycleAmount') ? Mage::helper('core')->currency($this->getAdditionalData('InstallCycleAmount'), true, false) : '-' ?>
+

+ + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Paypal.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Paypal.phtml new file mode 100755 index 0000000..d32a3d8 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Paypal.phtml @@ -0,0 +1,67 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Prepayment.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Prepayment.phtml new file mode 100755 index 0000000..51247e9 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Prepayment.phtml @@ -0,0 +1,132 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>

+ +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>
+ escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>
+ + + + +
+ escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + +
escapeHtml($this->__($text)); ?> + +
escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + +
getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Przelewy.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Przelewy.phtml new file mode 100755 index 0000000..00bb9ef --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Przelewy.phtml @@ -0,0 +1,49 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), + $value['refamount'], + $helper->makeValidNumber($value['reftid']), + $value['refamount'] + ) + );?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/Sepa.phtml b/app/design/frontend/base/default/template/novalnet/method/info/Sepa.phtml new file mode 100755 index 0000000..d90778b --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/Sepa.phtml @@ -0,0 +1,88 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ +getAdditionalData('NnGuarantee')): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>

+ + + escapeHtml($this->__('Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.')); ?>

+ + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>

+ + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/info/SepaInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/info/SepaInstalment.phtml new file mode 100755 index 0000000..b17b1e2 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/info/SepaInstalment.phtml @@ -0,0 +1,90 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> +
+ __('Testorder'); ?> +
+ +escapeHtml($this->getMethod()->getTitle()) ?>
+ + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>

+ + + escapeHtml($this->__('Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.')); ?>

+ +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>

+ +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>

+ + +getAdditionalData('PaidInstall') && $paymentStatus == 100): ?> +

+ + + + + + + + + + + + + + + + + + +
: getAdditionalData('PaidInstall') ?>
: getAdditionalData('DueInstall') ? $this->getAdditionalData('DueInstall') : '0' ?>
: getAdditionalData('InstallCycleAmount') ? Mage::helper('core')->currency($this->getAdditionalData('InstallCycleAmount'), true, false) : '-' ?>
+

+ + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>

+ + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Banktransfer.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Banktransfer.phtml new file mode 100755 index 0000000..eb1853b --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Banktransfer.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Cashpayment.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Cashpayment.phtml new file mode 100755 index 0000000..b16d4ec --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Cashpayment.phtml @@ -0,0 +1,66 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('CpDueDate')): ?> + escapeHtml($this->__('Slip expiry date: %s', $this->getAdditionalData('CpDueDate'))) ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with slip expiry date %s', $this->getAdditionalData('CpDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('CashpaymentStores')): ?> + __('Store(s) near you:'); ?>{{pdf_row_separator}} + getAdditionalData('CashpaymentStores') as $key => $value): ?> + escapeHtml($value['title'] . ':') ?>{{pdf_row_separator}} + escapeHtml($value['street']) ?>{{pdf_row_separator}} + escapeHtml($value['city']) ?>{{pdf_row_separator}} + escapeHtml($value['country']) ?>{{pdf_row_separator}} + escapeHtml($value['zipcode']) ?>{{pdf_row_separator}} + + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Cc.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Cc.phtml new file mode 100755 index 0000000..ffc2a9b --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Cc.phtml @@ -0,0 +1,65 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Eps.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Eps.phtml new file mode 100755 index 0000000..eb1853b --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Eps.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Giropay.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Giropay.phtml new file mode 100755 index 0000000..f5ebe9a --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Giropay.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Ideal.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Ideal.phtml new file mode 100755 index 0000000..f5ebe9a --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Ideal.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} +{{pdf_row_separator}} +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Invoice.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Invoice.phtml new file mode 100755 index 0000000..bc6c3e6 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Invoice.phtml @@ -0,0 +1,159 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute('transaction_no', $transactionId); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('NnGuarantee') && $paymentStatus != 75): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'The refund has been executed for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + + {{pdf_row_separator}}escapeHtml($this->__($text)); ?> + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/InvoiceInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/InvoiceInstalment.phtml new file mode 100755 index 0000000..27859e9 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/InvoiceInstalment.phtml @@ -0,0 +1,147 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account', + $orderFullAmount + ) + ); ?> + + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + + {{pdf_row_separator}}escapeHtml($this->__($text)); ?> + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Paypal.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Paypal.phtml new file mode 100755 index 0000000..d30823f --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Paypal.phtml @@ -0,0 +1,65 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); +?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Prepayment.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Prepayment.phtml new file mode 100755 index 0000000..415a798 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Prepayment.phtml @@ -0,0 +1,130 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$currentUrl = Mage::helper('core/url')->getCurrentUrl(); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed successfully for the TID: %s and the due date updated as %s', + $helper->makeValidNumber($transactionId), + $this->getAdditionalData('NnDueDate') + ) + ); ?>{{pdf_row_separator}} + +getAdditionalData('dueDateUpdateAt')): ?> + escapeHtml( + $this->__('The transaction has been updated with due date %s', $this->getAdditionalData('NnDueDate')) + ) + ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + + getAdditionalData('NnNote'));?> + + getAdditionalData('NnNote'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNote')); ?> + + getAdditionalData('NnNote')); + $dueDate = substr($note[0],9); + $formattedDueDate = Mage::helper('core')->formatDate($dueDate, 'medium', false); + $orderFullAmount = substr($this->getAdditionalData('NnNoteAmount'),11); + ?> + escapeHtml( + $this->__( + 'Please transfer the amount of %s to the following account on or before %s', + $orderFullAmount, + $formattedDueDate + ) + ); ?> + + + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID'), 'br')): ?>{{pdf_row_separator}} + escapeHtml($this->getAdditionalData('NnNoteTID')); ?> + + getAdditionalData('NnNoteTID')); ?>{{pdf_row_separator}} + + + + + {{pdf_row_separator}} + escapeHtml( + $this->__($text) . ': ' . $this->__($referenceTxt) . ' ' . $value + ); ?> + + + {{pdf_row_separator}}escapeHtml($this->__($text)); ?> + + {{pdf_row_separator}}escapeHtml($this->__($text) . ': ' . $value); ?> + + + + + + getAdditionalData('NnComments')); ?> + + {{pdf_row_separator}}getAdditionalData('NnComments'); ?> + + + + escapeHtml($this->__('Error in getting payment method')) ?> + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Przelewy.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Przelewy.phtml new file mode 100755 index 0000000..16b465e --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Przelewy.phtml @@ -0,0 +1,47 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> + getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), + $value['refamount'], + $helper->makeValidNumber($value['reftid']), + $value['refamount'] + ) + );?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/Sepa.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/Sepa.phtml new file mode 100755 index 0000000..c73028c --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/Sepa.phtml @@ -0,0 +1,83 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + +getAdditionalData('NnGuarantee') && $paymentStatus != 75): ?> + escapeHtml($this->__('This is processed as a guarantee payment')); ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + getAdditionalData('NnGuarantee')): ?> + escapeHtml( + $this->__( + 'The refund has been executed for the TID: %s with the amount of %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/method/pdf/SepaInstalment.phtml b/app/design/frontend/base/default/template/novalnet/method/pdf/SepaInstalment.phtml new file mode 100755 index 0000000..a656753 --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/method/pdf/SepaInstalment.phtml @@ -0,0 +1,69 @@ +getInfo(); +$helper = Mage::helper('novalnet_payment'); +$transactionId = $this->getAdditionalData('NnTid') ? $this->getAdditionalData('NnTid') : $info->getLastTransId(); +$nextCycleDate = $this->getAdditionalData('paidUntil') ? $this->getAdditionalData('paidUntil') : ''; +$currentTime = $this->getAdditionalData('voidCreateAt'); +$transactionStatus = $helper->getModel('Mysql4_TransactionStatus')->loadByAttribute( + 'transaction_no', $helper->makeValidNumber($info->getLastTransId() ? $info->getLastTransId() : $this->getAdditionalData('NnTid')) +); +$paymentStatus = $transactionStatus->getTransactionStatus(); // Get payment original transaction status +?> + +getAdditionalData('NnTestOrder')): ?> + __('Testorder'); ?>{{pdf_row_separator}} + +escapeHtml($this->getMethod()->getTitle()) ?>{{pdf_row_separator}} + + escapeHtml($this->__('Novalnet Transaction ID: %s', $helper->makeValidNumber($transactionId))) ?>{{pdf_row_separator}} + + + escapeHtml($this->__('Next Payment Date is: %s', $nextCycleDate)); ?>{{pdf_row_separator}} + +getAdditionalData('voidTid')): ?> + escapeHtml($this->__('The transaction has been canceled on %s', $currentTime)) ?>{{pdf_row_separator}} + +getAdditionalData('subsCancelReason')): ?> + escapeHtml( + $this->__('Subscription Cancellation: %s', $this->getAdditionalData('subsCancelReason')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('captureTid')): ?> + escapeHtml( + $this->__('The transaction has been confirmed on %s', $this->getAdditionalData('captureCreateAt')) + ); ?>{{pdf_row_separator}} + +getAdditionalData('refunded_tid')): ?> +getAdditionalData('refunded_tid') as $key => $value): ?> + escapeHtml( + $this->__( + 'Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s', + $helper->makeValidNumber($value['reqtid']), $value['refamount'], + $helper->makeValidNumber($value['reftid']), $value['refamount'] + ) + ); + ?>{{pdf_row_separator}} + + +getAdditionalData('NnComments')): ?> + getAdditionalData('NnComments'); ?> + + diff --git a/app/design/frontend/base/default/template/novalnet/recurring/profile/view.phtml b/app/design/frontend/base/default/template/novalnet/recurring/profile/view.phtml new file mode 100755 index 0000000..5a8b6bf --- /dev/null +++ b/app/design/frontend/base/default/template/novalnet/recurring/profile/view.phtml @@ -0,0 +1,181 @@ + + +getTransactionStatus(); ?> +
+ + +
+

__('Recurring Profile # %s', $this->escapeHtml($this->getReferenceId())) ?>

+
+ getCanCancel() && $transactionStatus->getAmount()) : ?> + + + getCanSuspend() && $this->_profile->getState() != 'pending' && $transactionStatus->getAmount()) : + ?> + + + getCanActivate() && $this->_profile->getState() != 'pending') : + ?> + + +
+ + +
+ + getMessagesBlock()->getGroupedHtml() ?> + + + getChildGroup('info_tabs'); ?> + +
+
__('About This Profile:') ?>
+
+ +
+
+ + + + getChildGroup("info_blocks_row_{$i}"); ?> + +
+ + $block): ?> + getObjectData($block, 'view_column')) : ?> +
+
+
+

+ escapeHtml($this->getObjectData($block, 'view_label')) + ?> +

+
+
+ getChildHtml($alias) + ?> + __('No information available.')); + ?> +
+
+
+ + + +
+ + + + + getChild('table') ?> + +
+

escapeHtml($this->getObjectData($table, 'view_label')) ?>

+ getChildHtml('table') ?> +
+ + + +
+ diff --git a/app/design/frontend/rwd/default/layout/novalnet.xml b/app/design/frontend/rwd/default/layout/novalnet.xml new file mode 100755 index 0000000..60c2b30 --- /dev/null +++ b/app/design/frontend/rwd/default/layout/novalnet.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + ]]> + + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + + + + skin_css + css/novalnet/novalnet.css + + + js + novalnet/cc.js + + + js + novalnet/sepa.js + + + js + novalnet/paypal.js + + + + + + + + + diff --git a/app/design/frontend/rwd/default/template/novalnet/method/form/Cc.phtml b/app/design/frontend/rwd/default/template/novalnet/method/form/Cc.phtml new file mode 100755 index 0000000..659ae26 --- /dev/null +++ b/app/design/frontend/rwd/default/template/novalnet/method/form/Cc.phtml @@ -0,0 +1,239 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); + +$vendorId = Mage::getStoreConfig('novalnet_global/novalnet/merchant_id'); +$productId = Mage::getStoreConfig('novalnet_global/novalnet/product_id'); +$currentLanguage = explode("_", Mage::app()->getLocale()->getLocaleCode()); +$encodedkey = base64_encode('vendor=' . $vendorId . '&product=' . $productId . '&server_ip=' . $helper->getServerAddr() . '&lang=' . $currentLanguage[0]); +$nnIframeSource = 'https://secure.novalnet.de/cc?api=' . $encodedkey; + +$maskedCardInfo = $this->getMethod()->getExistingTransInfo(); +$oneClickShopping = ($this->getMethod()->getConfigData('cc_shop_type') == 1 && $maskedCardInfo) ? 1 : ''; +?> + + diff --git a/app/design/frontend/rwd/default/template/novalnet/method/form/Invoice.phtml b/app/design/frontend/rwd/default/template/novalnet/method/form/Invoice.phtml new file mode 100755 index 0000000..543b865 --- /dev/null +++ b/app/design/frontend/rwd/default/template/novalnet/method/form/Invoice.phtml @@ -0,0 +1,124 @@ +escapeHtml($this->getMethodCode()); +$helper = Mage::helper('novalnet_payment'); +$billingInfo = $helper->getCheckout()->getQuote()->getBillingAddress(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + diff --git a/app/design/frontend/rwd/default/template/novalnet/method/form/InvoiceInstalment.phtml b/app/design/frontend/rwd/default/template/novalnet/method/form/InvoiceInstalment.phtml new file mode 100755 index 0000000..58923de --- /dev/null +++ b/app/design/frontend/rwd/default/template/novalnet/method/form/InvoiceInstalment.phtml @@ -0,0 +1,163 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$billingInfo = $helper->getCheckout()->getQuote()->getBillingAddress(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + + diff --git a/app/design/frontend/rwd/default/template/novalnet/method/form/Sepa.phtml b/app/design/frontend/rwd/default/template/novalnet/method/form/Sepa.phtml new file mode 100755 index 0000000..083e2a8 --- /dev/null +++ b/app/design/frontend/rwd/default/template/novalnet/method/form/Sepa.phtml @@ -0,0 +1,235 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$maskedAccountInfo = $this->getMethod()->getExistingTransInfo(); +$oneClickShopping = ($this->getMethod()->getConfigData('sepa_shop_type') == 1 && $maskedAccountInfo) ? 1 : ''; +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +?> + + + diff --git a/app/design/frontend/rwd/default/template/novalnet/method/form/SepaInstalment.phtml b/app/design/frontend/rwd/default/template/novalnet/method/form/SepaInstalment.phtml new file mode 100755 index 0000000..4b62dea --- /dev/null +++ b/app/design/frontend/rwd/default/template/novalnet/method/form/SepaInstalment.phtml @@ -0,0 +1,241 @@ +getMethodCode(); +$helper = Mage::helper('novalnet_payment'); +$config = $helper->getModel('Service_Abstract'); +$billingInfo = $this->getBillingInfo(); +$customerSession = $helper->getCustomerSession(); +$dateOfBirth = ($customerSession->isLoggedIn() && + $customerSession->getCustomer()->hasDob() ? $customerSession->getCustomer()->getDob() : ''); +$dateOfBirth = $dateOfBirth ? Mage::getSingleton('core/date')->gmtDate('Y-m-d', $dateOfBirth) : ''; +$company = $helper->getEndUserCompany(); +$orderTotal = $helper->getCheckout()->getQuote()->getGrandTotal(); +$priceHelper = Mage::helper('core'); +$formattedPrice = $priceHelper->currency($orderTotal, true, false); +$instalmentPeriods = array(); +$allcycles = explode(',', $this->getInstalmentTotal()); +foreach($allcycles as $allcycle) { + if (($orderTotal / $allcycle) >= 9.99) { + $instalmentPeriods[$allcycle] = ($this->getInstalmentCycle() == 1) + ? $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every month', $this->getInstalmentCycle()) + : $allcycle . __(' Cycles / ') . $priceHelper->currency($orderTotal / $allcycle, true, false) . __(' Every %s months', $this->getInstalmentCycle()); + } +} +?> + + + + diff --git a/app/etc/modules/Novalnet_Payment.xml b/app/etc/modules/Novalnet_Payment.xml new file mode 100755 index 0000000..c18d076 --- /dev/null +++ b/app/etc/modules/Novalnet_Payment.xml @@ -0,0 +1,31 @@ + + + + + + true + community + + + + + + diff --git a/app/locale/de_DE/Novalnet_Payment.csv b/app/locale/de_DE/Novalnet_Payment.csv new file mode 100755 index 0000000..2047791 --- /dev/null +++ b/app/locale/de_DE/Novalnet_Payment.csv @@ -0,0 +1,402 @@ +"Product activation key","Produktaktivierungsschlüssel" +"Enter Novalnet Product activation key","Novalnet-Aktivierungsschlüssel für das Produkt eingeben" +"Novalnet Global Configuration","Novalnet: Zentrale Einstellungen" +"Novalnet Merchant ID","Händler-ID" +"Authentication code","Authentifizierungscode" +"Project ID","Projekt-ID" +"Select Tariff ID","Auswahl der Tarif-ID" +"Select Novalnet tariff ID","Novalnet-Tarif-ID auswählen." +"Subscription Tariff ID","Tarif-ID des Abonnements" +"Select Novalnet subscription tariff ID","Novalnet-Abonnements-Tarif-ID auswählen" +"Payment access key","Zahlungs-Zugriffsschlüssel" +"payment_action_description","Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Zahlung einziehen: Betrag sofort belasten. Zahlung autorisieren: Die Zahlung wird überprüft und autorisiert, aber erst zu einem späteren Zeitpunkt belastet. So haben Sie Zeit, über die Bestellung zu entscheiden." +"one_click_payment_description","Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden" +"Status to be used for successful orders","Wählen Sie, welcher Status für erfolgreich abgeschlossene Bestellungen verwendet wird" +"Minimum transaction amount for authorization","Mindesttransaktionsbetrag für die Autorisierung (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)" +"Manual checking of order description","Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden." +"Manual checking of paypal order description","Falls der Bestellbetrag das angegebene Limit übersteigt, wird die Transaktion ausgesetzt, bis Sie diese selbst bestätigen. Um diese Option zu verwenden, müssen Sie die Option Billing Agreement (Zahlungsvereinbarung) in Ihrem PayPal-Konto aktiviert haben. Kontaktieren Sie dazu bitte Ihren Kundenbetreuer bei PayPal." +"Novalnet Live Mode","Live-Modus aktivieren" +"Selected payment methods will be in Live Mode","Für ausgewählten Zahlungsarten wird der Live-Modus gesetzt" +"Referrer ID","Partner-ID" +"Referrer id description","Geben Sie die Partner-ID der Person / des Unternehmens ein, welche / welches Ihnen Novalnet empfohlen hat." +"Enable auto-fill","Automatisches Eintragen aktivieren" +"Autofill description","Die Zahlungsdetails werden automatisch während des Checkout-Vorgangs in das Zahlungsformular eingetragen." +"Enable default payment method","Default-Zahlungsart aktivieren." +"Payment last success description","Für registrierte Benutzer wird die letzte ausgewählte Zahlungsart als Standardeinstellung beim Checkout ausgewählt." +"Novalnet Use Proxy","Proxy-Server" +"Proxy Host","Host des Proxyservers" +"Proxy Port","Port des Proxyservers" +"Onhold order status","On-hold-Bestellstatus" +"OnHold cancellation / VOID Transaction status","Bestellstatus für Stornierung" +"Gateway timeout","Zeitlimit der Schnittstelle (in Sekunden)" +"Gateway timeout description","Falls die Verarbeitungszeit der Bestellung das Zeitlimit der Schnittstelle überschreitet, wird die Bestellung nicht ausgeführt." +"Display payment method logo","Logo der Zahlungsart anzeigen" +"The payment method logo will be displayed on the checkout page","Das Logo der Zahlungsart wird auf der Checkout-Seite angezeigt." +"Merchant script management","Verwaltung des Händlerskripts" +"Deactivate IP address control description","Diese Option ermöglicht eine manuelle Ausführung. Bitte deaktivieren Sie diese Option, bevor Sie Ihren Shop in den LIVE-Modus schalten, um nicht autorisierte Zugriffe von externen Parteien (außer von Novalnet) zu vermeiden." +"Test mode description","Die Zahlung wird im Testmodus durchgeführt, daher wird der Betrag für diese Transaktion nicht eingezogen." +"Callback order status","Callback / Webhook Bestellstatus" +"Enable E-mail notification for callback","Email-Benachrichtigung für Callback aktivieren" +"Email To address description","Emailadresse des Empfängers" +"E-mail Bcc Address","Emailadresse (Bcc)" +"Email Bcc address description","Emailadresse des Empfängers für Bcc" +"Vendor script url","URL für Benachrichtigungen" +"One click shopping","Kauf mit einem Klick" +"Novalnet Credit Card","Kredit- / Debitkarte" +"Novalnet Direct Debit SEPA","SEPA-Lastschrift" +"Novalnet Invoice","Rechnung" +"Novalnet Prepayment","Vorkasse" +"Novalnet Instant Bank Transfer","Sofortüberweisung" +"Novalnet PayPal","PayPal" +"Novalnet iDEAL","iDEAL" +"Novalnet Eps","eps" +"Novalnet Giropay","giropay" +"Novalnet Przelewy24","Przelewy24" +"Novalnet Instalment by Direct Debit SEPA","Ratenzahlung per SEPA-Lastschrift" +"Novalnet Instalment by Invoice","Ratenzahlung per Rechnung" +"Enable module","Zahlungsart anzeigen" +"Novalnet Title","Novalnet Titel *" +"Payment logo","Logo der Zahlungsart" +"Banktransfer payment description","Sie werden zu Sofortüberweisung weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist" +"Ideal payment description","Sie werden zu iDEAL weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist." +"Eps payment description","Sie werden zu eps weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist" +"Giropay payment description","Sie werden zu giropay weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist" +"Paypal payment description","Sie werden zu PayPal weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist" +"Przelewy payment description","Sie werden zu Przelewy24 weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist" +"Browse logo to be displayed with the payment name","Das Logo der Zahlungsart wird auf der Checkout-Seite angezeigt." +"Enable 3D secure","3D-Secure aktivieren" +"CC-3D secure description","3D-Secure wird für Kreditkarten aktiviert. Die kartenausgebende Bank fragt vom Käufer ein Passwort ab, welches helfen soll, betrügerische Zahlungen zu verhindern. Dies kann von der kartenausgebenden Bank als Beweis verwendet werden, dass der Käufer tatsächlich der Inhaber der Kreditkarte ist. Damit soll das Risiko von Chargebacks verringert werden." +"Force 3D secure on predefined conditions","3D-Secure-Zahlungen unter vorgegebenen Bedingungen durchführen" +"Force 3D secure on predefined conditions description","Wenn 3D-Secure in dem darüberliegenden Feld nicht aktiviert ist, sollen 3D-Secure-Zahlungen nach den Einstellungen zum Modul im Novalnet-Händleradministrationsportal ein unter "3D-Secure-Zahlungen durchführen (gemäß vordefinierten Filtern und Einstellungen)" durchgeführt werden.

Wenn die vordefinierten Filter und Einstellungen des Moduls "3D-Secure durchfĂĽhren" zutreffen, wird die Transaktion als 3D-Secure-Transaktion durchgefĂĽhrt, ansonsten als Nicht-3D-Secure-Transaktion.

Beachten Sie bitte, dass das Modul "3D-Secure-Zahlungen durchführen (gemäß vordefinierten Filtern und Einstellungen)" im Novalnet-Händleradministrationsportal ein konfiguriert sein muss, bevor es hier aktiviert wird.

Für weitere Informationen sehen Sie sich bitte die Beschreibung dieses Betrugsprüfungsmoduls an (unter dem Reiter "Betrugsprüfungsmodule" unterhalb des Menüpunkts "Projekte" für das ausgewähte Projekt im Novalnet-Händleradministrationsportal ein) oder kontaktieren Sie das Novalnet-Support-Team." +"Enforce 3D secure payment outside EU","3D-Secure-Zahlungen außerhalb der EU erzwingen" +"By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA.","Wenn Sie diese Option aktivieren, werden alle Zahlungen mit Karten, die außerhalb der EU ausgegeben wurden, mit der starken Kundenauthentifizierung (Strong Customer Authentication, SCA) von 3D-Secure 2.0 authentifiziert." +"Order completion status","Status für erfolgreichen Auftragsabschluss" +"Order status for the pending payment","Status für offene Zahlungen" +"The order has been updated.","Der Auftrag wurde aktualisiert." +"Novalnet Credit Card Types","Kreditkartentyp" +"Notification for the buyer","Benachrichtigung des Käufers" +"The entered text will be displayed on the checkout page","Der eingegebene Text wird auf der Checkout-Seite angezeigt." +"User Group Excluded","Ausgeschlossene Benutzergruppe" +"Payment from applicable countries","Zahlung aus zugelassenen Ländern" +"Payment from Specific countries","Länderauswahl für Zahlungsmöglichkeit" +"Novalnet Minimum Order Total","Mindestwert für Gesamtbestellung (in Euro)" +"Novalnet Maximum Order Total","Höchstwert für Gesamtbestellung (in Euro)" +"Novalnet Minimum Orders Count","Mindestanzahl an Bestellungen" +"Novalnet Minimum Orders Count Desc","Standardwert: ""0"" (Prüfung deaktiviert) | Mindestanzahl der vorherigen Bestellungen des Endkunden, damit dieser diese Zahlungsart verwenden darf." +"Novalnet Sort Order","Geben Sie eine Sortierreihenfolge an." +"SEPA Payment duration in days","Fälligkeitsdatum (in Tagen)" +"SEPA Payment duration in days description","Geben Sie die Anzahl der Tage ein, nach denen der Zahlungsbetrag eingezogen werden soll (muss zwischen 2 und 14 Tagen liegen)." +"Enable auto-fill for payment data","Automatisches Eintragen der Zahlungsdaten aktivieren" +"Enable auto-fill for payment data description","Für registrierte Benutzer werden die SEPA-Lastschriftdetails automatisch in das Zahlungsformular eingetragen." +"Invoice payment duration","Fälligkeitsdatum (in Tagen)" +"Prepayment payment duration","Fälligkeitsdatum (in Tagen)" +"Prepayment payment duration description","Anzahl der Tage, die der Käufer Zeit hat, um den Betrag an Novalnet zu überweisen (muss zwischen 7 und 28 Tagen liegen). Wenn Sie dieses Feld leer lassen, werden standardmäßig 14 Tage als Fälligkeitsdatum festgelegt." +"Invoice payment duration description","Anzahl der Tage, die der Käufer Zeit hat, um den Betrag an Novalnet zu überweisen (muss mehr als 7 Tage betragen). Wenn Sie dieses Feld leer lassen, werden standardmäßig 14 Tage als Fälligkeitsdatum festgelegt" +"Enable the payment Method and activate the Risk and Control option","Zahlungsart und Risikomanagement-Einstellungen aktivieren" +"Orders","Bestellungen" +"Novalnet Transactions","Novalnet Transaktions" +"Novalnet Transactions Overview","Novalnet-Transaktionsübersicht" +"Transactions Overview","Transaktionsübersicht" +"Configuration","Konfiguration" +"General","General" +"Payment Methods","Zahlungsmethode" +"Payment Method","Zahlungsart" +"Risk and Control","Risikomanagement und Kontrolle" +"Information","Informationen" +"Novalnet Merchant Admin","Novalnet Händler Admin" +"Novalnet Magento Module","Novalnet Magento Modul" +"None","Keiner" +"PIN by callback","PIN-by-Callback" +"PIN by SMS","PIN-by-SMS" +"Novalnet Capture","Novalnet Erfassen" +"IBAN","IBAN" +"BIC","BIC" +"Novalnet Recurring Profiles","Novalnet Wiederkehrende Profile" +"Customer was redirected to Novalnet","Besteller zu Novalnet umgeleitet" +"checkHash failed","Während der Umleitung wurden einige Daten geändert. Die Überprüfung des Hashes schlug fehl." +"Customer successfully returned from Novalnet","Der Kunde wurde erfolgreich von Novalnet zurückgeleitet." +"Are you sure you want to do this?","Sind Sie sicher, daß Sie das machen wollen?" +"Cancel","Stornieren" +"Continue","Bestätigen" +"You will be redirected to Novalnet AG in a few seconds.","Sie werden in wenigen Sekunden zur Novalnet AG weitergeleitet." +"Transactions","Transaktions" +"Novalnet - Transaction Log","Novalnet-Transaktions-Log" +"Transactions Log","Transaktions-Log" +"Novalnet - Transaction Overview"," Novalnet-Transaktionsübersicht" +"Transaction ID","Transaktions-ID" +"Transaction Status","Transaktionen Status" +"NC No","NC No" +"Customer ID","Kundennummer" +"Day","Tag" +"Month","Monat" +"Year","Jahr" +"Please select reason","Wählen Sie bitte den Grund aus" +"Product is costly","Angebot zu teuer" +"Cheating","Betrug" +"Partner interfered","(Ehe-)Partner hat Einspruch eingelegt" +"Financial problem","Finanzielle Schwierigkeiten" +"Content does not match my likes","Inhalt entsprach nicht meinen Vorstellungen" +"Content is not enough","Inhalte nicht ausreichend" +"Interested only for a trial","Nur an Probezugang interessiert" +"Page is very slow","Seite zu langsam" +"Satisfied customer","Zufriedener Kunde" +"Logging in problems","Zugangsprobleme" +"Other reasons","Sonstige" +"Please select the reason of subscription cancellation","Wählen Sie bitte den Grund für die Abonnementskündigung aus." +"Your account details are invalid","Ihre Kontodaten sind ungültig." +"No active payment method for this store","Für diesen Shop ist keine Zahlungsart aktiviert." +"Payment was not successful. An error occurred.","Die Zahlung war nicht erfolgreich. Ein Fehler trat auf." +"Payment Failed","Zahlung fehlgeschlagen" +"Trial Billing Cycles are not support Novalnet payment","Testzeiträume werden von den Novalnet-Zahlungsarten nicht unterstützt" +"Required parameter not valid","Ungültiger Wert für Pflichtfeld" +"Payment was successful","Zahlung war erfolgreich" +"Payment was not successfull","Die Zahlung war nicht erfolgreich. Ein Fehler trat auf." +"Payment Failed","Zahlung fehlgeschlagen" +"Gateway request error: %s","Fehler beim übertragen der Daten: %s" +"Basic parameter not valid","Füllen Sie bitte alle Pflichtfelder aus." +"Order-ID","Bestellnummer" +"Transaction-ID","Transaktions-ID" +"Customer-ID","Kundennummer" +"Payment Name","Zahlungsart" +"Novalnet Shop Information","Novalnet Shop Informationen" +"Shop URL","Shop URL" +"Novalnet Additional Information","Novalnet Zusätzliche Informationen" +"Novalnet Request Data","Novalnet Aufrufdaten" +"Request Data","Aufrufdaten" +"Novalnet Response Data","Novalnet Rückgabedaten" +"Response Data","Rückgabedaten" +"Novalnet Order Information","Novalnet Bestellinformationen" +"Successful","erfolgreiche" +"Transaction-Status","Status der Transaktion" +"Testorder","Testbestellung" +"TID: %s","Novalnet Transaktions-ID: %s" +"Novalnet Transaction ID: %s","Novalnet Transaktions-ID: %s" +"Next Payment Date is: %s","Nächstes Belastungsdatum: %s" +"The transaction has been canceled on %s","Die Transaktion wurde am %s storniert." +"The transaction has been confirmed on %s","Die Buchung wurde am %s bestätigt." +"Subscription Cancellation: %s","Das Abonnement wurde gekündigt wegen: %s" +"Please transfer the invoice amount with the following information to our payment provider Novalnet AG","Überweisen Sie bitte den Betrag an die unten aufgeführte Bankverbindung unseres Zahlungsdienstleisters Novalnet." +"Please transfer the amount of %s to the following account on or before %s","Bitte überweisen Sie den Betrag von %s spätestens bis zum %s auf das folgende Konto" +"Please transfer the amount of %s to the following account","Please transfer the amount of %s to the following account" +"Due Date","Fälligkeitsdatum" +"NN Account Holder","Kontoinhaber" +"NN_Bank","Bank" +"NN_Amount","Betrag" +"Amount","Betrag" +"Order No","Bestellnummer" +"Please Note: This transaction will run on TEST MODE and the amount will not be charged","Die Zahlung wird im Testmodus durchgeführt, daher wird der Betrag für diese Transaktion nicht eingezogen." +"redirect payment description","Nach der erfolgreichen Überprüfung werden Sie auf die abgesicherte Novalnet-Bestellseite umgeleitet, um die Zahlung fortzusetzen." +"The amount will be debited from your account by Novalnet","Der Betrag wird durch Novalnet von Ihrem Konto abgebucht." +"Invoice/Prepayment payment description","Sie erhalten eine E-Mail mit den Bankdaten von Novalnet, um die Zahlung abzuschließen." +"Cashpayment payment description","Nach erfolgreichem Bestellabschluss erhalten Sie einen Zahlschein bzw. eine SMS. Damit können Sie Ihre Online-Bestellung bei einem unserer Partner im Einzelhandel (z.B. Drogerie, Supermarkt etc.) bezahlen." +"The amount will be debited from your credit/debit card","Der Betrag wird Ihrer Kredit-/Debitkarte belastet" +"NN CC type","Kartentyp" +"Account Holder","Kontoinhaber" +"NN Country","Land der Bank" +"Account Holder","Kontoinhaber" +"IBAN or Account number","IBAN oder Kontonummer" +"BIC or Bank code","BIC oder Bankleitzahl" +"NN Confirm","Hiermit erteile ich das SEPA-Lastschriftmandat und bestätige, dass die angegebene IBAN und BIC korrekt sind." +"SEPA Due date is not valid","SEPA Fälligkeitsdatum Ungültiger" +"Mobile phone number","Mobiltelefonnummer" +"NN Mobile Number","Telefonnummer" +"Note for pin by sms and callback","Nachdem Sie auf den Button ""Weiter"" geklickt haben, erhalten Sie in Kürze eine PIN via Telefon / SMS. Geben Sie diese PIN bitte in das passende Textfeld ein." +"PIN","PIN zu Ihrer Transaktion" +"Forgot PIN? [New PIN Request]","PIN vergessen?" +"The order amount has been changed","Der Bestellbetrag hat sich geändert, setzen Sie bitte die neue Bestellung fort." +"You will shortly receive an SMS","In Kürze erhalten Sie eine SMS mit der PIN zu Ihrer Transaktion, um die Zahlung abzuschließen." +"You will shortly receive a transaction PIN","In Kürze erhalten Sie einen Telefonanruf mit der PIN zu Ihrer Transaktion, um die Zahlung abzuschließen" +"The PIN you entered is incorrect","Die von Ihnen eingegebene PIN ist falsch." +"Please enter your telephone number","Geben Sie bitte Ihre Telefonnummer ein" +"Please enter your mobile number","Geben Sie bitte Ihre Mobiltelefonnummer ein." +"Your E-mail address is invalid","Ihre Emailadresse ist ungültig." +"Customer name/email fields are not valid","Ungültige Werte für die Felder Kundenname-/email" +"Refund reference","Referenz für die Rückerstattung" +"Period for subsequent subscription cycle","Zeitraum für den folgenden Abonnementzyklus" +"The period of the subsequent subscription cycle (E.g: 1d/1m/1y)","Beschreibung: Zeitraum des folgenden Abonnementzyklus (z.B. 1d/1m/1y)" +"Enter your PIN","PIN eingeben." +"NN_Reference","Verwendungszweck" +"NN_Reference1","Verwendungszweck 1" +"NN_Reference2","Verwendungszweck 2" +"NN_Reference3","Verwendungszweck 3" +"payment reference one","Verwendungszweck 1: (Novalnet Rechnungsnummer)" +"payment reference two","Verwendungszweck 2: (TID)" +"payment reference three","Verwendungszweck 3: (Bestellnummer)" +"NN_Reference_desc1","Bitte verwenden Sie einen der unten angegebenen Verwendungszwecke für die Überweisung. Nur so kann Ihr Geldeingang Ihrer Bestellung zugeordnet werden." +"NN_Reference_desc2","Bitte verwenden Sie einen der unten angegebenen Verwendungszwecke für die Überweisung. Nur so kann Ihr Geldeingang Ihrer Bestellung zugeordnet werden." +"Please select atleast one payment reference.","Wählen Sie mindestens einen Verwendungszweck aus." +"Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s","Die Rückerstattung für die TID %s mit dem Betrag %s wurde veranlasst. Die neue TID: %s für den erstatteten Betrag lautet: %s" +"Refund has been initiated for the TID: %s with the amount of %s","Die Rückerstattung für die TID %s mit dem Betrag %s wurde veranlasst." +"Please don’t close the browser after successful payment","Bitte schließen Sie den Browser nach der erfolgreichen Zahlung nicht, bis Sie zum Shop zurückgeleitet wurden." +"Add new card details for later purchases","Neue Kartendaten für spätere Käufe hinzufügen" +"Enter new card details","Neue Kartendaten für spätere Käufe hinzufügen" +"Given card details","Eingegebene Kartendaten" +"Enter account details","Neue Kontodaten eingeben" +"Given account details","Eingegebene Kontodaten" +"I want to save my card details for later purchases","Ich möchte meine Kartendaten für spätere Einkäufe speichern" +"Save my PayPal account details for later purchases","Ich möchte meine PayPal-Kontodaten für spätere Einkäufe speichern" +"I want to save my account details for later purchases","Ich möchte meine Kontodaten für spätere Einkäufe speichern" +"Notify Novalnet updates","Benachrichtigung bei Novalnet-Updates" +"Notify, if any, updates available in Novalnet payment module","Benachrichtigung, falls Updates für ein Novalnet-Zahlungsmodul erhältlich sind" +"Send an e-mail using zend/magento template","E-Mail mit Zend-/Magento-Template verschicken" +"Novalnet merchant script log","Log für das Novalnet-Händlerskript" +"If yes, the merchant script log will be created","Wenn ja, wird ein Log für das Händlerskript angelegt" +"Are you sure you want to capture the payment?","Sind Sie sicher, dass Sie die Zahlung einziehen möchten?" +"Order Status Management","Verwaltung des Bestellstatus für ausgesetzte Zahlungen" +"One click shopping","Kauf mit einem Klick" +"NN None","Keiner" +"Date Of Birth","Ihr Geburtsdatum" +"You need to be at least 18 years old","Sie müssen mindestens 18 Jahre alt sein." +"Novalnet callback received. Refund/Bookback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s","Novalnet-Callback-Meldung erhalten: Rückerstattung / Bookback erfolgreich ausgeführt für die TID: %s Betrag: %s am %s. TID der Folgebuchung: %s" +"Novalnet callback received. Chargeback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s","Novalnet-Callback-Nachricht erhalten: Chargeback erfolgreich importiert für die TID: %s Betrag: %s am %s Uhr. TID der Folgebuchung: %s" +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s","Novalnet-Callback-Skript erfolgreich ausgeführt für die TID: %s mit dem Betrag %s am , um %s Uhr. Bitte suchen Sie nach der bezahlten Transaktion in unserer Novalnet-Händleradministration mit der TID: %s." +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s","Novalnet-Callback-Skript erfolgreich ausgeführt für die TID: %s mit dem Betrag am %s, um %s Uhr" +"Novalnet callback script received. Subscription has been stopped for the TID: %s on %s","Nachricht vom Novalnet-Callback-Skript erhalten: Das Abonnement wurde für die TID: %s am %s, Uhr eingestellt" +"Subscription has been canceled due to: ","Das Abonnement wurde gekündigt wegen: " +"Reference order id: %s","Verwendungszweck Bestellnummer: %s" +"Novalnet Callback Script executed successfully for the subscription TID: %s with amount %s on %s","Novalnet-Callback-Skript erfolgreich ausgeführt für die Abonnements TID: %s mit dem Betrag %s am %s." +"Novalnet Callback Script executed successfully on %s","Novalnet-Callback-Skript erfolgreich ausgeführt am %s" +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s","Novalnet-Callback-Skript erfolgreich ausgeführt für die TID: %s mit dem Betrag %s am %s Uhr." +"Payment guarantee configuration","Einstellungen für die Zahlungsgarantie" +"Payment guarantee comments","Grundanforderungen für die Zahlungsgarantie
Erlaubte B2C-Länder: DE, AT, CH
Erlaubte B2B-Länder: Europäische Union
Zugelassene Währung: EUR
Mindestbetrag der Bestellung: 9.99 EUR
Mindestalter: 18 Jahre
Rechnungsadresse und Lieferadresse mĂĽssen ĂĽbereinstimmen

" +"Payment instalment comments","Voraussetzungen fĂĽr die Ratenzahlung
Erlaubte B2C-Länder: DE, AT, CH
Erlaubte B2B-Länder: Europäische Union
Zugelassene Währung: EUR
Mindestbetrag der Bestellung: 19.98 EUR
Bitte beachten Sie, dass der Betrag einer Rate mindestens 9.99 EUR betragen muss und Raten, die diese Kriterien nicht erfĂĽllen, nicht im Ratenplan angezeigt werden
Mindestalter: 18 Jahre
Rechnungsadresse und Lieferadresse mĂĽssen ĂĽbereinstimmen

" +"Enable payment guarantee","Zahlungsgarantie aktivieren" +"Novalnet Minimum order amount","Mindestbestellbetrag (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1,00 EUR)" +"This setting will override the default setting made in the minimum order amount. Note: Minimum amount should be greater than or equal to 9,99 EUR","Diese Einstellung überschreibt die Standardeinstellung für den Mindest-Bestellbetrag. Anmerkung: der Mindest-Bestellbetrag sollte größer oder gleich 9,99 EUR sein" +"Force Non-Guarantee payment","Zahlung ohne Zahlungsgarantie erzwingen" +"The minimum amount should be at least 9,99 EUR","Der Mindestbetrag sollte bei mindestens 9,99 EUR" +"Form appearance","Darstellung des Formulars" +"Custom CSS Settings","Angepasste CSS-Einstellungen" +"CSS settings for Credit Card fields","CSS-Einstellungen für Felder mit Kreditkartendaten" +"Form fields","Formularfelder" +"NN Label","Beschriftung" +"Input field","Eingabefeld" +"CSS settings for Credit Card iframe","CSS-Einstellungen für den iFrame mit Kreditkartendaten" +"NN Input","Eingabe" +"CSS text","Text für das CSS" +"Proceed with new PayPal account details","Mit neuen PayPal-Kontodetails fortfahren" +"Given PayPal account details","Angegebene PayPal-Kontodetails" +"PayPal transaction ID: %s","PayPal Transaktions-ID: %s" +"In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal.","Um diese Option zu verwenden, müssen Sie die Option Billing Agreement (Zahlungsvereinbarung) in Ihrem PayPal-Konto aktiviert haben. Kontaktieren Sie dazu bitte Ihren Kundenbetreuer bei PayPal." +"Once the order is submitted, the payment will be processed as a reference transaction at Novalnet","Sobald die Bestellung abgeschickt wurde, wird die Zahlung bei Novalnet als Referenztransaktion verarbeitet." +"The payment cannot be processed, because the basic requirements haven’t been met.","Die Zahlung kann nicht verarbeitet werden, weil die grundlegenden Anforderungen nicht erfüllt wurden." +"The transaction has been canceled due to: %s","Die Transaktion wurde storniert. Grund: %s" +"The amount of %s for the order %s has been paid. Please verify received amount and TID details, and update the order status accordingly.","Der Betrag von %s für die Bestellung %s wurde bezahlt. Überprüfen Sie bitten den erhaltenen Betrag und die Details zur TID und aktualisieren Sie den Status der Bestellung entsprechend." +"Created on","Angelegt am" +"Updated on","Aktualisiert am" +"Your credit card details are invalid","Ihre Kreditkartendetails sind ungültig" +"Card holder name","Name des Karteninhabers" +"Name on card","Name auf der Kreditkarte" +"Card number","Kreditkartennummer" +"XXXX XXXX XXXX XXXX","XXXX XXXX XXXX XXXX" +"Expiry date","Ablaufdatum" +"MM / YYYY","MM / YYYY" +"CVC/CVV/CID","CVC/CVV/CID" +"XXX","XXX" +"what is this?","Was ist das?" +"This is processed as a guarantee payment","Diese Transaktion wird mit Zahlungsgarantie verarbeitet" +"Change the due date","Fälligkeitsdatum ändern" +"Transaction due date","Fälligkeitsdatum der Transaktion" +"Change the slip expiry date","Ablaufdatum des Zahlscheins ändern" +"Slip expiry date","Verfallsdatum des Zahlscheins" +"Are you sure you want to change the due date?","Sind Sie sicher, dass Sie das Fälligkeitsdatum ändern möchten?" +"Are you sure you want to change the slip expiry date?","Sind Sie sicher, dass Sie das Ablaufdatum des Zahlscheins ändern wollen?" +"The transaction has been updated with a new due date %s","Die Transaktion wurde aktualisiert. Neues Fälligkeitsdatum: %s." +"The date should be in future","Das Datum sollte in der Zukunft liegen." +"Barzahlen","Barzahlen/viacash" +"Slip expiry date (in days)","Fälligkeitsdatum (in Tagen)" +"paypal onclick description","Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden.
Um diese Option zu verwenden, müssen Sie die Option Billing Agreement (Zahlungsvereinbarung) in Ihrem PayPal-Konto aktiviert haben. Kontaktieren Sie dazu bitte Ihren Kundenbetreuer bei PayPal." +"Cashpayment duration description","Anzahl der Tage, die der Käufer Zeit hat, um den Betrag in einer Filiale zu bezahlen. Wenn Sie dieses Feld leer lassen, ist der Zahlschein standardmäßig 14 Tage lang gültig" +"Slip expiry date: %s","Verfallsdatum des Zahlscheins: %s" +"Store(s) near you:","Barzahlen-Partnerfiliale in Ihrer Nähe:" +"Pay now with Barzahlen","Bezahlen mit Barzahlen" +"DD/MM/YYYY","TT.MM.JJJJ" +"Please enter valid birthdate","Geben Sie ein gültiges Geburtsdatum ein" +"The transaction has been confirmed successfully for the TID: %s and the due date updated as %s","Die Transaktion mit der TID: %s wurde erfolgreich bestätigt und das Fälligkeitsdatum auf %s gesetzt." +"Novalnet callback received. The transaction has been confirmed successfully for the TID: %s and the due date updated as %s","Novalnet-Callback-Meldung erhalten: Die Transaktion mit der TID: %s wurde erfolgreich bestätigt und das Fälligkeitsdatum auf %s gesetzt." +"Enter the Novalnet Product activation key that is required for authentication and click Activate. You will find the Product activation key in the Novalnet Admin Portal: PROJECT > Choose your project > Shop Parameters > API Signature (Product activation key).","Geben Sie den Novalnet-Produktaktivierungsschlüssel ein, der für die Authentifizierung erforderlich ist, und klicken Sie auf Aktivieren. Den Produktaktivierungsschlüssel finden Sie im Novalnet Admin-Portal > PROJEKT > Wählen Sie Ihr Projekt > Parameter Ihres Shops > API-Signature (Aktivierungsschlüssel des Produkts)." +"Novalnet callback received. The transaction has been confirmed on %s","Novalnet-Callback-Meldung erhalten: Die Buchung wurde am %s Uhr bestätigt" +"Novalnet callback received. The transaction has been canceled on %s","Novalnet-Callback-Meldung erhalten: Die Transaktion wurde am %s Uhr storniert" +"Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.","Ihre Bestellung ist unter Bearbeitung. Sobald diese bestätigt wurde, erhalten Sie alle notwendigen Informationen zum Ausgleich der Rechnung. Wir bitten Sie zu beachten, dass dieser Vorgang bis zu 24 Stunden andauern kann." +"Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.","Ihre Bestellung wird derzeit überprüft. Wir werden Sie in Kürze über den Bestellstatus informieren. Bitte beachten Sie, dass dies bis zu 24 Stunden dauern kann." +"The transaction has been updated with slip expiry date %s","Das Ablaufdatum des Belegs wurde für die Transaktion auf den %s gesetzt" +"Novalnet callback received. The transaction has been canceled on %s","Novalnet-Callback-Nachricht erhalten: Die Transaktion wurde am %s Uhr storniert" +"Novalnet callback received. The transaction status has been changed from pending to on hold for the TID: %s on %s.","Novalnet-Callback-Nachricht erhalten: Der Status der Transaktion mit der TID: %s wurde am %s Uhr von ausstehend auf ausgesetzt geändert." +"Novalnet callback script received. Subscription has been reactivated for the TID: %s on %s.","Novalnet-Callback-Nachricht erhalten: Das Abonnement wurde für die TID: %s reaktiviert, am %s Uhr." +"Novalnet callback script received. Subscription payment has been changed from %s to %s on %s.","Novalnet callback script received. Subscription payment has been changed from %s to %s on %s." +"Minimum amount should be greater than or equal to 9,99 EUR","Der Mindest-Bestellbetrag sollte größer oder gleich 9,99 EUR sein" +"payment guarantee","Zahlungsgarantie" +"instalment payment","Ratenzahlung" +"Only DE, CH countries allowed %s","Die Zahlung kann nicht verarbeitet werden, da die grundlegenden Anforderungen für die %s nicht erfüllt wurden (Als Land ist nur Deutschland, Österreich oder Schweiz erlaubt)" +"Minimum order amount should be %s %s","Die Zahlung kann nicht verarbeitet werden, da die grundlegenden Anforderungen für die %s nicht erfüllt wurden (Mindestbestellmenge sollte %s EUR sein)" +"Only EUR currency allowed %s","Die Zahlung kann nicht verarbeitet werden, da die grundlegenden Anforderungen für die %s nicht erfüllt wurden (Als Währung ist nur EUR erlaubt)" +"The shipping address should be the same as the billing address %s","Die Zahlung kann nicht verarbeitet werden, da die grundlegenden Anforderungen für die %s nicht erfüllt wurden (Die Lieferadresse muss mit der Rechnungsadresse übereinstimmen)" +"Instalment by Invoice"," Ratenzahlung per Rechnung" +"Instalment by Direct Debit SEPA","Ratenzahlung per SEPA-Lastschrift" +"Recurring Period for the instalment cycles","Zahlungsrhythmus für die einzelnen Raten" +"On choosing an appropriate recurring period, each instalment cycle will be processed based on that","Wählen Sie einen passenden Zeitraum zwischen den zu zahlenden Raten aus" +"Instalment cycles","Anzahl der Raten" +"Choose your instalment plan","Wählen Sie Ihren Ratenplan" +"Choose the financing option that best fits your needs and you will be charged based on that chosen plan","Wählen Sie die Finanzierungsoption, die Ihren Bedürfnissen am besten entspricht. Die Raten werden Ihnen entsprechend dem gewählten Ratenplan berechnet" +"Net loan amount: ","Netto-Kreditbetrag: " +" cycles"," Raten" +"Instalment Information"," Information zu den Raten" +"Processed Instalments","Bezahlte Raten" +"Due Instalments","Offene Raten" +"Next Instalment Date","Nächste Rate fällig am" +"Instalment Cycle Amount","Betrag jeder Rate" +"Total paid amount","Bezahlt gesamt" +"Total due amount","Offen gesamt" +"Paid instalments","Bezahlte Raten" +"Instalment Summary","Zusammenfassung" +"Paid Date","Bezahlt am" +"The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below.","Für Ihre Bestellung Nr. %orderNo bei %store_name ist die nächste Rate fällig. Bitte beachten Sie weitere Details unten." +"I hereby grant the mandate for the SEPA direct debit","Ich erteile hiermit das SEPA-Lastschriftmandat" +"(electronic transmission)","(elektronische Übermittlung)" +"and confirm that the given bank details are correct!","und bestätige, dass die Bankverbindung korrekt ist." +"I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG.","Ich ermächtige den Zahlungsempfänger, Zahlungen von meinem Konto mittels Lastschrift einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von dem Zahlungsempfänger auf mein Konto gezogenen Lastschriften einzulösen." +"Creditor identifier: DE53ZZZ00000004253","Gläubiger-Identifikationsnummer: DE53ZZZ00000004253" +"Note:","Hinweis:" +"You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.","Ich kann innerhalb von acht Wochen, beginnend mit dem Belastungsdatum, die Erstattung des belasteten Betrages verlangen. Es gelten dabei die mit meinem Kreditinstitut vereinbarten Bedingungen." +"The instalment amount for this cycle %s %s will be debited from your account in one - three business days.","Die nächste Rate in Höhe von %s %s wird in ein bis drei Werktagen von Ihrem Konto abgebucht." +"The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below.","Für Ihre Bestellung Nr. %orderNo bei %store_name ist die nächste Rate fällig. Bitte beachten Sie weitere Details unten." +"Please enter the refund amount","Geben Sie bitte den erstatteten Betrag ein" +"(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)","(in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1,00 EUR)" +"Refund","Rückerstattung" +" Cycles / "," Raten / " +"Month","Monat" +"Months","Monate" +" Every %s months"," pro %s Monate" +" Every month"," pro Monat" +"Reference","Verwendungszweck" +"Paid","Bezahlt" +"Pending","Ausstehend" +"Cancel","Stornieren" +"Every month","pro Monat" +"Every 2 months"," pro 2 Monate" +"Every 3 months"," pro 3 Monate" +"Every 4 months"," pro 4 Monate" +"Every 6 months"," pro 6 Monate" +"Instalment confirmation %s Order no: %s","Für Ihren Einkauf bei %s, Bestellnr. %s, ist die nächste Rate fällig." +"Authorize","Zahlung autorisieren" +"Capture","Zahlung einziehen" +"Payment Action","Bearbeitungsmaßnahme" +"Products remain in the shopping cart after cancelled payment","Produkte im Warenkorb nach Abbruch des Zahlungsvorgangs wiederherstellen" +"Your Novalnet Merchant details are now updated. Click the","Ihre Novalnet-Händlerdaten sind nun aktualisiert. Klicken Sie auf " +"button to complete the configuration & save all changes!",", um die Konfiguration abzuschließen und alle Änderungen zu speichern." +"Activate"," Aktivieren" +"Instalment number","Ratenzahl" +"Instalment payment date","Datum der Ratenzahlung" +"Monthly instalment amount","Monatlich fällige Rate" +"Instalment","Ratenzahlung" +"Card type not accepted, try using another card type","Kartentyp wird nicht akzeptiert, versuchen Sie es mit einem anderen Kartentyp" +"Allow manual testing of the Notification / Webhook URL","Deaktivieren Sie die IP-Adresskontrolle (nur zu Testzwecken)" +"Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties","Aktivieren Sie diese Option, um die Novalnet-Benachrichtigungs-/Webhook-URL manuell zu testen. Deaktivieren Sie die Option, bevor Sie Ihren Shop liveschalten, um unautorisierte Zugriffe von Dritten zu blockieren" +"Send e-mail to","E-Mails senden an" +"Notification / Webhook URL","Benachrichtigungs- / Webhook-URL" +"Notification / Webhook URL is required to keep the merchant’s database/system synchronized with the Novalnet account (e.g. delivery status). Refer the Installation Guide for more information","Eine Benachrichtigungs- / Webhook-URL ist erforderlich, um die Datenbank / das System des Händlers mit dem Novalnet-Account synchronisiert zu halten (z.B. Lieferstatus). Weitere Informationen finden Sie in der Installationsanleitung" +"Notification / Webhook URL Setup","Benachrichtigungs- / Webhook-URL festlegen" +"Sort order of display. Lowest is displayed first.","Die Zahlungsarten werden in Ihrem Checkout anhand der von Ihnen vorgegebenen Sortierreihenfolge angezeigt (in aufsteigender Reihenfolge)" +"If the payment guarantee is activated (True), but the above mentioned requirements are not met, the payment should be processed as non-guarantee payment.","Falls die Zahlungsgarantie zwar aktiviert ist, jedoch die Voraussetzungen für Zahlungsgarantie nicht erfüllt sind, wird die Zahlung ohne Zahlungsgarantie verarbeitet. Die Voraussetzungen finden Sie in der Installationsanleitung unter 'Zahlungsgarantie aktivieren'" +"Select the various instalment cycles that can be availed in the instalment plan","Wählen Sie die Anzahl der Raten aus." +"one click payment description","Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden" diff --git a/app/locale/de_DE/template/email/novalnet/novalnet_callback_critical_email.html b/app/locale/de_DE/template/email/novalnet/novalnet_callback_critical_email.html new file mode 100755 index 0000000..a835c5b --- /dev/null +++ b/app/locale/de_DE/template/email/novalnet/novalnet_callback_critical_email.html @@ -0,0 +1,115 @@ + + + +
+
+ + + + + + + +
+
+

Regards,
+ {{var regards}}

+
+
+
+ diff --git a/app/locale/de_DE/template/email/novalnet/novalnet_callback_email.html b/app/locale/de_DE/template/email/novalnet/novalnet_callback_email.html new file mode 100755 index 0000000..504a602 --- /dev/null +++ b/app/locale/de_DE/template/email/novalnet/novalnet_callback_email.html @@ -0,0 +1,29 @@ + + + +
+
+ + + Dear Mr./Ms./Mrs. {{var toName}}

+ + This email is sent to you (Recipient E-mail: {{var toEmail}}) by {{var fromName}} from {{var fromEmail}}

+ + Subject: {{var subject}}

+ + Body: {{var body}}
+ +
+
+
+
+ diff --git a/app/locale/de_DE/template/email/novalnet/novalnet_callback_instalment_email.html b/app/locale/de_DE/template/email/novalnet/novalnet_callback_instalment_email.html new file mode 100755 index 0000000..78f05e3 --- /dev/null +++ b/app/locale/de_DE/template/email/novalnet/novalnet_callback_instalment_email.html @@ -0,0 +1,63 @@ + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +
{{var logo_alt}}
+

Dear {{htmlescape var=$order.getCustomerName()}},

+

+ Für Ihre Bestellung Nr. {{var order.increment_id}} bei {{var store.getFrontendName()}} ist die nächste Rate fällig. Bitte beachten Sie weitere Details unten. +

+
+ + + + +
+

Zahlungsart

+ {{var payment_html}} +

{{var sepaPayment}}

+
+
+ {{layout handle="sales_email_order_items" order=$order}} +

Vielen Dank, {{var store.getFrontendName()}}

+
+
+ \ No newline at end of file diff --git a/app/locale/en_US/Novalnet_Payment.csv b/app/locale/en_US/Novalnet_Payment.csv new file mode 100755 index 0000000..70eb16e --- /dev/null +++ b/app/locale/en_US/Novalnet_Payment.csv @@ -0,0 +1,397 @@ +"Product activation key","Product activation key" +"Enter Novalnet Product activation key","Enter Novalnet Product activation key" +"Novalnet Global Configuration","Novalnet Global Configuration" +"Novalnet Merchant ID","Merchant ID" +"Authentication code","Authentication code" +"Project ID","Project ID" +"Select Tariff ID","Select Tariff ID" +"Select Novalnet tariff ID","Select Novalnet tariff ID" +"Subscription Tariff ID","Subscription Tariff ID" +"Select Novalnet subscription tariff ID","Select Novalnet subscription tariff ID" +"Payment access key","Payment access key" +"Minimum transaction amount for authorization","Minimum transaction amount for authorization (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)" +"Manual checking of order description","In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold." +"Manual checking of paypal order description","In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal." +"Novalnet Live Mode","Enable Live Mode" +"Selected payment methods will be in Live Mode","Selected payment methods will be in Live Mode" +"Referrer ID","Referrer ID" +"Referrer id description","Enter the referrer ID of the person/company who recommended you Novalnet" +"Enable auto-fill","Enable auto-fill" +"Autofill description","The payment details will be filled automatically in the payment form during the checkout process" +"Enable default payment method","Enable default payment method" +"Payment last success description","For the registered users the last chosen payment method will be selected by default during the checkout" +"Novalnet Use Proxy","Proxy server" +"Proxy Host","Proxy Host" +"Proxy Port","Proxy Port" +"Onhold order status","Onhold order status" +"paypal onclick description","Payment details stored during the checkout process can be used for future payments.
In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal." +"payment_action_description","Choose whether or not the payment should be charged immediately. Capture completes the transaction by transferring the funds from buyer account to merchant account. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order." +"one click payment description","Payment details stored during the checkout process can be used for future payments" +"Status to be used for successful orders","Status to be used for successful orders" +"OnHold cancellation / VOID Transaction status","Cancellation order status" +"Gateway timeout","Gateway timeout (in seconds)" +"Gateway timeout description","In case the order processing time exceeds the gateway timeout, the order will not be placed" +"Display payment method logo","Display payment method logo" +"The payment method logo will be displayed on the checkout page","The payment method logo will be displayed on the checkout page" +"Merchant script management","Merchant script management" +"Deactivate IP address control description","This option will allow performing a manual execution. Please disable this option before setting your shop to LIVE mode, to avoid unauthorized calls from external parties (excl. Novalnet)." +"Test mode description","The payment will be processed in the test mode therefore amount for this transaction will not be charged" +"Callback order status","Callback / Webhook order status" +"Enable E-mail notification for callback","Enable E-mail notification for callback" +"Email To address description","E-Mail address of the recipient" +"E-mail Bcc Address","E-mail address (Bcc)" +"Email Bcc address description","E-Mail address of the recipient for BCC" +"Vendor script url","Notification URL" +"One click shopping","One-click shopping" +"Novalnet Credit Card","Credit/Debit Cards" +"Novalnet Direct Debit SEPA","Direct Debit SEPA" +"Novalnet Invoice","Invoice" +"Novalnet Prepayment","Prepayment" +"Novalnet Instant Bank Transfer","Sofort" +"Novalnet PayPal","PayPal" +"Novalnet iDEAL","iDEAL" +"Novalnet Eps","eps" +"Novalnet Giropay","giropay" +"Novalnet Przelewy24","Przelewy24" +"Novalnet Instalment by Direct Debit SEPA","Instalment by Direct Debit SEPA" +"Novalnet Instalment by Invoice","Instalment by Invoice" +"Enable module","Display payment method" +"Novalnet Title","Novalnet Title *" +"Payment logo","Payment logo" +"Banktransfer payment description","You will be redirected to Sofort. Please don’t close or refresh the browser until the payment is completed" +"Ideal payment description","You will be redirected to iDEAL. Please don’t close or refresh the browser until the payment is completed" +"Eps payment description","You will be redirected to eps. Please don’t close or refresh the browser until the payment is completed" +"Giropay payment description","You will be redirected to giropay. Please don’t close or refresh the browser until the payment is completed" +"Paypal payment description","You will be redirected to PayPal. Please don’t close or refresh the browser until the payment is completed" +"Przelewy payment description","You will be redirected to Przelewy24. Please don’t close or refresh the browser until the payment is completed" +"Browse logo to be displayed with the payment name","The payment method logo(s) will be displayed on the checkout page" +"Enable 3D secure","Enable 3D secure" +"CC-3D secure description","The 3D-Secure will be activated for credit cards. The issuing bank prompts the buyer for a password what, in turn, help to prevent a fraudulent payment. It can be used by the issuing bank as evidence that the buyer is indeed their card holder. This is intended to help decrease a risk of charge-back." +"Force 3D secure on predefined conditions","Force 3D secure on predefined conditions" +"Force 3D secure on predefined conditions description","If 3D secure is not enabled in the above field, then force 3D secure process as per the "Enforced 3D secure (as per predefined filters & settings)" module configuration at the Novalnet Merchant Administration portal. If the predefined filters & settings from Enforced 3D secure module are met, then the transaction will be processed as 3D secure transaction otherwise it will be processed as non 3D secure.

Please note that the "Enforced 3D secure (as per predefined filters & settings)" module should be configured at Novalnet Merchant Administration portal prior to the activation here.

For further information, please refer the description of this fraud module at "Fraud Modules" tab, below "Projects" menu, under the selected project in Novalnet Merchant Administration portal or contact Novalnet support team." +"Enforce 3D secure payment outside EU","Enforce 3D secure payment outside EU" +"By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA.","By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA." +"Order completion status","Completed order status" +"Order status for the pending payment","Payment status for the pending payment" +"The order has been updated.","The order has been updated." +"Novalnet Credit Card Types","Credit Card type" +"Notification for the buyer","Notification for the buyer" +"The entered text will be displayed on the checkout page","The entered text will be displayed on the checkout page" +"User Group Excluded","User Group Excluded" +"Payment from applicable countries","Payment from applicable countries" +"Payment from Specific countries","Payment from Specific countries" +"Novalnet Minimum Order Total","Minimum Order Total (in Euro)" +"Novalnet Maximum Order Total","Maximum Order Total (in Euro)" +"Novalnet Minimum Orders Count","Minimum Orders Count" +"Novalnet Minimum Orders Count Desc","Default: ""0"" for disabled check | Minimum count of orders (in the past) needed for the customer to use this payment method" +"Novalnet Sort Order","Define a sorting order" +"SEPA Payment duration in days","Payment due date (in days)" +"SEPA Payment duration in days description","Number of days after which the payment is debited (must be between 2 and 14 days)." +"Enable auto-fill for payment data","Enable auto-fill for payment data" +"Enable auto-fill for payment data description","For the registered users SEPA direct debit details will be filled automatically in the payment form" +"Invoice payment duration","Payment due date (in days)" +"Prepayment payment duration","Payment due date (in days)" +"Prepayment payment duration description","Number of days given to the buyer to transfer the amount to Novalnet (must be between 7 and 28 days). If this field is left blank, 14 days will be set as due date by default." +"Invoice payment duration description","Number of days given to the buyer to transfer the amount to Novalnet (must be greater than 7 days). If this field is left blank, 14 days will be set as due date by default." +"Enable the payment Method and activate the Risk and Control option","Enable the payment Method and activate the Risk and Control option" +"Orders","Orders" +"Novalnet Transactions","Novalnet Transactions" +"Novalnet Transactions Overview","Novalnet Transactions Overview" +"Configuration","Configuration" +"General","General" +"Payment Methods","Payment Methods" +"Risk and Control","Risk and Control" +"Information","Information" +"Novalnet Merchant Admin","Novalnet Merchant Admin" +"Novalnet Magento Module","Novalnet Magento Module" +"None","None" +"PIN by callback","PIN by callback" +"PIN by SMS","PIN by SMS" +"Novalnet Capture","Novalnet Capture" +"IBAN","IBAN" +"BIC","BIC" +"Novalnet Recurring Profiles","Novalnet Recurring Profiles" +"Customer was redirected to Novalnet","Customer was redirected to Novalnet" +"checkHash failed","While redirecting some data has been changed. The hash check failed." +"Customer successfully returned from Novalnet","Customer successfully returned from Novalnet" +"Are you sure you want to do this?","Are you sure you want to do this?" +"Cancel","Cancel" +"Continue","Continue" +"You will be redirected to Novalnet AG in a few seconds.","You will be redirected to Novalnet AG in a few seconds." +"Transactions","Transactions" +"Novalnet - Transaction Log","Novalnet Transactions Log" +"Transactions Log","Transactions Log" +"Novalnet - Transaction Overview","Novalnet Transactions Overview" +"Transaction Overview","Transactions Overview" +"Transaction ID","Transaction ID" +"Transaction Status","Transaction Status" +"NC No","NC No" +"Customer ID","Customer ID" +"Transaction Overview","Transaction Overview" +"Day","Day" +"Month","Month" +"Year","Year" +"Please select reason","Please select reason" +"Product is costly","Product is costly" +"Cheating","Cheating" +"Partner interfered","Partner interfered" +"Financial problem","Financial problem" +"Content does not match my likes","Content does not match my likes" +"Content is not enough","Content is not enough" +"Interested only for a trial","Interested only for a trial" +"Page is very slow","Page is very slow" +"Satisfied customer","Satisfied customer" +"Logging in problems","Logging in problems" +"Other reasons","Other" +"Please select the reason of subscription cancellation","Please select the reason of subscription cancellation" +"Your account details are invalid","Your account details are invalid" +"No active payment method for this store","No active payment method for this store" +"Trial Billing Cycles are not support Novalnet payment","Trial Billing Cycles are not support Novalnet payment" +"Required parameter not valid","Required parameter not valid" +"Payment was successful","Payment was successful" +"Payment was not successfull","Payment was not successful. An error occurred." +"Payment Failed","Payment Failed" +"Gateway request error: %s","Gateway request error: %s" +"Basic parameter not valid","Please fill in all the mandatory fields" +"Order-ID","Order-ID" +"Transaction-ID","Transaction-ID" +"Customer-ID","Customer-ID" +"Payment Name","Payment method" +"Novalnet Shop Information","Novalnet Shop Information" +"Shop URL","Shop URL" +"Novalnet Additional Information","Novalnet Additional Information" +"Novalnet Request Data","Novalnet Request Data" +"Request Data","Request Data" +"Novalnet Response Data","Novalnet Response Data" +"Response Data","Response Data" +"Novalnet Order Information","Novalnet Order Information" +"Successful","Successful" +"Transaction-Status","Transaction-Status" +"Testorder","Test order" +"TID: %s","Novalnet transaction ID: %s" +"Novalnet Transaction ID: %s","Novalnet transaction ID: %s" +"Next Payment Date is: %s","Next charging date: %s" +"The transaction has been canceled on %s","The transaction has been canceled on %s" +"The transaction has been confirmed on %s","The transaction has been confirmed on %s" +"Subscription Cancellation: %s","Subscription has been canceled due to: %s" +"Please transfer the invoice amount with the following information to our payment provider Novalnet AG","Please transfer the amount to the below mentioned account details of our payment processor Novalnet" +"Please transfer the amount of %s to the following account on or before %s","Please transfer the amount of %s to the following account on or before %s" +"Please transfer the amount of %s to the following account","Please transfer the amount of %s to the following account" +"Due Date","Due date" +"NN Account Holder","Account holder" +"NN_Bank","Bank" +"NN_Amount","Amount" +"Order No","Order number" +"Please Note: This transaction will run on TEST MODE and the amount will not be charged","The payment will be processed in the test mode therefore amount for this transaction will not be charged" +"redirect payment description","After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment" +"The amount will be debited from your account by Novalnet","The amount will be debited from your account by Novalnet" +"Invoice/Prepayment payment description","You will receive an e-mail with the Novalnet account details to complete the payment." +"Cashpayment payment description","On successful checkout, you will receive a payment slip/SMS to pay your online purchase at one of our retail partners (e.g. supermarket)." +"The amount will be debited from your credit/debit card","The amount will be debited from your credit/debit card" +"NN CC type","Type of card" +"Account Holder","Account holder" +"NN Country","Bank country" +"IBAN or Account number","IBAN or Account number" +"BIC or Bank code","BIC or Bank code" +"NN Confirm","I hereby grant the SEPA direct debit mandate and confirm that the given IBAN and BIC are correct" +"SEPA Due date is not valid","SEPA Due date is not valid" +"Mobile phone number","Mobile number" +"NN Mobile Number","Telephone number" +"Note for pin by sms and callback","After clicking the ""Continue"" button, you will shortly receive a PIN by phone / SMS. Please enter the PIN in the appropriate text box" +"You will shortly receive a transaction PIN","You will shortly receive a transaction PIN through phone call to complete the payment" +"PIN","Transaction PIN" +"Forgot PIN? [New PIN Request]","Forgot your PIN?" +"The order amount has been changed","The order amount has been changed, please proceed with the new order" +"You will shortly receive an SMS","You will shortly receive an SMS containing your transaction PIN to complete the payment" +"The PIN you entered is incorrect","The PIN you entered is incorrect" +"Please enter your telephone number","Please enter your telephone number" +"Please enter your mobile number","Please enter your mobile number" +"Your E-mail address is invalid","Your E-mail address is invalid" +"Customer name/email fields are not valid","Customer name/email fields are not valid" +"Refund reference","Refund reference" +"Period for subsequent subscription cycle","Period for subsequent subscription cycle" +"The period of the subsequent subscription cycle (E.g: 1d/1m/1y)","The period of the subsequent subscription cycle (E.g: 1d/1m/1y)" +"Enter your PIN","Enter your PIN" +"NN_Reference","Payment Reference" +"NN_Reference1","Payment Reference 1" +"NN_Reference2","Payment Reference 2" +"NN_Reference3","Payment Reference 3" +"payment reference one","Payment Reference 1 (Novalnet Invoice Reference)" +"payment reference two","Payment Reference 2 (TID)" +"payment reference three","Payment Reference 3 (Order No)" +"NN_Reference_desc1","Please use any of the following payment references when transferring the amount. This is necessary to match it with your corresponding order." +"NN_Reference_desc2","Please use any of the following payment references when transferring the amount. This is necessary to match it with your corresponding order." +"Please select atleast one payment reference.","Please select atleast one payment reference." +"Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s","Refund has been initiated for the TID: %s with the amount %s. New TID: %s for the refunded amount %s." +"Refund has been initiated for the TID: %s with the amount of %s","Refund has been initiated for the TID: %s with the amount of %s." +"Please don’t close the browser after successful payment","Please don’t close the browser after successful payment, until you have been redirected back to the Shop" +"Add new card details for later purchases","Add new card details for later purchases" +"Given card details","Given card details" +"Enter account details","Enter new account details" +"Given account details","Given account details" +"I want to save my card details for later purchases","I want to save my card details for later purchases" +"Save my PayPal account details for later purchases","Save my PayPal account details for later purchases" +"I want to save my account details for later purchases","I want to save my account details for later purchases" +"Notify Novalnet updates","Notify Novalnet updates" +"Notify, if any, updates available in Novalnet payment module","Notify, if any, updates available in Novalnet payment module" +"Send an e-mail using zend/magento template","Send an e-mail using zend/magento template" +"Novalnet merchant script log","Novalnet vendor script log" +"If yes, the merchant script log will be created","If yes, the vendor script log will be created" +"Are you sure you want to capture the payment?","Are you sure you want to capture the payment?" +"Order Status Management","Order status management for on-hold transaction(-s)" +"One click shopping","One-click shopping" +"NN None","None" +"Date Of Birth","Your date of birth" +"You need to be at least 18 years old","You need to be at least 18 years old" +"Novalnet callback received. Refund/Bookback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s","Novalnet callback received. Refund/Bookback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s" +"Novalnet callback received. Chargeback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s","Novalnet callback received. Chargeback executed successfully for the TID: %s amount: %s on %s. The subsequent TID: %s" +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s","Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s. Please refer PAID transaction in our Novalnet Merchant Administration with the TID: %s." +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s","Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s" +"Novalnet callback script received. Subscription has been stopped for the TID: %s on %s","Novalnet callback script received. Subscription has been stopped for the TID: %s on %s" +"Subscription has been canceled due to: ","Subscription has been canceled due to: " +"Reference order id: %s","Reference order id: %s" +"Novalnet Callback Script executed successfully for the subscription TID: %s with amount %s on %s","Novalnet Callback Script executed successfully for the subscription TID: %s with amount %s on %s." +"Novalnet Callback Script executed successfully on %s","Novalnet Callback Script executed successfully on %s" +"Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s","Novalnet Callback Script executed successfully for the TID: %s with amount %s on %s" +"Payment guarantee configuration","Payment guarantee configuration" +"Payment guarantee comments","Basic requirements for payment guarantee
Allowed B2C countries: DE, AT, CH
Allowed B2B countries: European Union
Allowed currency: EUR
Minimum order amount: 9.99 EUR or more
Age limit: 18 years or more
The billing address must be the same as the shipping address

" +"Payment instalment comments","Basic requirements for the instalment payment
Allowed B2C countries: DE, AT, CH
Allowed B2B countries: European Union
Allowed currency: EUR
Minimum order amount: 19.98 EUR or more
Please note that the instalment cycle amount has to be a minimum of 9.99 EUR and the instalment cycles which do not meet this criteria will not be displayed in the instalment plan
Age limit: 18 years or more
The billing address must be the same as the shipping address

" +"Enable payment guarantee","Enable payment guarantee" +"Novalnet Minimum order amount","Minimum order amount (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)" +"This setting will override the default setting made in the minimum order amount. Note: Minimum amount should be greater than or equal to 9,99 EUR","This setting will override the default setting made in the minimum order amount. Note: Minimum amount should be greater than or equal to 9.99 EUR" +"Force Non-Guarantee payment","Force Non-Guarantee payment" +"The minimum amount should be at least 9,99 EUR","The minimum amount should be at least 9.99 EUR" +"Form appearance","Form appearance" +"Custom CSS Settings","Custom CSS settings" +"CSS settings for Credit Card fields","CSS settings for Credit Card fields" +"Form fields","Form fields" +"NN Label","Label" +"Input field","Input field" +"CSS settings for Credit Card iframe","CSS settings for Credit Card iframe" +"NN Input","Input" +"CSS text","CSS Text" +"Proceed with new PayPal account details","Proceed with new PayPal account details" +"Given PayPal account details","Given PayPal account details" +"PayPal transaction ID: %s","PayPal transaction ID: %s" +"In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal.","In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal." +"Once the order is submitted, the payment will be processed as a reference transaction at Novalnet","Once the order is submitted, the payment will be processed as a reference transaction at Novalnet" +"The payment cannot be processed, because the basic requirements haven’t been met.","The payment cannot be processed, because the basic requirements haven’t been met." +"The transaction has been canceled due to: %s","The transaction has been canceled due to: %s" +"The amount of %s for the order %s has been paid. Please verify received amount and TID details, and update the order status accordingly.","The amount of %s for the order %s has been paid. Please verify received amount and TID details, and update the order status accordingly." +"Your credit card details are invalid","Your credit card details are invalid" +"Card holder name","Card holder name" +"Name on card","Name on card" +"Card number","Card number" +"XXXX XXXX XXXX XXXX","XXXX XXXX XXXX XXXX" +"Expiry date","Expiry date" +"MM / YYYY","MM / YYYY" +"CVC/CVV/CID","CVC/CVV/CID" +"XXX","XXX" +"what is this?","what is this?" +"This is processed as a guarantee payment","This is processed as a guarantee payment" +"Change the due date","Change the due date" +"Transaction due date","Transaction due date" +"Change the slip expiry date","Change the slip expiry date" +"Slip expiry date","Slip expiry date" +"Are you sure you want to change the due date?","Are you sure you want to change the due date?" +"Are you sure you want to change the slip expiry date?","Are you sure you want to change the slip expiry date?" +"The transaction has been updated with a new due date %s","The transaction has been updated with a new due date %s" +"The transaction has been updated with slip expiry date %s","The transaction has been updated with slip expiry date %s" +"The date should be in future","The date should be in future" +"Barzahlen","Barzahlen/viacash" +"Slip expiry date (in days)","Payment due date (in days)" +"Cashpayment duration description","Number of days given to the buyer to pay at a store. If this field is left blank, 14 days will be set as slip expiry date by default." +"Slip expiry date: %s","Slip expiry date: %s" +"Store(s) near you:","Store(s) near you:" +"Pay now with Barzahlen","Pay now with Barzahlen" +"DD/MM/YYYY","DD/MM/YYYY" +"SEPA Due date is not valid","SEPA Due date is not valid" +"Please enter valid birthdate","Please enter valid birthdate" +"The transaction has been confirmed successfully for the TID: %s and the due date updated as %s","The transaction has been confirmed successfully for the TID: %s and the due date updated as %s" +"Novalnet callback received. The transaction has been confirmed successfully for the TID: %s and the due date updated as %s","Novalnet callback received. The transaction has been confirmed successfully for the TID: %s and the due date updated as %s" +"Enter the Novalnet Product activation key that is required for authentication and click Activate. You will find the Product activation key in the Novalnet Admin Portal: PROJECT > Choose your project > Shop Parameters > API Signature (Product activation key).","Enter the Novalnet Product activation key that is required for authentication and click Activate. You will find the Product activation key in the Novalnet Admin Portal: PROJECT > Choose your project > Shop Parameters > API Signature (Product activation key)." +"The transaction has been updated with slip expiry date %s","The transaction has been updated with slip expiry date %s" +"Novalnet callback received. The transaction has been confirmed on %s","Novalnet callback received. The transaction has been confirmed on %s" +"Novalnet callback received. The transaction has been canceled on %s","Novalnet callback received. The transaction has been canceled on %s" +"Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.","Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours." +"Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.","Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours." +"Novalnet callback received. The transaction has been canceled on %s","Novalnet callback received. The transaction has been canceled on %s" +"Novalnet callback received. The transaction status has been changed from pending to on hold for the TID: %s on %s.","Novalnet callback received. The transaction status has been changed from pending to on hold for the TID: %s on %s." +"Novalnet callback script received. Subscription has been reactivated for the TID: %s on %s.","Novalnet callback script received. Subscription has been reactivated for the TID: %s on %s." +"Novalnet callback script received. Subscription payment has been changed from %s to %s on %s.","Novalnet callback script received. Subscription payment has been changed from %s to %s on %s." +"Minimum amount should be greater than or equal to 9,99 EUR","Minimum amount should be greater than or equal to 9.99 EUR" +"payment guarantee","payment guarantee" +"instalment payment","instalment payment" +"Only DE, CH countries allowed %s","The payment cannot be processed, because the basic requirements for the %s haven't been met (Only Germany, Austria or Switzerland are allowed)" +"Minimum order amount should be %s %s","The payment cannot be processed, because the basic requirements for the %s haven't been met (Minimum order amount must be %s)" +"Only EUR currency allowed %s","The payment cannot be processed, because the basic requirements for the %s haven't been met (Only EUR currency allowed)" +"The shipping address should be the same as the billing address %s","The payment cannot be processed, because the basic requirements for the %s haven't been met (The shipping address must be the same as the billing address)" +"Instalment by Invoice","Instalment by Invoice" +"Instalment by Direct Debit SEPA","Instalment by Direct Debit SEPA" +"Recurring Period for the instalment cycles","Recurring Period for the instalment cycles" +"On choosing an appropriate recurring period, each instalment cycle will be processed based on that","On choosing an appropriate recurring period, each instalment cycle will be processed based on that" +"Instalment cycles","Instalment cycles" +"Choose your instalment plan","Choose your instalment plan" +"Choose the financing option that best fits your needs and you will be charged based on that chosen plan","Choose the financing option that best fits your needs and you will be charged based on that chosen plan" +"Net loan amount: ","Net loan amount: " +" cycles"," cycles" +"Instalment Information","Instalment Information" +"Processed Instalments","Processed Instalments" +"Due Instalments","Due Instalments" +"Next Instalment Date","Next Instalment Date" +"Instalment Cycle Amount","Instalment Cycle Amount" +"Total paid amount","Total paid amount" +"Total due amount","Total due amount" +"Paid instalments","Paid instalments" +"Instalment Summary","Instalment Summary" +"Paid Date","Paid date" +"The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below.","The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below." +"I hereby grant the mandate for the SEPA direct debit","I hereby grant the mandate for the SEPA direct debit" +"(electronic transmission)","(electronic transmission)" +"and confirm that the given bank details are correct!","and confirm that the given bank details are correct!" +"I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG.","I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG." +"Creditor identifier: DE53ZZZ00000004253","Creditor identifier: DE53ZZZ00000004253" +"Note:","Note:" +"You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.","You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited." +"The instalment amount for this cycle %s %s will be debited from your account in one - three business days.","The instalment amount for this cycle %s %s will be debited from your account in one - three business days." +"The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below.","The next instalment cycle have arrived for the instalment order %orderNo placed at the %store_name, kindly refer further details below." +"Please enter the refund amount","Please enter the refund amount" +"(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)","(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)" +"Refund","Refund" +" Cycles / "," Cycles / " +"month","month" +"months","months" +" Every month"," per month" +" Every %s months"," per %s months" +"Reference","Reference" +"Paid","Paid" +"Pending","Pending" +"Cancel","Cancel" +"Every month","per month" +"Every 2 months"," per 2 months" +"Every 3 months"," per 3 months" +"Every 4 months"," per 4 months" +"Every 6 months"," per 6 months" +"Instalment confirmation %s Order no: %s","Instalment confirmation %s Order no: %s" +"Products remain in the shopping cart after cancelled payment","Products remain in the shopping cart after cancelled payment" +"Authorize","Authorize" +"Capture","Capture" +"Payment Action","Payment Action" +"Products remain in the shopping cart after cancelled payment","Products remain in the shopping cart after cancelled payment" +"Your Novalnet Merchant details are now updated. Click the","Your Novalnet Merchant details are now updated. Click the " +"button to complete the configuration & save all changes!"," button to complete the configuration & save all changes!" +"Activate","Activate" +"Instalment number","Instalment number" +"Instalment payment date","Instalment payment date" +"Monthly instalment amount","Monthly instalment amount" +"Instalment","Instalment" +"Card type not accepted, try using another card type","Card type not accepted, try using another card type" +"Allow manual testing of the Notification / Webhook URL","Allow manual testing of the Notification / Webhook URL" +"Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties","Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties" +"Send e-mail to","Send e-mail to" +"Notification / Webhook URL","Notification / Webhook URL" +"Notification / Webhook URL is required to keep the merchant’s database/system synchronized with the Novalnet account (e.g. delivery status). Refer the Installation Guide for more information","Notification / Webhook URL is required to keep the merchant’s database/system synchronized with the Novalnet account (e.g. delivery status). Refer the Installation Guide for more information" +"Notification / Webhook URL Setup","Notification / Webhook URL Setup" +"Sort order of display. Lowest is displayed first.","The payment methods will be listed in your checkout (in ascending order) based on your given sorting order." +"If the payment guarantee is activated (True), but the above mentioned requirements are not met, the payment should be processed as non-guarantee payment.","Even if payment guarantee is enabled, payments will still be processed as non-guarantee payments if the payment guarantee requirements are not met. Review the requirements under 'Enable Payment Guarantee' in the Installation Guide." +"Select the various instalment cycles that can be availed in the instalment plan","Select the available instalment cycles." diff --git a/app/locale/en_US/template/email/novalnet/novalnet_callback_critical_email.html b/app/locale/en_US/template/email/novalnet/novalnet_callback_critical_email.html new file mode 100755 index 0000000..a835c5b --- /dev/null +++ b/app/locale/en_US/template/email/novalnet/novalnet_callback_critical_email.html @@ -0,0 +1,115 @@ + + + +
+
+ + + + + + + +
+
+

Regards,
+ {{var regards}}

+
+
+
+ diff --git a/app/locale/en_US/template/email/novalnet/novalnet_callback_email.html b/app/locale/en_US/template/email/novalnet/novalnet_callback_email.html new file mode 100755 index 0000000..504a602 --- /dev/null +++ b/app/locale/en_US/template/email/novalnet/novalnet_callback_email.html @@ -0,0 +1,29 @@ + + + +
+
+ + + Dear Mr./Ms./Mrs. {{var toName}}

+ + This email is sent to you (Recipient E-mail: {{var toEmail}}) by {{var fromName}} from {{var fromEmail}}

+ + Subject: {{var subject}}

+ + Body: {{var body}}
+ +
+
+
+
+ diff --git a/app/locale/en_US/template/email/novalnet/novalnet_callback_instalment_email.html b/app/locale/en_US/template/email/novalnet/novalnet_callback_instalment_email.html new file mode 100755 index 0000000..bd114d1 --- /dev/null +++ b/app/locale/en_US/template/email/novalnet/novalnet_callback_instalment_email.html @@ -0,0 +1,63 @@ + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +
{{var logo_alt}}
+

Dear {{htmlescape var=$order.getCustomerName()}},

+

+ The next instalment cycle have arrived for the instalment order {{var order.increment_id}} placed at the {{var store.getFrontendName()}}, kindly refer further details below. +

+
+ + + + +
+

Payment Method

+ {{var payment_html}} +

{{var sepaPayment}}

+
+
+ {{layout handle="sales_email_order_items" order=$order}} +

Thank you, {{var store.getFrontendName()}}

+
+
+ \ No newline at end of file diff --git a/js/novalnet/cc.js b/js/novalnet/cc.js new file mode 100755 index 0000000..32a3d67 --- /dev/null +++ b/js/novalnet/cc.js @@ -0,0 +1,253 @@ +/** + * Novalnet payment extension + * + * NOTICE OF LICENSE + * + * This source file is subject to the Novalnet End User License Agreement + * that is bundled with this package in the file freeware_license_agreement.txt + * + * DISCLAIMER + * + * If you wish to customize Novalnet payment extension for your needs, please contact technic@novalnet.de for more information. + * + * @category Novalnet + * @package Novalnet_Payment + * @copyright Copyright (c) Novalnet AG + * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz + */ +var $nncc_j = jQuery.noConflict(); +var nnButton, nnIfrmButton, iframeWindow, targetOrigin, onestepcheckout; +nnButton = nnIfrmButton = iframeWindow = targetOrigin = onestepcheckout = false; + +function initIframe() +{ + var reqObj = JSON.parse($nncc_j('#nn_cc_req_obj').val()), + clientKey = $nncc_j('#nn_client_key').val(); + if (clientKey == null || clientKey == undefined || clientKey == '') { + return; + } + NovalnetUtility.setClientKey(clientKey); + var request = { + callback: { + on_success: function (result) { + if (result) { + var isadmin = $nncc_j('#nn_is_admin').val(); + if (isadmin && isadmin == 1 && result['do_redirect'] == 1) { + alert('Card type not accepted, try using another card type'); + $nncc_j('button[onclick*="getHash()"]').attr('disabled',false); + } else { + $nncc_j('button[onclick*="getHash()"]').attr('disabled',false); + if($nncc_j('#nn_cc_save_card').val() == 1) { + $nncc_j('#nn_pan_hash').val(result['hash']); + $nncc_j('#nn_cc_uniqueid').val(result['unique_id']); + $nncc_j('#form-change-payment-creditcard')[0].submit(); + } else { + $nncc_j('#nn_pan_hash').val(result['hash']); + $nncc_j('#nn_cc_uniqueid').val(result['unique_id']); + $nncc_j('#nn_cc_do_redirect').val(result['do_redirect']); + if (onestepcheckout == true) { + $nncc_j.each( + $nncc_j('#onestepcheckout-place-order'), function (i, j) { + $nncc_j(j).click(); + } + ); + } + + eval($nncc_j('#nn_chk_button').val()); + } + } + } + }, + on_error: function (result) { + $nncc_j('button[onclick*="getHash()"]').attr('disabled',false); + alert(result['error_message']); + }, + on_show_overlay: function () { + $nncc_j('#novalnet_iframe').addClass("novalnet-challenge-window-overlay"); + }, + on_hide_overlay: function () { + $nncc_j('#novalnet_iframe').removeClass("novalnet-challenge-window-overlay"); + }, + on_show_captcha: function (result) { + $nncc_j('#' + this.getCode() + '_gethash').val(0); + }, + }, + iframe: { + id: "novalnet_iframe", + inline: $nncc_j('#nn_cc_layout').val(), + style: { + container: $nncc_j('#nn_cc_standard_style_css').val(), + input: $nncc_j('#nn_cc_standard_style_input').val(), + label: $nncc_j('#nn_cc_standard_style_label').val(), + }, + text: { + cardHolder : { + label: $nncc_j('#nn_cc_holder_label').val(), + input: $nncc_j('#nn_cc_holder_field').val(), + }, + cardNumber : { + label: $nncc_j('#nn_cc_number_label').val(), + input: $nncc_j('#nn_cc_number_field').val() + }, + expiryDate : { + label: $nncc_j('#nn_cc_date_label').val(), + input: $nncc_j('#nn_cc_date_field').val() + }, + cvc : { + label: $nncc_j('#nn_cc_cvc_label').val(), + input: $nncc_j('#nn_cc_cvc_field').val() + }, + cvcHint : $nncc_j('#nn_cc_cvc_hint').val(), + error : $nncc_j('#nn_cc_validate_text').val() + } + }, + customer: reqObj.customer, + transaction: reqObj.transaction + }; + // Create the Credit Card form + NovalnetUtility.createCreditCardForm(request); + + if ($nncc_j('#opc-payment').attr('class') == 'section allow active') { + setButtonAttr(); + } else if ($nncc_j('#opc-payment').length == 0) { + setButtonAttr(); + } +} + +function setButtonAttr() +{ + if ($nncc_j('#cc_enter_data').val() == 1) { + if ($nncc_j('#firecheckout-form button[onclick*="checkout.save()"]')[0]) { + nnButton = $nncc_j('#firecheckout-form button[onclick*="checkout.save()"]'); + } else if ($nncc_j('#onestepcheckout-form')[0]) { + nnButton = $nncc_j('#onestepcheckout-form button[onclick*="review.save()"]'); + } else if ($nncc_j('#edit_form')[0]) { + nnButton = $nncc_j('button[onclick*="order.submit()"]'); + } else { + nnButton = $nncc_j('button[onclick*="payment.save()"]'); + } + + if (nnButton !== undefined) { + $nncc_j.each( + nnButton, function (i, j) { + nnButtonContent = $nncc_j(j).attr('onclick'); + $nncc_j('#nn_chk_button').val(nnButtonContent); + j.removeAttribute('onclick'); + j.stopObserving('click'); + $nncc_j(j).attr('onclick', 'getHash()'); + } + ); + } + } +} + +function getHash() +{ + if ($nncc_j('input[name="payment[method]"]:checked').val() === 'novalnetCc' + && $nncc_j('#cc_enter_data').val() == 1) { + if ($nncc_j('#nn_pan_hash').val().trim() == '') { + $nncc_j('button[onclick*="getHash()"]').attr('disabled',true); + NovalnetUtility.getPanHash(); + } + } else { + eval($nncc_j('#nn_chk_button').val()); + } +} + +function reSize() +{ + if ($nncc_j('#novalnet_iframe').length > 0) { + clientKey = $nncc_j('#nn_client_key').val(); + if (clientKey == null || clientKey == undefined || clientKey == '') { + return; + } + NovalnetUtility.setClientKey(clientKey); + NovalnetUtility.setCreditCardFormHeight(); + } +} + +function formChange(type) +{ + if (type == 'given') { + $nncc_j('#cc_enter_data').val(0); + $nncc_j('#cc_oneclick_new, #cc_title_given').css('display', 'none'); + $nncc_j('#cc_oneclick_given, #cc_title_new').css('display', 'block'); + } else if (type == 'new') { + $nncc_j('#cc_enter_data').val(1); + $nncc_j('#cc_oneclick_new, #cc_title_given').css('display', 'block'); + $nncc_j('#cc_oneclick_given, #cc_title_new').css('display', 'none'); + } + + setButtonAttr(); +} + +function ccOneClickShopping() +{ + if ($nncc_j('#cc_oneclick_shopping').val() == undefined) { + return false; + } else if ($nncc_j('#cc_oneclick_shopping').val() == 1) { + $nncc_j('#cc_enter_data').val(0); + $nncc_j('#cc_oneclick_link, #cc_title_new, #cc_oneclick_given').css('display', 'block'); + $nncc_j('#cc_oneclick_new, #cc_title_given').css('display', 'none'); + } else { + $nncc_j('#cc_oneclick_link, #cc_oneclick_given').css('display', 'none'); + } +} + +$nncc_j(document).ready( + function () { + ccOneClickShopping(); + $nncc_j('#onestepcheckout-place-order').on( + 'click', function (e) { + if ($nncc_j('input[name="payment[method]"]:checked').val() === 'novalnetCc' + && $nncc_j('#cc_enter_data').val() == 1 + && $nncc_j('#nn_pan_hash').val().trim() == '') { + e.stopImmediatePropagation(); + onestepcheckout = true; + NovalnetUtility.getPanHash(); + } + } + ); + + Ajax.Responders.register( + {onComplete: function () { + ccOneClickShopping(); + }} + ); + + $nncc_j(document).on( + 'click', '#co-payment-form input[type="radio"]', function (event) { + if (this.value == "novalnetCc") { + $nncc_j(this).addClass('active'); + reSize(); + ccOneClickShopping(); + } + } + ); + + $nncc_j('#opc-payment .step-title').click( + function () { + $nncc_j('#nn_pan_hash').val(''); + } + ); + + $nncc_j('#opc-billing .step-title, #opc-shipping .step-title, #opc-shipping_method .step-title').click( + function () { + if ($nncc_j('#nn_chk_button').val() != '') { + $nncc_j('#nn_pan_hash').val(''); + $nncc_j.each( + nnButton, function (i, j) { + $nncc_j(j).attr('onclick', $nncc_j('#nn_chk_button').val()); + } + ); + } + } + ); + + $nncc_j(window).resize( + function () { + reSize(); + } + ); + } +); diff --git a/js/novalnet/info.js b/js/novalnet/info.js new file mode 100755 index 0000000..920f569 --- /dev/null +++ b/js/novalnet/info.js @@ -0,0 +1,23 @@ +/** + * Novalnet payment extension + * + * NOTICE OF LICENSE + * + * This source file is subject to the Novalnet End User License Agreement + * that is bundled with this package in the file freeware_license_agreement.txt + * + * DISCLAIMER + * + * If you wish to customize Novalnet payment extension for your needs, please contact technic@novalnet.de for more information. + * + * @category Novalnet + * @package Novalnet_Payment + * @copyright Copyright (c) Novalnet AG + * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz + */ +var $nnInfo_j = jQuery.noConflict(); +$nnInfo_j(document).ready( + function () { + $nnInfo_j('a[href*="novalnetpayment_information_merchantadmin/"], a[href*="novalnetpayment_information_module/"]').attr('target', '_blank'); + } +); diff --git a/js/novalnet/jquery-1.11.3.min.js b/js/novalnet/jquery-1.11.3.min.js new file mode 100755 index 0000000..5734783 --- /dev/null +++ b/js/novalnet/jquery-1.11.3.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a, b){"object" == typeof module && "object" == typeof module.exports?module.exports = a.document?b(a, !0):function(a){if (!a.document)throw new Error("jQuery requires a window with a document"); return b(a)}:b(a)}("undefined" != typeof window?window:this, function(a, b){var c = [], d = c.slice, e = c.concat, f = c.push, g = c.indexOf, h = {}, i = h.toString, j = h.hasOwnProperty, k = {}, l = "1.11.3", m = function(a, b){return new m.fn.init(a, b)}, n = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, o = /^-ms-/, p = /-([\da-z])/gi, q = function(a, b){return b.toUpperCase()}; m.fn = m.prototype = {jquery:l, constructor:m, selector:"", length:0, toArray:function(){return d.call(this)}, get:function(a){return null != a?0 > a?this[a + this.length]:this[a]:d.call(this)}, pushStack:function(a){var b = m.merge(this.constructor(), a); return b.prevObject = this, b.context = this.context, b}, each:function(a, b){return m.each(this, a, b)}, map:function(a){return this.pushStack(m.map(this, function(b, c){return a.call(b, c, b)}))}, slice:function(){return this.pushStack(d.apply(this, arguments))}, first:function(){return this.eq(0)}, last:function(){return this.eq( - 1)}, eq:function(a){var b = this.length, c = + a + (0 > a?b:0); return this.pushStack(c >= 0 && b > c?[this[c]]:[])}, end:function(){return this.prevObject || this.constructor(null)}, push:f, sort:c.sort, splice:c.splice}, m.extend = m.fn.extend = function(){var a, b, c, d, e, f, g = arguments[0] || {}, h = 1, i = arguments.length, j = !1; for ("boolean" == typeof g && (j = g, g = arguments[h] || {}, h++), "object" == typeof g || m.isFunction(g) || (g = {}), h === i && (g = this, h--); i > h; h++)if (null != (e = arguments[h]))for (d in e)a = g[d], c = e[d], g !== c && (j && c && (m.isPlainObject(c) || (b = m.isArray(c)))?(b?(b = !1, f = a && m.isArray(a)?a:[]):f = a && m.isPlainObject(a)?a:{}, g[d] = m.extend(j, f, c)):void 0 !== c && (g[d] = c)); return g}, m.extend({expando:"jQuery" + (l + Math.random()).replace(/\D/g, ""), isReady:!0, error:function(a){throw new Error(a)}, noop:function(){}, isFunction:function(a){return"function" === m.type(a)}, isArray:Array.isArray || function(a){return"array" === m.type(a)}, isWindow:function(a){return null != a && a == a.window}, isNumeric:function(a){return!m.isArray(a) && a - parseFloat(a) + 1 >= 0}, isEmptyObject:function(a){var b; for (b in a)return!1; return!0}, isPlainObject:function(a){var b; if (!a || "object" !== m.type(a) || a.nodeType || m.isWindow(a))return!1; try{if (a.constructor && !j.call(a, "constructor") && !j.call(a.constructor.prototype, "isPrototypeOf"))return!1} catch (c){return!1}if (k.ownLast)for (b in a)return j.call(a, b); for (b in a); return void 0 === b || j.call(a, b)}, type:function(a){return null == a?a + "":"object" == typeof a || "function" == typeof a?h[i.call(a)] || "object":typeof a}, globalEval:function(b){b && m.trim(b) && (a.execScript || function(b){a.eval.call(a, b)})(b)}, camelCase:function(a){return a.replace(o, "ms-").replace(p, q)}, nodeName:function(a, b){return a.nodeName && a.nodeName.toLowerCase() === b.toLowerCase()}, each:function(a, b, c){var d, e = 0, f = a.length, g = r(a); if (c){if (g){for (; f > e; e++)if (d = b.apply(a[e], c), d === !1)break} else for (e in a)if (d = b.apply(a[e], c), d === !1)break} else if (g){for (; f > e; e++)if (d = b.call(a[e], e, a[e]), d === !1)break} else for (e in a)if (d = b.call(a[e], e, a[e]), d === !1)break; return a}, trim:function(a){return null == a?"":(a + "").replace(n, "")}, makeArray:function(a, b){var c = b || []; return null != a && (r(Object(a))?m.merge(c, "string" == typeof a?[a]:a):f.call(c, a)), c}, inArray:function(a, b, c){var d; if (b){if (g)return g.call(b, a, c); for (d = b.length, c = c?0 > c?Math.max(0, d + c):c:0; d > c; c++)if (c in b && b[c] === a)return c}return - 1}, merge:function(a, b){var c = + b.length, d = 0, e = a.length; while (c > d)a[e++] = b[d++]; if (c !== c)while (void 0 !== b[d])a[e++] = b[d++]; return a.length = e, a}, grep:function(a, b, c){for (var d, e = [], f = 0, g = a.length, h = !c; g > f; f++)d = !b(a[f], f), d !== h && e.push(a[f]); return e}, map:function(a, b, c){var d, f = 0, g = a.length, h = r(a), i = []; if (h)for (; g > f; f++)d = b(a[f], f, c), null != d && i.push(d); else for (f in a)d = b(a[f], f, c), null != d && i.push(d); return e.apply([], i)}, guid:1, proxy:function(a, b){var c, e, f; return"string" == typeof b && (f = a[b], b = a, a = f), m.isFunction(a)?(c = d.call(arguments, 2), e = function(){return a.apply(b || this, c.concat(d.call(arguments)))}, e.guid = a.guid = a.guid || m.guid++, e):void 0}, now:function(){return + new Date}, support:k}), m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(a, b){h["[object " + b + "]"] = b.toLowerCase()}); function r(a){var b = "length"in a && a.length, c = m.type(a); return"function" === c || m.isWindow(a)?!1:1 === a.nodeType && b?!0:"array" === c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a}var s = function(a){var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u = "sizzle" + 1 * new Date, v = a.document, w = 0, x = 0, y = ha(), z = ha(), A = ha(), B = function(a, b){return a === b && (l = !0), 0}, C = 1 << 31, D = {}.hasOwnProperty, E = [], F = E.pop, G = E.push, H = E.push, I = E.slice, J = function(a, b){for (var c = 0, d = a.length; d > c; c++)if (a[c] === b)return c; return - 1}, K = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", L = "[\\x20\\t\\r\\n\\f]", M = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", N = M.replace("w", "w#"), O = "\\[" + L + "*(" + M + ")(?:" + L + "*([*^$|!~]?=)" + L + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + N + "))|)" + L + "*\\]", P = ":(" + M + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + O + ")*)|.*)\\)|)", Q = new RegExp(L + "+", "g"), R = new RegExp("^" + L + "+|((?:^|[^\\\\])(?:\\\\.)*)" + L + "+$", "g"), S = new RegExp("^" + L + "*," + L + "*"), T = new RegExp("^" + L + "*([>+~]|" + L + ")" + L + "*"), U = new RegExp("=" + L + "*([^\\]'\"]*?)" + L + "*\\]", "g"), V = new RegExp(P), W = new RegExp("^" + N + "$"), X = {ID:new RegExp("^#(" + M + ")"), CLASS:new RegExp("^\\.(" + M + ")"), TAG:new RegExp("^(" + M.replace("w", "w*") + ")"), ATTR:new RegExp("^" + O), PSEUDO:new RegExp("^" + P), CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + L + "*(even|odd|(([+-]|)(\\d*)n|)" + L + "*(?:([+-]|)" + L + "*(\\d+)|))" + L + "*\\)|)", "i"), bool:new RegExp("^(?:" + K + ")$", "i"), needsContext:new RegExp("^" + L + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + L + "*((?:-\\d)?\\d*)" + L + "*\\)|)(?=[^-]|$)", "i")}, Y = /^(?:input|select|textarea|button)$/i, Z = /^h\d$/i, $ = /^[^{]+\{\s*\[native \w/, _ = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, aa = /[+~]/, ba = /'|\\/g, ca = new RegExp("\\\\([\\da-f]{1,6}" + L + "?|(" + L + ")|.)", "ig"), da = function(a, b, c){var d = "0x" + b - 65536; return d !== d || c?b:0 > d?String.fromCharCode(d + 65536):String.fromCharCode(d >> 10 | 55296, 1023 & d | 56320)}, ea = function(){m()}; try{H.apply(E = I.call(v.childNodes), v.childNodes), E[v.childNodes.length].nodeType} catch (fa){H = {apply:E.length?function(a, b){G.apply(a, I.call(b))}:function(a, b){var c = a.length, d = 0; while (a[c++] = b[d++]); a.length = c - 1}}}function ga(a, b, d, e){var f, h, j, k, l, o, r, s, w, x; if ((b?b.ownerDocument || b:v) !== n && m(b), b = b || n, d = d || [], k = b.nodeType, "string" != typeof a || !a || 1 !== k && 9 !== k && 11 !== k)return d; if (!e && p){if (11 !== k && (f = _.exec(a)))if (j = f[1]){if (9 === k){if (h = b.getElementById(j), !h || !h.parentNode)return d; if (h.id === j)return d.push(h), d} else if (b.ownerDocument && (h = b.ownerDocument.getElementById(j)) && t(b, h) && h.id === j)return d.push(h), d} else{if (f[2])return H.apply(d, b.getElementsByTagName(a)), d; if ((j = f[3]) && c.getElementsByClassName)return H.apply(d, b.getElementsByClassName(j)), d}if (c.qsa && (!q || !q.test(a))){if (s = r = u, w = b, x = 1 !== k && a, 1 === k && "object" !== b.nodeName.toLowerCase()){o = g(a), (r = b.getAttribute("id"))?s = r.replace(ba, "\\$&"):b.setAttribute("id", s), s = "[id='" + s + "'] ", l = o.length; while (l--)o[l] = s + ra(o[l]); w = aa.test(a) && pa(b.parentNode) || b, x = o.join(",")}if (x)try{return H.apply(d, w.querySelectorAll(x)), d} catch (y){} finally{r || b.removeAttribute("id")}}}return i(a.replace(R, "$1"), b, d, e)}function ha(){var a = []; function b(c, e){return a.push(c + " ") > d.cacheLength && delete b[a.shift()], b[c + " "] = e}return b}function ia(a){return a[u] = !0, a}function ja(a){var b = n.createElement("div"); try{return!!a(b)} catch (c){return!1} finally{b.parentNode && b.parentNode.removeChild(b), b = null}}function ka(a, b){var c = a.split("|"), e = a.length; while (e--)d.attrHandle[c[e]] = b}function la(a, b){var c = b && a, d = c && 1 === a.nodeType && 1 === b.nodeType && (~b.sourceIndex || C) - (~a.sourceIndex || C); if (d)return d; if (c)while (c = c.nextSibling)if (c === b)return - 1; return a?1: - 1}function ma(a){return function(b){var c = b.nodeName.toLowerCase(); return"input" === c && b.type === a}}function na(a){return function(b){var c = b.nodeName.toLowerCase(); return("input" === c || "button" === c) && b.type === a}}function oa(a){return ia(function(b){return b = + b, ia(function(c, d){var e, f = a([], c.length, b), g = f.length; while (g--)c[e = f[g]] && (c[e] = !(d[e] = c[e]))})})}function pa(a){return a && "undefined" != typeof a.getElementsByTagName && a}c = ga.support = {}, f = ga.isXML = function(a){var b = a && (a.ownerDocument || a).documentElement; return b?"HTML" !== b.nodeName:!1}, m = ga.setDocument = function(a){var b, e, g = a?a.ownerDocument || a:v; return g !== n && 9 === g.nodeType && g.documentElement?(n = g, o = g.documentElement, e = g.defaultView, e && e !== e.top && (e.addEventListener?e.addEventListener("unload", ea, !1):e.attachEvent && e.attachEvent("onunload", ea)), p = !f(g), c.attributes = ja(function(a){return a.className = "i", !a.getAttribute("className")}), c.getElementsByTagName = ja(function(a){return a.appendChild(g.createComment("")), !a.getElementsByTagName("*").length}), c.getElementsByClassName = $.test(g.getElementsByClassName), c.getById = ja(function(a){return o.appendChild(a).id = u, !g.getElementsByName || !g.getElementsByName(u).length}), c.getById?(d.find.ID = function(a, b){if ("undefined" != typeof b.getElementById && p){var c = b.getElementById(a); return c && c.parentNode?[c]:[]}}, d.filter.ID = function(a){var b = a.replace(ca, da); return function(a){return a.getAttribute("id") === b}}):(delete d.find.ID, d.filter.ID = function(a){var b = a.replace(ca, da); return function(a){var c = "undefined" != typeof a.getAttributeNode && a.getAttributeNode("id"); return c && c.value === b}}), d.find.TAG = c.getElementsByTagName?function(a, b){return"undefined" != typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a, b){var c, d = [], e = 0, f = b.getElementsByTagName(a); if ("*" === a){while (c = f[e++])1 === c.nodeType && d.push(c); return d}return f}, d.find.CLASS = c.getElementsByClassName && function(a, b){return p?b.getElementsByClassName(a):void 0}, r = [], q = [], (c.qsa = $.test(g.querySelectorAll)) && (ja(function(a){o.appendChild(a).innerHTML = "", a.querySelectorAll("[msallowcapture^='']").length && q.push("[*^$]=" + L + "*(?:''|\"\")"), a.querySelectorAll("[selected]").length || q.push("\\[" + L + "*(?:value|" + K + ")"), a.querySelectorAll("[id~=" + u + "-]").length || q.push("~="), a.querySelectorAll(":checked").length || q.push(":checked"), a.querySelectorAll("a#" + u + "+*").length || q.push(".#.+[+~]")}), ja(function(a){var b = g.createElement("input"); b.setAttribute("type", "hidden"), a.appendChild(b).setAttribute("name", "D"), a.querySelectorAll("[name=d]").length && q.push("name" + L + "*[*^$|!~]?="), a.querySelectorAll(":enabled").length || q.push(":enabled", ":disabled"), a.querySelectorAll("*,:x"), q.push(",.*:")})), (c.matchesSelector = $.test(s = o.matches || o.webkitMatchesSelector || o.mozMatchesSelector || o.oMatchesSelector || o.msMatchesSelector)) && ja(function(a){c.disconnectedMatch = s.call(a, "div"), s.call(a, "[s!='']:x"), r.push("!=", P)}), q = q.length && new RegExp(q.join("|")), r = r.length && new RegExp(r.join("|")), b = $.test(o.compareDocumentPosition), t = b || $.test(o.contains)?function(a, b){var c = 9 === a.nodeType?a.documentElement:a, d = b && b.parentNode; return a === d || !(!d || 1 !== d.nodeType || !(c.contains?c.contains(d):a.compareDocumentPosition && 16 & a.compareDocumentPosition(d)))}:function(a, b){if (b)while (b = b.parentNode)if (b === a)return!0; return!1}, B = b?function(a, b){if (a === b)return l = !0, 0; var d = !a.compareDocumentPosition - !b.compareDocumentPosition; return d?d:(d = (a.ownerDocument || a) === (b.ownerDocument || b)?a.compareDocumentPosition(b):1, 1 & d || !c.sortDetached && b.compareDocumentPosition(a) === d?a === g || a.ownerDocument === v && t(v, a)? - 1:b === g || b.ownerDocument === v && t(v, b)?1:k?J(k, a) - J(k, b):0:4 & d? - 1:1)}:function(a, b){if (a === b)return l = !0, 0; var c, d = 0, e = a.parentNode, f = b.parentNode, h = [a], i = [b]; if (!e || !f)return a === g? - 1:b === g?1:e? - 1:f?1:k?J(k, a) - J(k, b):0; if (e === f)return la(a, b); c = a; while (c = c.parentNode)h.unshift(c); c = b; while (c = c.parentNode)i.unshift(c); while (h[d] === i[d])d++; return d?la(h[d], i[d]):h[d] === v? - 1:i[d] === v?1:0}, g):n}, ga.matches = function(a, b){return ga(a, null, null, b)}, ga.matchesSelector = function(a, b){if ((a.ownerDocument || a) !== n && m(a), b = b.replace(U, "='$1']"), !(!c.matchesSelector || !p || r && r.test(b) || q && q.test(b)))try{var d = s.call(a, b); if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType)return d} catch (e){}return ga(b, n, null, [a]).length > 0}, ga.contains = function(a, b){return(a.ownerDocument || a) !== n && m(a), t(a, b)}, ga.attr = function(a, b){(a.ownerDocument || a) !== n && m(a); var e = d.attrHandle[b.toLowerCase()], f = e && D.call(d.attrHandle, b.toLowerCase())?e(a, b, !p):void 0; return void 0 !== f?f:c.attributes || !p?a.getAttribute(b):(f = a.getAttributeNode(b)) && f.specified?f.value:null}, ga.error = function(a){throw new Error("Syntax error, unrecognized expression: " + a)}, ga.uniqueSort = function(a){var b, d = [], e = 0, f = 0; if (l = !c.detectDuplicates, k = !c.sortStable && a.slice(0), a.sort(B), l){while (b = a[f++])b === a[f] && (e = d.push(f)); while (e--)a.splice(d[e], 1)}return k = null, a}, e = ga.getText = function(a){var b, c = "", d = 0, f = a.nodeType; if (f){if (1 === f || 9 === f || 11 === f){if ("string" == typeof a.textContent)return a.textContent; for (a = a.firstChild; a; a = a.nextSibling)c += e(a)} else if (3 === f || 4 === f)return a.nodeValue} else while (b = a[d++])c += e(b); return c}, d = ga.selectors = {cacheLength:50, createPseudo:ia, match:X, attrHandle:{}, find:{}, relative:{">":{dir:"parentNode", first:!0}, " ":{dir:"parentNode"}, "+":{dir:"previousSibling", first:!0}, "~":{dir:"previousSibling"}}, preFilter:{ATTR:function(a){return a[1] = a[1].replace(ca, da), a[3] = (a[3] || a[4] || a[5] || "").replace(ca, da), "~=" === a[2] && (a[3] = " " + a[3] + " "), a.slice(0, 4)}, CHILD:function(a){return a[1] = a[1].toLowerCase(), "nth" === a[1].slice(0, 3)?(a[3] || ga.error(a[0]), a[4] = + (a[4]?a[5] + (a[6] || 1):2 * ("even" === a[3] || "odd" === a[3])), a[5] = + (a[7] + a[8] || "odd" === a[3])):a[3] && ga.error(a[0]), a}, PSEUDO:function(a){var b, c = !a[6] && a[2]; return X.CHILD.test(a[0])?null:(a[3]?a[2] = a[4] || a[5] || "":c && V.test(c) && (b = g(c, !0)) && (b = c.indexOf(")", c.length - b) - c.length) && (a[0] = a[0].slice(0, b), a[2] = c.slice(0, b)), a.slice(0, 3))}}, filter:{TAG:function(a){var b = a.replace(ca, da).toLowerCase(); return"*" === a?function(){return!0}:function(a){return a.nodeName && a.nodeName.toLowerCase() === b}}, CLASS:function(a){var b = y[a + " "]; return b || (b = new RegExp("(^|" + L + ")" + a + "(" + L + "|$)")) && y(a, function(a){return b.test("string" == typeof a.className && a.className || "undefined" != typeof a.getAttribute && a.getAttribute("class") || "")})}, ATTR:function(a, b, c){return function(d){var e = ga.attr(d, a); return null == e?"!=" === b:b?(e += "", "=" === b?e === c:"!=" === b?e !== c:"^=" === b?c && 0 === e.indexOf(c):"*=" === b?c && e.indexOf(c) > - 1:"$=" === b?c && e.slice( - c.length) === c:"~=" === b?(" " + e.replace(Q, " ") + " ").indexOf(c) > - 1:"|=" === b?e === c || e.slice(0, c.length + 1) === c + "-":!1):!0}}, CHILD:function(a, b, c, d, e){var f = "nth" !== a.slice(0, 3), g = "last" !== a.slice( - 4), h = "of-type" === b; return 1 === d && 0 === e?function(a){return!!a.parentNode}:function(b, c, i){var j, k, l, m, n, o, p = f !== g?"nextSibling":"previousSibling", q = b.parentNode, r = h && b.nodeName.toLowerCase(), s = !i && !h; if (q){if (f){while (p){l = b; while (l = l[p])if (h?l.nodeName.toLowerCase() === r:1 === l.nodeType)return!1; o = p = "only" === a && !o && "nextSibling"}return!0}if (o = [g?q.firstChild:q.lastChild], g && s){k = q[u] || (q[u] = {}), j = k[a] || [], n = j[0] === w && j[1], m = j[0] === w && j[2], l = n && q.childNodes[n]; while (l = ++n && l && l[p] || (m = n = 0) || o.pop())if (1 === l.nodeType && ++m && l === b){k[a] = [w, n, m]; break}} else if (s && (j = (b[u] || (b[u] = {}))[a]) && j[0] === w)m = j[1]; else while (l = ++n && l && l[p] || (m = n = 0) || o.pop())if ((h?l.nodeName.toLowerCase() === r:1 === l.nodeType) && ++m && (s && ((l[u] || (l[u] = {}))[a] = [w, m]), l === b))break; return m -= e, m === d || m % d === 0 && m / d >= 0}}}, PSEUDO:function(a, b){var c, e = d.pseudos[a] || d.setFilters[a.toLowerCase()] || ga.error("unsupported pseudo: " + a); return e[u]?e(b):e.length > 1?(c = [a, a, "", b], d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a, c){var d, f = e(a, b), g = f.length; while (g--)d = J(a, f[g]), a[d] = !(c[d] = f[g])}):function(a){return e(a, 0, c)}):e}}, pseudos:{not:ia(function(a){var b = [], c = [], d = h(a.replace(R, "$1")); return d[u]?ia(function(a, b, c, e){var f, g = d(a, null, e, []), h = a.length; while (h--)(f = g[h]) && (a[h] = !(b[h] = f))}):function(a, e, f){return b[0] = a, d(b, null, f, c), b[0] = null, !c.pop()}}), has:ia(function(a){return function(b){return ga(a, b).length > 0}}), contains:ia(function(a){return a = a.replace(ca, da), function(b){return(b.textContent || b.innerText || e(b)).indexOf(a) > - 1}}), lang:ia(function(a){return W.test(a || "") || ga.error("unsupported lang: " + a), a = a.replace(ca, da).toLowerCase(), function(b){var c; do if (c = p?b.lang:b.getAttribute("xml:lang") || b.getAttribute("lang"))return c = c.toLowerCase(), c === a || 0 === c.indexOf(a + "-"); while ((b = b.parentNode) && 1 === b.nodeType); return!1}}), target:function(b){var c = a.location && a.location.hash; return c && c.slice(1) === b.id}, root:function(a){return a === o}, focus:function(a){return a === n.activeElement && (!n.hasFocus || n.hasFocus()) && !!(a.type || a.href || ~a.tabIndex)}, enabled:function(a){return a.disabled === !1}, disabled:function(a){return a.disabled === !0}, checked:function(a){var b = a.nodeName.toLowerCase(); return"input" === b && !!a.checked || "option" === b && !!a.selected}, selected:function(a){return a.parentNode && a.parentNode.selectedIndex, a.selected === !0}, empty:function(a){for (a = a.firstChild; a; a = a.nextSibling)if (a.nodeType < 6)return!1; return!0}, parent:function(a){return!d.pseudos.empty(a)}, header:function(a){return Z.test(a.nodeName)}, input:function(a){return Y.test(a.nodeName)}, button:function(a){var b = a.nodeName.toLowerCase(); return"input" === b && "button" === a.type || "button" === b}, text:function(a){var b; return"input" === a.nodeName.toLowerCase() && "text" === a.type && (null == (b = a.getAttribute("type")) || "text" === b.toLowerCase())}, first:oa(function(){return[0]}), last:oa(function(a, b){return[b - 1]}), eq:oa(function(a, b, c){return[0 > c?c + b:c]}), even:oa(function(a, b){for (var c = 0; b > c; c += 2)a.push(c); return a}), odd:oa(function(a, b){for (var c = 1; b > c; c += 2)a.push(c); return a}), lt:oa(function(a, b, c){for (var d = 0 > c?c + b:c; --d >= 0; )a.push(d); return a}), gt:oa(function(a, b, c){for (var d = 0 > c?c + b:c; ++d < b; )a.push(d); return a})}}, d.pseudos.nth = d.pseudos.eq; for (b in{radio:!0, checkbox:!0, file:!0, password:!0, image:!0})d.pseudos[b] = ma(b); for (b in{submit:!0, reset:!0})d.pseudos[b] = na(b); function qa(){}qa.prototype = d.filters = d.pseudos, d.setFilters = new qa, g = ga.tokenize = function(a, b){var c, e, f, g, h, i, j, k = z[a + " "]; if (k)return b?0:k.slice(0); h = a, i = [], j = d.preFilter; while (h){(!c || (e = S.exec(h))) && (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = T.exec(h)) && (c = e.shift(), f.push({value:c, type:e[0].replace(R, " ")}), h = h.slice(c.length)); for (g in d.filter)!(e = X[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({value:c, type:g, matches:e}), h = h.slice(c.length)); if (!c)break}return b?h.length:h?ga.error(a):z(a, i).slice(0)}; function ra(a){for (var b = 0, c = a.length, d = ""; c > b; b++)d += a[b].value; return d}function sa(a, b, c){var d = b.dir, e = c && "parentNode" === d, f = x++; return b.first?function(b, c, f){while (b = b[d])if (1 === b.nodeType || e)return a(b, c, f)}:function(b, c, g){var h, i, j = [w, f]; if (g){while (b = b[d])if ((1 === b.nodeType || e) && a(b, c, g))return!0} else while (b = b[d])if (1 === b.nodeType || e){if (i = b[u] || (b[u] = {}), (h = i[d]) && h[0] === w && h[1] === f)return j[2] = h[2]; if (i[d] = j, j[2] = a(b, c, g))return!0}}}function ta(a){return a.length > 1?function(b, c, d){var e = a.length; while (e--)if (!a[e](b, c, d))return!1; return!0}:a[0]}function ua(a, b, c){for (var d = 0, e = b.length; e > d; d++)ga(a, b[d], c); return c}function va(a, b, c, d, e){for (var f, g = [], h = 0, i = a.length, j = null != b; i > h; h++)(f = a[h]) && (!c || c(f, d, e)) && (g.push(f), j && b.push(h)); return g}function wa(a, b, c, d, e, f){return d && !d[u] && (d = wa(d)), e && !e[u] && (e = wa(e, f)), ia(function(f, g, h, i){var j, k, l, m = [], n = [], o = g.length, p = f || ua(b || "*", h.nodeType?[h]:h, []), q = !a || !f && b?p:va(p, m, a, h, i), r = c?e || (f?a:o || d)?[]:g:q; if (c && c(q, r, h, i), d){j = va(r, n), d(j, [], h, i), k = j.length; while (k--)(l = j[k]) && (r[n[k]] = !(q[n[k]] = l))}if (f){if (e || a){if (e){j = [], k = r.length; while (k--)(l = r[k]) && j.push(q[k] = l); e(null, r = [], j, i)}k = r.length; while (k--)(l = r[k]) && (j = e?J(f, l):m[k]) > - 1 && (f[j] = !(g[j] = l))}} else r = va(r === g?r.splice(o, r.length):r), e?e(null, g, r, i):H.apply(g, r)})}function xa(a){for (var b, c, e, f = a.length, g = d.relative[a[0].type], h = g || d.relative[" "], i = g?1:0, k = sa(function(a){return a === b}, h, !0), l = sa(function(a){return J(b, a) > - 1}, h, !0), m = [function(a, c, d){var e = !g && (d || c !== j) || ((b = c).nodeType?k(a, c, d):l(a, c, d)); return b = null, e}]; f > i; i++)if (c = d.relative[a[i].type])m = [sa(ta(m), c)]; else{if (c = d.filter[a[i].type].apply(null, a[i].matches), c[u]){for (e = ++i; f > e; e++)if (d.relative[a[e].type])break; return wa(i > 1 && ta(m), i > 1 && ra(a.slice(0, i - 1).concat({value:" " === a[i - 2].type?"*":""})).replace(R, "$1"), c, e > i && xa(a.slice(i, e)), f > e && xa(a = a.slice(e)), f > e && ra(a))}m.push(c)}return ta(m)}function ya(a, b){var c = b.length > 0, e = a.length > 0, f = function(f, g, h, i, k){var l, m, o, p = 0, q = "0", r = f && [], s = [], t = j, u = f || e && d.find.TAG("*", k), v = w += null == t?1:Math.random() || .1, x = u.length; for (k && (j = g !== n && g); q !== x && null != (l = u[q]); q++){if (e && l){m = 0; while (o = a[m++])if (o(l, g, h)){i.push(l); break}k && (w = v)}c && ((l = !o && l) && p--, f && r.push(l))}if (p += q, c && q !== p){m = 0; while (o = b[m++])o(r, s, g, h); if (f){if (p > 0)while (q--)r[q] || s[q] || (s[q] = F.call(i)); s = va(s)}H.apply(i, s), k && !f && s.length > 0 && p + b.length > 1 && ga.uniqueSort(i)}return k && (w = v, j = t), r}; return c?ia(f):f}return h = ga.compile = function(a, b){var c, d = [], e = [], f = A[a + " "]; if (!f){b || (b = g(a)), c = b.length; while (c--)f = xa(b[c]), f[u]?d.push(f):e.push(f); f = A(a, ya(e, d)), f.selector = a}return f}, i = ga.select = function(a, b, e, f){var i, j, k, l, m, n = "function" == typeof a && a, o = !f && g(a = n.selector || a); if (e = e || [], 1 === o.length){if (j = o[0] = o[0].slice(0), j.length > 2 && "ID" === (k = j[0]).type && c.getById && 9 === b.nodeType && p && d.relative[j[1].type]){if (b = (d.find.ID(k.matches[0].replace(ca, da), b) || [])[0], !b)return e; n && (b = b.parentNode), a = a.slice(j.shift().value.length)}i = X.needsContext.test(a)?0:j.length; while (i--){if (k = j[i], d.relative[l = k.type])break; if ((m = d.find[l]) && (f = m(k.matches[0].replace(ca, da), aa.test(j[0].type) && pa(b.parentNode) || b))){if (j.splice(i, 1), a = f.length && ra(j), !a)return H.apply(e, f), e; break}}}return(n || h(a, o))(f, b, !p, e, aa.test(a) && pa(b.parentNode) || b), e}, c.sortStable = u.split("").sort(B).join("") === u, c.detectDuplicates = !!l, m(), c.sortDetached = ja(function(a){return 1 & a.compareDocumentPosition(n.createElement("div"))}), ja(function(a){return a.innerHTML = "", "#" === a.firstChild.getAttribute("href")}) || ka("type|href|height|width", function(a, b, c){return c?void 0:a.getAttribute(b, "type" === b.toLowerCase()?1:2)}), c.attributes && ja(function(a){return a.innerHTML = "", a.firstChild.setAttribute("value", ""), "" === a.firstChild.getAttribute("value")}) || ka("value", function(a, b, c){return c || "input" !== a.nodeName.toLowerCase()?void 0:a.defaultValue}), ja(function(a){return null == a.getAttribute("disabled")}) || ka(K, function(a, b, c){var d; return c?void 0:a[b] === !0?b.toLowerCase():(d = a.getAttributeNode(b)) && d.specified?d.value:null}), ga}(a); m.find = s, m.expr = s.selectors, m.expr[":"] = m.expr.pseudos, m.unique = s.uniqueSort, m.text = s.getText, m.isXMLDoc = s.isXML, m.contains = s.contains; var t = m.expr.match.needsContext, u = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, v = /^.[^:#\[\.,]*$/; function w(a, b, c){if (m.isFunction(b))return m.grep(a, function(a, d){return!!b.call(a, d, a) !== c}); if (b.nodeType)return m.grep(a, function(a){return a === b !== c}); if ("string" == typeof b){if (v.test(b))return m.filter(b, a, c); b = m.filter(b, a)}return m.grep(a, function(a){return m.inArray(a, b) >= 0 !== c})}m.filter = function(a, b, c){var d = b[0]; return c && (a = ":not(" + a + ")"), 1 === b.length && 1 === d.nodeType?m.find.matchesSelector(d, a)?[d]:[]:m.find.matches(a, m.grep(b, function(a){return 1 === a.nodeType}))}, m.fn.extend({find:function(a){var b, c = [], d = this, e = d.length; if ("string" != typeof a)return this.pushStack(m(a).filter(function(){for (b = 0; e > b; b++)if (m.contains(d[b], this))return!0})); for (b = 0; e > b; b++)m.find(a, d[b], c); return c = this.pushStack(e > 1?m.unique(c):c), c.selector = this.selector?this.selector + " " + a:a, c}, filter:function(a){return this.pushStack(w(this, a || [], !1))}, not:function(a){return this.pushStack(w(this, a || [], !0))}, is:function(a){return!!w(this, "string" == typeof a && t.test(a)?m(a):a || [], !1).length}}); var x, y = a.document, z = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, A = m.fn.init = function(a, b){var c, d; if (!a)return this; if ("string" == typeof a){if (c = "<" === a.charAt(0) && ">" === a.charAt(a.length - 1) && a.length >= 3?[null, a, null]:z.exec(a), !c || !c[1] && b)return!b || b.jquery?(b || x).find(a):this.constructor(b).find(a); if (c[1]){if (b = b instanceof m?b[0]:b, m.merge(this, m.parseHTML(c[1], b && b.nodeType?b.ownerDocument || b:y, !0)), u.test(c[1]) && m.isPlainObject(b))for (c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c, b[c]); return this}if (d = y.getElementById(c[2]), d && d.parentNode){if (d.id !== c[2])return x.find(a); this.length = 1, this[0] = d}return this.context = y, this.selector = a, this}return a.nodeType?(this.context = this[0] = a, this.length = 1, this):m.isFunction(a)?"undefined" != typeof x.ready?x.ready(a):a(m):(void 0 !== a.selector && (this.selector = a.selector, this.context = a.context), m.makeArray(a, this))}; A.prototype = m.fn, x = m(y); var B = /^(?:parents|prev(?:Until|All))/, C = {children:!0, contents:!0, next:!0, prev:!0}; m.extend({dir:function(a, b, c){var d = [], e = a[b]; while (e && 9 !== e.nodeType && (void 0 === c || 1 !== e.nodeType || !m(e).is(c)))1 === e.nodeType && d.push(e), e = e[b]; return d}, sibling:function(a, b){for (var c = []; a; a = a.nextSibling)1 === a.nodeType && a !== b && c.push(a); return c}}), m.fn.extend({has:function(a){var b, c = m(a, this), d = c.length; return this.filter(function(){for (b = 0; d > b; b++)if (m.contains(this, c[b]))return!0})}, closest:function(a, b){for (var c, d = 0, e = this.length, f = [], g = t.test(a) || "string" != typeof a?m(a, b || this.context):0; e > d; d++)for (c = this[d]; c && c !== b; c = c.parentNode)if (c.nodeType < 11 && (g?g.index(c) > - 1:1 === c.nodeType && m.find.matchesSelector(c, a))){f.push(c); break}return this.pushStack(f.length > 1?m.unique(f):f)}, index:function(a){return a?"string" == typeof a?m.inArray(this[0], m(a)):m.inArray(a.jquery?a[0]:a, this):this[0] && this[0].parentNode?this.first().prevAll().length: - 1}, add:function(a, b){return this.pushStack(m.unique(m.merge(this.get(), m(a, b))))}, addBack:function(a){return this.add(null == a?this.prevObject:this.prevObject.filter(a))}}); function D(a, b){do a = a[b]; while (a && 1 !== a.nodeType); return a}m.each({parent:function(a){var b = a.parentNode; return b && 11 !== b.nodeType?b:null}, parents:function(a){return m.dir(a, "parentNode")}, parentsUntil:function(a, b, c){return m.dir(a, "parentNode", c)}, next:function(a){return D(a, "nextSibling")}, prev:function(a){return D(a, "previousSibling")}, nextAll:function(a){return m.dir(a, "nextSibling")}, prevAll:function(a){return m.dir(a, "previousSibling")}, nextUntil:function(a, b, c){return m.dir(a, "nextSibling", c)}, prevUntil:function(a, b, c){return m.dir(a, "previousSibling", c)}, siblings:function(a){return m.sibling((a.parentNode || {}).firstChild, a)}, children:function(a){return m.sibling(a.firstChild)}, contents:function(a){return m.nodeName(a, "iframe")?a.contentDocument || a.contentWindow.document:m.merge([], a.childNodes)}}, function(a, b){m.fn[a] = function(c, d){var e = m.map(this, b, c); return"Until" !== a.slice( - 5) && (d = c), d && "string" == typeof d && (e = m.filter(d, e)), this.length > 1 && (C[a] || (e = m.unique(e)), B.test(a) && (e = e.reverse())), this.pushStack(e)}}); var E = /\S+/g, F = {}; function G(a){var b = F[a] = {}; return m.each(a.match(E) || [], function(a, c){b[c] = !0}), b}m.Callbacks = function(a){a = "string" == typeof a?F[a] || G(a):m.extend({}, a); var b, c, d, e, f, g, h = [], i = !a.once && [], j = function(l){for (c = a.memory && l, d = !0, f = g || 0, g = 0, e = h.length, b = !0; h && e > f; f++)if (h[f].apply(l[0], l[1]) === !1 && a.stopOnFalse){c = !1; break}b = !1, h && (i?i.length && j(i.shift()):c?h = []:k.disable())}, k = {add:function(){if (h){var d = h.length; !function f(b){m.each(b, function(b, c){var d = m.type(c); "function" === d?a.unique && k.has(c) || h.push(c):c && c.length && "string" !== d && f(c)})}(arguments), b?e = h.length:c && (g = d, j(c))}return this}, remove:function(){return h && m.each(arguments, function(a, c){var d; while ((d = m.inArray(c, h, d)) > - 1)h.splice(d, 1), b && (e >= d && e--, f >= d && f--)}), this}, has:function(a){return a?m.inArray(a, h) > - 1:!(!h || !h.length)}, empty:function(){return h = [], e = 0, this}, disable:function(){return h = i = c = void 0, this}, disabled:function(){return!h}, lock:function(){return i = void 0, c || k.disable(), this}, locked:function(){return!i}, fireWith:function(a, c){return!h || d && !i || (c = c || [], c = [a, c.slice?c.slice():c], b?i.push(c):j(c)), this}, fire:function(){return k.fireWith(this, arguments), this}, fired:function(){return!!d}}; return k}, m.extend({Deferred:function(a){var b = [["resolve", "done", m.Callbacks("once memory"), "resolved"], ["reject", "fail", m.Callbacks("once memory"), "rejected"], ["notify", "progress", m.Callbacks("memory")]], c = "pending", d = {state:function(){return c}, always:function(){return e.done(arguments).fail(arguments), this}, then:function(){var a = arguments; return m.Deferred(function(c){m.each(b, function(b, f){var g = m.isFunction(a[b]) && a[b]; e[f[1]](function(){var a = g && g.apply(this, arguments); a && m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0] + "With"](this === d?c.promise():this, g?[a]:arguments)})}), a = null}).promise()}, promise:function(a){return null != a?m.extend(a, d):d}}, e = {}; return d.pipe = d.then, m.each(b, function(a, f){var g = f[2], h = f[3]; d[f[1]] = g.add, h && g.add(function(){c = h}, b[1 ^ a][2].disable, b[2][2].lock), e[f[0]] = function(){return e[f[0] + "With"](this === e?d:this, arguments), this}, e[f[0] + "With"] = g.fireWith}), d.promise(e), a && a.call(e, e), e}, when:function(a){var b = 0, c = d.call(arguments), e = c.length, f = 1 !== e || a && m.isFunction(a.promise)?e:0, g = 1 === f?a:m.Deferred(), h = function(a, b, c){return function(e){b[a] = this, c[a] = arguments.length > 1?d.call(arguments):e, c === i?g.notifyWith(b, c):--f || g.resolveWith(b, c)}}, i, j, k; if (e > 1)for (i = new Array(e), j = new Array(e), k = new Array(e); e > b; b++)c[b] && m.isFunction(c[b].promise)?c[b].promise().done(h(b, k, c)).fail(g.reject).progress(h(b, j, i)):--f; return f || g.resolveWith(k, c), g.promise()}}); var H; m.fn.ready = function(a){return m.ready.promise().done(a), this}, m.extend({isReady:!1, readyWait:1, holdReady:function(a){a?m.readyWait++:m.ready(!0)}, ready:function(a){if (a === !0?!--m.readyWait:!m.isReady){if (!y.body)return setTimeout(m.ready); m.isReady = !0, a !== !0 && --m.readyWait > 0 || (H.resolveWith(y, [m]), m.fn.triggerHandler && (m(y).triggerHandler("ready"), m(y).off("ready")))}}}); function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded", J, !1), a.removeEventListener("load", J, !1)):(y.detachEvent("onreadystatechange", J), a.detachEvent("onload", J))}function J(){(y.addEventListener || "load" === event.type || "complete" === y.readyState) && (I(), m.ready())}m.ready.promise = function(b){if (!H)if (H = m.Deferred(), "complete" === y.readyState)setTimeout(m.ready); else if (y.addEventListener)y.addEventListener("DOMContentLoaded", J, !1), a.addEventListener("load", J, !1); else{y.attachEvent("onreadystatechange", J), a.attachEvent("onload", J); var c = !1; try{c = null == a.frameElement && y.documentElement} catch (d){}c && c.doScroll && !function e(){if (!m.isReady){try{c.doScroll("left")} catch (a){return setTimeout(e, 50)}I(), m.ready()}}()}return H.promise(b)}; var K = "undefined", L; for (L in m(k))break; k.ownLast = "0" !== L, k.inlineBlockNeedsLayout = !1, m(function(){var a, b, c, d; c = y.getElementsByTagName("body")[0], c && c.style && (b = y.createElement("div"), d = y.createElement("div"), d.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px", c.appendChild(d).appendChild(b), typeof b.style.zoom !== K && (b.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1", k.inlineBlockNeedsLayout = a = 3 === b.offsetWidth, a && (c.style.zoom = 1)), c.removeChild(d))}), function(){var a = y.createElement("div"); if (null == k.deleteExpando){k.deleteExpando = !0; try{delete a.test} catch (b){k.deleteExpando = !1}}a = null}(), m.acceptData = function(a){var b = m.noData[(a.nodeName + " ").toLowerCase()], c = + a.nodeType || 1; return 1 !== c && 9 !== c?!1:!b || b !== !0 && a.getAttribute("classid") === b}; var M = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, N = /([A-Z])/g; function O(a, b, c){if (void 0 === c && 1 === a.nodeType){var d = "data-" + b.replace(N, "-$1").toLowerCase(); if (c = a.getAttribute(d), "string" == typeof c){try{c = "true" === c?!0:"false" === c?!1:"null" === c?null: + c + "" === c? + c:M.test(c)?m.parseJSON(c):c} catch (e){}m.data(a, b, c)} else c = void 0}return c}function P(a){var b; for (b in a)if (("data" !== b || !m.isEmptyObject(a[b])) && "toJSON" !== b)return!1; + return!0}function Q(a, b, d, e){if (m.acceptData(a)){var f, g, h = m.expando, i = a.nodeType, j = i?m.cache:a, k = i?a[h]:a[h] && h; if (k && j[k] && (e || j[k].data) || void 0 !== d || "string" != typeof b)return k || (k = i?a[h] = c.pop() || m.guid++:h), j[k] || (j[k] = i?{}:{toJSON:m.noop}), ("object" == typeof b || "function" == typeof b) && (e?j[k] = m.extend(j[k], b):j[k].data = m.extend(j[k].data, b)), g = j[k], e || (g.data || (g.data = {}), g = g.data), void 0 !== d && (g[m.camelCase(b)] = d), "string" == typeof b?(f = g[b], null == f && (f = g[m.camelCase(b)])):f = g, f}}function R(a, b, c){if (m.acceptData(a)){var d, e, f = a.nodeType, g = f?m.cache:a, h = f?a[m.expando]:m.expando; if (g[h]){if (b && (d = c?g[h]:g[h].data)){m.isArray(b)?b = b.concat(m.map(b, m.camelCase)):b in d?b = [b]:(b = m.camelCase(b), b = b in d?[b]:b.split(" ")), e = b.length; while (e--)delete d[b[e]]; if (c?!P(d):!m.isEmptyObject(d))return}(c || (delete g[h].data, P(g[h]))) && (f?m.cleanData([a], !0):k.deleteExpando || g != g.window?delete g[h]:g[h] = null)}}}m.extend({cache:{}, noData:{"applet ":!0, "embed ":!0, "object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"}, hasData:function(a){return a = a.nodeType?m.cache[a[m.expando]]:a[m.expando], !!a && !P(a)}, data:function(a, b, c){return Q(a, b, c)}, removeData:function(a, b){return R(a, b)}, _data:function(a, b, c){return Q(a, b, c, !0)}, _removeData:function(a, b){return R(a, b, !0)}}), m.fn.extend({data:function(a, b){var c, d, e, f = this[0], g = f && f.attributes; if (void 0 === a){if (this.length && (e = m.data(f), 1 === f.nodeType && !m._data(f, "parsedAttrs"))){c = g.length; while (c--)g[c] && (d = g[c].name, 0 === d.indexOf("data-") && (d = m.camelCase(d.slice(5)), O(f, d, e[d]))); m._data(f, "parsedAttrs", !0)}return e}return"object" == typeof a?this.each(function(){m.data(this, a)}):arguments.length > 1?this.each(function(){m.data(this, a, b)}):f?O(f, a, m.data(f, a)):void 0}, removeData:function(a){return this.each(function(){m.removeData(this, a)})}}), m.extend({queue:function(a, b, c){var d; return a?(b = (b || "fx") + "queue", d = m._data(a, b), c && (!d || m.isArray(c)?d = m._data(a, b, m.makeArray(c)):d.push(c)), d || []):void 0}, dequeue:function(a, b){b = b || "fx"; var c = m.queue(a, b), d = c.length, e = c.shift(), f = m._queueHooks(a, b), g = function(){m.dequeue(a, b)}; "inprogress" === e && (e = c.shift(), d--), e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire()}, _queueHooks:function(a, b){var c = b + "queueHooks"; return m._data(a, c) || m._data(a, c, {empty:m.Callbacks("once memory").add(function(){m._removeData(a, b + "queue"), m._removeData(a, c)})})}}), m.fn.extend({queue:function(a, b){var c = 2; return"string" != typeof a && (b = a, a = "fx", c--), arguments.length < c?m.queue(this[0], a):void 0 === b?this:this.each(function(){var c = m.queue(this, a, b); m._queueHooks(this, a), "fx" === a && "inprogress" !== c[0] && m.dequeue(this, a)})}, dequeue:function(a){return this.each(function(){m.dequeue(this, a)})}, clearQueue:function(a){return this.queue(a || "fx", [])}, promise:function(a, b){var c, d = 1, e = m.Deferred(), f = this, g = this.length, h = function(){--d || e.resolveWith(f, [f])}; "string" != typeof a && (b = a, a = void 0), a = a || "fx"; while (g--)c = m._data(f[g], a + "queueHooks"), c && c.empty && (d++, c.empty.add(h)); return h(), e.promise(b)}}); var S = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, T = ["Top", "Right", "Bottom", "Left"], U = function(a, b){return a = b || a, "none" === m.css(a, "display") || !m.contains(a.ownerDocument, a)}, V = m.access = function(a, b, c, d, e, f, g){var h = 0, i = a.length, j = null == c; if ("object" === m.type(c)){e = !0; for (h in c)m.access(a, b, h, c[h], !0, f, g)} else if (void 0 !== d && (e = !0, m.isFunction(d) || (g = !0), j && (g?(b.call(a, d), b = null):(j = b, b = function(a, b, c){return j.call(m(a), c)})), b))for (; i > h; h++)b(a[h], c, g?d:d.call(a[h], h, b(a[h], c))); return e?a:j?b.call(a):i?b(a[0], c):f}, W = /^(?:checkbox|radio)$/i; !function(){var a = y.createElement("input"), b = y.createElement("div"), c = y.createDocumentFragment(); if (b.innerHTML = "
a", k.leadingWhitespace = 3 === b.firstChild.nodeType, k.tbody = !b.getElementsByTagName("tbody").length, k.htmlSerialize = !!b.getElementsByTagName("link").length, k.html5Clone = "<:nav>" !== y.createElement("nav").cloneNode(!0).outerHTML, a.type = "checkbox", a.checked = !0, c.appendChild(a), k.appendChecked = a.checked, b.innerHTML = "", k.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue, c.appendChild(b), b.innerHTML = "", k.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, k.noCloneEvent = !0, b.attachEvent && (b.attachEvent("onclick", function(){k.noCloneEvent = !1}), b.cloneNode(!0).click()), null == k.deleteExpando){k.deleteExpando = !0; try{delete b.test} catch (d){k.deleteExpando = !1}}}(), function(){var b, c, d = y.createElement("div"); for (b in{submit:!0, change:!0, focusin:!0})c = "on" + b, (k[b + "Bubbles"] = c in a) || (d.setAttribute(c, "t"), k[b + "Bubbles"] = d.attributes[c].expando === !1); d = null}(); var X = /^(?:input|select|textarea)$/i, Y = /^key/, Z = /^(?:mouse|pointer|contextmenu)|click/, $ = /^(?:focusinfocus|focusoutblur)$/, _ = /^([^.]*)(?:\.(.+)|)$/; function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement} catch (a){}}m.event = {global:{}, add:function(a, b, c, d, e){var f, g, h, i, j, k, l, n, o, p, q, r = m._data(a); if (r){c.handler && (i = c, c = i.handler, e = i.selector), c.guid || (c.guid = m.guid++), (g = r.events) || (g = r.events = {}), (k = r.handle) || (k = r.handle = function(a){return typeof m === K || a && m.event.triggered === a.type?void 0:m.event.dispatch.apply(k.elem, arguments)}, k.elem = a), b = (b || "").match(E) || [""], h = b.length; while (h--)f = _.exec(b[h]) || [], o = q = f[1], p = (f[2] || "").split(".").sort(), o && (j = m.event.special[o] || {}, o = (e?j.delegateType:j.bindType) || o, j = m.event.special[o] || {}, l = m.extend({type:o, origType:q, data:d, handler:c, guid:c.guid, selector:e, needsContext:e && m.expr.match.needsContext.test(e), namespace:p.join(".")}, i), (n = g[o]) || (n = g[o] = [], n.delegateCount = 0, j.setup && j.setup.call(a, d, p, k) !== !1 || (a.addEventListener?a.addEventListener(o, k, !1):a.attachEvent && a.attachEvent("on" + o, k))), j.add && (j.add.call(a, l), l.handler.guid || (l.handler.guid = c.guid)), e?n.splice(n.delegateCount++, 0, l):n.push(l), m.event.global[o] = !0); a = null}}, remove:function(a, b, c, d, e){var f, g, h, i, j, k, l, n, o, p, q, r = m.hasData(a) && m._data(a); if (r && (k = r.events)){b = (b || "").match(E) || [""], j = b.length; while (j--)if (h = _.exec(b[j]) || [], o = q = h[1], p = (h[2] || "").split(".").sort(), o){l = m.event.special[o] || {}, o = (d?l.delegateType:l.bindType) || o, n = k[o] || [], h = h[2] && new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)"), i = f = n.length; while (f--)g = n[f], !e && q !== g.origType || c && c.guid !== g.guid || h && !h.test(g.namespace) || d && d !== g.selector && ("**" !== d || !g.selector) || (n.splice(f, 1), g.selector && n.delegateCount--, l.remove && l.remove.call(a, g)); i && !n.length && (l.teardown && l.teardown.call(a, p, r.handle) !== !1 || m.removeEvent(a, o, r.handle), delete k[o])} else for (o in k)m.event.remove(a, o + b[j], c, d, !0); m.isEmptyObject(k) && (delete r.handle, m._removeData(a, "events"))}}, trigger:function(b, c, d, e){var f, g, h, i, k, l, n, o = [d || y], p = j.call(b, "type")?b.type:b, q = j.call(b, "namespace")?b.namespace.split("."):[]; if (h = l = d = d || y, 3 !== d.nodeType && 8 !== d.nodeType && !$.test(p + m.event.triggered) && (p.indexOf(".") >= 0 && (q = p.split("."), p = q.shift(), q.sort()), g = p.indexOf(":") < 0 && "on" + p, b = b[m.expando]?b:new m.Event(p, "object" == typeof b && b), b.isTrigger = e?2:3, b.namespace = q.join("."), b.namespace_re = b.namespace?new RegExp("(^|\\.)" + q.join("\\.(?:.*\\.|)") + "(\\.|$)"):null, b.result = void 0, b.target || (b.target = d), c = null == c?[b]:m.makeArray(c, [b]), k = m.event.special[p] || {}, e || !k.trigger || k.trigger.apply(d, c) !== !1)){if (!e && !k.noBubble && !m.isWindow(d)){for (i = k.delegateType || p, $.test(i + p) || (h = h.parentNode); h; h = h.parentNode)o.push(h), l = h; l === (d.ownerDocument || y) && o.push(l.defaultView || l.parentWindow || a)}n = 0; while ((h = o[n++]) && !b.isPropagationStopped())b.type = n > 1?i:k.bindType || p, f = (m._data(h, "events") || {})[b.type] && m._data(h, "handle"), f && f.apply(h, c), f = g && h[g], f && f.apply && m.acceptData(h) && (b.result = f.apply(h, c), b.result === !1 && b.preventDefault()); if (b.type = p, !e && !b.isDefaultPrevented() && (!k._default || k._default.apply(o.pop(), c) === !1) && m.acceptData(d) && g && d[p] && !m.isWindow(d)){l = d[g], l && (d[g] = null), m.event.triggered = p; try{d[p]()} catch (r){}m.event.triggered = void 0, l && (d[g] = l)}return b.result}}, dispatch:function(a){a = m.event.fix(a); var b, c, e, f, g, h = [], i = d.call(arguments), j = (m._data(this, "events") || {})[a.type] || [], k = m.event.special[a.type] || {}; if (i[0] = a, a.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, a) !== !1){h = m.event.handlers.call(this, a, j), b = 0; while ((f = h[b++]) && !a.isPropagationStopped()){a.currentTarget = f.elem, g = 0; while ((e = f.handlers[g++]) && !a.isImmediatePropagationStopped())(!a.namespace_re || a.namespace_re.test(e.namespace)) && (a.handleObj = e, a.data = e.data, c = ((m.event.special[e.origType] || {}).handle || e.handler).apply(f.elem, i), void 0 !== c && (a.result = c) === !1 && (a.preventDefault(), a.stopPropagation()))}return k.postDispatch && k.postDispatch.call(this, a), a.result}}, handlers:function(a, b){var c, d, e, f, g = [], h = b.delegateCount, i = a.target; if (h && i.nodeType && (!a.button || "click" !== a.type))for (; i != this; i = i.parentNode || this)if (1 === i.nodeType && (i.disabled !== !0 || "click" !== a.type)){for (e = [], f = 0; h > f; f++)d = b[f], c = d.selector + " ", void 0 === e[c] && (e[c] = d.needsContext?m(c, this).index(i) >= 0:m.find(c, this, null, [i]).length), e[c] && e.push(d); e.length && g.push({elem:i, handlers:e})}return h < b.length && g.push({elem:this, handlers:b.slice(h)}), g}, fix:function(a){if (a[m.expando])return a; var b, c, d, e = a.type, f = a, g = this.fixHooks[e]; g || (this.fixHooks[e] = g = Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}), d = g.props?this.props.concat(g.props):this.props, a = new m.Event(f), b = d.length; while (b--)c = d[b], a[c] = f[c]; return a.target || (a.target = f.srcElement || y), 3 === a.target.nodeType && (a.target = a.target.parentNode), a.metaKey = !!a.metaKey, g.filter?g.filter(a, f):a}, props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks:{}, keyHooks:{props:"char charCode key keyCode".split(" "), filter:function(a, b){return null == a.which && (a.which = null != b.charCode?b.charCode:b.keyCode), a}}, mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter:function(a, b){var c, d, e, f = b.button, g = b.fromElement; return null == a.pageX && null != b.clientX && (d = a.target.ownerDocument || y, e = d.documentElement, c = d.body, a.pageX = b.clientX + (e && e.scrollLeft || c && c.scrollLeft || 0) - (e && e.clientLeft || c && c.clientLeft || 0), a.pageY = b.clientY + (e && e.scrollTop || c && c.scrollTop || 0) - (e && e.clientTop || c && c.clientTop || 0)), !a.relatedTarget && g && (a.relatedTarget = g === a.target?b.toElement:g), a.which || void 0 === f || (a.which = 1 & f?1:2 & f?3:4 & f?2:0), a}}, special:{load:{noBubble:!0}, focus:{trigger:function(){if (this !== ca() && this.focus)try{return this.focus(), !1} catch (a){}}, delegateType:"focusin"}, blur:{trigger:function(){return this === ca() && this.blur?(this.blur(), !1):void 0}, delegateType:"focusout"}, click:{trigger:function(){return m.nodeName(this, "input") && "checkbox" === this.type && this.click?(this.click(), !1):void 0}, _default:function(a){return m.nodeName(a.target, "a")}}, beforeunload:{postDispatch:function(a){void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result)}}}, simulate:function(a, b, c, d){var e = m.extend(new m.Event, c, {type:a, isSimulated:!0, originalEvent:{}}); d?m.event.trigger(e, null, b):m.event.dispatch.call(b, e), e.isDefaultPrevented() && c.preventDefault()}}, m.removeEvent = y.removeEventListener?function(a, b, c){a.removeEventListener && a.removeEventListener(b, c, !1)}:function(a, b, c){var d = "on" + b; a.detachEvent && (typeof a[d] === K && (a[d] = null), a.detachEvent(d, c))}, m.Event = function(a, b){return this instanceof m.Event?(a && a.type?(this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.returnValue === !1?aa:ba):this.type = a, b && m.extend(this, b), this.timeStamp = a && a.timeStamp || m.now(), void(this[m.expando] = !0)):new m.Event(a, b)}, m.Event.prototype = {isDefaultPrevented:ba, isPropagationStopped:ba, isImmediatePropagationStopped:ba, preventDefault:function(){var a = this.originalEvent; this.isDefaultPrevented = aa, a && (a.preventDefault?a.preventDefault():a.returnValue = !1)}, stopPropagation:function(){var a = this.originalEvent; this.isPropagationStopped = aa, a && (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0)}, stopImmediatePropagation:function(){var a = this.originalEvent; this.isImmediatePropagationStopped = aa, a && a.stopImmediatePropagation && a.stopImmediatePropagation(), this.stopPropagation()}}, m.each({mouseenter:"mouseover", mouseleave:"mouseout", pointerenter:"pointerover", pointerleave:"pointerout"}, function(a, b){m.event.special[a] = {delegateType:b, bindType:b, handle:function(a){var c, d = this, e = a.relatedTarget, f = a.handleObj; return(!e || e !== d && !m.contains(d, e)) && (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c}}}), k.submitBubbles || (m.event.special.submit = {setup:function(){return m.nodeName(this, "form")?!1:void m.event.add(this, "click._submit keypress._submit", function(a){var b = a.target, c = m.nodeName(b, "input") || m.nodeName(b, "button")?b.form:void 0; c && !m._data(c, "submitBubbles") && (m.event.add(c, "submit._submit", function(a){a._submit_bubble = !0}), m._data(c, "submitBubbles", !0))})}, postDispatch:function(a){a._submit_bubble && (delete a._submit_bubble, this.parentNode && !a.isTrigger && m.event.simulate("submit", this.parentNode, a, !0))}, teardown:function(){return m.nodeName(this, "form")?!1:void m.event.remove(this, "._submit")}}), k.changeBubbles || (m.event.special.change = {setup:function(){return X.test(this.nodeName)?(("checkbox" === this.type || "radio" === this.type) && (m.event.add(this, "propertychange._change", function(a){"checked" === a.originalEvent.propertyName && (this._just_changed = !0)}), m.event.add(this, "click._change", function(a){this._just_changed && !a.isTrigger && (this._just_changed = !1), m.event.simulate("change", this, a, !0)})), !1):void m.event.add(this, "beforeactivate._change", function(a){var b = a.target; X.test(b.nodeName) && !m._data(b, "changeBubbles") && (m.event.add(b, "change._change", function(a){!this.parentNode || a.isSimulated || a.isTrigger || m.event.simulate("change", this.parentNode, a, !0)}), m._data(b, "changeBubbles", !0))})}, handle:function(a){var b = a.target; return this !== b || a.isSimulated || a.isTrigger || "radio" !== b.type && "checkbox" !== b.type?a.handleObj.handler.apply(this, arguments):void 0}, teardown:function(){return m.event.remove(this, "._change"), !X.test(this.nodeName)}}), k.focusinBubbles || m.each({focus:"focusin", blur:"focusout"}, function(a, b){var c = function(a){m.event.simulate(b, a.target, m.event.fix(a), !0)}; m.event.special[b] = {setup:function(){var d = this.ownerDocument || this, e = m._data(d, b); e || d.addEventListener(a, c, !0), m._data(d, b, (e || 0) + 1)}, teardown:function(){var d = this.ownerDocument || this, e = m._data(d, b) - 1; e?m._data(d, b, e):(d.removeEventListener(a, c, !0), m._removeData(d, b))}}}), m.fn.extend({on:function(a, b, c, d, e){var f, g; if ("object" == typeof a){"string" != typeof b && (c = c || b, b = void 0); for (f in a)this.on(f, b, c, a[f], e); return this}if (null == c && null == d?(d = b, c = b = void 0):null == d && ("string" == typeof b?(d = c, c = void 0):(d = c, c = b, b = void 0)), d === !1)d = ba; else if (!d)return this; return 1 === e && (g = d, d = function(a){return m().off(a), g.apply(this, arguments)}, d.guid = g.guid || (g.guid = m.guid++)), this.each(function(){m.event.add(this, a, d, c, b)})}, one:function(a, b, c, d){return this.on(a, b, c, d, 1)}, off:function(a, b, c){var d, e; if (a && a.preventDefault && a.handleObj)return d = a.handleObj, m(a.delegateTarget).off(d.namespace?d.origType + "." + d.namespace:d.origType, d.selector, d.handler), this; if ("object" == typeof a){for (e in a)this.off(e, b, a[e]); return this}return(b === !1 || "function" == typeof b) && (c = b, b = void 0), c === !1 && (c = ba), this.each(function(){m.event.remove(this, a, c, b)})}, trigger:function(a, b){return this.each(function(){m.event.trigger(a, b, this)})}, triggerHandler:function(a, b){var c = this[0]; return c?m.event.trigger(a, b, c, !0):void 0}}); function da(a){var b = ea.split("|"), c = a.createDocumentFragment(); if (c.createElement)while (b.length)c.createElement(b.pop()); return c}var ea = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", fa = / jQuery\d+="(?:null|\d+)"/g, ga = new RegExp("<(?:" + ea + ")[\\s/>]", "i"), ha = /^\s+/, ia = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, ja = /<([\w:]+)/, ka = /\s*$/g, ra = {option:[1, ""], legend:[1, "
", "
"], area:[1, "", ""], param:[1, "", ""], thead:[1, "", "
"], tr:[2, "", "
"], col:[2, "", "
"], td:[3, "", "
"], _default:k.htmlSerialize?[0, "", ""]:[1, "X
", "
"]}, sa = da(y), ta = sa.appendChild(y.createElement("div")); ra.optgroup = ra.option, ra.tbody = ra.tfoot = ra.colgroup = ra.caption = ra.thead, ra.th = ra.td; function ua(a, b){var c, d, e = 0, f = typeof a.getElementsByTagName !== K?a.getElementsByTagName(b || "*"):typeof a.querySelectorAll !== K?a.querySelectorAll(b || "*"):void 0; if (!f)for (f = [], c = a.childNodes || a; null != (d = c[e]); e++)!b || m.nodeName(d, b)?f.push(d):m.merge(f, ua(d, b)); return void 0 === b || b && m.nodeName(a, b)?m.merge([a], f):f}function va(a){W.test(a.type) && (a.defaultChecked = a.checked)}function wa(a, b){return m.nodeName(a, "table") && m.nodeName(11 !== b.nodeType?b:b.firstChild, "tr")?a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type = (null !== m.find.attr(a, "type")) + "/" + a.type, a}function ya(a){var b = pa.exec(a.type); return b?a.type = b[1]:a.removeAttribute("type"), a}function za(a, b){for (var c, d = 0; null != (c = a[d]); d++)m._data(c, "globalEval", !b || m._data(b[d], "globalEval"))}function Aa(a, b){if (1 === b.nodeType && m.hasData(a)){var c, d, e, f = m._data(a), g = m._data(b, f), h = f.events; if (h){delete g.handle, g.events = {}; for (c in h)for (d = 0, e = h[c].length; e > d; d++)m.event.add(b, c, h[c][d])}g.data && (g.data = m.extend({}, g.data))}}function Ba(a, b){var c, d, e; if (1 === b.nodeType){if (c = b.nodeName.toLowerCase(), !k.noCloneEvent && b[m.expando]){e = m._data(b); for (d in e.events)m.removeEvent(b, d, e.handle); b.removeAttribute(m.expando)}"script" === c && b.text !== a.text?(xa(b).text = a.text, ya(b)):"object" === c?(b.parentNode && (b.outerHTML = a.outerHTML), k.html5Clone && a.innerHTML && !m.trim(b.innerHTML) && (b.innerHTML = a.innerHTML)):"input" === c && W.test(a.type)?(b.defaultChecked = b.checked = a.checked, b.value !== a.value && (b.value = a.value)):"option" === c?b.defaultSelected = b.selected = a.defaultSelected:("input" === c || "textarea" === c) && (b.defaultValue = a.defaultValue)}}m.extend({clone:function(a, b, c){var d, e, f, g, h, i = m.contains(a.ownerDocument, a); if (k.html5Clone || m.isXMLDoc(a) || !ga.test("<" + a.nodeName + ">")?f = a.cloneNode(!0):(ta.innerHTML = a.outerHTML, ta.removeChild(f = ta.firstChild)), !(k.noCloneEvent && k.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || m.isXMLDoc(a)))for (d = ua(f), h = ua(a), g = 0; null != (e = h[g]); ++g)d[g] && Ba(e, d[g]); if (b)if (c)for (h = h || ua(a), d = d || ua(f), g = 0; null != (e = h[g]); g++)Aa(e, d[g]); else Aa(a, f); return d = ua(f, "script"), d.length > 0 && za(d, !i && ua(a, "script")), d = h = e = null, f}, buildFragment:function(a, b, c, d){for (var e, f, g, h, i, j, l, n = a.length, o = da(b), p = [], q = 0; n > q; q++)if (f = a[q], f || 0 === f)if ("object" === m.type(f))m.merge(p, f.nodeType?[f]:f); else if (la.test(f)){h = h || o.appendChild(b.createElement("div")), i = (ja.exec(f) || ["", ""])[1].toLowerCase(), l = ra[i] || ra._default, h.innerHTML = l[1] + f.replace(ia, "<$1>") + l[2], e = l[0]; while (e--)h = h.lastChild; if (!k.leadingWhitespace && ha.test(f) && p.push(b.createTextNode(ha.exec(f)[0])), !k.tbody){f = "table" !== i || ka.test(f)?"" !== l[1] || ka.test(f)?0:h:h.firstChild, e = f && f.childNodes.length; while (e--)m.nodeName(j = f.childNodes[e], "tbody") && !j.childNodes.length && f.removeChild(j)}m.merge(p, h.childNodes), h.textContent = ""; while (h.firstChild)h.removeChild(h.firstChild); h = o.lastChild} else p.push(b.createTextNode(f)); h && o.removeChild(h), k.appendChecked || m.grep(ua(p, "input"), va), q = 0; while (f = p[q++])if ((!d || - 1 === m.inArray(f, d)) && (g = m.contains(f.ownerDocument, f), h = ua(o.appendChild(f), "script"), g && za(h), c)){e = 0; while (f = h[e++])oa.test(f.type || "") && c.push(f)}return h = null, o}, cleanData:function(a, b){for (var d, e, f, g, h = 0, i = m.expando, j = m.cache, l = k.deleteExpando, n = m.event.special; null != (d = a[h]); h++)if ((b || m.acceptData(d)) && (f = d[i], g = f && j[f])){if (g.events)for (e in g.events)n[e]?m.event.remove(d, e):m.removeEvent(d, e, g.handle); j[f] && (delete j[f], l?delete d[i]:typeof d.removeAttribute !== K?d.removeAttribute(i):d[i] = null, c.push(f))}}}), m.fn.extend({text:function(a){return V(this, function(a){return void 0 === a?m.text(this):this.empty().append((this[0] && this[0].ownerDocument || y).createTextNode(a))}, null, a, arguments.length)}, append:function(){return this.domManip(arguments, function(a){if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType){var b = wa(this, a); b.appendChild(a)}})}, prepend:function(){return this.domManip(arguments, function(a){if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType){var b = wa(this, a); b.insertBefore(a, b.firstChild)}})}, before:function(){return this.domManip(arguments, function(a){this.parentNode && this.parentNode.insertBefore(a, this)})}, after:function(){return this.domManip(arguments, function(a){this.parentNode && this.parentNode.insertBefore(a, this.nextSibling)})}, remove:function(a, b){for (var c, d = a?m.filter(a, this):this, e = 0; null != (c = d[e]); e++)b || 1 !== c.nodeType || m.cleanData(ua(c)), c.parentNode && (b && m.contains(c.ownerDocument, c) && za(ua(c, "script")), c.parentNode.removeChild(c)); return this}, empty:function(){for (var a, b = 0; null != (a = this[b]); b++){1 === a.nodeType && m.cleanData(ua(a, !1)); while (a.firstChild)a.removeChild(a.firstChild); a.options && m.nodeName(a, "select") && (a.options.length = 0)}return this}, clone:function(a, b){return a = null == a?!1:a, b = null == b?a:b, this.map(function(){return m.clone(this, a, b)})}, html:function(a){return V(this, function(a){var b = this[0] || {}, c = 0, d = this.length; if (void 0 === a)return 1 === b.nodeType?b.innerHTML.replace(fa, ""):void 0; if (!("string" != typeof a || ma.test(a) || !k.htmlSerialize && ga.test(a) || !k.leadingWhitespace && ha.test(a) || ra[(ja.exec(a) || ["", ""])[1].toLowerCase()])){a = a.replace(ia, "<$1>"); try{for (; d > c; c++)b = this[c] || {}, 1 === b.nodeType && (m.cleanData(ua(b, !1)), b.innerHTML = a); b = 0} catch (e){}}b && this.empty().append(a)}, null, a, arguments.length)}, replaceWith:function(){var a = arguments[0]; return this.domManip(arguments, function(b){a = this.parentNode, m.cleanData(ua(this)), a && a.replaceChild(b, this)}), a && (a.length || a.nodeType)?this:this.remove()}, detach:function(a){return this.remove(a, !0)}, domManip:function(a, b){a = e.apply([], a); var c, d, f, g, h, i, j = 0, l = this.length, n = this, o = l - 1, p = a[0], q = m.isFunction(p); if (q || l > 1 && "string" == typeof p && !k.checkClone && na.test(p))return this.each(function(c){var d = n.eq(c); q && (a[0] = p.call(this, c, d.html())), d.domManip(a, b)}); if (l && (i = m.buildFragment(a, this[0].ownerDocument, !1, this), c = i.firstChild, 1 === i.childNodes.length && (i = c), c)){for (g = m.map(ua(i, "script"), xa), f = g.length; l > j; j++)d = i, j !== o && (d = m.clone(d, !0, !0), f && m.merge(g, ua(d, "script"))), b.call(this[j], d, j); if (f)for (h = g[g.length - 1].ownerDocument, m.map(g, ya), j = 0; f > j; j++)d = g[j], oa.test(d.type || "") && !m._data(d, "globalEval") && m.contains(h, d) && (d.src?m._evalUrl && m._evalUrl(d.src):m.globalEval((d.text || d.textContent || d.innerHTML || "").replace(qa, ""))); i = c = null}return this}}), m.each({appendTo:"append", prependTo:"prepend", insertBefore:"before", insertAfter:"after", replaceAll:"replaceWith"}, function(a, b){m.fn[a] = function(a){for (var c, d = 0, e = [], g = m(a), h = g.length - 1; h >= d; d++)c = d === h?this:this.clone(!0), m(g[d])[b](c), f.apply(e, c.get()); return this.pushStack(e)}}); var Ca, Da = {}; function Ea(b, c){var d, e = m(c.createElement(b)).appendTo(c.body), f = a.getDefaultComputedStyle && (d = a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0], "display"); return e.detach(), f}function Fa(a){var b = y, c = Da[a]; return c || (c = Ea(a, b), "none" !== c && c || (Ca = (Ca || m("