elpaypg 2.0.8 → 2.1.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.
- package/package.json +3 -1
- package/public/css/checkout.css +39 -0
- package/public/elpay.js +11 -2
- package/src/index.js +22 -1
- package/src/services/whatsapp-berry.service.js +3 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elpaypg",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "ELPAY PG - single-backend payment gateway module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
".env.example"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@berrysdk/core": "^0.1.10",
|
|
18
|
+
"berryprotocol": "^0.1.10",
|
|
17
19
|
"express": "^4.19.0",
|
|
18
20
|
"qrcode": "^1.5.4"
|
|
19
21
|
},
|
package/public/css/checkout.css
CHANGED
|
@@ -2532,9 +2532,12 @@
|
|
|
2532
2532
|
display: flex !important;
|
|
2533
2533
|
flex-direction: row !important;
|
|
2534
2534
|
flex: 1 !important;
|
|
2535
|
+
width: 100% !important;
|
|
2536
|
+
max-width: 100% !important;
|
|
2535
2537
|
height: 100% !important;
|
|
2536
2538
|
max-height: 100% !important;
|
|
2537
2539
|
min-height: 0 !important;
|
|
2540
|
+
min-width: 0 !important;
|
|
2538
2541
|
overflow: hidden !important;
|
|
2539
2542
|
}
|
|
2540
2543
|
|
|
@@ -2691,6 +2694,42 @@
|
|
|
2691
2694
|
}
|
|
2692
2695
|
}
|
|
2693
2696
|
|
|
2697
|
+
/* NARROW DESKTOP (iframe width 768-1099px)
|
|
2698
|
+
The branding sidebar (310px) + methods rail (220px) together eat 530px of a
|
|
2699
|
+
~900px modal, leaving too little for the QR workspace, which then gets clipped
|
|
2700
|
+
by the wrapper's overflow:hidden. Reclaim the branding panel and slim the rail
|
|
2701
|
+
so the right-hand column always fits. */
|
|
2702
|
+
@media (min-width: 768px) and (max-width: 1099px) {
|
|
2703
|
+
.ypg-pc-sidebar {
|
|
2704
|
+
display: none !important;
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
.ypg-pc-methods-list {
|
|
2708
|
+
width: 190px !important;
|
|
2709
|
+
min-width: 190px !important;
|
|
2710
|
+
max-width: 190px !important;
|
|
2711
|
+
flex-shrink: 0 !important;
|
|
2712
|
+
padding: 12px 10px !important;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
.ypg-pc-active-view {
|
|
2716
|
+
padding: 14px 18px !important;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
/* Very narrow desktop: let the QR card wrap instead of overflowing. */
|
|
2721
|
+
@media (min-width: 768px) and (max-width: 880px) {
|
|
2722
|
+
.ypg-pc-active-view {
|
|
2723
|
+
padding: 12px 14px !important;
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
.ypg-qr-card-container {
|
|
2727
|
+
flex-wrap: wrap !important;
|
|
2728
|
+
justify-content: center !important;
|
|
2729
|
+
gap: 12px !important;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2694
2733
|
/* MOBILE SPECIFIC RULES - PINNED HEADER WITH CONTENT SCROLLING BEHIND IT */
|
|
2695
2734
|
@media (max-width: 767px) {
|
|
2696
2735
|
.ypg-pc-sidebar {
|
package/public/elpay.js
CHANGED
|
@@ -710,9 +710,9 @@
|
|
|
710
710
|
/* DESKTOP / PC MODAL STYLES (Razorpay 2-Column Exact Layout) */
|
|
711
711
|
@media (min-width: 768px) {
|
|
712
712
|
.elpay-checkout-container {
|
|
713
|
-
width:
|
|
713
|
+
width: 960px;
|
|
714
714
|
max-width: 95vw;
|
|
715
|
-
height:
|
|
715
|
+
height: 620px;
|
|
716
716
|
max-height: 92vh;
|
|
717
717
|
border-radius: 16px;
|
|
718
718
|
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
|
|
@@ -722,6 +722,15 @@
|
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
+
/* Large desktop: give the branding sidebar room so the QR workspace keeps
|
|
726
|
+
full width. Below this breakpoint the checkout hides the sidebar instead. */
|
|
727
|
+
@media (min-width: 1200px) {
|
|
728
|
+
.elpay-checkout-container {
|
|
729
|
+
width: 1100px;
|
|
730
|
+
height: 660px;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
725
734
|
/* MOBILE BOTTOM DRAWER / BOTTOM SHEET STYLES */
|
|
726
735
|
@media (max-width: 767px) {
|
|
727
736
|
.elpay-checkout-backdrop {
|
package/src/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
PaymentVerificationPipeline
|
|
26
26
|
} from './vendor/core/index.js';
|
|
27
27
|
import { createRouter } from './router.js';
|
|
28
|
+
import { getWhatsAppBerryService, WhatsAppBerryService } from './services/whatsapp-berry.service.js';
|
|
28
29
|
|
|
29
30
|
const __filename = fileURLToPath(import.meta.url);
|
|
30
31
|
const __dirname = path.dirname(__filename);
|
|
@@ -110,10 +111,22 @@ export async function elpay(options = {}) {
|
|
|
110
111
|
server: null, eventEmitter
|
|
111
112
|
});
|
|
112
113
|
|
|
114
|
+
const whatsappDataDir = options.whatsappDataDir || path.resolve(process.cwd(), 'data', 'whatsapp');
|
|
115
|
+
const whatsappEnabled = options.whatsapp !== false;
|
|
116
|
+
const whatsappBerryService = !whatsappEnabled
|
|
117
|
+
? null
|
|
118
|
+
: (options.whatsappBerryService || getWhatsAppBerryService({
|
|
119
|
+
sessionId: options.whatsappSessionId || 'elpay_berry_session',
|
|
120
|
+
sessionPath: path.join(whatsappDataDir, 'auth'),
|
|
121
|
+
databasePath: path.join(whatsappDataDir, 'store.db'),
|
|
122
|
+
metaFile: path.join(whatsappDataDir, 'session.json')
|
|
123
|
+
}));
|
|
124
|
+
|
|
113
125
|
const ctx = {
|
|
114
126
|
db, merchantRepo, accountRepo, customerRepo, customerSessionRepo, sessionRepo, deviceRepo,
|
|
115
127
|
obsRepo, ticketRepo, auditRepo, queueEngine, timingEngine, attributionEngine, pipeline,
|
|
116
128
|
recoveryEngine, eventEmitter, defaultMerchant, checkoutBaseUrl, webhookEngine,
|
|
129
|
+
whatsappBerryService,
|
|
117
130
|
baseUrl: options.baseUrl || process.env.BASE_URL || 'http://localhost:5000',
|
|
118
131
|
otpCooldownMs: options.otpCooldownMs,
|
|
119
132
|
theme: options.theme || {}
|
|
@@ -124,12 +137,20 @@ export async function elpay(options = {}) {
|
|
|
124
137
|
const destroy = () => {
|
|
125
138
|
timingEngine.destroy?.();
|
|
126
139
|
attributionEngine.destroy?.();
|
|
140
|
+
if (whatsappBerryService && typeof whatsappBerryService.disconnect === 'function') {
|
|
141
|
+
whatsappBerryService.disconnect({ cleanSession: false }).catch(() => {});
|
|
142
|
+
}
|
|
127
143
|
};
|
|
128
144
|
|
|
129
145
|
return {
|
|
130
146
|
router,
|
|
147
|
+
whatsappBerryService,
|
|
131
148
|
on: (event, cb) => eventEmitter.on(event, cb),
|
|
132
|
-
init: async () => {
|
|
149
|
+
init: async () => {
|
|
150
|
+
if (whatsappBerryService && typeof whatsappBerryService.initialize === 'function') {
|
|
151
|
+
whatsappBerryService.initialize().catch(() => {});
|
|
152
|
+
}
|
|
153
|
+
},
|
|
133
154
|
destroy,
|
|
134
155
|
};
|
|
135
156
|
}
|
|
@@ -16,11 +16,8 @@ async function loadDependencies() {
|
|
|
16
16
|
const candidates = [
|
|
17
17
|
'berryprotocol',
|
|
18
18
|
pathToFileURL(path.resolve(rootDir, 'node_modules/berryprotocol/dist/index.js')).href,
|
|
19
|
-
pathToFileURL(path.resolve(
|
|
20
|
-
'
|
|
21
|
-
'file:///D:/E-Commerce PKG/services/whatsapp-worker/node_modules/berryprotocol/dist/index.js',
|
|
22
|
-
'file:///D:/ECOM AND ELPAY PG INTEGRATION/E-Commerce PACKAGE/services/whatsapp-worker/node_modules/berryprotocol/dist/index.js',
|
|
23
|
-
'file:///D:/distribution/services/whatsapp-worker/node_modules/berryprotocol/dist/index.js'
|
|
19
|
+
pathToFileURL(path.resolve(process.cwd(), 'node_modules/berryprotocol/dist/index.js')).href,
|
|
20
|
+
pathToFileURL(path.resolve(process.cwd(), 'node_modules/elpaypg/node_modules/berryprotocol/dist/index.js')).href
|
|
24
21
|
];
|
|
25
22
|
for (const p of candidates) {
|
|
26
23
|
try {
|
|
@@ -37,11 +34,7 @@ async function loadDependencies() {
|
|
|
37
34
|
const qrCandidates = [
|
|
38
35
|
'qrcode',
|
|
39
36
|
pathToFileURL(path.resolve(rootDir, 'node_modules/qrcode/lib/index.js')).href,
|
|
40
|
-
pathToFileURL(path.resolve(
|
|
41
|
-
'file:///D:/WA-USERAUTH DEV/node_modules/qrcode/lib/index.js',
|
|
42
|
-
'file:///D:/E-Commerce PKG/services/whatsapp-worker/node_modules/qrcode/lib/index.js',
|
|
43
|
-
'file:///D:/ECOM AND ELPAY PG INTEGRATION/E-Commerce PACKAGE/services/whatsapp-worker/node_modules/qrcode/lib/index.js',
|
|
44
|
-
'file:///D:/distribution/services/whatsapp-worker/node_modules/qrcode/lib/index.js'
|
|
37
|
+
pathToFileURL(path.resolve(process.cwd(), 'node_modules/qrcode/lib/index.js')).href
|
|
45
38
|
];
|
|
46
39
|
for (const p of qrCandidates) {
|
|
47
40
|
try {
|