spree_vpago 2.0.9.pre.beta3 → 2.0.9.pre.beta5

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: f296be84aaf9c992751edaa2755f496ed70899de40b876afeb7013457cf6297a
4
- data.tar.gz: 8d586c4b779e6d6e29a60ae07bd941e920132635ec2b870e360763ad65d93caa
3
+ metadata.gz: 7af7ed97c69c8a8263697826295b12b59d8eabcd50fc6ec83a8be08f474e024e
4
+ data.tar.gz: 58bc7620d3cf994a1302f6c972cef6ff6c3611d58f59667235e7c473f8808769
5
5
  SHA512:
6
- metadata.gz: 6891950168f31b3df2f32b39791c8ba902ae19279886dacbfc60265802674007e2a8ff7437f9ee854f6e796a4061ef00dac7d23b98e043f62d64f0b8195c8368
7
- data.tar.gz: a1bcc701762f41001a1327ae1d0609f9b3a0b542a8a24428712eabfee28e200ec357fd946e87586f33bcbaa2ac481403619f5e8325cd286d061097e72e8a571f
6
+ metadata.gz: d3b9a0bc94d9b0baf78a87632c227eca2237928805255e815dcd0afa9919115191755ac7741173d821fc46703b8529186f6eeb3a8dfee1f79235394e20e66929
7
+ data.tar.gz: 6f930577991ff8830593fc48d64ec9c6be8b894c73648987caf6f08a103ef2e800e7355a1a57f09f41d6cf2c56a92c818b6e1d5cc64e5e78537484b3e55a227c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.0.9.pre.beta3)
4
+ spree_vpago (2.0.9.pre.beta5)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -1,8 +1,15 @@
1
1
  <% @checkout = ::Vpago::TrueMoney::Checkout.new(@payment) %>
2
2
  <% redirect_urls = @checkout.generate_payment_urls(params[:platform]) %>
3
+ <h1><%= params[:platform] %></h1>
3
4
  <%= redirect_urls %>
4
5
  <% @payment.user_informer.payment_is_processing(processing: true) %>
5
6
 
7
+ <dialog id="custom-dialog" style="padding: 1.5em; border-radius: 8px; border: 1px solid #ccc; max-width: 300px;">
8
+ <p style="margin-bottom: 1em;">Do you want to open the app?</p>
9
+ <button id="dialog-confirm" style="margin-right: 1em; padding: 0.5em 1em;">Yes</button>
10
+ <button id="dialog-cancel" style="padding: 0.5em 1em;">No</button>
11
+ </dialog>
12
+
6
13
  <script>
7
14
  document.addEventListener("DOMContentLoaded", () => {
8
15
  const platform = "<%= params[:platform] %>";
@@ -12,23 +19,56 @@
12
19
  const docRefPath = "<%= @payment.user_informer.document_reference_path %>";
13
20
  const successUrl = "<%= @payment.success_url %>";
14
21
 
22
+ function showDialog(onConfirm) {
23
+ const dialog = document.getElementById('custom-dialog');
24
+ const confirmAction = document.getElementById('dialog-confirm');
25
+ const cancelAction = document.getElementById('dialog-cancel');
26
+
27
+ // Clean up old listeners to avoid duplicates
28
+ confirmAction.onclick = null;
29
+ cancelAction.onclick = null;
30
+
31
+ confirmAction.onclick = () => {
32
+ dialog.close();
33
+ onConfirm(true);
34
+ };
35
+ cancelAction.onclick = () => {
36
+ dialog.close();
37
+ onConfirm(false);
38
+ };
39
+
40
+ dialog.showModal();
41
+ }
42
+
15
43
  function setupConfirmPaymentButton() {
16
44
  if (platform === "app") {
17
- window.location.href = redirectUrls.deeplink;
18
- window.location.href = redirectUrls.webview;
45
+ showDialog((proceed) => {
46
+ if (proceed) {
47
+ window.location.href = redirectUrls.deeplink;
48
+ setTimeout(() => {
49
+ window.location.href = redirectUrls.webview;
50
+ }, 1500);
51
+ } else {
52
+ window.location.href = redirectUrls.webview;
53
+ }
54
+ });
19
55
 
20
56
  } else if (confirmButton) {
21
57
  confirmButton.addEventListener("click", () => {
22
- const proceed = confirm("Do you want to open the app?");
23
- if (proceed) {
24
- window.location.href = redirectUrls.deeplink;
25
- }
26
- window.open(redirectUrls.webview, "_blank");
58
+ showDialog((proceed) => {
59
+ if (proceed) {
60
+ window.location.href = redirectUrls.deeplink;
61
+ setTimeout(() => {
62
+ window.location.href = redirectUrls.webview;
63
+ }, 1500); // wait 1.5 seconds before redirecting to webview
64
+ } else {
65
+ window.location.href = redirectUrls.webview;
66
+ }
67
+ });
27
68
  });
28
69
  }
29
70
  }
30
71
 
31
-
32
72
  function setupPaymentProcessingListener() {
33
73
  if (window.initPaymentProcessingListener) {
34
74
  window.initPaymentProcessingListener(firebaseConfigs, docRefPath, successUrl);
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.0.9-beta3'.freeze
4
+ VERSION = '2.0.9-beta5'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_vpago
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9.pre.beta3
4
+ version: 2.0.9.pre.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - You