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: f4838e2350880e15e3dee9b5831cec91b1260c26952b828da179efa84594506e
4
- data.tar.gz: 203caa948f10d1f04fea821841d3ba6aa7dad3de16f6b258957f7e303da3e40d
3
+ metadata.gz: 63c041b11de487a906751960209807c501c1c1e2b9fa7be4c902cedc6e566d47
4
+ data.tar.gz: a619fb9e96d513f5a6d462c56827b9cfce1742a511b5638bb6b81878bcda7606
5
5
  SHA512:
6
- metadata.gz: 490b707ebb654847f94e534fe448946cbaf866ef772da8106217b2e726f7e2bbc2daab5db8e660549c54d84ca7892456f626ef2025ed57bd95665b34aaed6e93
7
- data.tar.gz: 1b5cc65e70fd8f580dac244600af09c23eeedf21092aab8b408cc5b7bf22140b294b3bfea1bd297bc64829d1c97a4781016224689c9f42a8503e8dd29d2fdc0b
6
+ metadata.gz: be88c1bc4337844f6bb84afa307b78e2e247b4bb89ecdf3a4429878d66184c840652e96ab4715040db92e019915690523c5a84423df4ea8195f04d107fa21be7
7
+ data.tar.gz: 579c3d7d20e0a19d96e664cd9294435b14a95512490c50b53f5cae93760056285b3bb28b838da89e0758da19040ce5989fc10a2ac6a8685a44b4c22e9df8c204
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.2.2.pre.pre34)
4
+ spree_vpago (2.2.2.pre.pre36)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -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 enable_payout?
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
- document.addEventListener("DOMContentLoaded", function () {
48
- if (abapayKhqrDeeplink) {
49
- var formData = new FormData(document.getElementById("aba_merchant_request"));
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
- // When status code is 4 (duplicated transaction),
63
- // Possibly user refresh the checkout page even after the transaction is completed.
64
- // So in this case, we should hide loading spinner and show redirect container UI
65
- // While it check transaction status in the background. It will automatically redirect user to the result page after checking.
66
- if (data.status.code === 4){
67
- showRedirectContainer();
68
- return;
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
- var shouldDelayBeforeOpenCheckoutUrl = false;
72
- var shouldShowRedirectContainer = false;
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
- if (data.abapay_deeplink && shouldOpenAbaPayDeeplink) {
75
- openDeeplinkUrl(data.abapay_deeplink);
76
- shouldDelayBeforeOpenCheckoutUrl = true;
77
- shouldShowRedirectContainer = true;
78
- }
61
+ if (data.abapay_deeplink && shouldOpenAbaPayDeeplink) {
62
+ window.location.href = data.abapay_deeplink;
63
+ }
79
64
 
80
- if (data.checkout_qr_url && shouldOpenCheckoutUrl) {
81
- openUrl(data.checkout_qr_url, shouldDelayBeforeOpenCheckoutUrl ? 100 : 0);
82
- shouldShowRedirectContainer = false;
83
- }
65
+ if (data.checkout_qr_url && shouldOpenCheckoutUrl) {
66
+ window.location.href = data.checkout_qr_url;
67
+ }
84
68
 
85
- if(shouldShowRedirectContainer){
86
- showRedirectContainer("Open ABA Mobile", () => openDeeplinkUrl(data.abapay_deeplink));
87
- }
88
- })
89
- .catch(function(error) {
90
- console.error("Payment request failed:", error);
91
- });
92
- } else {
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>
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.2.2-pre34'.freeze
4
+ VERSION = '2.2.2-pre36'.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.2.2.pre.pre34
4
+ version: 2.2.2.pre.pre36
5
5
  platform: ruby
6
6
  authors:
7
7
  - You