spree_vpago 2.1.4.pre.beta5 → 2.1.4.pre.beta6
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: 5cc9bf61785b98ad108ca7489f282f2ad24f84d33a4b746ecfa25eed3d411f64
|
|
4
|
+
data.tar.gz: 54a8386ee6192dc2b98e96044e6f7ce689b46413f4fa7365b57f74afd8e5f8c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bee5ba3f80b99041f9ef0c71e487508eff0b8b4b3cd62e988f6fda583e3d96e979be3fc3c4c9f2eda7b29a17d54c58bfb42b99ec0522dff6ec07a3b29927ef38
|
|
7
|
+
data.tar.gz: c97611f2ddffa60ca142547515f1b04fcf639cc55cb0b6c30a37dd4bfb5bb4d99fcecffc7584cba2c7d66d78e06db0f40affe91e5b3b42aa004a0850c9f72dd9
|
data/Gemfile.lock
CHANGED
|
@@ -24,6 +24,10 @@ module Vpago
|
|
|
24
24
|
]
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def available_vattanac_payment_options
|
|
28
|
+
%w[khqr deeplink all]
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
def preference_field_for(form, field, options)
|
|
28
32
|
case field
|
|
29
33
|
when 'preferred_acleda_type'
|
|
@@ -33,6 +37,8 @@ module Vpago
|
|
|
33
37
|
class: 'fullwidth select2')
|
|
34
38
|
when 'preferred_icon_name'
|
|
35
39
|
return form.select(:preferred_icon_name, available_payment_icons, {}, class: 'fullwidth select2')
|
|
40
|
+
when 'preferred_vattanac_payment_option'
|
|
41
|
+
return form.select(:preferred_vattanac_payment_option, available_vattanac_payment_options, {}, class: 'fullwidth select2')
|
|
36
42
|
end
|
|
37
43
|
super
|
|
38
44
|
end
|
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
<%
|
|
2
2
|
checkout = Vpago::Vattanac::Checkout.new(@payment)
|
|
3
|
+
payment_option = @payment.payment_method.preferred_vattanac_payment_option
|
|
4
|
+
|
|
3
5
|
result = begin
|
|
4
6
|
checkout.create
|
|
5
7
|
rescue => e
|
|
6
8
|
Rails.logger.error("Vattanac checkout.create failed: #{e.message}")
|
|
7
|
-
{
|
|
9
|
+
{ deeplink_url: nil, web_url: nil }
|
|
8
10
|
end
|
|
9
11
|
%>
|
|
10
12
|
|
|
11
13
|
<script>
|
|
12
14
|
const platform = "<%= params[:platform] %>";
|
|
13
|
-
const
|
|
15
|
+
const deeplinkUrl = "<%= raw(result[:deeplink_url]) %>";
|
|
14
16
|
const webUrl = "<%= raw(result[:web_url]) %>";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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);
|
|
21
38
|
}
|
|
22
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.1.4.pre.
|
|
4
|
+
version: 2.1.4.pre.beta6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|