spree_vpago 2.3.0 → 2.3.1.pre.pre1

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: 2a7ada27fbff4e24f884836fe4a37ec7bb187f24366cd657b7611b8a4cfac5b2
4
- data.tar.gz: 36df26111882ca8171272455e6b53ca420e199fb25c590975c2c8961ddf53046
3
+ metadata.gz: bab3806e6c7ff83a83c403b9e05fc27ec43314e9a23a9856e850cf9235f0b15f
4
+ data.tar.gz: 67e45376ac85892bbf43215916bd9fc85994f1d1baa3e871687063cfb9c78446
5
5
  SHA512:
6
- metadata.gz: 998dc20da1342ee30b3af17b96be1f5cd406cb92a182d18cd3abc92d5358c2787c03edcd22ddf1c8524630fdca5c9e04c7b4e3798518b4c6fd3e770b054307dc
7
- data.tar.gz: 1489be00f087c7cf9799e5fd847386eef0e961e40274392947ad04af86f2d97df13c4c1911b5bf7419559a775a37756f127f49d3a9ee44c30cba5ac2483b5574
6
+ metadata.gz: 89fe788fbb4845d4ecfe884043e5e714a11a8f09f3e53b1d1c941960bdbf761cb693da0ea18bf9ca83df222be1c92c08bbfc4392e861f880ba5c6a7b576e3399
7
+ data.tar.gz: c0f18dda30ec14cddf791824399634ec3f4c0fed0f796a993134352c20a6f643f009dece8c72295af253cb51e29ae83942422282db4846e7e32172d230857ce1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.3.0)
4
+ spree_vpago (2.3.1.pre.pre1)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -6,10 +6,12 @@ module Spree
6
6
 
7
7
  if params[:tab] == 'vendors'
8
8
  scope.where.not(vendor_id: nil)
9
+ .includes(:vendor)
9
10
  elsif params[:tab] == 'tenants'
10
11
  scope.joins(:vendor)
11
12
  .where.not(vendor_id: nil)
12
13
  .where.not(spree_vendors: { tenant_id: nil })
14
+ .includes(vendor: :tenant)
13
15
  else
14
16
  scope.where(vendor_id: nil)
15
17
  end
@@ -6,7 +6,7 @@ module Spree
6
6
  preference :host, :string
7
7
  preference :api_key, :string
8
8
  preference :merchant_id, :string
9
- preference :payment_option, :string
9
+ preference :payment_option, :string, default: 'abapay_khqr_deeplink'
10
10
  preference :transaction_fee_fix, :string
11
11
  preference :transaction_fee_percentage, :string
12
12
  preference :public_key, :text
@@ -17,6 +17,8 @@ module Spree
17
17
 
18
18
  validates :preferred_public_key, presence: true, if: :enable_pre_auth?
19
19
  validates :preferred_abapay_khqr_deeplink_option, inclusion: { in: ABAPAY_KHQR_DEEPLINK_OPTIONS }, if: :abapay_khqr_deeplink?
20
+
21
+ # For initial save, there is no preferences yet, so validating them would failed. Only validate along with host or api key.
20
22
  validates :preferred_payment_option, inclusion: { in: PAYMENT_OPTIONS }
21
23
 
22
24
  def reviewing_mode?
@@ -1,5 +1,11 @@
1
1
  <!-- insert_before "[data-hook='admin_payment_methods_index_row_actions']" -->
2
2
 
3
3
  <% if params[:tab] == 'tenants' %>
4
- <td class="text-center"><%= method.vendor&.name || 'N/A' %></td>
4
+ <td class="text-center">
5
+ <% if method.vendor&.tenant %>
6
+ <%= link_to method.vendor.tenant.name, edit_admin_tenant_path(method.vendor.tenant), target: "_blank" %>
7
+ <% else %>
8
+ N/A
9
+ <% end %>
10
+ </td>
5
11
  <% end %>
@@ -1,5 +1,11 @@
1
1
  <!-- insert_before "[data-hook='admin_payment_methods_index_row_actions']" -->
2
2
 
3
3
  <% if params[:tab] == 'vendors' %>
4
- <td class="text-center"><%= method.vendor&.name || 'N/A' %></td>
4
+ <td class="text-center">
5
+ <% if method.vendor %>
6
+ <%= link_to method.vendor.name, edit_admin_vendor_path(method.vendor), target: "_blank" %>
7
+ <% else %>
8
+ N/A
9
+ <% end %>
10
+ </td>
5
11
  <% end %>
@@ -13,12 +13,6 @@
13
13
  </form>
14
14
 
15
15
  <script>
16
- const isMobile = <%= mobile_user_agent? %>;
17
-
18
- const abapayKhqrDeeplink = <%= @payment.payment_method.abapay_khqr_deeplink? %>;
19
- const shouldOpenAbaPayDeeplink = isMobile && <%= @payment.payment_method.open_abapay_deeplink? %>;
20
- const shouldOpenCheckoutUrl = <%= @payment.payment_method.open_checkout_url? %>;
21
-
22
16
  function showRedirectContainer(buttonLabel = null, onClick = null) {
23
17
  const loadingContainer = document.getElementById('vpago_loading_container');
24
18
  const redirectContainer = document.getElementById('vpago_redirect_container');
@@ -40,6 +34,17 @@
40
34
  }
41
35
 
42
36
  function submitFormViaJs(){
37
+ const isMobile = <%= mobile_user_agent? %>;
38
+
39
+ const abapayKhqrDeeplink = <%= @payment.payment_method.abapay_khqr_deeplink? %>;
40
+ const shouldOpenAbaPayDeeplink = isMobile && <%= @payment.payment_method.open_abapay_deeplink? %>;
41
+
42
+ // If the device is not mobile, deeplinks won't work anyway,
43
+ // so we always open the checkout URL (KHQR page) for desktop users.
44
+ //
45
+ // On mobile, only open the checkout URL if explicitly enabled.
46
+ const shouldOpenCheckoutUrl = !isMobile || <%= @payment.payment_method.open_checkout_url? %>;
47
+
43
48
  var formData = new FormData(document.getElementById("aba_merchant_request"));
44
49
  var checkoutUrl = document.getElementById("aba_merchant_request").action;
45
50
 
@@ -62,12 +67,24 @@
62
67
  return;
63
68
  }
64
69
 
70
+ let deeplinkTriggered = false;
71
+
65
72
  if (data.abapay_deeplink && shouldOpenAbaPayDeeplink) {
66
73
  window.location.href = data.abapay_deeplink;
74
+ deeplinkTriggered = true;
67
75
  }
68
76
 
69
77
  if (data.checkout_qr_url && shouldOpenCheckoutUrl) {
70
- window.location.href = data.checkout_qr_url;
78
+ // If a deeplink is triggered, add a short delay before navigating to the checkout URL.
79
+ // Without this delay, some platforms (especially Android) may ignore or cancel the deeplink
80
+ // because a second navigation happens too quickly.
81
+ if (deeplinkTriggered){
82
+ setTimeout(() => {
83
+ window.location.href = data.checkout_qr_url;
84
+ }, 300);
85
+ } else {
86
+ window.location.href = data.checkout_qr_url;
87
+ }
71
88
  }
72
89
 
73
90
  var shouldShowRedirectContainer = !shouldOpenCheckoutUrl && shouldOpenAbaPayDeeplink;
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.3.0'.freeze
4
+ VERSION = '2.3.1-pre1'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
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.3.0
4
+ version: 2.3.1.pre.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-24 00:00:00.000000000 Z
11
+ date: 2026-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -442,9 +442,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
442
442
  version: 3.2.0
443
443
  required_rubygems_version: !ruby/object:Gem::Requirement
444
444
  requirements:
445
- - - ">="
445
+ - - ">"
446
446
  - !ruby/object:Gem::Version
447
- version: '0'
447
+ version: 1.3.1
448
448
  requirements:
449
449
  - none
450
450
  rubygems_version: 3.4.1