spree_vpago 2.2.2.pre.pre3 → 2.2.2.pre.pre4
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: a0ba07837392b1baedf9b89ea7e09de961d6176200c2ad7f9e1d76c81fca99b3
|
|
4
|
+
data.tar.gz: 852c658f7e0125dd1f730f7c1ffb07296c46376e8d536baaa298e5b209c9fe4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9577ff4c2005f41930073a86daf4c7fb8b0a5ea0e9148b6fc26a910eb21a0ef3c798fbf65985c2e3a250c3aec342e4dc89b0bb4f4139d1e6738fd3394d620602
|
|
7
|
+
data.tar.gz: fd310d6641367ab174a74d9507edfcd90565aa1a3013b19fe16ced1f7079e0b1dd635665b4d2bd4c80af5fff690e117c3ba46d8ad0c9e8ca19ae549a4f536c43
|
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.pre4)
|
|
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.3.2)
|
|
192
192
|
faraday (~> 2.0)
|
|
193
193
|
ffaker (2.21.0)
|
|
194
194
|
ffi (1.15.5)
|
|
@@ -1,47 +1,13 @@
|
|
|
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' %>">
|
|
9
2
|
|
|
3
|
+
<form method="POST" action="<%= @checkout.checkout_url %>" id="aba_merchant_request">
|
|
10
4
|
<% @checkout.gateway_params.each do |key, value| %>
|
|
11
|
-
<input type=
|
|
5
|
+
<input type='hidden' name='<%= key %>' value='<%= value %>' />
|
|
12
6
|
<% end %>
|
|
13
7
|
</form>
|
|
14
8
|
|
|
15
9
|
<script>
|
|
16
|
-
document.addEventListener("DOMContentLoaded", function () {
|
|
17
|
-
|
|
18
|
-
|
|
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.open(data.abapay_deeplink, '_blank');
|
|
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
|
-
});
|
|
10
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
11
|
+
document.getElementById("aba_merchant_request").submit()
|
|
12
|
+
})
|
|
47
13
|
</script>
|
|
@@ -8,32 +8,50 @@ 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)
|
|
11
13
|
%>
|
|
12
14
|
|
|
13
15
|
<script>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
+
const platform = "<%= params[:platform] %>";
|
|
18
|
+
const deeplinkUrl = "<%= raw(result[:deeplink_url]) %>";
|
|
19
|
+
const webUrl = "<%= raw(result[:web_url]) %>";
|
|
20
|
+
const paymentOption = "<%= payment_option %>";
|
|
21
|
+
|
|
22
|
+
const redirectTo = (url) => { if (url) window.location.href = url; };
|
|
23
|
+
|
|
24
|
+
const setupPaymentProcessingListener = () => {
|
|
25
|
+
const firebaseConfigs = <%= Rails.application.credentials.firebase_web_config.to_json.html_safe %>;
|
|
26
|
+
const documentReferencePath = "<%= @payment.user_informer.document_reference_path %>";
|
|
27
|
+
const successUrl = "<%= @payment.success_url %>";
|
|
28
|
+
|
|
29
|
+
if (window.initPaymentProcessingListener) {
|
|
30
|
+
window.initPaymentProcessingListener(firebaseConfigs, documentReferencePath, successUrl);
|
|
31
|
+
} else {
|
|
32
|
+
console.log("initPaymentProcessingListener is not defined");
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
switch (paymentOption) {
|
|
37
|
+
case "khqr":
|
|
38
|
+
redirectTo(webUrl);
|
|
39
|
+
break;
|
|
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
|
+
});
|
|
39
57
|
</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.pre4
|
|
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-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|