spree_vpago 2.2.2.pre.pre34 → 2.2.2.pre.pre36
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: 63c041b11de487a906751960209807c501c1c1e2b9fa7be4c902cedc6e566d47
|
|
4
|
+
data.tar.gz: a619fb9e96d513f5a6d462c56827b9cfce1742a511b5638bb6b81878bcda7606
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be88c1bc4337844f6bb84afa307b78e2e247b4bb89ecdf3a4429878d66184c840652e96ab4715040db92e019915690523c5a84423df4ea8195f04d107fa21be7
|
|
7
|
+
data.tar.gz: 579c3d7d20e0a19d96e664cd9294435b14a95512490c50b53f5cae93760056285b3bb28b838da89e0758da19040ce5989fc10a2ac6a8685a44b4c22e9df8c204
|
data/Gemfile.lock
CHANGED
|
@@ -159,7 +159,7 @@ module Spree
|
|
|
159
159
|
# ABA requires the use of the v2 API, but it does not yet support payout responses.
|
|
160
160
|
# Until v2 fully supports payouts, we fall back to v1 when payouts are enabled.
|
|
161
161
|
# Otherwise, we use v2 by default.
|
|
162
|
-
checker = if
|
|
162
|
+
checker = if payment.payouts.any?
|
|
163
163
|
Vpago::PaywayV2::TransactionStatus.new(payment)
|
|
164
164
|
else
|
|
165
165
|
Vpago::PaywayV2::TransactionStatusV2.new(payment)
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
<%= csrf_meta_tags %>
|
|
9
9
|
<%= csp_meta_tag %>
|
|
10
10
|
|
|
11
|
+
<%= yield :head %>
|
|
12
|
+
|
|
11
13
|
<%= javascript_include_tag "vpago/vpago_payments/check_transaction_periodically", 'data-turbo-track': 'reload' %>
|
|
12
14
|
<%= javascript_include_tag "vpago/vpago_payments/request_process_payment", 'data-turbo-track': 'reload' %>
|
|
13
15
|
<%= javascript_include_tag "vpago/vpago_payments/user_informers/#{user_informer}", 'data-turbo-track': 'reload' %>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<% @checkout_options = { disable_return_deeplink: params[:platform] == 'web' } %>
|
|
2
2
|
<% @checkout = ::Vpago::PaywayV2::Checkout.new(@payment, @checkout_options) %>
|
|
3
3
|
|
|
4
|
+
<% content_for :head do %>
|
|
5
|
+
<link rel="preconnect" href="<%= @payment.payment_method.preferred_host %>" crossorigin>
|
|
6
|
+
<link rel="dns-prefetch" href="<%= @payment.payment_method.preferred_host %>">
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
4
9
|
<form method="POST" action="<%= @checkout.checkout_url %>" id="aba_merchant_request">
|
|
5
10
|
<% @checkout.gateway_params.each do |key, value| %>
|
|
6
11
|
<input type="hidden" name="<%= key %>" value="<%= value %>">
|
|
@@ -14,20 +19,6 @@
|
|
|
14
19
|
const shouldOpenAbaPayDeeplink = isMobile && <%= @payment.payment_method.open_abapay_deeplink? %>;
|
|
15
20
|
const shouldOpenCheckoutUrl = <%= @payment.payment_method.open_checkout_url? %>;
|
|
16
21
|
|
|
17
|
-
function openDeeplinkUrl(deeplinkUrl) {
|
|
18
|
-
window.location.href = deeplinkUrl;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function openUrl(url, delay = 0) {
|
|
22
|
-
if(delay > 0) {
|
|
23
|
-
setTimeout(function() {
|
|
24
|
-
window.location.href = url;
|
|
25
|
-
}, delay);
|
|
26
|
-
} else {
|
|
27
|
-
window.location.href = url;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
22
|
function showRedirectContainer(buttonLabel = null, onClick = null) {
|
|
32
23
|
const loadingContainer = document.getElementById('vpago_loading_container');
|
|
33
24
|
const redirectContainer = document.getElementById('vpago_redirect_container');
|
|
@@ -44,53 +35,48 @@
|
|
|
44
35
|
redirectContainer.style.removeProperty('display');
|
|
45
36
|
}
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var checkoutUrl = document.getElementById("aba_merchant_request").action;
|
|
51
|
-
|
|
52
|
-
fetch(checkoutUrl, {
|
|
53
|
-
method: "POST",
|
|
54
|
-
body: formData
|
|
55
|
-
})
|
|
56
|
-
.then(function(response) {
|
|
57
|
-
return response.json();
|
|
58
|
-
})
|
|
59
|
-
.then(function(data) {
|
|
60
|
-
console.log("[Vpago] checkout response data:", JSON.stringify(data));
|
|
38
|
+
if (abapayKhqrDeeplink) {
|
|
39
|
+
var formData = new FormData(document.getElementById("aba_merchant_request"));
|
|
40
|
+
var checkoutUrl = document.getElementById("aba_merchant_request").action;
|
|
61
41
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
42
|
+
fetch(checkoutUrl, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: formData
|
|
45
|
+
})
|
|
46
|
+
.then(function(response) {
|
|
47
|
+
return response.json();
|
|
48
|
+
})
|
|
49
|
+
.then(function(data) {
|
|
50
|
+
console.log("[Vpago] checkout response data:", JSON.stringify(data));
|
|
70
51
|
|
|
71
|
-
|
|
72
|
-
|
|
52
|
+
// When status code is 4 (duplicated transaction),
|
|
53
|
+
// Possibly user refresh the checkout page even after the transaction is completed.
|
|
54
|
+
// So in this case, we should hide loading spinner and show redirect container UI
|
|
55
|
+
// While it check transaction status in the background. It will automatically redirect user to the result page after checking.
|
|
56
|
+
if (data.status.code === 4){
|
|
57
|
+
showRedirectContainer();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
shouldShowRedirectContainer = true;
|
|
78
|
-
}
|
|
61
|
+
if (data.abapay_deeplink && shouldOpenAbaPayDeeplink) {
|
|
62
|
+
window.location.href = data.abapay_deeplink;
|
|
63
|
+
}
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
65
|
+
if (data.checkout_qr_url && shouldOpenCheckoutUrl) {
|
|
66
|
+
window.location.href = data.checkout_qr_url;
|
|
67
|
+
}
|
|
84
68
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
69
|
+
shouldShowRedirectContainer = !shouldOpenCheckoutUrl && shouldOpenAbaPayDeeplink;
|
|
70
|
+
if(shouldShowRedirectContainer){
|
|
71
|
+
showRedirectContainer("Open ABA Mobile", () => openDeeplinkUrl(data.abapay_deeplink));
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
.catch(function(error) {
|
|
75
|
+
console.error("Payment request failed:", error);
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
93
79
|
document.getElementById("aba_merchant_request").submit();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
96
82
|
</script>
|
data/lib/spree_vpago/version.rb
CHANGED