spree_vpago 2.1.0 → 2.1.1

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: 9c9ce227143c8106d8c5084630d0fe37d326af055cf7b7fd907b974425a7684a
4
- data.tar.gz: 85a48677949896599736a58e4993d28c11d75381b06e9fd0b3739f45a7b4b748
3
+ metadata.gz: 0a01d3dcdc6c3ced08df846438e83619a55e7ae1ef61a2062b8d92cb5563fc09
4
+ data.tar.gz: 9c3c06510f3dcfc46c8dda76e951675931e91d96b473b3372849610aa38e8de2
5
5
  SHA512:
6
- metadata.gz: 98c4e438907e5a241357ff997546dcdbadd1187a45fb4db3be8e7a5aabf94a722f1f25f2084788cded45eb7668ad3213c3e4603d78e8c8bd42c9746f62ae9c23
7
- data.tar.gz: 660c08f76c5e32ce96708c4ae468bc8b81546db1c8206d9cad658d98bef9a2d8457e93d3b41c047d95c6e30e79c82b4d2546bdd6221f3dbe9902f9eca43717da
6
+ metadata.gz: 1244b21a9ba3d2eb6dd345e7d5cc7ce318a867d8744a7c8bb40789f77d2be7b85a9c8b4339eec6aa5c732ba5ab31fd756dbe4fd97518b3ab39fd23df1b749a96
7
+ data.tar.gz: d6b2cc2a7eeb0a9eeb39f1b4d5c6d0d5f9ae09e7c3f2372498a3d2f411f0205076243dbc0d1813a4b2b4c2b15133b2e7cb4cf7645222053df4572070f776e4d2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.1.0)
4
+ spree_vpago (2.1.1)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -228,7 +228,7 @@ GEM
228
228
  base64 (~> 0.2)
229
229
  faraday (>= 1.0, < 3.a)
230
230
  google-cloud-errors (1.5.0)
231
- google-cloud-firestore (3.0.0)
231
+ google-cloud-firestore (3.1.0)
232
232
  bigdecimal (~> 3.0)
233
233
  concurrent-ruby (~> 1.0)
234
234
  google-cloud-core (~> 1.7)
@@ -242,7 +242,7 @@ GEM
242
242
  gapic-common (~> 1.0)
243
243
  google-cloud-errors (~> 1.0)
244
244
  google-logging-utils (0.2.0)
245
- google-protobuf (4.31.1-arm64-darwin)
245
+ google-protobuf (4.31.1)
246
246
  bigdecimal
247
247
  rake (>= 13)
248
248
  googleapis-common-protos (1.8.0)
@@ -259,7 +259,7 @@ GEM
259
259
  multi_json (~> 1.11)
260
260
  os (>= 0.9, < 2.0)
261
261
  signet (>= 0.16, < 2.a)
262
- grpc (1.73.0-arm64-darwin)
262
+ grpc (1.74.1-arm64-darwin)
263
263
  google-protobuf (>= 3.25, < 5.0)
264
264
  googleapis-common-protos-types (~> 1.0)
265
265
  hashdiff (1.1.0)
@@ -3,7 +3,7 @@ module Spree
3
3
  layout 'vpago_payments'
4
4
  helper 'vpago/vpago_payments'
5
5
 
6
- skip_before_action :verify_authenticity_token, only: [:process_payment]
6
+ skip_before_action :verify_authenticity_token, only: %i[process_payment true_money_process_payment]
7
7
 
8
8
  rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
9
9
  rescue_from CanCan::AccessDenied, with: :access_denied
@@ -55,6 +55,21 @@ module Spree
55
55
  render json: { status: :internal_server_error, message: 'Failed to enqueue payment processor job' }, status: :internal_server_error
56
56
  end
57
57
 
58
+ # POST
59
+ def true_money_process_payment
60
+ return render json: { status: { code: '000001', message: 'success' }, data: nil }, status: :ok if request.method != 'POST'
61
+
62
+ @payment = Spree::Payment.find_by(number: params.dig(:data, :external_ref_id))
63
+ return render_not_found unless @payment
64
+
65
+ Vpago::PaymentProcessorJob.perform_later(payment_number: @payment.number) unless @payment.order.paid?
66
+
67
+ render json: { status: { code: '000001', message: 'success' }, data: nil }, status: :ok
68
+ rescue StandardError => e
69
+ Rails.logger.error("Payment error: #{e.message}")
70
+ render json: { status: :internal_server_error, message: 'Failed to enqueue payment processor job' }, status: :internal_server_error
71
+ end
72
+
58
73
  def sanitize_return_params
59
74
  sanitized_params = params.permit!.to_h
60
75
 
data/config/routes.rb CHANGED
@@ -24,6 +24,7 @@ Spree::Core::Engine.add_routes do
24
24
  get :success
25
25
 
26
26
  match :process_payment, via: %i[get post]
27
+ match :true_money_process_payment, via: %i[get post]
27
28
  end
28
29
  end
29
30
 
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.1.0'.freeze
4
+ VERSION = '2.1.1'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
@@ -40,11 +40,14 @@ module Vpago
40
40
  end
41
41
 
42
42
  def merchant_auth
43
- {
43
+ merchant_auth = {
44
44
  'mc_id' => merchant_id,
45
45
  'tran_id' => transaction_id,
46
46
  'complete_amount' => amount.to_s
47
- }.to_json
47
+ }
48
+
49
+ merchant_auth['payout'] = payout unless payout.nil?
50
+ merchant_auth.to_json
48
51
  end
49
52
 
50
53
  def merchant_auth_encryption
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.0
4
+ version: 2.1.1
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-23 00:00:00.000000000 Z
11
+ date: 2025-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday