spree_vpago 2.2.2.pre.pre8 → 2.2.2.pre.pre10
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bd56e9a7ecb7d8d5ca0abaf1232b9d92233bd025043e06b763dbb89d675e0412
|
|
4
|
+
data.tar.gz: 757343200d1e61cbe263a684d24ce2fa1fdd112c87b0d696bf27842132066378
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ef89ccf97395357c1f766648af7fc48891494fc9b2b14d159edfd01c6e7a88f456bb8865bae8a76cde9821122badd3932d6516c6dc78c0c6903c7f25684591e
|
|
7
|
+
data.tar.gz: 97718367ab37d76e0d9898278df202752167c2b4056954e6bb37534a23e6b57d60a5b200c6395e98f3c332e5e5eb94a74e4c771c9887155a448f385716adf316
|
data/Gemfile.lock
CHANGED
|
@@ -12,43 +12,80 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
</form>
|
|
14
14
|
|
|
15
|
+
<!-- WebView Container -->
|
|
16
|
+
<div id="webViewContainer" style="display:none;"></div>
|
|
17
|
+
|
|
15
18
|
<script>
|
|
16
|
-
document.addEventListener("DOMContentLoaded", function () {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
19
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
20
|
+
const form = document.getElementById("aba_merchant_request");
|
|
21
|
+
const paymentOption = form.dataset.paymentOption;
|
|
22
|
+
const webViewContainer = document.getElementById("webViewContainer");
|
|
23
|
+
|
|
24
|
+
// CASE 1: ABA KHQR Deeplink → fetch JSON then redirect
|
|
25
|
+
if (paymentOption === "abapay_khqr_deeplink") {
|
|
26
|
+
|
|
27
|
+
fetch(form.action, {
|
|
28
|
+
method: "POST",
|
|
29
|
+
body: new FormData(form)
|
|
30
|
+
})
|
|
31
|
+
.then(res => res.json())
|
|
32
|
+
.then(data => {
|
|
33
|
+
|
|
34
|
+
// Load QR page inside webViewContainer
|
|
35
|
+
if (data.checkout_qr_url) {
|
|
36
|
+
webViewContainer.style.display = "block";
|
|
37
|
+
webViewContainer.style.position = "fixed";
|
|
38
|
+
webViewContainer.style.top = "0";
|
|
39
|
+
webViewContainer.style.left = "0";
|
|
40
|
+
webViewContainer.style.width = "100%";
|
|
41
|
+
webViewContainer.style.height = "100%";
|
|
42
|
+
webViewContainer.style.zIndex = "9999";
|
|
43
|
+
|
|
44
|
+
const checkoutIframe = document.createElement("iframe");
|
|
45
|
+
checkoutIframe.src = data.checkout_qr_url;
|
|
46
|
+
checkoutIframe.style.width = "100%";
|
|
47
|
+
checkoutIframe.style.height = "100%";
|
|
48
|
+
checkoutIframe.style.border = "none";
|
|
49
|
+
|
|
50
|
+
webViewContainer.appendChild(checkoutIframe);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Attempt ABA Deeplink (hidden iframe)
|
|
54
|
+
if (data.abapay_deeplink) {
|
|
55
|
+
|
|
56
|
+
const deeplinkFrame = document.createElement("iframe");
|
|
57
|
+
deeplinkFrame.style.display = "none";
|
|
58
|
+
deeplinkFrame.src = data.abapay_deeplink;
|
|
59
|
+
document.body.appendChild(deeplinkFrame);
|
|
60
|
+
|
|
61
|
+
// Detect if app opened
|
|
62
|
+
let appOpened = false;
|
|
63
|
+
|
|
64
|
+
const visibilityHandler = () => {
|
|
65
|
+
appOpened = true;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
document.addEventListener("visibilitychange", visibilityHandler);
|
|
69
|
+
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
document.removeEventListener("visibilitychange", visibilityHandler);
|
|
72
|
+
|
|
73
|
+
if (!appOpened) {
|
|
74
|
+
console.log("ABA app not installed, staying inside webViewContainer");
|
|
75
|
+
}
|
|
76
|
+
}, 2000);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!data.checkout_qr_url && !data.abapay_deeplink) {
|
|
80
|
+
console.error("Missing checkout_qr_url and abapay_deeplink", data);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
})
|
|
84
|
+
.catch(err => console.error("ABA Deeplink Error:", err));
|
|
85
|
+
|
|
86
|
+
// CASE 2: Normal ABA KHQR → regular redirect form post
|
|
87
|
+
} else {
|
|
88
|
+
form.submit();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
54
91
|
</script>
|
data/lib/spree_vpago/version.rb
CHANGED