spree_vpago 2.0.9.pre.beta2 → 2.0.9.pre.beta4

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: 91c3ee464688d551c3777fc9860477816b520ff2fe7340b7370223cf11c1fa09
4
- data.tar.gz: d0770530477d73c2f08bee23c81d49d4313ab005fad63d0881a192321a160536
3
+ metadata.gz: 1bff3c94ecaa21b9dcfb67138aa888435953948b8f609b4b46a319885bc7c3e3
4
+ data.tar.gz: 83402df2fba6406190658cd7d0bc62b6b1ce285da70e96881414b86f786e3955
5
5
  SHA512:
6
- metadata.gz: eced2b2de78c69984df98c990b436a1a336e7c903284b50f7a2664e2c455f71a7f195d55ca090b33ac3a58bae41a7f9366143bc738045319133ee21bb0b48710
7
- data.tar.gz: a1ddf1d1a55ca47ea3cad6b195e23efa014f7ec33b40047d86b1e4529c87e4b9c75775060d46ee885e4d298ae145f6898abdf950678c6311565841a2be6c7b08
6
+ metadata.gz: c1cc295fb06c4d804eda035280028f91e3fcbbff4f22956d7892f5b1bcf931bf1bff9e2bba2124227ec12f57712003d10d235aed015d5fed8cdf10cc64d278c2
7
+ data.tar.gz: bca976171a7475b6c05791a99c5087e5769b092e935a9f5f13bb7f0470cfde4a5613ed2f5bd11b98acdbc38410ca770991157837116ba8093f9c0e7eca0bdb3b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.0.9.pre.beta2)
4
+ spree_vpago (2.0.9.pre.beta4)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -1,7 +1,14 @@
1
1
  <% @checkout = ::Vpago::TrueMoney::Checkout.new(@payment) %>
2
2
  <% redirect_urls = @checkout.generate_payment_urls(params[:platform]) %>
3
+ <%= redirect_urls %>
3
4
  <% @payment.user_informer.payment_is_processing(processing: true) %>
4
- <h1> <%= params[:platform] %> </h1>
5
+
6
+ <dialog id="custom-dialog" style="padding: 1.5em; border-radius: 8px; border: 1px solid #ccc; max-width: 300px;">
7
+ <p style="margin-bottom: 1em;">Do you want to open the app?</p>
8
+ <button id="dialog-confirm" style="margin-right: 1em; padding: 0.5em 1em;">Yes</button>
9
+ <button id="dialog-cancel" style="padding: 0.5em 1em;">No</button>
10
+ </dialog>
11
+
5
12
  <script>
6
13
  document.addEventListener("DOMContentLoaded", () => {
7
14
  const platform = "<%= params[:platform] %>";
@@ -11,17 +18,45 @@
11
18
  const docRefPath = "<%= @payment.user_informer.document_reference_path %>";
12
19
  const successUrl = "<%= @payment.success_url %>";
13
20
 
21
+ function showDialog(onConfirm) {
22
+ const dialog = document.getElementById('custom-dialog');
23
+ const confirmAction = document.getElementById('dialog-confirm');
24
+ const cancelAction = document.getElementById('dialog-cancel');
25
+
26
+ // Clean up old listeners to avoid duplicates
27
+ confirmAction.onclick = null;
28
+ cancelAction.onclick = null;
29
+
30
+ confirmAction.onclick = () => {
31
+ dialog.close();
32
+ onConfirm(true);
33
+ };
34
+ cancelAction.onclick = () => {
35
+ dialog.close();
36
+ onConfirm(false);
37
+ };
38
+
39
+ dialog.showModal();
40
+ }
41
+
14
42
  function setupConfirmPaymentButton() {
15
43
  if (platform === "app") {
16
- if (confirmButton) confirmButton.style.display = "none";
17
- window.location.href = redirectUrls.webview;
18
- setTimeout(() => {
19
- window.top.location.href = redirectUrls.deeplink;
20
- }, 1500);
21
-
44
+ showDialog((proceed) => {
45
+ if (proceed) {
46
+ window.location.href = redirectUrls.deeplink;
47
+ }
48
+ window.location.href = redirectUrls.webview;
49
+ });
50
+
22
51
  } else if (confirmButton) {
23
- confirmButton.addEventListener("click", () => window.open(redirectUrls.webview , "_blank"));
24
-
52
+ confirmButton.addEventListener("click", () => {
53
+ showDialog((proceed) => {
54
+ if (proceed) {
55
+ window.location.href = redirectUrls.deeplink;
56
+ }
57
+ window.open(redirectUrls.webview, "_blank");
58
+ });
59
+ });
25
60
  }
26
61
  }
27
62
 
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.0.9-beta2'.freeze
4
+ VERSION = '2.0.9-beta4'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
@@ -1,7 +1,7 @@
1
1
  module Vpago
2
2
  module TrueMoney
3
3
  class Checkout < Base
4
- def generate_payment_urls(platform)
4
+ def generate_payment_urls(_platform)
5
5
  request_body = {
6
6
  payment_info: payload.to_json,
7
7
  redirectionType: redirect_type,
@@ -17,14 +17,10 @@ module Vpago
17
17
 
18
18
  body = parse_json(response.body)
19
19
 
20
- if platform == 'app'
21
- {
22
- webview: body['data']['webview'],
23
- deeplink: body['data']['deeplink']
24
- }
25
- else
26
- body['data']['deeplink']
27
- end
20
+ {
21
+ webview: body['data']['webview'],
22
+ deeplink: body['data']['deeplink']
23
+ }
28
24
  rescue Faraday::Error, JSON::ParserError, NoMethodError => e
29
25
  Rails.logger.error("Failed to generate payment URL: #{e.class} - #{e.message}")
30
26
  raise
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.0.9.pre.beta2
4
+ version: 2.0.9.pre.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-21 00:00:00.000000000 Z
11
+ date: 2025-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday