mp_api 2.1.2 → 2.3.0

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: 7bb51f1c6126fedb7f71adb776f93719b41044ebfcc5bc2f6266bd9ffacbc007
4
- data.tar.gz: a0a78feb21186cb970612015a18f8d1f85128692bb96b9972311f0cffd889690
3
+ metadata.gz: bd8aeefc7758768285d0eb089327721c340a8affec21ae421242a8cf2b161ce4
4
+ data.tar.gz: a8fcdb42276e6951dcdad15865bc88fff3e622f9a134c15a93841739ae0623e6
5
5
  SHA512:
6
- metadata.gz: 7d85b4ce7b252dfbdd27ba1a2310a07852b6b72604a0dc8167e1a976d26caedc80d87205a7ac9699115937bca5013ee65f49cd4768f6a7b0f807ef555e42bb4d
7
- data.tar.gz: 338db9ef576b227e74f5df63c5e909bc3028732202ba5c5aa79a14ab0bbd27eea0aff4cd75694a94646bb0759e2b11b94290a2147d0667a776118a3a603cadba
6
+ metadata.gz: 10f58ee5bb49744cd78aa26b7940f703f891a0606d648774a6131875fd887d1bc00b8bbb9f2186e8ef6e445bc10855f0a60d31cc6773fcb66a2d69cdd47a1200
7
+ data.tar.gz: be2ae974b4713e68c24cf8af5b4f71e1f67031f50dfa18b0014cb08e5e5383724d69041348874efc55551a402ae817b36caa12f1a9a8afab31b9a99f013cd189
data/lib/mp_api/client.rb CHANGED
@@ -4,7 +4,8 @@ module MpApi
4
4
  MAX_RETRIES = 1
5
5
  SAVE_RESPONSES = true
6
6
 
7
- def create_pix_payment(date_of_expiration: nil, amount:, description: nil, statement_descriptor: nil, payment_method:, payer_email:, payer_identification_type:, payer_identification_number:)
7
+ # @param items [Array<MpApi::Item>] Array de objetos Item contendo id, title, description, category_id, quantity, unit_price
8
+ def create_pix_payment(date_of_expiration: nil, amount:, description: nil, statement_descriptor: nil, payment_method:, payer_email:, payer_identification_type:, payer_identification_number:, external_reference: nil, items: [])
8
9
  body = {
9
10
  date_of_expiration: date_of_expiration,
10
11
  transaction_amount: amount,
@@ -17,12 +18,17 @@ module MpApi
17
18
  type: payer_identification_type,
18
19
  number: payer_identification_number
19
20
  }
21
+ },
22
+ external_reference: external_reference,
23
+ additional_info: {
24
+ items: items.map(&:to_api_hash)
20
25
  }
21
26
  }.compact
22
27
  post("/payments", body:)
23
28
  end
24
29
 
25
- def create_credit_card_payment(date_of_expiration: nil, amount:, description: nil, statement_descriptor: nil, payment_method:, payer_email:, payer_identification_type:, payer_identification_number:, capture: nil, token: nil, issuer_id: nil, installments: nil, three_d_secure_mode: false)
30
+ # @param items [Array<MpApi::Item>] Array de objetos Item contendo id, title, description, category_id, quantity, unit_price
31
+ def create_credit_card_payment(date_of_expiration: nil, amount:, description: nil, statement_descriptor: nil, payment_method:, payer_email:, payer_identification_type:, payer_identification_number:, capture: nil, external_reference: nil, token: nil, issuer_id: nil, installments: nil, three_d_secure_mode: false, items: [])
26
32
  body = {
27
33
  date_of_expiration: date_of_expiration,
28
34
  transaction_amount: amount,
@@ -37,10 +43,14 @@ module MpApi
37
43
  }
38
44
  },
39
45
  capture: capture,
46
+ external_reference: external_reference,
40
47
  token: token,
41
48
  issuer_id: issuer_id,
42
49
  installments: installments,
43
- three_d_secure_mode: three_d_secure_mode ? "optional" : "not_supported"
50
+ three_d_secure_mode: three_d_secure_mode ? "optional" : "not_supported",
51
+ additional_info: {
52
+ items: items.map(&:to_api_hash)
53
+ }
44
54
  }.compact
45
55
  post("/payments", body:)
46
56
  end
@@ -0,0 +1,25 @@
1
+ module MpApi
2
+ class Item
3
+
4
+ attr_reader :id, :title, :description, :category_id, :quantity, :unit_price
5
+ def initialize(id:, title:, description:, category_id: nil, quantity: nil, unit_price: nil)
6
+ @id = id
7
+ @title = title
8
+ @description = description
9
+ @category_id = category_id
10
+ @quantity = quantity
11
+ @unit_price = unit_price
12
+ end
13
+
14
+ def to_api_hash
15
+ {
16
+ id: id,
17
+ title: title,
18
+ description: description,
19
+ category_id: category_id,
20
+ quantity: quantity,
21
+ unit_price: unit_price
22
+ }
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MpApi
4
- VERSION = "2.1.2"
4
+ VERSION = "2.3.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mp_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todas Essas Coisas
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-07-14 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: ac
@@ -23,6 +24,7 @@ dependencies:
23
24
  - - ">="
24
25
  - !ruby/object:Gem::Version
25
26
  version: 1.1.0
27
+ description:
26
28
  email:
27
29
  - caioif4@gmail.com
28
30
  executables: []
@@ -34,6 +36,7 @@ files:
34
36
  - Rakefile
35
37
  - lib/mp_api.rb
36
38
  - lib/mp_api/client.rb
39
+ - lib/mp_api/item.rb
37
40
  - lib/mp_api/version.rb
38
41
  homepage: https://github.com/todasessascoisas/mp_api
39
42
  licenses:
@@ -42,6 +45,7 @@ metadata:
42
45
  homepage_uri: https://github.com/todasessascoisas/mp_api
43
46
  source_code_uri: https://github.com/todasessascoisas/mp_api
44
47
  changelog_uri: https://github.com/todasessascoisas/mp_api
48
+ post_install_message:
45
49
  rdoc_options: []
46
50
  require_paths:
47
51
  - lib
@@ -56,7 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
60
  - !ruby/object:Gem::Version
57
61
  version: '0'
58
62
  requirements: []
59
- rubygems_version: 3.6.9
63
+ rubygems_version: 3.5.3
64
+ signing_key:
60
65
  specification_version: 4
61
66
  summary: ''
62
67
  test_files: []