@bizzsv/bizz-payment 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -175
- package/README.npm.md +27 -0
- package/package.json +1 -1
- package/dist/package.json +0 -71
package/README.md
CHANGED
|
@@ -1,191 +1,27 @@
|
|
|
1
1
|
# BizPaymentForm SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Secure, isolated payment form for integration in web apps.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- **Node.js:** 24.14.0 or higher
|
|
8
|
-
- **Vite:** 8.0.1 or higher
|
|
9
|
-
- **TypeScript:** 5.9.3 or higher
|
|
10
|
-
|
|
11
|
-
In the root of the project, we have .nvmrc file, if you have installed nvm, you can run
|
|
12
|
-
```bash
|
|
13
|
-
nvm use
|
|
14
|
-
```
|
|
15
|
-
to use the correct version of Node.js. If you don't have nvm installed, you can install it [here](https://github.com/nvm-sh/nvm).
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Plugins/packages used
|
|
19
|
-
|
|
20
|
-
This package is the only one that uses for productions.
|
|
21
|
-
|
|
22
|
-
- **Maska:** Used to mask the input fields, like credit card, number, expiration date, CVV, etc.
|
|
23
|
-
- **Node-Forge:** Used to generate the PKCE challenge and verifier for the OAuth 2.0 flow.
|
|
24
|
-
- **Dompurify:** Used to sanitize the HTML for prevent XSS attacks.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Features includes
|
|
28
|
-
- **Payments without 3DS:** show the form without 3DS if the commerce does not have 3DS enabled.
|
|
29
|
-
- **Payments with 3DS:** show the form with 3DS if the commerce has 3DS enabled.
|
|
30
|
-
|
|
31
|
-
## Development Workflow: Vite Bundle Plugin
|
|
32
|
-
|
|
33
|
-
To keep the project scalable and maintainable while using `srcdoc`, we implemented a custom Vite plugin:
|
|
34
|
-
|
|
35
|
-
1. **TypeScript Native:** We write the iframe logic using modern TypeScript and imports.
|
|
36
|
-
2. **IIFE Transformation:** Vite compiles the entire dependency tree of the iframe into a single, minified, self-executing string (IIFE).
|
|
37
|
-
3. **Dynamic Injection:** This string is injected into the `iframeContent.html` generator, making it available for the `srcdoc` at runtime.
|
|
38
|
-
|
|
39
|
-
## How run the project
|
|
40
|
-
|
|
41
|
-
Native development server with Vite:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
pnpm dev
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
React development server with Vite:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
pnpm examples:react:dev
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Vue development server with Vite:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm examples:vue:dev
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular development server with Vite:
|
|
60
|
-
|
|
61
|
-
You need have installed the Angular CLI globally to run the development server. Read more about how to install the Angular CLI [here](https://angular.dev/installation).
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
pnpm install -g @angular/cli
|
|
65
|
-
```
|
|
66
|
-
then:
|
|
67
|
-
```bash
|
|
68
|
-
pnpm examples:angular:dev
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Note: for run the examples (React, Vue, Angular), you need to build the project first.
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
pnpm build
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Testing
|
|
78
|
-
|
|
79
|
-
The project has two types of tests:
|
|
80
|
-
- Unit tests: for testing the iframe logic.
|
|
81
|
-
- End-to-end tests: for testing the iframe in the browser.
|
|
82
|
-
|
|
83
|
-
To run the tests, you need to run the following command:
|
|
5
|
+
## Install
|
|
84
6
|
|
|
85
7
|
```bash
|
|
86
|
-
pnpm
|
|
8
|
+
pnpm add @bizzsv/bizz-payment
|
|
87
9
|
```
|
|
88
10
|
|
|
89
|
-
To run the tests in watch mode, you need to run the following command:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
pnpm test:watch
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
To run the end-to-end tests, you need to run the following command:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
pnpm test:e2e
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
To run the end-to-end tests, you need to run the following command:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
pnpm test:e2e
|
|
105
|
-
```
|
|
106
|
-
or run the tests with the UI:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
pnpm test:e2e:ui
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Documentation website
|
|
113
|
-
|
|
114
|
-
The documentation is built with Starlight and is hosted in the `docs` directory, run on Astro, and its SSR.
|
|
115
|
-
|
|
116
|
-
To run the documentation server, you need to run the following command:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
pnpm docs:dev
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
To build the documentation, you need to run the following command:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
pnpm docs:build
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
To preview the documentation, you need to run the following command:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pnpm docs:preview
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Build the project
|
|
135
|
-
|
|
136
11
|
```bash
|
|
137
|
-
|
|
12
|
+
npm install @bizzsv/bizz-payment
|
|
138
13
|
```
|
|
139
14
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[Read more](https://developer.cardinaltrusted.com/reference/emv-3ds-test-cases-challenge)
|
|
143
|
-
[Read documentation for Cardinal integration](https://developer.cardinaltrusted.com/docs/cardinal-cruise-integration)
|
|
144
|
-
|
|
145
|
-
### Cards for testing
|
|
146
|
-
|
|
147
|
-
The expiration data can be 01/2027 or 01/2028, always the year must be in the future.
|
|
148
|
-
|
|
149
|
-
| Card type | PAN | Cvv | Fecha | Friction |
|
|
150
|
-
|-----------|-----|-----|-------|----------|
|
|
151
|
-
| Visa | 4000000000002701 | 123 | 01 / 2027 | No |
|
|
152
|
-
| Mastercard | 5200000000002235 | 123 | 01 / 2027 | No |
|
|
153
|
-
| Visa | 4000000000002503 | 123 | 01 / 2027 | Yes |
|
|
154
|
-
| Mastercard | 5200000000002151 | 123 | 01 / 2027 | Yes |
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
For no 3DS cards
|
|
158
|
-
|
|
159
|
-
| Card type | PAN | Cvv | Fecha | Friction | Failed |
|
|
160
|
-
|-----------|-----|-----|-------|----------|--------|
|
|
161
|
-
| Visa | 4242000000000851 | 123 | 01 / 2027 | No | Yes |
|
|
162
|
-
| Visa | 4242000000000000 | 123 | 01 / 2027 | No | No |
|
|
163
|
-
| UnionPay | 6215000000003218 | 123 | 01 / 2027 | No | No |
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## Security: The `srcdoc` Approach
|
|
167
|
-
|
|
168
|
-
The package encapsulates the payment form inside an `iframe` with the `srcdoc` attribute. This architectural decision provides several critical security and operational benefits:
|
|
15
|
+
## Usage
|
|
169
16
|
|
|
170
|
-
|
|
171
|
-
By using `srcdoc`, the form lives in a separate environment (`about:srcdoc`). This acts as a "firewall" that prevents:
|
|
172
|
-
- **Script Interception:** External scripts (trackers, malicious ads, or browser extensions) cannot access the data inside the iframe, that means that the commerces can't get access to the data inside the iframe
|
|
173
|
-
- **Keyloggers:** It's significantly harder for generic DOM-based keyloggers to capture inputs inside an isolated iframe.
|
|
174
|
-
- ** CSS Integrity:** The host website's CSS (e.g., `input { margin: 50px !important }`) cannot leak into or break the payment form's layout.
|
|
17
|
+
The package exports `BizzPaymentForm` and related configuration types (`PaymentFormConfig`, `PaymentFormI18n`, etc.). Import from `@bizzsv/bizz-payment` according to your bundler (ESM or CJS).
|
|
175
18
|
|
|
176
|
-
|
|
177
|
-
The `srcdoc` ensures that the content is loaded in a "clean room" environment.
|
|
178
|
-
- **CSS Encapsulation:** The host website's CSS (e.g., `input { margin: 50px !important }`) cannot leak into or break the payment form's layout.
|
|
179
|
-
- **Deterministic UI:** The form will look exactly the same on any website, whether it's a WordPress site, a React app, or a legacy HTML page.
|
|
19
|
+
For framework examples (React, Vue, Angular), tests, docs tooling, and contribution workflow, see the full **README.md** in the source repository.
|
|
180
20
|
|
|
181
|
-
|
|
182
|
-
Unlike traditional `iframe.src` approaches used by other packages (which require hosting an external HTML file), our `srcdoc` architecture:
|
|
183
|
-
- **No Extra Hosting:** The entire form (HTML + CSS + JS) is bundled into your final `dist/index.js`.
|
|
184
|
-
- **Instant Load:** There is no additional network request to fetch the iframe content; it renders as soon as the JS is executed.
|
|
21
|
+
## Documentation
|
|
185
22
|
|
|
186
|
-
|
|
187
|
-
The data never is stored in the browser (localStorage, sessionStorage, cookies, etc.), all data keep in the memory, that means that for each page reload, the data is lost, and each page reload, is a new instance of the form.
|
|
23
|
+
Package documentation and integration details may be published separately; check the github pages documentation website [here](https://biz-latam.github.io/biz-payment/) for links.
|
|
188
24
|
|
|
189
|
-
|
|
25
|
+
## License
|
|
190
26
|
|
|
191
|
-
|
|
27
|
+
ISC — see the `LICENSE` file included in the package when published.
|
package/README.npm.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BizPaymentForm SDK
|
|
2
|
+
|
|
3
|
+
Secure, isolated payment form for integration in web apps.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @bizzsv/bizz-payment
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @bizzsv/bizz-payment
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The package exports `BizzPaymentForm` and related configuration types (`PaymentFormConfig`, `PaymentFormI18n`, etc.). Import from `@bizzsv/bizz-payment` according to your bundler (ESM or CJS).
|
|
18
|
+
|
|
19
|
+
For framework examples (React, Vue, Angular), tests, docs tooling, and contribution workflow, see the full **README.md** in the source repository.
|
|
20
|
+
|
|
21
|
+
## Documentation
|
|
22
|
+
|
|
23
|
+
Package documentation and integration details may be published separately; check the github pages documentation website [here](https://biz-latam.github.io/biz-payment/) for links.
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
ISC — see the `LICENSE` file included in the package when published.
|
package/package.json
CHANGED
package/dist/package.json
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bizzsv/bizz-payment",
|
|
3
|
-
"version": "1.2.2-dev",
|
|
4
|
-
"description": "The Biz Payment SDK is designed to provide a secure, isolated form for payment integration.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.cjs",
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"default": "./dist/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.cts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "rimraf dist && vite build",
|
|
26
|
-
"dev": "vite serve examples/vanilla --config vite.config.ts",
|
|
27
|
-
"test": "vitest run",
|
|
28
|
-
"test:watch": "vitest",
|
|
29
|
-
"test:e2e": "playwright test",
|
|
30
|
-
"test:e2e:ui": "playwright test --ui",
|
|
31
|
-
"docs:dev": "pnpm --dir docs run dev",
|
|
32
|
-
"docs:build": "pnpm --dir docs run build",
|
|
33
|
-
"docs:preview": "pnpm --dir docs run preview",
|
|
34
|
-
"examples:angular:dev": "pnpm --dir examples/angular run start",
|
|
35
|
-
"examples:angular:build": "pnpm --dir examples/angular run build",
|
|
36
|
-
"examples:vue:dev": "pnpm --dir examples/vue run dev",
|
|
37
|
-
"examples:vue:build": "pnpm --dir examples/vue run build",
|
|
38
|
-
"examples:react:dev": "pnpm --dir examples/react run dev",
|
|
39
|
-
"examples:react:build": "pnpm --dir examples/react run build"
|
|
40
|
-
},
|
|
41
|
-
"keywords": [],
|
|
42
|
-
"author": {
|
|
43
|
-
"name": "Kevin Mendez",
|
|
44
|
-
"email": "kevin@bizz.sv",
|
|
45
|
-
"url": "https://bizz.sv"
|
|
46
|
-
},
|
|
47
|
-
"license": "ISC",
|
|
48
|
-
"packageManager": "pnpm@10.33.0",
|
|
49
|
-
"pnpm": {
|
|
50
|
-
"onlyBuiltDependencies": [
|
|
51
|
-
"esbuild"
|
|
52
|
-
],
|
|
53
|
-
"overrides": {}
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@faker-js/faker": "^10.4.0",
|
|
57
|
-
"@playwright/test": "^1.58.2",
|
|
58
|
-
"@types/node": "^25.5.0",
|
|
59
|
-
"@types/node-forge": "^1.3.14",
|
|
60
|
-
"rimraf": "^6.0.1",
|
|
61
|
-
"typescript": "^5.9.3",
|
|
62
|
-
"vite": "^8.0.1",
|
|
63
|
-
"vite-plugin-dts": "^4.5.4",
|
|
64
|
-
"vitest": "^4.1.0"
|
|
65
|
-
},
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"dompurify": "^3.3.3",
|
|
68
|
-
"maska": "^3.2.0",
|
|
69
|
-
"node-forge": "^1.3.3"
|
|
70
|
-
}
|
|
71
|
-
}
|