solidus_mp 0.3.5 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/app/models/solidus_mp/mp_pix.rb +17 -2
- data/lib/solidus_mp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337fc7106db6c102a4c8dbae9d6d57c58ff8e7ff3ea3a45874f0239ece25405d
|
4
|
+
data.tar.gz: f7a9733e4ab7f42a94eeb6202bafde5601c1075061582f4eb5e1dc0b48d9a174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1f979eee81e4aebb2d0cb3662068905d246a90fef950a055951e01cf99402b9a4bd586d70a1c7c247b8e0db45cfcbd02ac643b88e5fd9b6eb8148103798e46
|
7
|
+
data.tar.gz: ba3e5a0a1b0c052f800730f297903fa70b2ecfdf67a01eef18c89ba228413f9cce86cde828bd3df6c11a762b6e6b18f7c5b0c5e80232ab5d4ef78d6bd830e091
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require 'solidus_dev_support/rake_tasks'
|
5
|
-
SolidusDevSupport::RakeTasks.install
|
4
|
+
# require 'solidus_dev_support/rake_tasks'
|
5
|
+
# SolidusDevSupport::RakeTasks.install
|
6
6
|
|
7
7
|
task default: 'extension:specs'
|
@@ -17,6 +17,10 @@ module SolidusMp
|
|
17
17
|
source.is_a?(payment_source_class)
|
18
18
|
end
|
19
19
|
|
20
|
+
def auto_capture?
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
20
24
|
def create_pix_payment payment
|
21
25
|
mp_payment = create_mp_payment(payment)
|
22
26
|
if mp_payment.error || mp_payment.internal_error
|
@@ -33,7 +37,8 @@ module SolidusMp
|
|
33
37
|
|
34
38
|
def create_mp_payment payment
|
35
39
|
MpApi.configuration.access_token = preferences[:access_token]
|
36
|
-
|
40
|
+
identification_type = payment.source.tax_id.length > 14 ? "CNPJ" : "CPF"
|
41
|
+
MpApi::Payment.new(payer_email: payment.source.email, payer_identification_type: identification_type, payment_method: "pix", payer_identification_number: payment.source.tax_id, amount: payment.amount.to_f, statement_descriptor: payment.source.statement_descriptor, description: payment.source.description, items: payment.source.items).create
|
37
42
|
end
|
38
43
|
|
39
44
|
def cancel_payment payment
|
@@ -56,6 +61,16 @@ module SolidusMp
|
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
64
|
+
def should_skip_processing?(source)
|
65
|
+
MpApi.configuration.access_token = preferences[:access_token]
|
66
|
+
mp_payment = MpApi::Payment.find_by_id(source.external_id)
|
67
|
+
if mp_payment.status == "approved"
|
68
|
+
false
|
69
|
+
else
|
70
|
+
true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
59
74
|
def partial_name
|
60
75
|
'mercado_pago_pix'
|
61
76
|
end
|
@@ -77,4 +92,4 @@ module SolidusMp
|
|
77
92
|
end
|
78
93
|
|
79
94
|
end
|
80
|
-
end
|
95
|
+
end
|
data/lib/solidus_mp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_mp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.5.3
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: ''
|