How fredsoares/sisp_payments_js works
Project type and purpose
• This is an open-source Node.js SDK (library) called “sisp-payments” that simplifies integrating SISP (Vinti4) card payments into any Node.js application.
• It exposes two primary methods:
• generatePaymentRequestForm(...) – builds an HTML form to redirect the user to SISP’s payment page
• validatePayment(...) – validates the incoming webhook from SISP and normalizes error codes
File structure
• Root files (.eslintrc.js, .prettierrc, package.json, README.md, LICENSE) indicate a published npm module with linting, formatting, tests, and CI config.
• src/index.js – entry point, exports the Sisp class.
• src/sisp.js – the main class, holds credentials and implements the two public methods.
• src/utils/paymentErrors.js – maps SISP error codes to descriptions for validatePayment.
• src/*.test.js & jest.config.js – unit tests validating both functions.
README for additional insights
• Describes usage in a host Node.js application:
• Instantiation with credentials (posID, posAutCode).
• Embedding the returned HTML form in a frontend.
• Handling SISP’s POST webhook.
• No internal persistence or database—purely request/response interactions with SISP.
Detail without overthinking
• Every named component: “Sisp class,” “paymentErrors util,” “webhookUrl handler.”
• Call out configuration injection (posID, posAutCode) at instantiation.
• Both happy path (success) and error path (validatePayment → error code).