pay-sdk-web10 1.0.1

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.
@@ -0,0 +1 @@
1
+
package/dist/logo.jpg ADDED
Binary file
package/git_push.sh ADDED
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+
3
+ # Make sure we're in the correct Git repository folder
4
+ echo "Please navigate to your Git repository folder first!"
5
+
6
+ # Get the current directory
7
+ current_dir=$(pwd)
8
+
9
+ # Check if it's a Git repository
10
+ if [ ! -d "$current_dir/.git" ]; then
11
+ echo "This is not a Git repository. Exiting..."
12
+ exit 1
13
+ fi
14
+
15
+ # Ask for commit message
16
+ echo "Enter commit message: "
17
+ read commit_message
18
+
19
+ # Stage changes
20
+ echo "Staging changes..."
21
+ git add .
22
+
23
+ # Commit changes
24
+ echo "Committing changes with message: '$commit_message'"
25
+ git commit -m "$commit_message"
26
+
27
+ # Push changes to the main branch (or replace with your branch name)
28
+ echo "Pushing changes to GitHub..."
29
+ git push origin main
30
+
31
+ # Output success message
32
+ echo "Changes pushed successfully to GitHub."
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "pay-sdk-web10",
3
+ "version": "1.0.1",
4
+ "description": "A wallet payment form component with live API verification",
5
+ "main": "dist/WalletPaymentForm.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "rollup -c",
9
+ "start": "rollup -c --watch",
10
+ "prepublishOnly": "npm run build"
11
+ }
12
+ ,
13
+ "keywords": [
14
+ "wallet",
15
+ "payment",
16
+ "react"
17
+ ],
18
+ "author": "Allan Bravo",
19
+ "license": "MIT",
20
+ "peerDependencies": {
21
+ "react": "^18.3.1",
22
+ "react-icons": "^5.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/core": "^7.24.0",
26
+ "@babel/preset-react": "^7.23.3",
27
+ "@rollup/plugin-babel": "^6.0.4",
28
+ "@rollup/plugin-commonjs": "^25.0.7",
29
+ "@rollup/plugin-node-resolve": "^15.2.3",
30
+ "@rollup/plugin-url": "^8.0.2",
31
+ "rollup": "^4.9.6",
32
+ "rollup-plugin-copy": "^3.5.0",
33
+ "rollup-plugin-css-only": "^4.5.2",
34
+ "rollup-plugin-node-polyfills": "^0.2.1"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/Bravothe/payment-library.git"
39
+ },
40
+ "dependencies": {
41
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
42
+ "react-dom": "^18.3.1"
43
+ }
44
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
7
+
@@ -0,0 +1,43 @@
1
+ import resolve from '@rollup/plugin-node-resolve';
2
+ import commonjs from '@rollup/plugin-commonjs';
3
+ import babel from '@rollup/plugin-babel';
4
+ import css from 'rollup-plugin-css-only';
5
+ import url from '@rollup/plugin-url';
6
+ import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
7
+
8
+ export default {
9
+ input: 'src/WalletPaymentForm.js',
10
+ output: [
11
+ {
12
+ file: 'dist/WalletPaymentForm.esm.js',
13
+ format: 'esm',
14
+ },
15
+ {
16
+ file: 'dist/WalletPaymentForm.umd.js',
17
+ format: 'umd',
18
+ name: 'WalletPaymentForm',
19
+ },
20
+ ],
21
+ plugins: [
22
+ babel({
23
+ babelHelpers: 'bundled',
24
+ presets: ['@babel/preset-react'],
25
+ extensions: ['.js', '.jsx'],
26
+ }),
27
+ resolve(),
28
+ commonjs(),
29
+ css({ output: 'dist/WalletPaymentForm.css' }),
30
+ url({
31
+ include: ['**/*.jpg', '**/*.png', '**/*.gif'],
32
+ limit: 0,
33
+ destDir: 'dist',
34
+ publicPath: '',
35
+ fileName: '[name][extname]',
36
+ }),
37
+ NodeGlobalsPolyfillPlugin({
38
+ process: true,
39
+ buffer: true,
40
+ }),
41
+ ],
42
+ external: ['react', 'react-dom'],
43
+ };
@@ -0,0 +1,295 @@
1
+ import React from 'react';
2
+ import { IoEye, IoEyeOff } from 'react-icons/io5';
3
+
4
+ const EnterPasscode = ({ passcode, setPasscode, showPasscode, setShowPasscode, transactionDetails, onSubmit, onBack }) => {
5
+ const renderHeader = () => (
6
+ <div className="popup-header">
7
+ <div className="logo">
8
+ <img
9
+ src="https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg"
10
+ alt="EVzone Logo"
11
+ className="header-icon"
12
+ />
13
+ </div>
14
+ <h2>
15
+ <span className="evzone">EVzone</span><span className="pay"> Pay</span>
16
+ </h2>
17
+ </div>
18
+ );
19
+
20
+ return (
21
+ <>
22
+ <div className="passcode-popup">
23
+ {renderHeader()}
24
+ <div className="merchant-header">Merchant Info :</div>
25
+ <div className="merchant-details">
26
+ <div className="merchant-left">
27
+ <div className="merchant-info">
28
+ <div className="merchant-name">Airbnb</div>
29
+ <div className="merchant-id">W-123456789</div>
30
+ </div>
31
+ </div>
32
+ <div className="merchant-amount">
33
+ <strong>UGX {transactionDetails.totalBilling.toFixed(2)}</strong>
34
+ </div>
35
+ </div>
36
+ <div className="passcode-section">
37
+ <label htmlFor="passcode">Enter Passcode</label>
38
+ <div className="passcode-input">
39
+ <input
40
+ type={showPasscode ? "text" : "password"}
41
+ id="passcode"
42
+ value={passcode}
43
+ onChange={(e) => setPasscode(e.target.value)}
44
+ placeholder="••••••"
45
+ maxLength="6"
46
+ />
47
+ <span className="toggle-visibility" onClick={() => setShowPasscode(!showPasscode)}>
48
+ {showPasscode ? <IoEye /> : <IoEyeOff />}
49
+ </span>
50
+ </div>
51
+ </div>
52
+ <div className="transaction-details">
53
+ <p>
54
+ You are making a payment to <strong>Acorn International School</strong> and an amount of
55
+ <strong> UGX {transactionDetails.totalBilling.toFixed(2)}</strong> will be deducted off your wallet, including:
56
+ <br />
57
+ <strong>0.5% Tax:</strong> UGX {(transactionDetails.totalBilling * 0.005).toFixed(2)}
58
+ <br />
59
+ <strong>0.5% Wallet Fee:</strong> UGX {(transactionDetails.totalBilling * 0.005).toFixed(2)}
60
+ </p>
61
+ </div>
62
+ <div className="buttons-container">
63
+ <button onClick={onSubmit} className="confirm-button" disabled={!passcode}>
64
+ Confirm Payment
65
+ </button>
66
+ <button onClick={onBack} className="back-button" style={{ marginTop: '15px' }}>
67
+ Back
68
+ </button>
69
+ </div>
70
+ </div>
71
+ <style>{`
72
+ .passcode-popup {
73
+ display: flex;
74
+ flex-direction: column;
75
+ align-items: center;
76
+ background: white;
77
+ padding: 20px;
78
+ border-radius: 10px;
79
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
80
+ max-width: 400px;
81
+ width: 90%;
82
+ text-align: center;
83
+ border: 1px solid #ddd;
84
+ font-family: Arial, sans-serif;
85
+ z-index: 1001;
86
+ position: relative;
87
+ pointer-events: auto;
88
+ }
89
+
90
+ .popup-header {
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ margin-bottom: 15px;
95
+ width: 100%;
96
+ padding: 10px 15px;
97
+ border-bottom: 1px solid #ddd;
98
+ }
99
+
100
+ .logo {
101
+ width: 40px;
102
+ height: 40px;
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ margin-right: 10px;
107
+ border-radius: 50%;
108
+ overflow: hidden;
109
+ }
110
+
111
+ .header-icon {
112
+ width: 100%;
113
+ height: auto;
114
+ }
115
+
116
+ .popup-header h2 {
117
+ font-size: 1.2em;
118
+ color: #080808;
119
+ margin: 0;
120
+ font-weight: bold;
121
+ }
122
+
123
+ .popup-header .evzone {
124
+ color: #0a0a0a;
125
+ }
126
+
127
+ .popup-header .pay {
128
+ color: #0a0a0a;
129
+ }
130
+
131
+ .merchant-header {
132
+ font-size: 1.2em;
133
+ font-weight: bold;
134
+ color: #02CD8D;
135
+ text-align: left;
136
+ margin-bottom: 10px;
137
+ width: 100%;
138
+ }
139
+
140
+ .merchant-details {
141
+ display: flex;
142
+ justify-content: space-between;
143
+ align-items: center;
144
+ background: #f9f9f9;
145
+ padding: 12px;
146
+ border-radius: 8px;
147
+ margin-bottom: 15px;
148
+ width: 100%;
149
+ }
150
+
151
+ .merchant-left {
152
+ display: flex;
153
+ align-items: center;
154
+ }
155
+
156
+ .merchant-info {
157
+ display: flex;
158
+ flex-direction: column;
159
+ text-align: left;
160
+ }
161
+
162
+ .merchant-name {
163
+ font-size: 1em;
164
+ font-weight: bold;
165
+ }
166
+
167
+ .merchant-id {
168
+ font-size: 0.9em;
169
+ color: #666;
170
+ }
171
+
172
+ .merchant-amount {
173
+ text-align: right;
174
+ }
175
+
176
+ .merchant-amount strong {
177
+ font-size: 1.2em;
178
+ font-weight: bold;
179
+ color: #000;
180
+ }
181
+
182
+ .passcode-section {
183
+ text-align: left;
184
+ margin-bottom: 20px;
185
+ width: 100%;
186
+ }
187
+
188
+ .passcode-section label {
189
+ font-size: 1em;
190
+ font-weight: bold;
191
+ color: #000;
192
+ }
193
+
194
+ .passcode-input {
195
+ position: relative;
196
+ width: 100%;
197
+ border: 1px solid #ccc;
198
+ border-radius: 8px;
199
+ padding: 12px;
200
+ font-size: 1.1em;
201
+ text-align: center;
202
+ letter-spacing: 5px;
203
+ background: transparent;
204
+ display: flex;
205
+ align-items: center;
206
+ }
207
+
208
+ .passcode-input input {
209
+ flex: 1;
210
+ border: none;
211
+ outline: none;
212
+ text-align: center;
213
+ font-size: 1.4em;
214
+ letter-spacing: 5px;
215
+ background: transparent;
216
+ color: #000;
217
+ font-weight: bold;
218
+ }
219
+
220
+ .passcode-input .toggle-visibility {
221
+ position: absolute;
222
+ right: 12px;
223
+ top: 50%;
224
+ transform: translateY(-50%);
225
+ cursor: pointer;
226
+ font-size: 1.5em;
227
+ color: #000;
228
+ }
229
+
230
+ .transaction-details {
231
+ display: flex;
232
+ align-items: flex-start;
233
+ background: #e0f0ff;
234
+ padding: 12px;
235
+ border-radius: 8px;
236
+ text-align: left;
237
+ width: 100%;
238
+ margin-bottom: 20px;
239
+ }
240
+
241
+ .transaction-details p {
242
+ font-size: 1em;
243
+ color: #000;
244
+ line-height: 1.5;
245
+ margin: 0;
246
+ }
247
+
248
+ .buttons-container {
249
+ width: 100%;
250
+ }
251
+
252
+ .confirm-button {
253
+ width: 100%;
254
+ background: #007bff;
255
+ color: #fff;
256
+ padding: 12px;
257
+ border-radius: 5px;
258
+ font-size: 1.1em;
259
+ cursor: pointer;
260
+ border: none;
261
+ transition: background-color 0.3s ease;
262
+ }
263
+
264
+ .confirm-button:disabled {
265
+ background: #ddd;
266
+ cursor: not-allowed;
267
+ }
268
+
269
+ .confirm-button:hover:not(:disabled) {
270
+ background: #0056b3;
271
+ }
272
+
273
+ .back-button {
274
+ width: 100%;
275
+ background: white;
276
+ border: 2px solid red;
277
+ color: red;
278
+ padding: 10px 15px;
279
+ border-radius: 5px;
280
+ font-size: 1em;
281
+ cursor: pointer;
282
+ transition: all 0.3s ease;
283
+ }
284
+
285
+ .back-button:hover {
286
+ background: white;
287
+ color: red;
288
+ border-color: red;
289
+ }
290
+ `}</style>
291
+ </>
292
+ );
293
+ };
294
+
295
+ export default EnterPasscode;
@@ -0,0 +1,168 @@
1
+ import React from 'react';
2
+
3
+ const HasAccountSummary = ({ onClose }) => {
4
+ return (
5
+ <>
6
+ <div className="popup-content">
7
+ <div className="popup-header">
8
+ <div className="logo">
9
+ <img
10
+ src="https://res.cloudinary.com/dlfa42ans/image/upload/v1741686201/logo_n7vrsf.jpg"
11
+ alt="EvZone Logo"
12
+ className="header-icon"
13
+ />
14
+ </div>
15
+ <h2>
16
+ <span className="evzone">EVzone</span>
17
+ <span className="pay"> Pay</span>
18
+ </h2>
19
+ <button className="close-btn" onClick={onClose}>
20
+ <span>×</span>
21
+ </button>
22
+ </div>
23
+ <div className="error-content">
24
+ <div className="message-container">
25
+ <div className="info-icon">i</div>
26
+ <div className="message-text">
27
+ <h3>EVzone requires you to sign in to proceed with this transaction</h3>
28
+ </div>
29
+ </div>
30
+ <button onClick={onClose} className="submit-button">Sign in</button>
31
+ </div>
32
+ </div>
33
+ <style>{`
34
+ .popup-content {
35
+ display: flex;
36
+ flex-direction: column;
37
+ align-items: center;
38
+ background: white;
39
+ border-radius: 10px;
40
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
41
+ max-width: 400px;
42
+ width: 90%;
43
+ text-align: center;
44
+ border: 1px solid #ddd;
45
+ font-family: Arial, sans-serif;
46
+ z-index: 1001;
47
+ position: relative;
48
+ pointer-events: auto;
49
+ }
50
+
51
+ .popup-header {
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: space-between;
55
+ margin-bottom: 15px;
56
+ width: 100%;
57
+ padding: 10px 15px;
58
+ border-bottom: 1px solid #ddd;
59
+ }
60
+
61
+ .logo {
62
+ width: 40px;
63
+ height: 40px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ margin-right: 10px;
68
+ border-radius: 50%;
69
+ overflow: hidden;
70
+ }
71
+
72
+ .header-icon {
73
+ width: 100%;
74
+ height: auto;
75
+ }
76
+
77
+ .popup-header h2 {
78
+ font-size: 1.2em;
79
+ color: #080808;
80
+ margin: 0;
81
+ font-weight: bold;
82
+ text-align: left;
83
+ flex-grow: 1;
84
+ }
85
+
86
+ .popup-header .evzone {
87
+ color: #0a0a0a;
88
+ }
89
+
90
+ .popup-header .pay {
91
+ color: #0a0a0a;
92
+ }
93
+
94
+ .close-btn {
95
+ background: none;
96
+ border: none;
97
+ font-size: 1.5em;
98
+ color: #ff5a5f;
99
+ cursor: pointer;
100
+ }
101
+
102
+ .error-content {
103
+ display: flex;
104
+ flex-direction: column;
105
+ align-items: center;
106
+ padding: 20px;
107
+ background-color: #fff;
108
+ border-radius: 8px;
109
+ }
110
+
111
+ .message-container {
112
+ display: flex;
113
+ align-items: center;
114
+ width: 100%;
115
+ margin-bottom: 20px;
116
+ background-color: #e0f7fa;
117
+ border-radius: 10px;
118
+ padding: 10px 15px;
119
+ }
120
+
121
+ .info-icon {
122
+ display: flex;
123
+ justify-content: center;
124
+ align-items: center;
125
+ width: 40px;
126
+ height: 40px;
127
+ background-color: #b3e5fc;
128
+ color: #0288d1;
129
+ border-radius: 50%;
130
+ font-size: 24px;
131
+ font-weight: bold;
132
+ margin-right: 15px;
133
+ }
134
+
135
+ .message-text {
136
+ flex: 1;
137
+ }
138
+
139
+ .message-text h3 {
140
+ font-size: 1.2em;
141
+ margin: 0;
142
+ color: #333;
143
+ font-weight: 500;
144
+ }
145
+
146
+ .submit-button {
147
+ background-color: #0288d1;
148
+ color: #fff;
149
+ border: none;
150
+ border-radius: 5px;
151
+ padding: 10px 20px;
152
+ font-size: 1em;
153
+ font-weight: 500;
154
+ cursor: pointer;
155
+ transition: background-color 0.3s ease;
156
+ width: 100%;
157
+ max-width: 200px;
158
+ }
159
+
160
+ .submit-button:hover {
161
+ background-color: #0277bd;
162
+ }
163
+ `}</style>
164
+ </>
165
+ );
166
+ };
167
+
168
+ export default HasAccountSummary;