solidus_mp_dois 3.1.0 → 3.1.2

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: 44927e2980c46be7c5cdc7d57931c6e9300d46370f903d265ac906b16c04c094
4
- data.tar.gz: 28533f9624bdfc9225f2cc8131445886fa6bbf5865580d4db7f652b8c5ea8fb9
3
+ metadata.gz: 890c24765fb805a7b5a3689db4b015a0d061a399ce53149a75a9f3c23626263e
4
+ data.tar.gz: '09dd3fc598f692fbb14d5081d806135c2eb252fb4c4c996e11593e4cdabc269e'
5
5
  SHA512:
6
- metadata.gz: 7294f4d3c0d25d3c1e82feebe64853a6c520a97c767b7bebd88128aef7be987b4c78594040c16e188d7707e41797776670e91e97fce3e65773804ff10ec0cff0
7
- data.tar.gz: 9c3d71ee5ad8ab90e6bd9757402f2d8d96b7803614e6a3360601152cceb3f967baa524c35dd915632a900b9387a54700034182b9bfff4b1552312c7a0cde34b6
6
+ metadata.gz: 8f21a8add7662bd01d8c8c05982a832b73d828e66bf2483f06a6a3f4ed74df801fa9c85da83dbaba275e8501db1219516553cd8e311fa7c5e2a99cc895d492df
7
+ data.tar.gz: b0650ac259a3b7927fa4a773ac0922bc14f0d0470fd49b3ba995fb96d29555e24a4214475ee324f9e14eae18f18749e5612dc28f60c4c7ecfe0a2fed36ab1bb1
@@ -0,0 +1,29 @@
1
+ module SolidusMpDois
2
+ class Gateway
3
+ def initialize(options)
4
+ end
5
+
6
+ def void(transaction_id, _options = {})
7
+ # Respondendo sempre com successful_response para funcionar o botão de "Cancelar" do pedido. Reembolso deve ser feito por fora.
8
+ successful_response("Pagamento cancelado. Se necessário, realize o reembolso.", transaction_id)
9
+ end
10
+
11
+ private
12
+
13
+ def successful_response(message, transaction_id)
14
+ ActiveMerchant::Billing::Response.new(
15
+ true,
16
+ message,
17
+ {},
18
+ authorization: transaction_id
19
+ )
20
+ end
21
+
22
+ def failure_response(message)
23
+ ActiveMerchant::Billing::Response.new(
24
+ false,
25
+ message
26
+ )
27
+ end
28
+ end
29
+ end
@@ -8,6 +8,10 @@ module SolidusMpDois
8
8
  CreditCardSource
9
9
  end
10
10
 
11
+ def gateway_class
12
+ Gateway
13
+ end
14
+
11
15
  def supports?(source)
12
16
  source.is_a?(payment_source_class)
13
17
  end
@@ -8,6 +8,10 @@ module SolidusMpDois
8
8
  PixSource
9
9
  end
10
10
 
11
+ def gateway_class
12
+ Gateway
13
+ end
14
+
11
15
  def supports?(source)
12
16
  source.is_a?(payment_source_class)
13
17
  end
@@ -62,8 +66,8 @@ module SolidusMpDois
62
66
 
63
67
  def pix_paid? payment
64
68
  mp_payment = find_payment(payment.source.external_id)
65
- sync(payment, mp_payment)
66
- payment.completed?
69
+ paid_amount = Float(mp_payment.transaction_details.total_paid_amount)
70
+ mp_payment.status == "approved" && paid_amount >= payment.amount
67
71
  end
68
72
 
69
73
  def invalidate_payment payment
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_mp_dois
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todas Essas Coisas
@@ -48,6 +48,7 @@ files:
48
48
  - app/models/solidus_mp_dois/card.rb
49
49
  - app/models/solidus_mp_dois/credit_card_source.rb
50
50
  - app/models/solidus_mp_dois/customer.rb
51
+ - app/models/solidus_mp_dois/gateway.rb
51
52
  - app/models/solidus_mp_dois/mp_card.rb
52
53
  - app/models/solidus_mp_dois/mp_pix.rb
53
54
  - app/models/solidus_mp_dois/pix_source.rb