spree_vpago 2.2.2.pre.pre16 → 2.2.2.pre.pre17
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: a41c53551544436fc2973a85d085bf8dd9712ebd84ae9d6b8d820ffeeea6d5b2
|
|
4
|
+
data.tar.gz: e0141d5b5968a647843616bfcea9a458c2805215cc78bc3651a999565bed6a59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc3468dcff8511b38149ec840b73c09ed669c0347d0daa84956983edde8b8e4470f23825efc5e662424f6057d008f5ca788623a580cd21f45f3ab726923638a8
|
|
7
|
+
data.tar.gz: 9ed4fe39e71672992963611effb80f9e781b24b677a9ac040de0b75cf56762d2e210a3c60abde7e3e69a838816715d7969412a92db588de3cf543eba81a39cd2
|
data/Gemfile.lock
CHANGED
|
@@ -16,15 +16,29 @@ module Vpago
|
|
|
16
16
|
# when return nil, each payment method should use their default URL.
|
|
17
17
|
# eg. PayWayV2 will use the continue_success_url as deeplink back URL.
|
|
18
18
|
def custom_return_deeplink_url
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if user_agent.include?('telegram')
|
|
19
|
+
if telegram_user_agent?
|
|
22
20
|
'tg://'
|
|
23
|
-
elsif
|
|
21
|
+
elsif facebook_user_agent?
|
|
24
22
|
'fb://'
|
|
25
|
-
elsif
|
|
23
|
+
elsif messenger_user_agent?
|
|
26
24
|
'fb-messenger://'
|
|
27
25
|
end
|
|
28
26
|
end
|
|
27
|
+
|
|
28
|
+
def mobile_user_agent?
|
|
29
|
+
request.user_agent.to_s.downcase.match?(/android|iphone|ipad|ipod/)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def telegram_user_agent?
|
|
33
|
+
request.user_agent.to_s.downcase.include?('telegram')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def facebook_user_agent?
|
|
37
|
+
request.user_agent.to_s.downcase.include?('fban') || request.user_agent.to_s.downcase.include?('facebook')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def messenger_user_agent?
|
|
41
|
+
request.user_agent.to_s.downcase.include?('messenger')
|
|
42
|
+
end
|
|
29
43
|
end
|
|
30
44
|
end
|
|
@@ -8,22 +8,29 @@
|
|
|
8
8
|
</form>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
+
const isTelegram = <%= telegram_user_agent? %>;
|
|
12
|
+
const isMobile = <%= mobile_user_agent? %>;
|
|
13
|
+
|
|
11
14
|
const abapayKhqrDeeplink = "<%= @payment.payment_method.abapay_khqr_deeplink? %>";
|
|
12
|
-
const shouldOpenAbaPayDeeplink = <%= @payment.payment_method.open_abapay_deeplink? %>;
|
|
15
|
+
const shouldOpenAbaPayDeeplink = isMobile && <%= @payment.payment_method.open_abapay_deeplink? %>;
|
|
13
16
|
const shouldOpenCheckoutUrl = <%= @payment.payment_method.open_checkout_url? %>;
|
|
14
17
|
|
|
15
|
-
function
|
|
16
|
-
|
|
18
|
+
function openDeeplink(abapay_deeplink) {
|
|
19
|
+
if(isTelegram){
|
|
20
|
+
window.open(abapay_deeplink, '_blank');
|
|
21
|
+
} else {
|
|
22
|
+
window.location.href = abapay_deeplink;
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
function openAbapayDeeplink(abapay_deeplink) {
|
|
20
27
|
document.getElementById("vpago_primary_button").style.display = "block";
|
|
21
28
|
document.getElementById("vpago_primary_button").innerText = "Open ABA Pay";
|
|
22
29
|
document.getElementById("vpago_primary_button").addEventListener("click", function() {
|
|
23
|
-
|
|
30
|
+
openDeeplink(abapay_deeplink)
|
|
24
31
|
});
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
openDeeplink(abapay_deeplink)
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
function openCheckoutUrl(checkout_qr_url, delay = 0) {
|
|
@@ -57,7 +64,7 @@
|
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
if (data.checkout_qr_url && shouldOpenCheckoutUrl) {
|
|
60
|
-
openCheckoutUrl(data.checkout_qr_url, shouldDelayBeforeOpenCheckoutUrl ?
|
|
67
|
+
openCheckoutUrl(data.checkout_qr_url, shouldDelayBeforeOpenCheckoutUrl ? 500 : 0);
|
|
61
68
|
}
|
|
62
69
|
})
|
|
63
70
|
.catch(function(error) {
|
data/lib/spree_vpago/version.rb
CHANGED