spree_vpago 2.2.2.pre.pre4 → 2.2.2.pre.pre5
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: 1a10395ce29f627210dcc1d925b2f54084896dfe62232ea005e07aa02df3b5d8
|
|
4
|
+
data.tar.gz: 562854f5952bd693b6247b72db976fcb46efd0d3849e636b25bb634499b57b29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fadbe5c4d4b211817f9ca901c4c7f660692976d728897e81a85fb41caa158cb84dbd9f05fd1485823784af27d06243572898a4b123943e5a316b1702332f5d1b
|
|
7
|
+
data.tar.gz: 1ca3cace17a3897b31358871c4faf0a8a4b30287bb66f036de40278c297f81b6a4ff4b097efd13ea76901d4320e823b386f4ce5e61640219fc6e4c1fa70fb0d5
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
spree_vpago (2.2.2.pre.
|
|
4
|
+
spree_vpago (2.2.2.pre.pre5)
|
|
5
5
|
faraday
|
|
6
6
|
google-cloud-firestore
|
|
7
7
|
spree_api (>= 4.5)
|
|
@@ -188,7 +188,7 @@ GEM
|
|
|
188
188
|
faraday-http-cache (2.5.0)
|
|
189
189
|
faraday (>= 0.8)
|
|
190
190
|
faraday-net_http (3.0.2)
|
|
191
|
-
faraday-retry (2.
|
|
191
|
+
faraday-retry (2.4.0)
|
|
192
192
|
faraday (~> 2.0)
|
|
193
193
|
ffaker (2.21.0)
|
|
194
194
|
ffi (1.15.5)
|
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
<% @checkout = ::Vpago::PaywayV2::Checkout.new(@payment) %>
|
|
2
|
+
<% payment_option = @payment.payment_method.preferences[:payment_option] %>
|
|
3
|
+
|
|
4
|
+
<form method="POST"
|
|
5
|
+
action="<%= @checkout.checkout_url %>"
|
|
6
|
+
id="aba_merchant_request"
|
|
7
|
+
data-payment-option="<%= payment_option %>"
|
|
8
|
+
style="<%= 'display:none;' if payment_option == 'abapay_khqr_deeplink' %>">
|
|
2
9
|
|
|
3
|
-
<form method="POST" action="<%= @checkout.checkout_url %>" id="aba_merchant_request">
|
|
4
10
|
<% @checkout.gateway_params.each do |key, value| %>
|
|
5
|
-
<input type=
|
|
11
|
+
<input type="hidden" name="<%= key %>" value="<%= value %>">
|
|
6
12
|
<% end %>
|
|
7
13
|
</form>
|
|
8
14
|
|
|
9
15
|
<script>
|
|
10
16
|
document.addEventListener("DOMContentLoaded", function () {
|
|
11
|
-
document.getElementById("aba_merchant_request")
|
|
12
|
-
|
|
17
|
+
const form = document.getElementById("aba_merchant_request");
|
|
18
|
+
const paymentOption = form.dataset.paymentOption;
|
|
19
|
+
|
|
20
|
+
// 🔹 CASE 1: ABA KHQR Deeplink → fetch JSON then redirect
|
|
21
|
+
if (paymentOption === "abapay_khqr_deeplink") {
|
|
22
|
+
fetch(form.action, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: new FormData(form)
|
|
25
|
+
})
|
|
26
|
+
.then(res => res.json())
|
|
27
|
+
.then(data => {
|
|
28
|
+
if (data.checkout_qr_url) {
|
|
29
|
+
window.location.href = data.checkout_qr_url;
|
|
30
|
+
}
|
|
31
|
+
if (data.abapay_deeplink) {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
window.location.href = data.abapay_deeplink;
|
|
34
|
+
}, 1500);
|
|
35
|
+
}
|
|
36
|
+
if (!data.checkout_qr_url && !data.abapay_deeplink) {
|
|
37
|
+
console.error("checkout_qr_url and abapay_deeplink both missing", data);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.catch(err => console.error("ABA Deeplink Error:", err));
|
|
41
|
+
|
|
42
|
+
// 🔹 CASE 2: Normal ABA KHQR → regular redirect form post
|
|
43
|
+
} else {
|
|
44
|
+
form.submit();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
13
47
|
</script>
|
|
@@ -8,50 +8,32 @@ rescue => e
|
|
|
8
8
|
Rails.logger.error("Vattanac checkout.create failed: #{e.message}")
|
|
9
9
|
{ deeplink_url: nil, web_url: nil }
|
|
10
10
|
end
|
|
11
|
-
|
|
12
|
-
@payment.user_informer.payment_is_processing(processing: true)
|
|
13
11
|
%>
|
|
14
12
|
|
|
15
13
|
<script>
|
|
16
|
-
|
|
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
|
-
case "deeplink":
|
|
42
|
-
redirectTo(deeplinkUrl);
|
|
43
|
-
break;
|
|
44
|
-
|
|
45
|
-
case "all":
|
|
46
|
-
if (platform === "app") redirectTo(deeplinkUrl);
|
|
47
|
-
else if (platform === "web") redirectTo(webUrl);
|
|
48
|
-
else console.error("Unknown platform:", platform);
|
|
49
|
-
break;
|
|
50
|
-
|
|
51
|
-
default:
|
|
52
|
-
console.error("Invalid payment option:", paymentOption);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
setupPaymentProcessingListener();
|
|
56
|
-
});
|
|
14
|
+
const platform = "<%= params[:platform] %>";
|
|
15
|
+
const deeplinkUrl = "<%= raw(result[:deeplink_url]) %>";
|
|
16
|
+
const webUrl = "<%= raw(result[:web_url]) %>";
|
|
17
|
+
const paymentOption = "<%= payment_option %>";
|
|
18
|
+
|
|
19
|
+
const redirectTo = (url) => { if (url) window.location.href = url; };
|
|
20
|
+
|
|
21
|
+
switch (paymentOption) {
|
|
22
|
+
case "khqr":
|
|
23
|
+
redirectTo(webUrl);
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case "deeplink":
|
|
27
|
+
redirectTo(deeplinkUrl);
|
|
28
|
+
break;
|
|
29
|
+
|
|
30
|
+
case "all":
|
|
31
|
+
if (platform === "app") redirectTo(deeplinkUrl);
|
|
32
|
+
else if (platform === "web") redirectTo(webUrl);
|
|
33
|
+
else console.error("Unknown platform:", platform);
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
default:
|
|
37
|
+
console.error("Invalid payment option:", paymentOption);
|
|
38
|
+
}
|
|
57
39
|
</script>
|
data/lib/spree_vpago/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.2.2.pre.pre5
|
|
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-
|
|
11
|
+
date: 2026-02-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|