spree_vpago 2.2.2.pre.pre37 → 2.2.2.pre.pre38

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: 80ca360d497f7891656f158631ef9178ccabf9d459ab128794b0566ed1a00d0a
4
- data.tar.gz: 6da0dee64c3bd2031e9aa7546b7a1c6a0f555aa443f5b55e730883e7cf16c17b
3
+ metadata.gz: 6f928f176e0a9faa7c833f8a84357ef1b47b54e90317a746572e82990ec2fb70
4
+ data.tar.gz: 2575d2d9ed15e63f58efa5ab80efe48a82f21cadef0b42e0277d59b64adfe98e
5
5
  SHA512:
6
- metadata.gz: 193b7fb86e59840f6baee2efc7910efd16614078e67969b7ffa24879a4fc5e34914af0b83b4e9b54a5af64a169f513c7cc7b2f4805383c5dd08adf2dc3664b9c
7
- data.tar.gz: 4d5baf443e247ac4cb9cdeaff28ef8c8401289e18026102bb2c5147c7b274b04d190d1615e48c228377892e9e2c91ff5725553bcf87497139758e8f2ceadd2ba
6
+ metadata.gz: 1c783db7c54b8692924880f17c19e589e7b0ed097031fd93778e701364e5520c341e02ae1c2bf957ae4c014450d9411bfee35a14e73c27327ce6418e2d903c42
7
+ data.tar.gz: aa2a7c19225b123ef6e6c1dd1531cef9402fe67c7fbf04da3aa035ab54f46a5214501fbcbb4bf2393f84a602ba813fdf4cbe60910a1aa0937f126c9619a58572
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.2.2.pre.pre37)
4
+ spree_vpago (2.2.2.pre.pre38)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -2,11 +2,11 @@ module Spree
2
2
  module Admin
3
3
  class PaymentPaywayQueriersController < PaymentPaywayBaseController
4
4
  include Spree::Backend::Callbacks
5
+
5
6
  around_action :set_writing_role, only: %i[show]
6
7
 
7
8
  def show
8
- tran_status = transaction_status_service.new(@payment)
9
- tran_status.call
9
+ tran_status = @payment.payment_method.check_transaction(@payment)
10
10
 
11
11
  if tran_status.success?
12
12
  @payment.update_column(:gateway_status, true)
@@ -19,14 +19,6 @@ module Spree
19
19
  redirect_to admin_order_payment_path(order_id: @payment.order.number, id: @payment.number)
20
20
  end
21
21
 
22
- def transaction_status_service
23
- if @payment.payment_method.type_payway_v2?
24
- Vpago::PaywayV2::TransactionStatus
25
- elsif @payment.payment_method.type_payway?
26
- Vpago::Payway::TransactionStatus
27
- end
28
- end
29
-
30
22
  private
31
23
 
32
24
  def set_writing_role
@@ -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 payment.payouts.any?
162
+ checker = if payment.preload_payout_ids.any?
163
163
  Vpago::PaywayV2::TransactionStatus.new(payment)
164
164
  else
165
165
  Vpago::PaywayV2::TransactionStatusV2.new(payment)
@@ -33,6 +33,15 @@ module Vpago
33
33
  end
34
34
  end
35
35
 
36
+ def preload_payout_ids=(ids)
37
+ self.private_metadata ||= {}
38
+ self.private_metadata['preload_payout_ids'] = ids
39
+ end
40
+
41
+ def preload_payout_ids
42
+ self.private_metadata&.fetch('preload_payout_ids', []) || []
43
+ end
44
+
36
45
  # override
37
46
  def process!
38
47
  reset_for_retry! if failed?
@@ -39,7 +39,7 @@ module Vpago
39
39
 
40
40
  # If any payouts were rounded, the total may increase slightly.
41
41
  # Update the payment amount to match the sum of payouts to avoid mismatch errors.
42
- payment.update(amount: payouts.map(&:amount).sum)
42
+ payment.update(amount: payouts.map(&:amount).sum, preload_payout_ids: payouts.map(&:id))
43
43
 
44
44
  payouts
45
45
  end
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.2.2-pre37'.freeze
4
+ VERSION = '2.2.2-pre38'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
@@ -52,9 +52,7 @@ module Vpago
52
52
  end
53
53
 
54
54
  def check_payway_status
55
- trans_status = Vpago::PaywayV2::TransactionStatus.new(@payment)
56
- trans_status.call
57
- trans_status
55
+ @payment.payment_method.check_transaction(@payment)
58
56
  end
59
57
 
60
58
  def items_eligible?
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.pre37
4
+ version: 2.2.2.pre.pre38
5
5
  platform: ruby
6
6
  authors:
7
7
  - You