spree_vpago 2.1.4.pre.beta2 → 2.1.4.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: 76c7d879f66187b0dc1ad98a8a9530e93e8783af2407832ea3604a9c9ae1e5d7
4
- data.tar.gz: 2937b5f057dcda1802b875663aa2cf989ab18e100cc0161c28ef47b5962b84d2
3
+ metadata.gz: 54ada56aa2da14e1dcc11960a2172ec2010b6f3d6e9c98d3d9a9aa3250859969
4
+ data.tar.gz: a5814414f32583c1751850d23f4e9151acd8a885f2dd3730132d39be72623115
5
5
  SHA512:
6
- metadata.gz: 84115ee094881bb1df4792bf384ba5029726188cabddb826504757905a650e3d7aaae81359fd190d69af7715ac694452238468f0deb662d9b542b223d510b288
7
- data.tar.gz: 7f719b638dd3204832f191175b89ceebb71571bbda923b76448d9ce812fa100db0a79ce173e3744cc445a6616e75c484d0c627003311ed9b30cba371959a4b59
6
+ metadata.gz: 01ee171943fbc46335ef5c48b214aabf9afb9fa9533d6f213ad15edd20aec6e733c252f32fc720af6b41a81d91bbaa23977d412c6819ece507c8e17a0669a773
7
+ data.tar.gz: 27b4e56951e99dc7807a1ffe5e2bb78f863423d8a072d7d8155e2a184a51ff6a34998a017fd812e2e2e06ddaa88e5ea458e7c6c361b2e8af9fe80fdb492a369d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.1.4.pre.beta2)
4
+ spree_vpago (2.1.4.pre.beta4)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -36,9 +36,9 @@ module Spree
36
36
  params[:payment_response] = payment.transaction_response
37
37
 
38
38
  if success
39
- ActiveMerchant::Billing::Response.new(true, 'Payway Gateway: Purchased', params)
39
+ ActiveMerchant::Billing::Response.new(true, 'Vattanac Gateway: Purchased', params)
40
40
  else
41
- ActiveMerchant::Billing::Response.new(false, 'Payway Gateway: Purchasing Failed', params)
41
+ ActiveMerchant::Billing::Response.new(false, 'Vattanac Gateway: Purchasing Failed', params)
42
42
  end
43
43
  end
44
44
 
@@ -9,7 +9,7 @@ module Vpago
9
9
  :processing_url,
10
10
  :success_url,
11
11
  :process_payment_url,
12
- :processing_deeplink_url,
12
+ :success_deeplink_url,
13
13
  to: :url_constructor
14
14
  end
15
15
 
@@ -73,6 +73,10 @@ module Vpago
73
73
  def check_payment?
74
74
  payment_method.type_check?
75
75
  end
76
+
77
+ def can_redirect_to_app?
78
+ payment_method.can_redirect_to_app?
79
+ end
76
80
  end
77
81
  end
78
82
 
@@ -11,7 +11,7 @@ module Vpago
11
11
 
12
12
  def self.prepended(base)
13
13
  base.preference :icon_name, :string, default: 'cheque'
14
- base.preference :app_scheme, :string, default: 'bookmeplus://'
14
+ base.preference :app_scheme, :string
15
15
  base.belongs_to :vendor, class_name: 'Spree::Vendor', optional: true, inverse_of: :payment_methods
16
16
 
17
17
  def base.vpago_payments
@@ -105,6 +105,10 @@ module Vpago
105
105
  type == 'Spree::PaymentMethod::Check'
106
106
  end
107
107
 
108
+ def can_redirect_to_app?
109
+ preferred_app_scheme.present?
110
+ end
111
+
108
112
  # @return [String] the image asset path, e.g. "payment_logos/payway-abapay-khqr.png"
109
113
  def payment_icon_path
110
114
  "payment_logos/#{preferred_icon_name.tr('_', ' ').parameterize}.png"
@@ -11,10 +11,13 @@ module Vpago
11
11
 
12
12
  def checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=app"
13
13
  def web_checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=web"
14
+
14
15
  def processing_url = "#{base_url}/vpago_payments/processing?#{query}"
16
+
15
17
  def success_url = "#{base_url}/vpago_payments/success?#{query}"
18
+ def success_deeplink_url = "#{app_scheme}://#{URI(base_url).host}/book/payment?number=#{order.number}&tk=#{order.token}"
19
+
16
20
  def process_payment_url = "#{base_url}/vpago_payments/process_payment?#{query}"
17
- def processing_deeplink_url = "#{app_scheme}#{URI(base_url).host}/vpago_payments/processing?#{query}"
18
21
 
19
22
  def query
20
23
  {
@@ -25,6 +28,7 @@ module Vpago
25
28
  }.compact.to_query
26
29
  end
27
30
 
31
+ # true money use case
28
32
  def offsite_payment?
29
33
  payment.payment_method.type_true_money?
30
34
  end
@@ -1,6 +1,11 @@
1
1
  <%
2
- checkout = Vpago::Vattanac::Checkout.new(@payment)
3
- result = checkout.create
2
+ checkout = Vpago::Vattanac::Checkout.new(@payment)
3
+ result = begin
4
+ checkout.create
5
+ rescue => e
6
+ Rails.logger.error("Vattanac checkout.create failed: #{e.message}")
7
+ { mobile_url: nil, web_url: nil }
8
+ end
4
9
  %>
5
10
 
6
11
  <script>
@@ -8,7 +13,10 @@
8
13
  const mobileUrl = "<%= raw(result[:mobile_url]) %>";
9
14
  const webUrl = "<%= raw(result[:web_url]) %>";
10
15
  if (platform === "app" && mobileUrl) {
11
- window.location.href = mobileUrl;
16
+ window.location.href = mobileUrl;
17
+ setTimeout(() => {
18
+ window.location.href = webUrl
19
+ }, 1500);
12
20
  } else if (platform === "web" && webUrl) {
13
21
  window.location.href = webUrl;
14
22
  } else {
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.1.4-beta2'.freeze
4
+ VERSION = '2.1.4-beta4'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
@@ -105,9 +105,15 @@ module Vpago
105
105
  # redirect to continue URL, let it handle redirecting to app.
106
106
  # allowed override to specific app eg. from tg://t.me
107
107
  def return_deeplink_url
108
- return @options[:override_return_deeplink_url] if @options[:override_return_deeplink_url].present?
109
-
110
- continue_success_url
108
+ app_scheme = @payment.payment_method.preferences[:app_scheme]
109
+
110
+ if app_scheme.present?
111
+ uri = URI.parse(continue_success_url)
112
+ uri.scheme = app_scheme
113
+ uri.to_s
114
+ else
115
+ continue_success_url
116
+ end
111
117
  end
112
118
 
113
119
  def return_deeplink
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.beta2
4
+ version: 2.1.4.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-11-11 00:00:00.000000000 Z
11
+ date: 2025-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday