Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Novalnet-Technic committed May 16, 2023
0 parents commit bcd6cad
Show file tree
Hide file tree
Showing 23 changed files with 3,903 additions and 0 deletions.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ZENCART PAYMENT INTEGRATION BY NOVALNET
<a href="https://www.novalnet.com/modul/zencart-payment-module">Zen Cart</a> payment module by Novalnet enables secure integration of payments and payment services for all Zen Cart shops. Novalnet payment module for Zen Cart shop helps merchants to automate payment processing from checkout till collection.

## Integration requirements for Zen Cart
Novalnet <a href="https://www.novalnet.de/"> merchant account </a> is required for processing all international and local payments through this ZenCart Payment Gateway. The module is available for the ZenCart versions 1.5.7f in the following languages: EN & DE

## Key features of ZenCart payment integration
- 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
- Seamless checkout Iframe integration
- One-click shopping enabled for commonly used payment types
- Easy confirmation/cancellation of on-hold transactions for selected payment types
- Refund option for moat of the payment types
- Responsive templates

For detailed documentation and other technical inquiries, please send us an email at <a href="mailto:sales@novalnet.de"> sales@novalnet.de </a>

## Integrated payment methods
- Direct Debit SEPA
- Credit/Debit Cards
- Apple Pay
- Google Pay
- 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
- PostFinance Card
- PostFinance E-Finance
- Bancontact
- Multibanco
- Online bank transfer
- Alipay
- WeChat Pay
- Trustly

## License
See our License Agreement at: https://www.novalnet.com/payment-plugins-free-license/

## Documentation & Support
For more information about the Zen Cart Payment Integration by Novalnet, please get in touch with us: <a href="mailto:sales@novalnet.de"> sales@novalnet.de </a> or +49 89 9230683-20<br>

Novalnet AG<br>
Zahlungsinstitut (ZAG)<br>
Feringastr. 4<br>
85774 Unterföhring<br>
Deutschland<br>
Website: www.novalnet.de

## Who is Novalnet AG?
<p>Novalnet AG is a <a href="https://www.novalnet.de/zahlungsinstitut"> leading financial service institution </a> 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.</p>
<p>Accept, manage and monitor payments all on one platform with one single contract!</p>
<p>Our SaaS engine is <a href="https://www.novalnet.de/pci-dss-zertifizierung"> PCI DSS </a> 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.</p>
16 changes: 16 additions & 0 deletions admin/includes/extra_datafiles/novalnet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Novalnet payment module
*
* This script is used to define Novalnet constants for admin
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet.php
*/
define('TABLE_NOVALNET_TRANSACTION_DETAIL', DB_PREFIX . 'novalnet_transaction_detail');
define('FILENAME_NOVALNET_TRANSACTIONS', 'novalnet_transactions');
define('NOVALNET_MODULE_VERSION', '13.1.0');
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Novalnet payment module
*
* This file is used for register of Novalnet orders
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : reg_novalnet_transactions.php
*/


if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}

if (function_exists('zen_register_admin_page')) {
if (!zen_page_key_exists('customersNovalnetTransactions')) {
zen_register_admin_page('customersNovalnetTransactions', 'BOX_CUSTOMERS_NOVALNET_TRANSACTIONS', 'FILENAME_NOVALNET_TRANSACTIONS','' , 'customers', 'Y', 400);
}
}
12 changes: 12 additions & 0 deletions admin/includes/languages/english/extra_definitions/novalnet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Novalnet payment module
* admin component by webchills (www.webchills.at)
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet.php
*/
define('BOX_CUSTOMERS_NOVALNET_TRANSACTIONS', 'Novalnet Transactions');
48 changes: 48 additions & 0 deletions admin/includes/languages/english/novalnet_transactions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Novalnet payment module
*
* This script is used for displaying English language of
* Novalnet orders in admin component
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet_transactions.php
*/
define('HEADING_ADMIN_TITLE', 'Novalnet Transactions');
define('NOVALNET_ADMIN_INFO', 'For more detailed information on each transaction, please visit the Novalnet Admin Portal.');
define('TABLE_HEADING_ORDER_NUMBER', 'Order Number');
define('TABLE_HEADING_AMOUNT', 'Order Total');
define('NOVALNET_REFUND_AMOUNT', 'Refund Amount');
define('NOVALNET_CALLBACK_AMOUNT', 'Callback Amount');
define('NOVALNET_PAYMENT_TYPE', 'Payment Method');
define('ICON_PREVIEW', 'Preview');
define('TABLE_HEADING_CUSTOMERS', 'Customers');
define('TABLE_HEADING_DATE_PURCHASED', 'Date Purchased');
define('NOVALNET_REFERENCE_ID', 'Novalnet Transaction ID');
define('TABLE_HEADING_TRANSACTION_ID', 'ID');
define('TABLE_HEADING_PAYMENT_TYPE', 'Payment Method');
define('TABLE_HEADING_PAYMENT_STATUS', 'Status');
define('TABLE_HEADING_PAYMENT_MESSAGE', 'Response');
define('TABLE_HEADING_PAYMENT_REFNUM', 'Reference Number');
define('TABLE_HEADING_ACTION', 'Action');
define('MAX_DISPLAY_SEARCH_RESULTS_NOVALNET_IPN', 50);
define('TEXT_INFO_NOVALNET_RESPONSE_BEGIN', 'Novalnet Transaction ');
define('TEXT_INFO_NOVALNET_RESPONSE_END', ' for order ');
define('HEADING_NOVALNET_STATUS', 'Status');
define('TEXT_NOVALNET_SORT_ORDER_INFO', 'Sort Order');
define('TEXT_SORT_NOVALNET_ID_DESC', 'Novalnet Sort Order (new-old)');
define('TEXT_SORT_NOVALNET_ID', 'Novalnet Sort Order (old-new)');
define('TEXT_SORT_ZEN_ORDER_ID_DESC', 'Order Number (new-old)');
define('TEXT_SORT_ZEN_ORDER_ID', 'Order Number (old-new)');
define('TEXT_SORT_NOVALNET_STATUS_DESC', 'Novalnet Transaction Status desc');
define('TEXT_SORT_NOVALNET_STATUS', 'Novalnet Transaction Status asc');
define('TEXT_SORT_NOVALNET_PAYMENT_TYPE_DESC', 'Payment Method desc');
define('TEXT_SORT_NOVALNET_PAYMENT_TYPE', 'Payment Method asc');
define('TEXT_SORT_NOVALNET_STATE', 'Status');
define('TEXT_ALL_IPNS', 'All');
define('NOVALNET_STATUS', 'Novalnet Transaction Status');
define('NOVALNET_VIEW_ORDER', 'View order');
12 changes: 12 additions & 0 deletions admin/includes/languages/german/extra_definitions/novalnet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Novalnet payment module
* admin component by webchills (www.webchills.at)
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet.php
*/
define('BOX_CUSTOMERS_NOVALNET_TRANSACTIONS', 'Novalnet Transaktionen');
49 changes: 49 additions & 0 deletions admin/includes/languages/german/novalnet_transactions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Novalnet payment module
*
* This script is used for displaying German language of
* Novalnet orders in admin component
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet_transactions.php
*/
define('HEADING_ADMIN_TITLE', 'Novalnet Transaktionen');
define('NOVALNET_ADMIN_INFO', 'Ausführlichere Informationen zu den einzelnen Transaktionen finden Sie im Novalnet Admin-Portal.');
define('TABLE_HEADING_ORDER_NUMBER', 'Bestellnummer');
define('TABLE_HEADING_AMOUNT', 'Bestellsumme');
define('NOVALNET_REFUND_AMOUNT', 'Rückerstattungsbetrag');
define('NOVALNET_CALLBACK_AMOUNT', 'Callbackbetrag');
define('NOVALNET_PAYMENT_TYPE', 'Zahlungsart');
define('NOVALNET_REFERENCE_ID', ' Novalnet-Transaktions-ID');
define('TABLE_HEADING_TRANSACTION_ID', 'ID');
define('ICON_PREVIEW', 'Vorschau');
define('TABLE_HEADING_CUSTOMERS','Kunden');
define('TABLE_HEADING_DATE_PURCHASED', 'Bestelldatum');

define('TABLE_HEADING_PAYMENT_TYPE', 'Zahlungsart');
define('TABLE_HEADING_PAYMENT_STATUS', 'Status');
define('TABLE_HEADING_PAYMENT_MESSAGE', 'Rückmeldung');
define('TABLE_HEADING_PAYMENT_REFNUM', 'Referenznummer');
define('TABLE_HEADING_ACTION', 'Aktion');
define('MAX_DISPLAY_SEARCH_RESULTS_NOVALNET_IPN', 50);
define('TEXT_INFO_NOVALNET_RESPONSE_BEGIN', 'Novalnet Transaktion ');
define('TEXT_INFO_NOVALNET_RESPONSE_END', ' für Shopbestellung ');
define('HEADING_NOVALNET_STATUS', 'Status');
define('TEXT_NOVALNET_SORT_ORDER_INFO', 'Anzeigesortierung');
define('TEXT_SORT_NOVALNET_ID_DESC', 'Novalnet Sortierung (neu-alt)');
define('TEXT_SORT_NOVALNET_ID', 'Novalnet Sortierung (alt-neu)');
define('TEXT_SORT_ZEN_ORDER_ID_DESC', 'Bestellnummer (neu-alt)');
define('TEXT_SORT_ZEN_ORDER_ID', 'Bestellnummer (alt-neu)');
define('TEXT_SORT_NOVALNET_STATUS_DESC', 'Novalnet Transaktion Status absteigend');
define('TEXT_SORT_NOVALNET_STATUS', 'Novalnet Transaktion Status aufsteigend');
define('TEXT_SORT_NOVALNET_PAYMENT_TYPE_DESC', 'Zahlungsart absteigend');
define('TEXT_SORT_NOVALNET_PAYMENT_TYPE', 'Zahlungsart aufsteigend');
define('TEXT_SORT_NOVALNET_STATE', 'Status');
define('TEXT_ALL_IPNS', 'Alle');
define('NOVALNET_STATUS', 'Novalnet Transaktion Status');
define('NOVALNET_VIEW_ORDER', 'Bestellung ansehen');
129 changes: 129 additions & 0 deletions admin/novalnet_extension_helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php
/**
* Novalnet payment module
*
* This script is used for helper function of post process instalment
* payment and amount booking
*
* @author Novalnet AG
* @copyright Copyright (c) Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
* @link https://www.novalnet.de
*
* Script : novalnet_extension_helper.php
*
*/
require('includes/application_top.php');
include_once(DIR_FS_CATALOG . DIR_WS_MODULES.'payment/novalnet/NovalnetHelper.php');
include_once(DIR_FS_CATALOG . DIR_WS_LANGUAGES. $_SESSION['language']."/modules/payment/novalnet_payments.php");
include_once DIR_FS_CATALOG . DIR_WS_CLASSES . 'order.php';

global $messageStack, $db;
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

$request = $_REQUEST;

$txn_details = NovalnetHelper::getNovalnetTransDetails($request['oID']);
if ($txn_details->RecordCount()) {
$payment_details = '{}';
$payment_details = !empty($txn_details->fields['payment_details']) ? json_decode($txn_details->fields['payment_details'], true) : [];
$order = new order($request['oID']);
$current_order_status = $db->Execute("SELECT orders_status from " . TABLE_ORDERS . " where orders_id = " . zen_db_input($request['oID']));
$data = [];
$update_data = [];
$response = [];
$message = '';
$order_status_value = $current_order_status->fields['orders_status'];
$data = [
'custom' => [
'lang' => (isset($_SESSION['languages_code'])) ? strtoupper($_SESSION['languages_code']) : 'DE',
'shop_invoked' => 1
]
];
if (!empty($request['nn_book_confirm']) && !empty($request['book_amount'])) { // Zero amount booking transaction process
NovalnetHelper::buildRequestParams($data);
$data['custom']['shop_invoked'] = 1;
$data['transaction']['payment_type'] = $txn_details->fields['payment_type'];
$data['transaction']['amount'] = $request['book_amount'];
$data['transaction']['payment_data']['token'] = $payment_details['token'];
$response = NovalnetHelper::sendRequest($data, NovalnetHelper::getActionEndpoint('payment'));
if ($response['result']['status'] == 'SUCCESS') {
$message = PHP_EOL .PHP_EOL. sprintf(MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE, $currencies->format(($request['book_amount'] / 100), 1, $response['transaction']['currency']), $response['transaction']['tid']) . PHP_EOL;
$update_data = [
'amount' => $response['transaction']['amount'],
'tid' => $response['transaction']['tid'],
];
}
} elseif (!empty($request['nn_instacancel_allcycles']) || !empty($request['nn_instacancel_remaincycles'])) { // Instalment cancel process
$data['instalment'] = [
'tid' => $txn_details->fields['tid'],
'cancel_type' => isset($request['nn_instacancel_allcycles']) ? 'CANCEL_ALL_CYCLES' : 'CANCEL_REMAINING_CYCLES'
];
$response = NovalnetHelper::sendRequest($data, NovalnetHelper::getActionEndpoint('instalment_cancel'));
if ($response['result']['status'] == 'SUCCESS') {
$instalment_details = !empty($txn_details->fields['instalment_cycle_details']) ? json_decode($txn_details->fields['instalment_cycle_details'], true) : [];
foreach ($instalment_details as $cycle => $cycle_details) {
$update_data['status'] = 'CONFIRMED';
$message = PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_REMAINING_CYCLES_TEXT), $txn_details->fields['tid'], date('Y-m-d H:i:s'));
if ($cycle_details['status'] == 'Pending') { // Cancel the instalment cycles if its pending
$instalment_details[$cycle]['status'] = 'Canceled';
}
if (!empty($request['nn_instacancel_allcycles'])) { // If instalment all cycle cancel
$update_data['status'] = 'DEACTIVATED';
$message = PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_ALLCYCLES_TEXT), $txn_details->fields['tid'], date('Y-m-d H:i:s'), $currencies->format(($response['transaction']['refund']['amount']/100), 1, $order->info['currency']));
if ($cycle_details['status'] == 'Paid') { // Refund the instalment cycles if its paid
$instalment_details[$cycle]['status'] = 'Refunded';
}
}
}
$update_data = [
'instalment_cycle_details' => !empty($instalment_details) ? json_encode($instalment_details) : '{}',
];
$order_status_value = !empty($request['nn_instacancel_allcycles']) ? NovalnetHelper::getOrderStatusId() : $current_order_status->fields['orders_status'];
}
} elseif ((!empty($request['nn_refund_confirm']) && ($request['refund_trans_amount'] != '' ) && $txn_details->fields['status'] != 'Canceled')) { // To process instalment payments refund process
$refunded_amount = 0;
$data['transaction'] = [
'tid' => (!empty($request['refund_tid'])) ? $request['refund_tid'] : $txn_details->fields['tid'],
'amount' => $request['refund_trans_amount'],
];
if (!empty($request['refund_reason'])) {
$data['transaction']['reason'] = $request['refund_reason'];
}
$response = NovalnetHelper::sendRequest($data, NovalnetHelper::getActionEndpoint('transaction_refund'));
if ($response['result']['status'] == 'SUCCESS') {
$refunded_amount = $response['transaction']['refund']['amount'];
if (!empty($txn_details->fields['instalment_cycle_details'])) {
$instalment_details = json_decode($txn_details->fields['instalment_cycle_details'], true);
if (!empty($instalment_details)) {
$cycle = $request['instalment_cycle'];
$instalment_amount = (strpos((string)$instalment_details[$cycle]['instalment_cycle_amount'], '.')) ? $instalment_details[$cycle]['instalment_cycle_amount']*100 : $instalment_details[$cycle]['instalment_cycle_amount'];
$instalment_amount = $instalment_amount - $refunded_amount;
$instalment_details[$cycle]['instalment_cycle_amount'] = $instalment_amount;
if ($instalment_details[$cycle]['instalment_cycle_amount'] <= 0) {
$instalment_details[$cycle]['status'] = 'Refunded';
}
$update_data = [
'instalment_cycle_details' => json_encode($instalment_details),
];
}
}
$update_data['refund_amount'] = (!empty($txn_details->fields['refund_amount'])) ? ($refunded_amount + $txn_details->fields['refund_amount']) : $refunded_amount;
$message = PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG), $txn_details->fields['tid'], $currencies->format(($refunded_amount/100), 1, $order->info['currency']));
// Check for refund TID
if (!empty($response['transaction']['refund']['tid'])) {
$message .= PHP_EOL. sprintf((MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG), $response['transaction']['refund']['tid']);
}
$order_status_value = ($update_data['refund_amount'] >= $txn_details->fields['amount']) ? NovalnetHelper::getOrderStatusId() : $current_order_status->fields['orders_status'];
}
}
zen_db_perform(TABLE_NOVALNET_TRANSACTION_DETAIL, $update_data, 'update', 'order_no='.$request['oID']);
if ($response['result']['status'] == 'SUCCESS') {
$messageStack->add_session($response['result']['status_text'], 'success');
} else {
$messageStack->add_session($response['result']['status_text'], 'error');
}
NovalnetHelper::novalnetUpdateOrderStatus($request['oID'], $message, $order_status_value);
zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(['action']) . 'action=edit' . '&oID=' . (int)$request['oID']));
}
Loading

0 comments on commit bcd6cad

Please sign in to comment.