{"_id":"@deploily/ttk-epay-nodejs-client","_rev":"16-b491bfae755cfde2ed218c9b24453d5c","name":"@deploily/ttk-epay-nodejs-client","dist-tags":{"latest":"1.0.9"},"versions":{"1.0.2":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.2","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.2","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"39943e4db28c9aa4e56bc80e3aab10b51f8d0a6c","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.2.tgz","fileCount":4,"integrity":"sha512-8zLZc72TUKNIHJIWDllSqSf414MBCpLZsof631NvTfdTep43GVXWluXyqOHaIxAelwJbBvtVBU5/liLGul0otg==","signatures":[{"sig":"MEQCIHP+sGA2D9xfreNoXq+nl5hvUmKrtTCHf1Iwv9aRfvOcAiBiTeUUf0oF0Ns2Kj927pQc3sW4OtOqrU/NzzGwQDU3qw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26740},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"d3d5c0b09bd5f0a3e5ecb148f9a1275fe744c581","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.2","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.2_1748429962142_0.875410071768699","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.4","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.4","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"6279ae226c084b1c693f17aac6d85982f9d1d3c1","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.4.tgz","fileCount":6,"integrity":"sha512-7m+8dVJAEJ2y57YgrBST4xWxE80ckze+c0kh4wlYvuZFxXdEUGvsstyLhvNSVnj3ITT2gdk7ZiLijm7WWkHLHw==","signatures":[{"sig":"MEQCIBoTeqSDwPOl0y28eoCPet36Vs/t2/VUULk2MhtAqyZnAiAoEMlE/JYpJ9Pnhu9ramxe58ab4e0ejBUASamR4XqGzA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31119},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"5838c4ae58562db1d61769740fdeffff05a5921a","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.2","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.4_1748948361171_0.8369216625544291","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.5","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.5","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"0b1bc2ca82a396ebeda0c1c5fbfd2f5491387a78","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.5.tgz","fileCount":6,"integrity":"sha512-2u1aKumT+QUBuW4fuK1L3Y8HW40OUawzof64BwM9umDU+YnduRuKhszwY15FMT/iCAm4VYI7aFQnqCpJ0ExDdg==","signatures":[{"sig":"MEUCIQC4oYYK/63wUUXnvBxpMHjKia9qd4fTs5uDb+GxOLta9QIgfwL0F9l2ZIr27t3eaoMZ0n0vRRIb8mNyRb1Y8pdF/iI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31340},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"ce21b05f5d021eb2f049c5598810bfa59cc63525","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.2","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.5_1749635167322_0.8075856434933575","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.6","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.6","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"3f5bd7fbaeb7d895fbe0865b380097c197d1661c","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.6.tgz","fileCount":6,"integrity":"sha512-QmI4TMnru8F9x+afDtpuaJI0ZzC4pHspM8LdKZVh0TYp8EeOFFJUSw4YeeFRdyRAIxBOcCZDNdE6y++cduOu4A==","signatures":[{"sig":"MEYCIQCwvD8QgwAPq/N2sk/+/5GbqQpWqQALxzWhnv+Y6ZenEgIhAJzcO0EuvmCdgEMmXV/nav41UAUT25iOWBW8YJkiTLy9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33414},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"1a0b81a6cfdcd06b39658b757113e68589d38ecb","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","actor":{"name":"ziadi","type":"user","email":"kheira.ziadi@transformatek.dz"},"email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.2","dependencies":{"axios":"^1.9.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.6_1751368171199_0.5568274786153586","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.7","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.7","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"fc5c9b3ca7c9185ae9895116dbaf53fa95ab045c","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.7.tgz","fileCount":6,"integrity":"sha512-p8vuLVTwnjkWl42iBupy21BLMOZeTgvaWiSKnq0KurKvT4iLKht9lVYNFBm1Vk+SBBQUeetYCFxxOfd9rR1/xQ==","signatures":[{"sig":"MEUCIFvuKyVBtaxLjFgoJQJPJ4apHbcbiHOkYls85LhybiJWAiEAoGmCDGNUkAfWpJmN2krUCtVH36kYwnmRU71DATW2FvY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33197},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"0ddc26cfb9f5862e8b5e03a47f5f1b6fed4147b1","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","actor":{"name":"ziadi","type":"user","email":"kheira.ziadi@transformatek.dz"},"email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.2","dependencies":{"axios":"^1.9.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.7_1751376088465_0.7845051230660764","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.8","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.8","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"7d64e58516bf92248538e183f4bafb1820f7e228","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.8.tgz","fileCount":6,"integrity":"sha512-YPLMAyt8iptGtTsTPQBeggyXnHti6shVmS+7s/oLrcGzdVHrWNc+ri26/M3HxsE9GVnEBFGgGAwCYtycB/rIGg==","signatures":[{"sig":"MEQCIFe9ibrRkhmYh5kqXwZkjjPuvPpAv6BczNqfhrFPqowcAiBRaa00nBrHTFnNY3WU9AodoJ+LBOtzVve/5HzPOChfWw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33215},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"50381fbd511e4524d742ec252fe6ba04cfbe3480","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.4","dependencies":{"axios":"^1.9.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.8_1758706993595_0.6114699764054603","host":"s3://npm-registry-packages-npm-production"}},"1.0.9":{"name":"@deploily/ttk-epay-nodejs-client","version":"1.0.9","keywords":["payment","gateway","epay","ttk"],"author":{"name":"Deploily"},"license":"MIT","_id":"@deploily/ttk-epay-nodejs-client@1.0.9","maintainers":[{"name":"allilou","email":"deploily@transformatek.dz"},{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"}],"homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"dist":{"shasum":"395c08c8fd8a94453b9d0045fa2741e7bef2922a","tarball":"https://registry.npmjs.org/@deploily/ttk-epay-nodejs-client/-/ttk-epay-nodejs-client-1.0.9.tgz","fileCount":6,"integrity":"sha512-NaJg9FWNnp11/pwaI2g0e7BLxco+5NxI3A2sjf3XrHPfRSD20ipmPRczH72pDBbT/0Hio/5bherjcx7MS+tbtw==","signatures":[{"sig":"MEUCIF/s/aUrMdgR/B2eTm6nhKpNpReusmuf/m6RsU4K4rbVAiEApCX9EVasAcAb+JGfbrjaoFOXXik0fpQdLsIEeZ1Cn5o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33214},"jest":{"verbose":true,"testEnvironment":"node"},"main":"src/index.js","gitHead":"299ed8ddacdf87023bd387e303a0591df08a1f99","scripts":{"test":"jest","clean":"rm -rf node_modules package-lock.json","test:watch":"jest --watch","test:manual":"node tests/ttk-epaytest.js","test:coverage":"jest --coverage"},"_npmUser":{"name":"ziadi","email":"kheira.ziadi@transformatek.dz"},"publisher":"Deploily","repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"_npmVersion":"10.8.2","description":"Node.js client for TTK E-Pay payment gateway","directories":{},"_nodeVersion":"20.19.4","dependencies":{"axios":"^1.9.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios-mock-adapter":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ttk-epay-nodejs-client_1.0.9_1758707547180_0.4804279765744395","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-05-28T09:49:33.161Z","modified":"2026-06-09T22:07:58.148Z","1.0.3":"2025-05-28T09:49:33.455Z","1.0.0":"2025-05-28T10:14:30.371Z","1.0.1":"2025-05-28T10:32:58.005Z","1.0.2":"2025-05-28T10:59:22.314Z","1.0.4":"2025-06-03T10:59:21.355Z","1.0.5":"2025-06-11T09:46:07.501Z","1.0.6":"2025-07-01T11:09:31.379Z","1.0.7":"2025-07-01T13:21:28.659Z","1.0.8":"2025-09-24T09:43:13.790Z","1.0.9":"2025-09-24T09:52:27.363Z"},"bugs":{"url":"https://github.com/deploily/ttk-epay-nodejs-client/issues"},"author":{"name":"Deploily"},"license":"MIT","homepage":"https://github.com/deploily/ttk-epay-nodejs-client#readme","keywords":["payment","gateway","epay","ttk"],"repository":{"url":"git+https://github.com/deploily/ttk-epay-nodejs-client.git","type":"git"},"description":"Node.js client for TTK E-Pay payment gateway","maintainers":[{"email":"harooonabidi@gmail.com","name":"harounabidi"},{"email":"deploily@transformatek.dz","name":"allilou"},{"email":"kheira.ziadi@transformatek.dz","name":"ziadi"}],"readme":"# TTK-Epay \n\nA comprehensive client SDK for interacting with the TTK-Epay payment processing API. This library provides a simple interface for managing invoices, processing payments, and generating receipts.\n\n## Features\n\n- 🧾 Complete invoice management\n- 💰 Payment processing functionality\n- 📑 PDF receipt generation and email delivery\n- 🔍 Payment status verification\n- ⚡ Available for both Python and JavaScript environments\n\n## Installation\n\n\n### JavaScript (Node.js)\n\n```bash\nnpm install @deploily/ttk-epay-nodejs-client\n```\n\n## Quick Start\n\n\n### JavaScript\n\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\n// Example: Get list of invoices\nasync function getInvoices() {\n  try {\n    const invoices = await client.getInvoices(1, 10);\n    console.log(invoices);\n  } catch (error) {\n    console.error('Error fetching invoices:', error);\n  }\n}\n\ngetInvoices();\n\n```\n\n## API Reference\n\n### Admin Operations\n\n#### `getInvoices(page_number=1, page_size=10)`\n\nRetrieves a paginated list of invoices.\n\n**Parameters:**\n- `page_number` (optional): The page number to retrieve (default: 1)\n- `page_size` (optional): Number of items per page (default: 10)\n\n**Returns:** A dictionary/object containing:\n- List of Invoice objects\n- Page information (current page, total pages)\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\n// Example: Get list of invoices\nasync function listInvoices() {\n  try {\n    const response = await client.getInvoices(1, 20);\n    console.log('Raw response:', JSON.stringify(response, null, 2));\n  } catch (error) {\n    console.error('Error fetching invoices:', error.message);\n  }\n}\n\nlistInvoices();\n```\n\n#### `createInvoice(invoice_data)`\n\nCreates a new invoice.\n\n**Parameters:**\n- `invoice_data`: An Invoice object containing invoice details\n\n**Returns:** The created Invoice object with server-assigned fields\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \nconst { Invoice } = require('ttk-epay-nodejs-client/src/models.js'); // Import from your local models file\n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function createNewInvoice() {\n  try {\n    // Prepare the invoice data (use plain object)\n    const newInvoice = new Invoice ({\n      INVOICE_NUMBER: 12345,\n      CLIENT_NAME: \"Acme Corporation\",\n      CLIENT_CODE: 789,\n      CLIENT_ADDRESS: \"123 Business Ave, Suite 100\",\n      CLIENT_MAIL: \"billing@acme.com\",\n      NET_AMOUNT: 1000.00,\n      INVOICE_TVA: 0.19,\n      AMOUNT_TVA: 190.00,\n      AMOUNT_TTC: 1190.00,\n      PRODUCT_NAME: \"Enterprise Plan Subscription\",\n      INVOICE_DATE: \"2025-05-08T10:00:00.000Z\"\n    });\n\n    // Create the invoice\n    const createdInvoice = await client.createInvoice(newInvoice);\n    console.log(`Created invoice with ID: ${createdInvoice.ID}`);\n  } catch (error) {\n    console.error('Error creating invoice:', error.message);\n  }\n}\n\ncreateNewInvoice();\n\n```\n\n#### `getInvoiceById(invoice_id)`\n\nRetrieves a specific invoice by its ID.\n\n**Parameters:**\n- `invoice_id`: The ID of the invoice to retrieve\n\n**Returns:** The Invoice object if found\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function findInvoiceById() {\n  try {\n    const invoiceId = \"35\";\n    const invoice = await client.getInvoiceById(invoiceId);\n    \n    console.log(`Found invoice -  ID: ${invoice.ID}, Amount: ${invoice.NET_AMOUNT}, Paid: ${invoice.IS_PAID ? 'Yes' : 'No'}`);\n    return invoice;\n  } catch (error) {\n    console.error(`Error finding invoice: ${error.message}`);\n    return null;\n  }\n}\n\n\nfindInvoiceById();\n```\n\n#### `updateInvoice(invoice_id, invoice_data)`\n\nUpdates an existing invoice.\n\n**Parameters:**\n- `invoice_id`: The ID of the invoice to update\n- `invoice_data`: An Invoice object containing updated invoice details\n\n**Returns:** The updated Invoice object\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function updateExistingInvoice() {\n  try {\n    const invoiceId = \"35\";\n    const invoice = await client.getInvoiceById(invoiceId);\n    \n    // Update invoice details\n    invoice.NET_AMOUNT = 1500.00;\n    invoice.IS_PAID = true; // Change from No to Yes\n    \n    const result = await client.updateInvoice(invoice.ID, invoice);\n    console.log(`Updated invoice: Amount=${result.NET_AMOUNT}, Paid=${result.IS_PAID ? 'Yes' : 'No'}`);\n    return result;\n  } catch (error) {\n    console.error(`Update failed: ${error.message}`);\n    return null;\n  }\n}\nupdateExistingInvoice();\n```\n\n#### `getPayments(options)`\n\nRetrieves a list of payments with optional filtering.\n\n**Parameters (all optional):**\n- `page_number`: Page number for pagination (default: 1)\n- `page_size`: Number of items per page (default: 10)\n- `satim_order_id`: Filter by Satim order ID\n- `invoice_id`: Filter by invoice ID\n- `from_date`: Start date filter (format: 'YYYY-MM-DDTHH:MM:SSZ')\n- `to_date`: End date filter (format: 'YYYY-MM-DDTHH:MM:SSZ')\n\n**Returns:** A dictionary/object containing payment records and pagination info\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function getRecentPayments() {\n  const endDate = new Date().toISOString();\n  const startDate = new Date();\n  startDate.setDate(startDate.getDate() - 30);\n  \n  try {\n    // Fetching payments from the last 30 days\n    const payments = await client.getPayments({\n      pageSize: 50,\n      from_date: startDate.toISOString(),\n      to_date: endDate\n    });\n    \n    // Assuming 'payments' is an array or object with a 'payments' field\n    console.log(`Found ${payments.length} payments in the last 30 days`);\n  } catch (error) {\n    console.error(\"Error fetching payments:\", error);\n  }\n}\n\n\ngetRecentPayments();\n```\n\n#### `getPayementById(payement_id)`\n\nRetrieves a specific payement by its ID.\n\n**Parameters:**\n- `payement_id`: The ID of the payement to retrieve\n\n**Returns:** The payement object if found\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function findPayementById() {\n  \n  try {\n    const paymentId = \"2\";\n    const payment = await client.getPaymentById(paymentId);\n\n    console.log(`payment=== `,payment);\n    console.log(`Found payment -  ID: ${payment.ID}, Amount: ${payment.NET_AMOUNT}, Paid: ${payment.IS_PAID ? 'Yes' : 'No'}`);\n\n    return payment;\n  } catch (error) {\n    console.error(`Error finding payment: ${error.message}`);\n    return null;\n  }\n}\n\n\nfindInvoiceById();\n```\n\n\n### `generateLink(order_id, client_code)`\n\nGenerates a payment link for a specific invoice based on its order ID and client code.\n\n**Parameters:**\n\n* `order_id` (`string`): The unique identifier of the invoice to retrieve.\n* `client_code` (`number`): The client identifier associated with the invoice.\n\n**Returns:** A payment link (string) if successful, or null if an error occurs.\n\n\n**Example (JavaScript):**\n\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client');\n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function generateLink(orderId, clientCode) {\n  try {\n    const link = await client.generate_link(orderId, clientCode);\n    console.log(`Generated link:`, link);\n    return link;\n  } catch (error) {\n    console.error(`Failed to generate link: ${error.message}`);\n    return null;\n  }\n}\n\n// Example usage\ngenerateLink(\"15\", 15);\n```\n\n\n\n\n### Document Operations\n\n#### `getPdfRecipt(satim_order_id)`\n\nGenerates a PDF receipt for a specific payment.\n\n**Parameters:**\n- `satim_order_id`: The Satim order ID for the payment\n\n**Returns:** PDF receipt as binary data\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nconst fs = require('fs');\n\nasync function savePdfReceipt() {\n  const satimOrderId = \"SATIM-12345\";\n  \n  try {\n    // Fetching the PDF receipt data\n    const pdfData = await client.getPdfRecipt(satimOrderId);\n    \n    // Writing the PDF data to a file\n    fs.writeFileSync(`receipt_${satimOrderId}.pdf`, pdfData);\n    console.log(`Receipt saved to receipt_${satimOrderId}.pdf`);\n  } catch (error) {\n    console.error(\"Error saving PDF receipt:\", error);\n  }\n}\n\n\n\nsavePdfReceipt();\n```\n\n#### `sendPdfReceiptMail(satim_order_id, email)`\n\nSends a PDF receipt to a specified email address.\n\n**Parameters:**\n- `satim_order_id`: The Satim order ID for the payment\n- `email`: The email address to send the receipt to\n\n**Returns:** API response indicating success or failure\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client'); \n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function emailReceipt() {\n  const satimOrderId = \"SATIM-12345\";\n  const email = \"customer@example.com\";\n  \n  try {\n    // Sending the receipt via email\n    const result = await client.sendPdfReceiptMail(satimOrderId, email);\n    \n    // Check if the result is in the expected format or status\n    if (result) {\n      console.log(`Receipt sent successfully to ${email}`);\n    } else {\n      console.log(\"Receipt could not be sent. No result returned.\");\n    }\n  } catch (error) {\n    console.error(`Failed to send receipt: ${error.message}`);\n  }\n}\n\n\nemailReceipt();\n```\n\n### Payment Operations\n\n#### `postPayement(payment_data)`\n\nProcesses a new payment.\n\n**Parameters:**\n- `payment_data`: An InvoiceDto object containing payment details\n\n**Returns:** Payment processing result object\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client');\nconst { InvoiceDto } = require('ttk-epay-nodejs-client/src/models.js'); // Import from your local models file\n\n// Initialize the client\nconst client = new TtkEpay();\n\nasync function processPayment() {\n  // Create payment data with a unique invoice number (using timestamp)\n  const uniqueInvoiceNumber = Math.floor(Date.now() / 1000); // Unix timestamp\n  const payment = new InvoiceDto({\n    INVOICE_NUMBER: uniqueInvoiceNumber,\n    ORDER_ID: `ORD-${uniqueInvoiceNumber}`,\n    CLIENT_NAME: \"Jane Smith\",\n    CLIENT_CODE: 456,\n    CLIENT_ADDRESS: \"456 Customer St.\",\n    CLIENT_MAIL: \"jane@example.com\",\n    PRODUCT_NAME: \"Premium Package\",\n    NET_AMOUNT: 750.00\n  });\n\n  try {\n    // Process the payment\n    const result = await client.postPayement(payment);\n    \n    // Debug the result\n    console.log(\"Full API response:\", JSON.stringify(result, null, 2));\n    \n    // Check if the result has the expected fields\n    if (result && result.ERROR_CODE === \"0\") {\n      if (result.ORDER_ID && result.FORM_URL) {\n        console.log(`Payment initialized successfully!`);\n        console.log(`Order ID: ${result.ORDER_ID}`);\n        console.log(`Payment Form URL: ${result.FORM_URL}`);\n      } else {\n        console.error(\"Success response missing ORDER_ID or FORM_URL:\", result);\n      }\n    } else if (result && result.ERROR_CODE) {\n      console.error(`Payment API Error (${result.ERROR_CODE}): ${result.ERROR_MESSAGE}`);\n    } else {\n      console.error(\"Unexpected result format:\", result);\n    }\n  } catch (error) {\n    console.error(`Error processing payment: ${error.message}`);\n  }\n}\n\nprocessPayment();\n\n```\n\n#### `getPaymentStatus(satim_order_id)`\n\nChecks the status of a payment.\n\n**Parameters:**\n- `satim_order_id`: The Satim order ID for the payment\n\n**Returns:** Payment status object with transaction details\n\n\n**Example (JavaScript):**\n```javascript\nconst { TtkEpay } = require('@deploily/ttk-epay-nodejs-client');\nconst client = new TtkEpay();\n\nasync function checkPaymentStatus() {\n  try {\n    const status = await client.getPaymentStatus(\"8LmjDNjisi0A5EAAGBYM\");\n    \n    if (!status) {\n      return { error: \"No payment status received\" };\n    }\n\n    // Determine payment status text\n    let statusText;\n    if (status.ORDER_STATUS === 0) statusText = \"Rejected\";\n    else if (status.ORDER_STATUS === 1) statusText = \"Processing\";\n    else if (status.ORDER_STATUS === 2) statusText = \"Completed\";\n    else statusText = \"Unknown\";\n\n    return {\n      status: statusText,\n      amount: status.AMOUNT,\n      currency: status.CURRENCY,\n      error: status.ERROR_CODE !== \"0\" ? status.ERROR_MESSAGE : null\n    };\n\n  } catch (error) {\n    return { error: \"Failed to check payment status\" };\n  }\n}\n\n// Usage\ncheckPaymentStatus().then(result => {\n  console.log(result);\n});\n\n```\n\n\n\n## Data Models\n\n### Invoice\n\nThe primary data model for invoice operations.\n\n#### Fields\n\n| Field Name | Type | Description |\n|------------|------|-------------|\n| ID | int | Required. Invoice ID (auto-assigned for new invoices) |\n| INVOICE_NUMBER | int | Invoice reference number |\n| ORDER_ID | string | Order reference ID |\n| INVOICE_DATE | string | ISO 8601 datetime string (e.g., \"2025-05-07T12:45:27.142Z\") |\n| INVOICE_TYPE_CODE | string | Type code for the invoice |\n| NET_AMOUNT | float | Net amount before taxes |\n| INVOICE_TVA | float | VAT rate (e.g., 0.19 for 19%) |\n| AMOUNT_TVA | float | VAT amount |\n| AMOUNT_TTC | float | Total amount including taxes |\n| INVOICE_STATE_CODE | string | Status code for the invoice |\n| ORDER_NAME | string | Name or description of the order |\n| CLIENT_CODE | int | Client reference code |\n| CLIENT_NAME | string | Client name |\n| CLIENT_NRC | string | Client NRC (business registration) |\n| CLIENT_ADDRESS | string | Client's address |\n| CLIENT_MAIL | string | Client's email address |\n| CLIENT_IDF | string | Client's tax identification |\n| PRODUCT_NAME | string | Name of the product or service |\n| IS_PAID | boolean | Payment status flag (default: false) |\n\n### InvoiceDto\n\nSimplified data model for payment processing operations.\n\n#### Fields\n\n| Field Name | Type | Description |\n|------------|------|-------------|\n| INVOICE_NUMBER | int | Required. Invoice reference number |\n| ORDER_ID | string | Order reference ID |\n| INVOICE_DATE | string | ISO 8601 datetime string |\n| INVOICE_TYPE_CODE | string | Type code for the invoice |\n| NET_AMOUNT | float | Net amount before taxes |\n| CLIENT_CODE | int | Client reference code |\n| CLIENT_NAME | string | Client name |\n| CLIENT_ADDRESS | string | Client's address |\n| CLIENT_MAIL | string | Client's email address |\n| PRODUCT_NAME | string | Name of the product or service |\n\n## Error Handling\n\n JavaScript implementations handle errors differently:\n\n\n\n### JavaScript\n\nThe JavaScript library uses Promise-based error handling:\n\n```javascript\nconst axios = require('axios');\n\n// Sample client function simulating the API call\nconst client = {\n  getInvoiceById: (invoiceId) => {\n    return new Promise((resolve, reject) => {\n      // Simulating a response or error based on the invoiceId\n      if (invoiceId === \"NON-EXISTENT\") {\n        reject(new Error(\"Invoice not found\"));\n      } else {\n        resolve({ invoiceId: invoiceId, amount: 100 });\n      }\n    });\n  }\n};\n\n// 1. Promise-based error handling using .then() and .catch()\nclient.getInvoiceById(\"NON-EXISTENT\")\n  .then(invoice => {\n    console.log(\"Invoice found:\", invoice);\n  })\n  .catch(error => {\n    console.error(\"Error details:\", error.message);\n  });\n\n// 2. Async/await error handling with try-catch\nasync function fetchInvoice() {\n  try {\n    const invoice = await client.getInvoiceById(\"NON-EXISTENT\");\n    console.log(\"Invoice found:\", invoice);\n  } catch (error) {\n    console.error(\"Error details:\", error.message);\n  }\n}\n\nfetchInvoice();\n\n```\n\n## License\n\nMIT\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","readmeFilename":"README.md"}