Refactor invoice PDF generation and VAT validation

- Updated PDF template to display a fixed software code instead of "SOFTWARE".
- Changed VAT label to include tax label dynamically and set to 0% for certain conditions.
- Enhanced JavaScript for VAT number validation with asynchronous checks against the VIES database.
- Implemented debounce for VAT number input to optimize validation calls.
- Updated country settings to include country codes for VAT validation.
- Modified email sending functions in webhook handlers to use dynamic attachment names for invoices.
This commit is contained in:
“VeLiTi”
2026-02-06 16:02:56 +01:00
parent 4b83f596f1
commit 3131c2c5b2
12 changed files with 542 additions and 163 deletions

BIN
.DS_Store vendored

Binary file not shown.

86
api/v2/post/vat_check.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
defined($security_key) or exit;
//------------------------------------------
// VAT Number Validation (VIES Proxy)
//------------------------------------------
// CONTENT FROM API (POST)
$post_content = json_decode($input, true);
// Validate input
if (empty($post_content['countryCode']) || empty($post_content['vatNumber'])) {
http_response_code(400);
echo json_encode([
'error' => 'Missing required parameters: countryCode and vatNumber'
]);
exit;
}
$countryCode = strtoupper(trim($post_content['countryCode']));
$vatNumber = $post_content['vatNumber'];
// Remove all whitespace from VAT number
$vatNumber = preg_replace('/\s+/', '', $vatNumber);
// Remove country code prefix if included in VAT number
if (strpos($vatNumber, $countryCode) === 0) {
$vatNumber = substr($vatNumber, strlen($countryCode));
}
// VIES API endpoint
$viesUrl = 'https://ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number';
// Prepare request data
$requestData = json_encode([
'countryCode' => $countryCode,
'vatNumber' => $vatNumber
]);
// Initialize cURL
$ch = curl_init($viesUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json'
]);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 10 second timeout
// Execute request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
// Check for cURL errors
if ($curlError) {
http_response_code(500);
echo json_encode([
'error' => 'Failed to connect to VIES service',
'details' => $curlError
]);
exit;
}
// Parse VIES response regardless of HTTP code
$viesData = json_decode($response, true);
// If we can't parse JSON, return an error
if (json_last_error() !== JSON_ERROR_NONE) {
http_response_code(500);
echo json_encode([
'error' => 'Invalid response from VIES service',
'httpCode' => $httpCode,
'response' => $response
]);
exit;
}
// Always return 200 OK to the client with the VIES data
// The client will check the 'valid' field in the response
http_response_code(200);
echo json_encode($viesData);
?>

View File

@@ -590,7 +590,6 @@ INSERT INTO taxes (country,rate) VALUES
('Tunisia',19.00),
('Algeria',19.00);
INSERT INTO taxes (country,rate) VALUES
('Egypt',14.00),
('Ethiopia',15.00),
('Tanzania',18.00),
('Uganda',18.00),
@@ -923,6 +922,8 @@ WHERE warranty_date IS NOT NULL;
alter table users add refreshkey varchar(255);
alter table taxes add country_code varchar(10);
UPDATE taxes SET eu = 1 WHERE country IN (
'Austria', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czech Republic',
'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece',
@@ -933,4 +934,146 @@ UPDATE taxes SET eu = 1 WHERE country IN (
UPDATE taxes SET rate = 0.00 WHERE eu = 0 OR eu IS NULL;
UPDATE taxes SET country_code = 'AT' WHERE country = 'Austria';
UPDATE taxes SET country_code = 'BE' WHERE country = 'Belgium';
UPDATE taxes SET country_code = 'BG' WHERE country = 'Bulgaria';
UPDATE taxes SET country_code = 'HR' WHERE country = 'Croatia';
UPDATE taxes SET country_code = 'CY' WHERE country = 'Cyprus';
UPDATE taxes SET country_code = 'CZ' WHERE country = 'Czech Republic';
UPDATE taxes SET country_code = 'DK' WHERE country = 'Denmark';
UPDATE taxes SET country_code = 'EE' WHERE country = 'Estonia';
UPDATE taxes SET country_code = 'FI' WHERE country = 'Finland';
UPDATE taxes SET country_code = 'FR' WHERE country = 'France';
UPDATE taxes SET country_code = 'DE' WHERE country = 'Germany';
UPDATE taxes SET country_code = 'GR' WHERE country = 'Greece';
UPDATE taxes SET country_code = 'HU' WHERE country = 'Hungary';
UPDATE taxes SET country_code = 'IE' WHERE country = 'Ireland';
UPDATE taxes SET country_code = 'IT' WHERE country = 'Italy';
UPDATE taxes SET country_code = 'LV' WHERE country = 'Latvia';
UPDATE taxes SET country_code = 'LT' WHERE country = 'Lithuania';
UPDATE taxes SET country_code = 'LU' WHERE country = 'Luxembourg';
UPDATE taxes SET country_code = 'MT' WHERE country = 'Malta';
UPDATE taxes SET country_code = 'NL' WHERE country = 'Netherlands';
UPDATE taxes SET country_code = 'PL' WHERE country = 'Poland';
UPDATE taxes SET country_code = 'PT' WHERE country = 'Portugal';
UPDATE taxes SET country_code = 'RO' WHERE country = 'Romania';
UPDATE taxes SET country_code = 'SK' WHERE country = 'Slovakia';
UPDATE taxes SET country_code = 'SI' WHERE country = 'Slovenia';
UPDATE taxes SET country_code = 'ES' WHERE country = 'Spain';
UPDATE taxes SET country_code = 'SE' WHERE country = 'Sweden';
UPDATE taxes SET country_code = 'GB' WHERE country = 'United Kingdom';
UPDATE taxes SET country_code = 'CH' WHERE country = 'Switzerland';
UPDATE taxes SET country_code = 'NO' WHERE country = 'Norway';
UPDATE taxes SET country_code = 'IS' WHERE country = 'Iceland';
UPDATE taxes SET country_code = 'AL' WHERE country = 'Albania';
UPDATE taxes SET country_code = 'RS' WHERE country = 'Serbia';
UPDATE taxes SET country_code = 'MK' WHERE country = 'North Macedonia';
UPDATE taxes SET country_code = 'BA' WHERE country = 'Bosnia and Herzegovina';
UPDATE taxes SET country_code = 'ME' WHERE country = 'Montenegro';
UPDATE taxes SET country_code = 'MD' WHERE country = 'Moldova';
UPDATE taxes SET country_code = 'UA' WHERE country = 'Ukraine';
UPDATE taxes SET country_code = 'BY' WHERE country = 'Belarus';
UPDATE taxes SET country_code = 'TR' WHERE country = 'Turkey';
UPDATE taxes SET country_code = 'AD' WHERE country = 'Andorra';
UPDATE taxes SET country_code = 'AU' WHERE country = 'Australia';
UPDATE taxes SET country_code = 'NZ' WHERE country = 'New Zealand';
UPDATE taxes SET country_code = 'JP' WHERE country = 'Japan';
UPDATE taxes SET country_code = 'CN' WHERE country = 'China';
UPDATE taxes SET country_code = 'IN' WHERE country = 'India';
UPDATE taxes SET country_code = 'KR' WHERE country = 'South Korea';
UPDATE taxes SET country_code = 'SG' WHERE country = 'Singapore';
UPDATE taxes SET country_code = 'ID' WHERE country = 'Indonesia';
UPDATE taxes SET country_code = 'TH' WHERE country = 'Thailand';
UPDATE taxes SET country_code = 'VN' WHERE country = 'Vietnam';
UPDATE taxes SET country_code = 'PH' WHERE country = 'Philippines';
UPDATE taxes SET country_code = 'MY' WHERE country = 'Malaysia';
UPDATE taxes SET country_code = 'TW' WHERE country = 'Taiwan';
UPDATE taxes SET country_code = 'PK' WHERE country = 'Pakistan';
UPDATE taxes SET country_code = 'BD' WHERE country = 'Bangladesh';
UPDATE taxes SET country_code = 'LK' WHERE country = 'Sri Lanka';
UPDATE taxes SET country_code = 'NP' WHERE country = 'Nepal';
UPDATE taxes SET country_code = 'KH' WHERE country = 'Cambodia';
UPDATE taxes SET country_code = 'MM' WHERE country = 'Myanmar';
UPDATE taxes SET country_code = 'LA' WHERE country = 'Laos';
UPDATE taxes SET country_code = 'MN' WHERE country = 'Mongolia';
UPDATE taxes SET country_code = 'KZ' WHERE country = 'Kazakhstan';
UPDATE taxes SET country_code = 'UZ' WHERE country = 'Uzbekistan';
UPDATE taxes SET country_code = 'AM' WHERE country = 'Armenia';
UPDATE taxes SET country_code = 'GE' WHERE country = 'Georgia';
UPDATE taxes SET country_code = 'AZ' WHERE country = 'Azerbaijan';
UPDATE taxes SET country_code = 'FJ' WHERE country = 'Fiji';
UPDATE taxes SET country_code = 'PG' WHERE country = 'Papua New Guinea';
UPDATE taxes SET country_code = 'WS' WHERE country = 'Samoa';
UPDATE taxes SET country_code = 'TO' WHERE country = 'Tonga';
UPDATE taxes SET country_code = 'VU' WHERE country = 'Vanuatu';
UPDATE taxes SET country_code = 'BT' WHERE country = 'Bhutan';
UPDATE taxes SET country_code = 'SA' WHERE country = 'Saudi Arabia';
UPDATE taxes SET country_code = 'AE' WHERE country = 'United Arab Emirates';
UPDATE taxes SET country_code = 'BH' WHERE country = 'Bahrain';
UPDATE taxes SET country_code = 'KW' WHERE country = 'Kuwait';
UPDATE taxes SET country_code = 'OM' WHERE country = 'Oman';
UPDATE taxes SET country_code = 'QA' WHERE country = 'Qatar';
UPDATE taxes SET country_code = 'IL' WHERE country = 'Israel';
UPDATE taxes SET country_code = 'JO' WHERE country = 'Jordan';
UPDATE taxes SET country_code = 'LB' WHERE country = 'Lebanon';
UPDATE taxes SET country_code = 'EG' WHERE country = 'Egypt';
UPDATE taxes SET country_code = 'ZA' WHERE country = 'South Africa';
UPDATE taxes SET country_code = 'NG' WHERE country = 'Nigeria';
UPDATE taxes SET country_code = 'KE' WHERE country = 'Kenya';
UPDATE taxes SET country_code = 'GH' WHERE country = 'Ghana';
UPDATE taxes SET country_code = 'MA' WHERE country = 'Morocco';
UPDATE taxes SET country_code = 'TN' WHERE country = 'Tunisia';
UPDATE taxes SET country_code = 'DZ' WHERE country = 'Algeria';
UPDATE taxes SET country_code = 'ET' WHERE country = 'Ethiopia';
UPDATE taxes SET country_code = 'TZ' WHERE country = 'Tanzania';
UPDATE taxes SET country_code = 'UG' WHERE country = 'Uganda';
UPDATE taxes SET country_code = 'ZW' WHERE country = 'Zimbabwe';
UPDATE taxes SET country_code = 'ZM' WHERE country = 'Zambia';
UPDATE taxes SET country_code = 'BW' WHERE country = 'Botswana';
UPDATE taxes SET country_code = 'MU' WHERE country = 'Mauritius';
UPDATE taxes SET country_code = 'NA' WHERE country = 'Namibia';
UPDATE taxes SET country_code = 'RW' WHERE country = 'Rwanda';
UPDATE taxes SET country_code = 'SN' WHERE country = 'Senegal';
UPDATE taxes SET country_code = 'CI' WHERE country = 'Ivory Coast';
UPDATE taxes SET country_code = 'CM' WHERE country = 'Cameroon';
UPDATE taxes SET country_code = 'AO' WHERE country = 'Angola';
UPDATE taxes SET country_code = 'MZ' WHERE country = 'Mozambique';
UPDATE taxes SET country_code = 'MG' WHERE country = 'Madagascar';
UPDATE taxes SET country_code = 'ML' WHERE country = 'Mali';
UPDATE taxes SET country_code = 'BF' WHERE country = 'Burkina Faso';
UPDATE taxes SET country_code = 'NE' WHERE country = 'Niger';
UPDATE taxes SET country_code = 'BJ' WHERE country = 'Benin';
UPDATE taxes SET country_code = 'TG' WHERE country = 'Togo';
UPDATE taxes SET country_code = 'GN' WHERE country = 'Guinea';
UPDATE taxes SET country_code = 'MW' WHERE country = 'Malawi';
UPDATE taxes SET country_code = 'GA' WHERE country = 'Gabon';
UPDATE taxes SET country_code = 'MR' WHERE country = 'Mauritania';
UPDATE taxes SET country_code = 'LS' WHERE country = 'Lesotho';
UPDATE taxes SET country_code = 'SZ' WHERE country = 'Eswatini';
UPDATE taxes SET country_code = 'LR' WHERE country = 'Liberia';
UPDATE taxes SET country_code = 'CA' WHERE country = 'Canada';
UPDATE taxes SET country_code = 'US' WHERE country = 'United States';
UPDATE taxes SET country_code = 'MX' WHERE country = 'Mexico';
UPDATE taxes SET country_code = 'AR' WHERE country = 'Argentina';
UPDATE taxes SET country_code = 'BR' WHERE country = 'Brazil';
UPDATE taxes SET country_code = 'CL' WHERE country = 'Chile';
UPDATE taxes SET country_code = 'CO' WHERE country = 'Colombia';
UPDATE taxes SET country_code = 'PE' WHERE country = 'Peru';
UPDATE taxes SET country_code = 'EC' WHERE country = 'Ecuador';
UPDATE taxes SET country_code = 'UY' WHERE country = 'Uruguay';
UPDATE taxes SET country_code = 'PY' WHERE country = 'Paraguay';
UPDATE taxes SET country_code = 'BO' WHERE country = 'Bolivia';
UPDATE taxes SET country_code = 'VE' WHERE country = 'Venezuela';
UPDATE taxes SET country_code = 'CR' WHERE country = 'Costa Rica';
UPDATE taxes SET country_code = 'PA' WHERE country = 'Panama';
UPDATE taxes SET country_code = 'GT' WHERE country = 'Guatemala';
UPDATE taxes SET country_code = 'HN' WHERE country = 'Honduras';
UPDATE taxes SET country_code = 'SV' WHERE country = 'El Salvador';
UPDATE taxes SET country_code = 'NI' WHERE country = 'Nicaragua';
UPDATE taxes SET country_code = 'DO' WHERE country = 'Dominican Republic';
UPDATE taxes SET country_code = 'JM' WHERE country = 'Jamaica';
UPDATE taxes SET country_code = 'TT' WHERE country = 'Trinidad and Tobago';
UPDATE taxes SET country_code = 'BB' WHERE country = 'Barbados';
UPDATE taxes SET country_code = 'BS' WHERE country = 'Bahamas';
SET FOREIGN_KEY_CHECKS=1;

View File

@@ -1735,7 +1735,8 @@ function getProfile($profile, $permission){
'software_download' => 'R',
'software_available' => 'R',
'history' => 'RU',
'payment' => 'RU'
'payment' => 'RU',
'vat_check' => 'RU'
];
// 1. Check if basic_permission_level is 4 (System-admin+) - always allow
@@ -5725,7 +5726,7 @@ function generateSoftwareInvoice($invoice_data, $order_id, $language = 'US') {
$lbl_quantity = $translations['quantity'] ?? 'Quantity';
$lbl_price = $translations['price'] ?? 'Price';
$lbl_subtotal = $translations['subtotal'] ?? 'Subtotal';
$lbl_tax = $translations['tax'] ?? 'Tax';
$lbl_tax = $translations['tax'] ?? 'Vat';
$lbl_shipping = $translations['shipping'] ?? 'Shipping';
$lbl_discount = $translations['discount'] ?? 'Discount';
$lbl_total = $translations['total'] ?? 'Total';
@@ -5865,7 +5866,8 @@ function generateCountriesFile($token){
$countries[$tax['id']] = [
'country' => $tax['country'] ?? '',
'taxes' => $tax['rate'] ?? 0,
'eu' => $tax['eu'] ?? 0
'eu' => $tax['eu'] ?? 0,
'country_code' => $tax['country_code'] ?? ''
];
}
@@ -5875,7 +5877,7 @@ function generateCountriesFile($token){
$fileContent .= "// Generated on: " . date('Y-m-d H:i:s') . "\n\n";
$fileContent .= "\$countries = [\n";
foreach($countries as $id => $data){
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . "],\n";
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . ", 'country_code' => '" . addslashes($data['country_code']) . "'],\n";
}
$fileContent .= "];\n";

View File

@@ -70,7 +70,7 @@ $message = '
<td style="padding: 3px 0;">' . htmlspecialchars($order_id) . '</td>
</tr>
<tr>
<td style="padding: 3px 0;"><strong>Payment Methodr:</strong></td>
<td style="padding: 3px 0;"><strong>Payment Method:</strong></td>
<td style="padding: 3px 0;">' . (${$payment_method} ?? $invoice_data['header']['payment_method'] ). '</td>
</tr>
</table>
@@ -94,7 +94,7 @@ $message = '
foreach ($items as $item) {
$line_total = $item['price'] * $item['quantity'];
$message .= '<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">SOFTWARE</td>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">110.600.000</td>
<td style="padding: 10px 8px; border-bottom: 1px solid #dddddd; font-size: 13px;">' . htmlspecialchars($item['name']);
if ($item['serial_number'] !== 'N/A') {
@@ -132,7 +132,7 @@ if ($tax_amount > 0) {
<td style="text-align: right; padding: 5px 0;">€ ' . number_format($tax_amount, 2) . '</td>
</tr>';
} else {
$vat_label = 'VAT';
$vat_label = htmlspecialchars($lbl_tax) . ' (0%)';
if (!empty($vat_note)) {
$vat_label .= ' <small style="font-size: 11px; color: #888;">(' . htmlspecialchars($vat_note) . ')</small>';
}

View File

@@ -271,7 +271,7 @@ $pdf = '<!DOCTYPE html>
foreach ($items as $item) {
$line_total = $item['price'] * $item['quantity'];
$pdf .= '<tr>
<td>SOFTWARE</td>
<td>110.600.000</td>
<td>' . htmlspecialchars($item['name']);
if ($item['serial_number'] !== 'N/A') {
@@ -308,7 +308,7 @@ $pdf .= '</tbody>
<div class="total-amount">€ ' . number_format($tax_amount, 2) . '</div>
</div>';
} else {
$vat_label = 'VAT';
$vat_label = htmlspecialchars($lbl_tax) . ' (0%)';
if (!empty($vat_note)) {
$vat_label .= ' <small style="font-size: 9px; color: #666;">(' . htmlspecialchars($vat_note) . ')</small>';
}

View File

@@ -1482,6 +1482,48 @@ function showPaymentModal(option) {
modal.appendChild(modalContent);
document.body.appendChild(modal);
// VAT number validation state
let vatValidationInProgress = false;
let vatValidationResult = null;
// Function to check VAT number against VIES database (via server-side proxy)
async function checkVATNumber(countryCode, vatNumber) {
if (!countryCode || !vatNumber) {
return null;
}
// Use server-side proxy to avoid CORS issues
const serviceToken = document.getElementById("servicetoken")?.innerHTML || '';
const url = link + '/v2/vat_check';
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer ' + serviceToken
},
body: JSON.stringify({
countryCode: countryCode,
vatNumber: vatNumber
})
});
if (!response.ok) {
console.warn('VAT check HTTP error:', response.status);
return null;
}
const data = await response.json();
console.log('VIES response:', data);
return data;
} catch (error) {
console.error('Error checking VAT:', error);
return null;
}
}
// Function to calculate and update tax
function updateTaxDisplay() {
const selectedCountry = document.getElementById("paymentCountry").value;
@@ -1500,12 +1542,12 @@ function showPaymentModal(option) {
// Netherlands: always take the tax percentage
taxRate = countryTaxRate;
} else if (isEU) {
if (vatNumber) {
// EU with VAT number: 0% VAT, reverse charge
if (vatNumber && vatValidationResult && vatValidationResult.valid === true) {
// EU with VALID VAT number: 0% VAT, reverse charge
taxRate = 0;
vatNote = 'Reverse charge VAT';
} else {
// EU without VAT number: use country VAT
// EU without VAT number or invalid VAT: use country VAT
taxRate = countryTaxRate;
vatNote = 'Local VAT';
}
@@ -1564,9 +1606,112 @@ function showPaymentModal(option) {
}
}
// Debounce timer for VAT validation
let vatValidationTimeout = null;
// Function to validate VAT number with visual feedback
async function validateVATNumber() {
const selectedCountry = document.getElementById("paymentCountry").value;
const vatNumber = document.getElementById("paymentVatNumber").value.trim();
const vatInput = document.getElementById("paymentVatNumber");
// Reset validation state
vatValidationResult = null;
vatInput.style.borderColor = '';
// Remove any existing validation message
const existingMessage = document.getElementById('vatValidationMessage');
if (existingMessage) {
existingMessage.remove();
}
if (!vatNumber) {
updateTaxDisplay();
return;
}
if (!selectedCountry || typeof COUNTRIES === 'undefined' || !COUNTRIES) {
updateTaxDisplay();
return;
}
const countryData = Object.values(COUNTRIES).find(c => c.country === selectedCountry);
if (!countryData || countryData.eu !== 1 || !countryData.country_code) {
updateTaxDisplay();
return;
}
// For Netherlands, don't validate VAT (always apply VAT)
if (selectedCountry === 'Netherlands') {
updateTaxDisplay();
return;
}
// Show validating state
vatInput.style.borderColor = '#ffc107';
vatValidationInProgress = true;
const validationMsg = document.createElement('div');
validationMsg.id = 'vatValidationMessage';
validationMsg.style.cssText = 'margin-top: 5px; font-size: 12px; color: #ffc107;';
validationMsg.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Validating VAT number...';
vatInput.parentNode.appendChild(validationMsg);
// Call VIES API
const result = await checkVATNumber(countryData.country_code, vatNumber);
vatValidationInProgress = false;
if (result && result.valid === true) {
// VAT number is valid
vatValidationResult = result;
vatInput.style.borderColor = '#28a745';
validationMsg.style.color = '#28a745';
validationMsg.innerHTML = '<i class="fa-solid fa-check-circle"></i> Valid VAT number';
// Format VAT number as CountryCode + VatNumber (e.g., DE115235681)
const formattedVAT = result.countryCode + result.vatNumber;
if (vatInput.value !== formattedVAT) {
vatInput.value = formattedVAT;
}
} else {
// VAT number is invalid or check failed
vatValidationResult = null;
vatInput.style.borderColor = '#dc3545';
validationMsg.style.color = '#dc3545';
validationMsg.innerHTML = '<i class="fa-solid fa-times-circle"></i> Invalid VAT number or validation failed';
}
// Update tax display with new validation result
updateTaxDisplay();
}
// Add event listeners to country select and VAT number to update tax
document.getElementById("paymentCountry").addEventListener('change', updateTaxDisplay);
document.getElementById("paymentVatNumber").addEventListener('input', updateTaxDisplay);
document.getElementById("paymentCountry").addEventListener('change', () => {
vatValidationResult = null;
const vatInput = document.getElementById("paymentVatNumber");
vatInput.style.borderColor = '';
const existingMessage = document.getElementById('vatValidationMessage');
if (existingMessage) {
existingMessage.remove();
}
updateTaxDisplay();
// Validate VAT if already entered
if (vatInput.value.trim()) {
if (vatValidationTimeout) {
clearTimeout(vatValidationTimeout);
}
vatValidationTimeout = setTimeout(validateVATNumber, 500);
}
});
document.getElementById("paymentVatNumber").addEventListener('input', () => {
// Debounce VAT validation
if (vatValidationTimeout) {
clearTimeout(vatValidationTimeout);
}
vatValidationTimeout = setTimeout(validateVATNumber, 1000);
});
// Close modal on cancel
document.getElementById("cancelPayment").onclick = () => {

View File

@@ -4,8 +4,9 @@ defined(page_security_key) or exit;
//=============================
// Configuration file
//=============================
$domain = getDomainName($_SERVER['SERVER_NAME']);
$file = ((file_exists(dirname(__FILE__).'/custom/'.$domain.'/settings/'.$domain.'_config.php')) ? dirname(__FILE__).'/custom/'.$domain.'/settings/'.$domain.'_config.php' : dirname(__FILE__).'/settings/config.php');
$env = getenv('APP_ENV') ?: 'development';
$file = ((file_exists(dirname(__FILE__).'/custom/'.$env.'/settings/'.$env.'_config.php')) ? dirname(__FILE__).'/custom/'.$env.'/settings/'.$env.'_config.php' : dirname(__FILE__).'/settings/'.$env.'_config.php');
//Check if allowed
if (isAllowed('settings',$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){

BIN
settings/.DS_Store vendored

Binary file not shown.

View File

@@ -3,146 +3,146 @@
// Generated on: 2026-02-05 14:44:35
$countries = [
1 => ['country' => 'Austria', 'taxes' => 20.00,'eu' => 1],
2 => ['country' => 'Belgium', 'taxes' => 21.00,'eu' => 1],
3 => ['country' => 'Bulgaria', 'taxes' => 20.00,'eu' => 1],
4 => ['country' => 'Croatia', 'taxes' => 25.00,'eu' => 1],
5 => ['country' => 'Cyprus', 'taxes' => 19.00,'eu' => 1],
6 => ['country' => 'Czech Republic', 'taxes' => 21.00,'eu' => 1],
7 => ['country' => 'Denmark', 'taxes' => 25.00,'eu' => 1],
8 => ['country' => 'Estonia', 'taxes' => 24.00,'eu' => 1],
9 => ['country' => 'Finland', 'taxes' => 25.50,'eu' => 1],
10 => ['country' => 'France', 'taxes' => 20.00,'eu' => 1],
11 => ['country' => 'Germany', 'taxes' => 19.00,'eu' => 1],
12 => ['country' => 'Greece', 'taxes' => 24.00,'eu' => 1],
13 => ['country' => 'Hungary', 'taxes' => 27.00,'eu' => 1],
14 => ['country' => 'Ireland', 'taxes' => 23.00,'eu' => 1],
15 => ['country' => 'Italy', 'taxes' => 22.00,'eu' => 1],
16 => ['country' => 'Latvia', 'taxes' => 21.00,'eu' => 1],
17 => ['country' => 'Lithuania', 'taxes' => 21.00,'eu' => 1],
18 => ['country' => 'Luxembourg', 'taxes' => 16.00,'eu' => 1],
19 => ['country' => 'Malta', 'taxes' => 18.00,'eu' => 1],
20 => ['country' => 'Netherlands', 'taxes' => 21.00,'eu' => 1],
21 => ['country' => 'Poland', 'taxes' => 23.00,'eu' => 1],
22 => ['country' => 'Portugal', 'taxes' => 23.00,'eu' => 1],
23 => ['country' => 'Romania', 'taxes' => 19.00,'eu' => 1],
24 => ['country' => 'Slovakia', 'taxes' => 23.00,'eu' => 1],
25 => ['country' => 'Slovenia', 'taxes' => 22.00,'eu' => 1],
26 => ['country' => 'Spain', 'taxes' => 21.00,'eu' => 1],
27 => ['country' => 'Sweden', 'taxes' => 25.00,'eu' => 1],
28 => ['country' => 'United Kingdom', 'taxes' => 0.00,'eu' => 0],
29 => ['country' => 'Switzerland', 'taxes' => 0.00,'eu' => 0],
30 => ['country' => 'Norway', 'taxes' => 0.00,'eu' => 0],
31 => ['country' => 'Iceland', 'taxes' => 0.00,'eu' => 0],
32 => ['country' => 'Albania', 'taxes' => 0.00,'eu' => 0],
33 => ['country' => 'Serbia', 'taxes' => 0.00,'eu' => 0],
34 => ['country' => 'North Macedonia', 'taxes' => 0.00,'eu' => 0],
35 => ['country' => 'Bosnia and Herzegovina', 'taxes' => 0.00,'eu' => 0],
36 => ['country' => 'Montenegro', 'taxes' => 0.00,'eu' => 0],
37 => ['country' => 'Moldova', 'taxes' => 0.00,'eu' => 0],
38 => ['country' => 'Ukraine', 'taxes' => 0.00,'eu' => 0],
39 => ['country' => 'Belarus', 'taxes' => 0.00,'eu' => 0],
40 => ['country' => 'Turkey', 'taxes' => 0.00,'eu' => 0],
41 => ['country' => 'Andorra', 'taxes' => 0.00,'eu' => 0],
42 => ['country' => 'Australia', 'taxes' => 0.00,'eu' => 0],
43 => ['country' => 'New Zealand', 'taxes' => 0.00,'eu' => 0],
44 => ['country' => 'Japan', 'taxes' => 0.00,'eu' => 0],
45 => ['country' => 'China', 'taxes' => 0.00,'eu' => 0],
46 => ['country' => 'India', 'taxes' => 0.00,'eu' => 0],
47 => ['country' => 'South Korea', 'taxes' => 0.00,'eu' => 0],
48 => ['country' => 'Singapore', 'taxes' => 0.00,'eu' => 0],
49 => ['country' => 'Indonesia', 'taxes' => 0.00,'eu' => 0],
50 => ['country' => 'Thailand', 'taxes' => 0.00,'eu' => 0],
51 => ['country' => 'Vietnam', 'taxes' => 0.00,'eu' => 0],
52 => ['country' => 'Philippines', 'taxes' => 0.00,'eu' => 0],
53 => ['country' => 'Malaysia', 'taxes' => 0.00,'eu' => 0],
54 => ['country' => 'Taiwan', 'taxes' => 0.00,'eu' => 0],
55 => ['country' => 'Pakistan', 'taxes' => 0.00,'eu' => 0],
56 => ['country' => 'Bangladesh', 'taxes' => 0.00,'eu' => 0],
57 => ['country' => 'Sri Lanka', 'taxes' => 0.00,'eu' => 0],
58 => ['country' => 'Nepal', 'taxes' => 0.00,'eu' => 0],
59 => ['country' => 'Cambodia', 'taxes' => 0.00,'eu' => 0],
60 => ['country' => 'Myanmar', 'taxes' => 0.00,'eu' => 0],
61 => ['country' => 'Laos', 'taxes' => 0.00,'eu' => 0],
62 => ['country' => 'Mongolia', 'taxes' => 0.00,'eu' => 0],
63 => ['country' => 'Kazakhstan', 'taxes' => 0.00,'eu' => 0],
64 => ['country' => 'Uzbekistan', 'taxes' => 0.00,'eu' => 0],
65 => ['country' => 'Armenia', 'taxes' => 0.00,'eu' => 0],
66 => ['country' => 'Georgia', 'taxes' => 0.00,'eu' => 0],
67 => ['country' => 'Azerbaijan', 'taxes' => 0.00,'eu' => 0],
68 => ['country' => 'Fiji', 'taxes' => 0.00,'eu' => 0],
69 => ['country' => 'Papua New Guinea', 'taxes' => 0.00,'eu' => 0],
70 => ['country' => 'Samoa', 'taxes' => 0.00,'eu' => 0],
71 => ['country' => 'Tonga', 'taxes' => 0.00,'eu' => 0],
72 => ['country' => 'Vanuatu', 'taxes' => 0.00,'eu' => 0],
73 => ['country' => 'Bhutan', 'taxes' => 0.00,'eu' => 0],
74 => ['country' => 'Saudi Arabia', 'taxes' => 0.00,'eu' => 0],
75 => ['country' => 'United Arab Emirates', 'taxes' => 0.00,'eu' => 0],
76 => ['country' => 'Bahrain', 'taxes' => 0.00,'eu' => 0],
77 => ['country' => 'Kuwait', 'taxes' => 0.00,'eu' => 0],
78 => ['country' => 'Oman', 'taxes' => 0.00,'eu' => 0],
79 => ['country' => 'Qatar', 'taxes' => 0.00,'eu' => 0],
80 => ['country' => 'Israel', 'taxes' => 0.00,'eu' => 0],
81 => ['country' => 'Jordan', 'taxes' => 0.00,'eu' => 0],
82 => ['country' => 'Lebanon', 'taxes' => 0.00,'eu' => 0],
83 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0],
85 => ['country' => 'South Africa', 'taxes' => 0.00,'eu' => 0],
86 => ['country' => 'Nigeria', 'taxes' => 0.00,'eu' => 0],
87 => ['country' => 'Kenya', 'taxes' => 0.00,'eu' => 0],
88 => ['country' => 'Ghana', 'taxes' => 0.00,'eu' => 0],
89 => ['country' => 'Morocco', 'taxes' => 0.00,'eu' => 0],
90 => ['country' => 'Tunisia', 'taxes' => 0.00,'eu' => 0],
91 => ['country' => 'Algeria', 'taxes' => 0.00,'eu' => 0],
92 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0],
93 => ['country' => 'Ethiopia', 'taxes' => 0.00,'eu' => 0],
94 => ['country' => 'Tanzania', 'taxes' => 0.00,'eu' => 0],
95 => ['country' => 'Uganda', 'taxes' => 0.00,'eu' => 0],
96 => ['country' => 'Zimbabwe', 'taxes' => 0.00,'eu' => 0],
97 => ['country' => 'Zambia', 'taxes' => 0.00,'eu' => 0],
98 => ['country' => 'Botswana', 'taxes' => 0.00,'eu' => 0],
99 => ['country' => 'Mauritius', 'taxes' => 0.00,'eu' => 0],
100 => ['country' => 'Namibia', 'taxes' => 0.00,'eu' => 0],
101 => ['country' => 'Rwanda', 'taxes' => 0.00,'eu' => 0],
102 => ['country' => 'Senegal', 'taxes' => 0.00,'eu' => 0],
103 => ['country' => 'Ivory Coast', 'taxes' => 0.00,'eu' => 0],
104 => ['country' => 'Cameroon', 'taxes' => 0.00,'eu' => 0],
105 => ['country' => 'Angola', 'taxes' => 0.00,'eu' => 0],
106 => ['country' => 'Mozambique', 'taxes' => 0.00,'eu' => 0],
107 => ['country' => 'Madagascar', 'taxes' => 0.00,'eu' => 0],
108 => ['country' => 'Mali', 'taxes' => 0.00,'eu' => 0],
109 => ['country' => 'Burkina Faso', 'taxes' => 0.00,'eu' => 0],
110 => ['country' => 'Niger', 'taxes' => 0.00,'eu' => 0],
111 => ['country' => 'Benin', 'taxes' => 0.00,'eu' => 0],
112 => ['country' => 'Togo', 'taxes' => 0.00,'eu' => 0],
113 => ['country' => 'Guinea', 'taxes' => 0.00,'eu' => 0],
114 => ['country' => 'Malawi', 'taxes' => 0.00,'eu' => 0],
115 => ['country' => 'Gabon', 'taxes' => 0.00,'eu' => 0],
116 => ['country' => 'Mauritania', 'taxes' => 0.00,'eu' => 0],
117 => ['country' => 'Lesotho', 'taxes' => 0.00,'eu' => 0],
118 => ['country' => 'Eswatini', 'taxes' => 0.00,'eu' => 0],
119 => ['country' => 'Liberia', 'taxes' => 0.00,'eu' => 0],
120 => ['country' => 'Canada', 'taxes' => 0.00,'eu' => 0],
121 => ['country' => 'United States', 'taxes' => 0.00,'eu' => 0],
122 => ['country' => 'Mexico', 'taxes' => 0.00,'eu' => 0],
123 => ['country' => 'Argentina', 'taxes' => 0.00,'eu' => 0],
124 => ['country' => 'Brazil', 'taxes' => 0.00,'eu' => 0],
125 => ['country' => 'Chile', 'taxes' => 0.00,'eu' => 0],
126 => ['country' => 'Colombia', 'taxes' => 0.00,'eu' => 0],
127 => ['country' => 'Peru', 'taxes' => 0.00,'eu' => 0],
128 => ['country' => 'Ecuador', 'taxes' => 0.00,'eu' => 0],
129 => ['country' => 'Uruguay', 'taxes' => 0.00,'eu' => 0],
130 => ['country' => 'Paraguay', 'taxes' => 0.00,'eu' => 0],
131 => ['country' => 'Bolivia', 'taxes' => 0.00,'eu' => 0],
132 => ['country' => 'Venezuela', 'taxes' => 0.00,'eu' => 0],
133 => ['country' => 'Costa Rica', 'taxes' => 0.00,'eu' => 0],
134 => ['country' => 'Panama', 'taxes' => 0.00,'eu' => 0],
135 => ['country' => 'Guatemala', 'taxes' => 0.00,'eu' => 0],
136 => ['country' => 'Honduras', 'taxes' => 0.00,'eu' => 0],
137 => ['country' => 'El Salvador', 'taxes' => 0.00,'eu' => 0],
138 => ['country' => 'Nicaragua', 'taxes' => 0.00,'eu' => 0],
139 => ['country' => 'Dominican Republic', 'taxes' => 0.00,'eu' => 0],
140 => ['country' => 'Jamaica', 'taxes' => 0.00,'eu' => 0],
141 => ['country' => 'Trinidad and Tobago', 'taxes' => 0.00,'eu' => 0],
142 => ['country' => 'Barbados', 'taxes' => 0.00,'eu' => 0],
143 => ['country' => 'Bahamas', 'taxes' => 0.00,'eu' => 0],
1 => ['country' => 'Austria', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'AT'],
2 => ['country' => 'Belgium', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'BE'],
3 => ['country' => 'Bulgaria', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'BG'],
4 => ['country' => 'Croatia', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'HR'],
5 => ['country' => 'Cyprus', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'CY'],
6 => ['country' => 'Czech Republic', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'CZ'],
7 => ['country' => 'Denmark', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'DK'],
8 => ['country' => 'Estonia', 'taxes' => 24.00,'eu' => 1, 'country_code' => 'EE'],
9 => ['country' => 'Finland', 'taxes' => 25.50,'eu' => 1, 'country_code' => 'FI'],
10 => ['country' => 'France', 'taxes' => 20.00,'eu' => 1, 'country_code' => 'FR'],
11 => ['country' => 'Germany', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'DE'],
12 => ['country' => 'Greece', 'taxes' => 24.00,'eu' => 1, 'country_code' => 'GR'],
13 => ['country' => 'Hungary', 'taxes' => 27.00,'eu' => 1, 'country_code' => 'HU'],
14 => ['country' => 'Ireland', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'IE'],
15 => ['country' => 'Italy', 'taxes' => 22.00,'eu' => 1, 'country_code' => 'IT'],
16 => ['country' => 'Latvia', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'LV'],
17 => ['country' => 'Lithuania', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'LT'],
18 => ['country' => 'Luxembourg', 'taxes' => 16.00,'eu' => 1, 'country_code' => 'LU'],
19 => ['country' => 'Malta', 'taxes' => 18.00,'eu' => 1, 'country_code' => 'MT'],
20 => ['country' => 'Netherlands', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'NL'],
21 => ['country' => 'Poland', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'PL'],
22 => ['country' => 'Portugal', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'PT'],
23 => ['country' => 'Romania', 'taxes' => 19.00,'eu' => 1, 'country_code' => 'RO'],
24 => ['country' => 'Slovakia', 'taxes' => 23.00,'eu' => 1, 'country_code' => 'SK'],
25 => ['country' => 'Slovenia', 'taxes' => 22.00,'eu' => 1, 'country_code' => 'SI'],
26 => ['country' => 'Spain', 'taxes' => 21.00,'eu' => 1, 'country_code' => 'ES'],
27 => ['country' => 'Sweden', 'taxes' => 25.00,'eu' => 1, 'country_code' => 'SE'],
28 => ['country' => 'United Kingdom', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
29 => ['country' => 'Switzerland', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
30 => ['country' => 'Norway', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
31 => ['country' => 'Iceland', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
32 => ['country' => 'Albania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
33 => ['country' => 'Serbia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
34 => ['country' => 'North Macedonia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
35 => ['country' => 'Bosnia and Herzegovina', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
36 => ['country' => 'Montenegro', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
37 => ['country' => 'Moldova', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
38 => ['country' => 'Ukraine', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
39 => ['country' => 'Belarus', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
40 => ['country' => 'Turkey', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
41 => ['country' => 'Andorra', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
42 => ['country' => 'Australia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
43 => ['country' => 'New Zealand', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
44 => ['country' => 'Japan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
45 => ['country' => 'China', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
46 => ['country' => 'India', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
47 => ['country' => 'South Korea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
48 => ['country' => 'Singapore', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
49 => ['country' => 'Indonesia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
50 => ['country' => 'Thailand', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
51 => ['country' => 'Vietnam', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
52 => ['country' => 'Philippines', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
53 => ['country' => 'Malaysia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
54 => ['country' => 'Taiwan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
55 => ['country' => 'Pakistan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
56 => ['country' => 'Bangladesh', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
57 => ['country' => 'Sri Lanka', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
58 => ['country' => 'Nepal', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
59 => ['country' => 'Cambodia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
60 => ['country' => 'Myanmar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
61 => ['country' => 'Laos', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
62 => ['country' => 'Mongolia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
63 => ['country' => 'Kazakhstan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
64 => ['country' => 'Uzbekistan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
65 => ['country' => 'Armenia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
66 => ['country' => 'Georgia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
67 => ['country' => 'Azerbaijan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
68 => ['country' => 'Fiji', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
69 => ['country' => 'Papua New Guinea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
70 => ['country' => 'Samoa', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
71 => ['country' => 'Tonga', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
72 => ['country' => 'Vanuatu', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
73 => ['country' => 'Bhutan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
74 => ['country' => 'Saudi Arabia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
75 => ['country' => 'United Arab Emirates', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
76 => ['country' => 'Bahrain', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
77 => ['country' => 'Kuwait', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
78 => ['country' => 'Oman', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
79 => ['country' => 'Qatar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
80 => ['country' => 'Israel', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
81 => ['country' => 'Jordan', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
82 => ['country' => 'Lebanon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
83 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
85 => ['country' => 'South Africa', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
86 => ['country' => 'Nigeria', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
87 => ['country' => 'Kenya', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
88 => ['country' => 'Ghana', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
89 => ['country' => 'Morocco', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
90 => ['country' => 'Tunisia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
91 => ['country' => 'Algeria', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
92 => ['country' => 'Egypt', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
93 => ['country' => 'Ethiopia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
94 => ['country' => 'Tanzania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
95 => ['country' => 'Uganda', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
96 => ['country' => 'Zimbabwe', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
97 => ['country' => 'Zambia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
98 => ['country' => 'Botswana', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
99 => ['country' => 'Mauritius', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
100 => ['country' => 'Namibia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
101 => ['country' => 'Rwanda', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
102 => ['country' => 'Senegal', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
103 => ['country' => 'Ivory Coast', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
104 => ['country' => 'Cameroon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
105 => ['country' => 'Angola', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
106 => ['country' => 'Mozambique', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
107 => ['country' => 'Madagascar', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
108 => ['country' => 'Mali', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
109 => ['country' => 'Burkina Faso', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
110 => ['country' => 'Niger', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
111 => ['country' => 'Benin', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
112 => ['country' => 'Togo', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
113 => ['country' => 'Guinea', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
114 => ['country' => 'Malawi', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
115 => ['country' => 'Gabon', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
116 => ['country' => 'Mauritania', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
117 => ['country' => 'Lesotho', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
118 => ['country' => 'Eswatini', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
119 => ['country' => 'Liberia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
120 => ['country' => 'Canada', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
121 => ['country' => 'United States', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
122 => ['country' => 'Mexico', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
123 => ['country' => 'Argentina', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
124 => ['country' => 'Brazil', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
125 => ['country' => 'Chile', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
126 => ['country' => 'Colombia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
127 => ['country' => 'Peru', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
128 => ['country' => 'Ecuador', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
129 => ['country' => 'Uruguay', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
130 => ['country' => 'Paraguay', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
131 => ['country' => 'Bolivia', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
132 => ['country' => 'Venezuela', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
133 => ['country' => 'Costa Rica', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
134 => ['country' => 'Panama', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
135 => ['country' => 'Guatemala', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
136 => ['country' => 'Honduras', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
137 => ['country' => 'El Salvador', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
138 => ['country' => 'Nicaragua', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
139 => ['country' => 'Dominican Republic', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
140 => ['country' => 'Jamaica', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
141 => ['country' => 'Trinidad and Tobago', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
142 => ['country' => 'Barbados', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
143 => ['country' => 'Bahamas', 'taxes' => 0.00,'eu' => 0, 'country_code' => ''],
];

View File

@@ -262,17 +262,18 @@ try {
$dompdf->render();
$subject = 'Software Upgrade - Invoice: '.$order_id;
$attachment = $dompdf->output();
$attachment_name = $subject.'.pdf';
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//Send email via PHPMailer
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
// The send_mail function will exit on error and debuglog the error
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $subject);
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $attachment_name);
// Send to bookkeeping if configured
if(invoice_bookkeeping){
debuglog("WEBHOOK: Sending to bookkeeping: " . email_bookkeeping);
send_mail(email_bookkeeping, $subject, $message, $attachment, $subject);
send_mail(email_bookkeeping, $subject, $message, $attachment, $attachment_name);
}
} else {
debuglog("WEBHOOK: No invoice data found for invoice_id: $invoice_id");

View File

@@ -306,16 +306,17 @@ try {
$dompdf->render();
$subject = 'Software Upgrade - Invoice: '.$order_id;
$attachment = $dompdf->output();
$attachment_name = $subject.'.pdf';
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//Send email via PHPMailer
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $subject);
$mail_result = send_mail($customer_email, $subject, $message, $attachment, $attachment_name);
// Send to bookkeeping if configured
if(invoice_bookkeeping){
debuglog("PAYPAL WEBHOOK: Sending to bookkeeping: " . email_bookkeeping);
send_mail(email_bookkeeping, $subject, $message, $attachment, $subject);
send_mail(email_bookkeeping, $subject, $message, $attachment, $attachment_name);
}
} else {
debuglog("PAYPAL WEBHOOK: No invoice data found for invoice_id: $invoice_id");