spree_vpago 2.2.2.pre.pre12 → 2.2.2.pre.pre13

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: 0d5ee57baf6e2451847466adba567cf8922799e54575e0aa690758416ad14ed1
4
- data.tar.gz: 2998d1e7883e8c1bd041bc2eb9abc4c8f3dcb45ee21a3c8d6958c838ffa57bfa
3
+ metadata.gz: 8e1146678e861bc1d84d97e922fb268148a45bb605d9d14414d121428e5c2dc6
4
+ data.tar.gz: fa89bb5e2bfec29f04d4fa31477b6f48d4f8ed0b970faa2bd51d1e828640b87d
5
5
  SHA512:
6
- metadata.gz: f4fac23a6529811d3fc71c6ac9128a2c2c93fad05cc3bab1e09878d7d9ccc67ecb4482075893162ce1568524ab364dc6c7bc763c2c56615122083c74dc4d21d3
7
- data.tar.gz: 75f328a206a6a6deeb0a62d3bc41286188ebc931c36299ac35b07bc9e0a087d6631fb1c6615d9ef8f5b50fda2c187c4fdcae63fd6a30c0358b9bc7d20f3d292e
6
+ metadata.gz: bc6d965090f34c46547385cae293652dbc453d2f50524e58d9320aa16bd85b3d8d9cb2e5a8ec8c496867377e133d9dbbbc99b1fa15a988dc6ead8da0a82e08e3
7
+ data.tar.gz: e1c7d30ac4be2adb539b1476c1f1d3aa9fdcd1e3650e09c333f617d463909c3986e2db43f48843e9db5eee17eb464b5a58d2fa68c81d5e0d664bb5ad55cf83e3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.2.2.pre.pre12)
4
+ spree_vpago (2.2.2.pre.pre13)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -12,101 +12,40 @@
12
12
  <% end %>
13
13
  </form>
14
14
 
15
- <!-- WebView Container -->
16
- <div id="webViewContainer" style="display:none;"></div>
17
-
18
15
  <script>
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 render checkout + optional deeplink
25
- // 1. Check if response is OK and has JSON content
26
- // 2. Validate required fields
27
- // 3. WAIT until checkout fully loads before attempting deeplink
28
- // 4. Detect if user leaves browser (app opened)
29
- // 5. Fallback: show form and submit normally
30
-
31
- if (paymentOption === "abapay_khqr_deeplink") {
32
- fetch(form.action, {
33
- method: "POST",
34
- body: new FormData(form)
35
- })
36
- .then(res => {
37
- if (!res.ok) {
38
- throw new Error(`HTTP ${res.status}: ${res.statusText}`);
39
- }
40
-
41
- const contentType = res.headers.get("content-type");
42
- if (!contentType || !contentType.includes("application/json")) {
43
- throw new Error("Response is not JSON");
44
- }
45
-
46
- return res.json();
47
- })
48
- .then(data => {
49
- // Validate required fields
50
- if (!data.checkout_qr_url && !data.abapay_deeplink) {
51
- throw new Error("Missing checkout_qr_url and abapay_deeplink");
52
- }
53
-
54
- // Setup container as full-screen overlay
55
- webViewContainer.style.display = "block";
56
- webViewContainer.style.position = "fixed";
57
- webViewContainer.style.top = "0";
58
- webViewContainer.style.left = "0";
59
- webViewContainer.style.width = "100%";
60
- webViewContainer.style.height = "100%";
61
- webViewContainer.style.zIndex = "9999";
62
- webViewContainer.style.backgroundColor = "#fff";
63
-
64
- const checkoutIframe = document.createElement("iframe");
65
- checkoutIframe.src = data.checkout_qr_url;
66
- checkoutIframe.style.width = "100%";
67
- checkoutIframe.style.height = "100%";
68
- checkoutIframe.style.border = "none";
69
-
70
- webViewContainer.appendChild(checkoutIframe);
71
-
72
- checkoutIframe.onload = function () {
73
- if (!data.abapay_deeplink) return;
74
-
75
- console.log("Checkout loaded, attempting ABA deeplink...");
76
-
77
- const deeplinkFrame = document.createElement("iframe");
78
- deeplinkFrame.style.display = "none";
79
- deeplinkFrame.src = data.abapay_deeplink;
80
- document.body.appendChild(deeplinkFrame);
81
-
82
- let appOpened = false;
83
-
84
- const visibilityHandler = () => {
85
- appOpened = true;
86
- };
87
-
88
- document.addEventListener("visibilitychange", visibilityHandler);
89
-
90
- setTimeout(() => {
91
- document.removeEventListener("visibilitychange", visibilityHandler);
92
-
93
- if (!appOpened) {
94
- console.log("ABA app not installed, staying on checkout page.");
95
- }
96
- }, 2000);
97
- };
98
- })
99
- .catch(err => {
100
- console.error("ABA Deeplink Error:", err);
101
- console.log("Falling back to regular form submission...");
102
-
103
- form.style.display = "block";
104
- form.submit();
105
- });
106
-
107
- // CASE 2: Normal ABA KHQR → regular redirect form post
108
- } else {
16
+ document.addEventListener("DOMContentLoaded", function () {
17
+ const form = document.getElementById("aba_merchant_request");
18
+ const paymentOption = form.dataset.paymentOption;
19
+
20
+ if (paymentOption === "abapay_khqr_deeplink") {
21
+
22
+ fetch(form.action, {
23
+ method: "POST",
24
+ body: new FormData(form)
25
+ })
26
+ .then(res => res.json())
27
+ .then(data => {
28
+
29
+ if (!data.checkout_qr_url && !data.abapay_deeplink) {
30
+ throw new Error("Missing payment URLs");
31
+ }
32
+
33
+ if (data.checkout_qr_url) {
34
+ window.open(data.checkout_qr_url, "_blank");
35
+ }
36
+
37
+ if (data.abapay_deeplink) {
38
+ window.location.href = data.abapay_deeplink;
39
+ }
40
+
41
+ })
42
+ .catch(err => {
43
+ console.error("Error:", err);
109
44
  form.submit();
110
- }
111
- });
112
- </script>
45
+ });
46
+
47
+ } else {
48
+ form.submit();
49
+ }
50
+ });
51
+ </script>
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.2.2-pre12'.freeze
4
+ VERSION = '2.2.2-pre13'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_vpago
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2.pre.pre12
4
+ version: 2.2.2.pre.pre13
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-24 00:00:00.000000000 Z
11
+ date: 2026-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday