mp_api 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mp_api/payment.rb +11 -2
- data/lib/mp_api/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: 59d843843d099fc02a62263d86caacb6d71655c160680034923a443155c2b1c8
|
4
|
+
data.tar.gz: 42bf488a1003f5e38d2418125e5d5b29f0de78c7c0aca65bb6a9329f2831f092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b769d68eb164df97a1ff8d2e7745b6205472acb3619aa22ee41fd1f869c17099cc1479bee8743dfcc30ada82c6b553169dfc43c55e6121e8ee6e4026f0b7d5b
|
7
|
+
data.tar.gz: 8d5503eb188b0bdc9bf1be1b9ecc8e2532a33b5474048bda8c46ef897cc8b9d597e63a6b7843f1af48ab8c328d0f1bcf61f8d12021dec506afc254c0eb226613
|
data/lib/mp_api/payment.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module MpApi
|
2
2
|
class Payment
|
3
3
|
attr_reader :status_detail, :three_ds_info_creq, :three_ds_info_external_resource_url, :three_d_secure_mode, :id, :description, :date_approved, :date_created, :money_release_date, :payer_email, :payer_identification_type, :payer_identification_number, :payment_method, :last_four_digits, :payment_type, :qr_code, :qr_code_base_64, :transaction_id, :ticket_url, :status, :amount, :token, :issuer_id, :installments, :statement_descriptor, :items, :error, :internal_error, :capture, :date_of_expiration, :saved_card, :customer_id
|
4
|
-
def initialize(payer_email:, payer_identification_type:, payer_identification_number:, payment_method:, last_four_digits: nil,
|
4
|
+
def initialize(payer_email:, payer_identification_type:, payer_identification_number:, payment_method:, amount:, last_four_digits: nil, status_detail: nil, three_ds_info_creq: nil, three_ds_info_external_resource_url: nil, three_d_secure_mode: nil, id: nil, description: nil, date_approved: nil, date_created: nil, money_release_date: nil, payment_type: nil, qr_code: nil, qr_code_base_64: nil, transaction_id: nil, ticket_url: nil, status: nil, token: nil, issuer_id: nil, installments: nil, items: nil, statement_descriptor: nil, error: nil, internal_error: nil, capture: nil, date_of_expiration: nil, saved_card: false, customer_id: nil)
|
5
5
|
@id = id
|
6
6
|
@description = description
|
7
7
|
@date_approved = date_approved
|
@@ -96,14 +96,23 @@ module MpApi
|
|
96
96
|
self.class.new(**self.class.build_hash(response.json))
|
97
97
|
end
|
98
98
|
|
99
|
+
def pix_paid? external_value = nil
|
100
|
+
external_value = @amount if external_value.nil?
|
101
|
+
@status == "approved" && external_value.to_d == @amount.to_d
|
102
|
+
end
|
103
|
+
|
99
104
|
def update attributes
|
100
105
|
attributes.each do |key, value|
|
101
|
-
instance_variable_set("@#{key}", value)
|
106
|
+
instance_variable_set(:"@#{key}", value)
|
102
107
|
end
|
103
108
|
Client.new.update_payment(id, JSON.dump(build_update_json))
|
104
109
|
self.class.find_by_id(id)
|
105
110
|
end
|
106
111
|
|
112
|
+
def invalidate_pix!
|
113
|
+
update(status: "cancelled")
|
114
|
+
end
|
115
|
+
|
107
116
|
def self.find_by_id(payment_id)
|
108
117
|
response = Client.new.get_payment(payment_id)
|
109
118
|
new(**build_hash(response.json))
|
data/lib/mp_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mp_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todas Essas Coisas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ac
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.5.
|
70
|
+
rubygems_version: 3.5.22
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: ''
|