mercadopago-sdk 3.1.0 → 3.2.1

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/.github/workflows/release.yml +1 -1
  4. data/.pre-commit-config.yaml +2 -2
  5. data/CHANGELOG.md +28 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +26 -18
  8. data/examples/order/create_checkout_pro.rb +167 -0
  9. data/examples/preference/create_with_industry_fields.rb +137 -0
  10. data/lib/mercadopago/config/config.rb +1 -1
  11. data/lib/mercadopago/config/request_options.rb +11 -3
  12. data/lib/mercadopago/core/mp_base.rb +7 -0
  13. data/lib/mercadopago/resources/advanced_payment.rb +5 -5
  14. data/lib/mercadopago/resources/card.rb +4 -4
  15. data/lib/mercadopago/resources/card_token.rb +1 -1
  16. data/lib/mercadopago/resources/chargeback.rb +1 -1
  17. data/lib/mercadopago/resources/customer.rb +3 -3
  18. data/lib/mercadopago/resources/disbursement_refund.rb +3 -3
  19. data/lib/mercadopago/resources/invoice.rb +1 -1
  20. data/lib/mercadopago/resources/merchant_order.rb +2 -2
  21. data/lib/mercadopago/resources/order.rb +39 -5
  22. data/lib/mercadopago/resources/order_transaction.rb +4 -3
  23. data/lib/mercadopago/resources/payment.rb +2 -2
  24. data/lib/mercadopago/resources/point.rb +3 -3
  25. data/lib/mercadopago/resources/preapproval.rb +2 -2
  26. data/lib/mercadopago/resources/preapproval_plan.rb +2 -2
  27. data/lib/mercadopago/resources/preference.rb +2 -2
  28. data/lib/mercadopago/resources/refund.rb +2 -2
  29. data/lib/mercadopago/webhook/validator.rb +1 -1
  30. data/mercadopago.gemspec +1 -1
  31. data/tests/test_order.rb +209 -0
  32. data/tests/test_path_param.rb +14 -0
  33. data/tests/test_payment.rb +39 -3
  34. data/tests/test_webhook_signature_validator.rb +4 -3
  35. metadata +5 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3f9c30f87f2a16606d96b4b955e9c84b2297608fa13ae849c7c1fa0c5e81e8e
4
- data.tar.gz: a85e57aab4d0cb2a0916e272b3cba305d0c43bc8b71ac395c5f20436e19b5ba0
3
+ metadata.gz: 7dfcf7186c9d72f9b02200699acf4807a80aee9014b0c8b1905097850b6ed5fe
4
+ data.tar.gz: 3cb25341c72de1d3686fe217c7fb81e3ec0bfa87a74cf80cee163b1c3ec6a0d6
5
5
  SHA512:
6
- metadata.gz: eb1e14c6daa97a705470095aad0577f4b16691b62e88afde38337a65cb459adc3875611c9c245bab111ed67dece2c52552bf28bddb2f3d190974b562e0197100
7
- data.tar.gz: 63222ba960570cec0eeeae9a267d4d549ef5862bd9da27918c62acee2aa6689d93e21fb5f91c5ffe0be374d28fcad6bb429bafb34011376cfb18d85c53234731
6
+ metadata.gz: c446ae477af4b97192b150ac3618b2e363d0d98dc8cb060aa08a26f4dc13811612fa69d6f618180fcd315f77cdd83757872f4c052b6689a86ab533411a7fd8bb
7
+ data.tar.gz: '086a6f76e544b588f0f09a55d59946bd68f9eb373dbd3328841fe977168273e2b5a2d35d9e30cf0b9672d81fd31947b8fcdc1bfaca17d21a1b6529e55adbad7b'
@@ -13,13 +13,13 @@ jobs:
13
13
 
14
14
  steps:
15
15
  - name: Checkout code
16
- uses: actions/checkout@v6
16
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
17
17
  with:
18
18
  ref: ${{ github.event.pull_request.head.ref }}
19
19
  repository: ${{ github.event.pull_request.head.repo.full_name }}
20
20
 
21
21
  - name: Cache gems
22
- uses: actions/cache@v4
22
+ uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v6
23
23
  with:
24
24
  path: vendor/bundle
25
25
  key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
@@ -14,7 +14,7 @@ jobs:
14
14
 
15
15
  steps:
16
16
  - name: Checkout code
17
- uses: actions/checkout@v6
17
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
18
18
 
19
19
  - name: Install dependencies
20
20
  run: bundle install
@@ -4,7 +4,7 @@ repos:
4
4
  rev: v2.0.0
5
5
  hooks:
6
6
  - id: pre_commit_hook
7
- stages: [commit]
7
+ stages: [pre-commit]
8
8
  - id: post_commit_hook
9
9
  stages: [post-commit]
10
10
 
@@ -13,7 +13,7 @@ repos:
13
13
  rev: 1.2.2
14
14
  hooks:
15
15
  - id: pre_commit_hook
16
- stages: [commit]
16
+ stages: [pre-commit]
17
17
  verbose: true
18
18
  - id: post_commit_hook
19
19
  stages: [post-commit]
data/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
5
5
  This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0] - 2026-06-30
9
+
10
+ ### Added
11
+
12
+ - **Orders**: helper for creating Checkout Pro orders
13
+ (`sdk.order.create_checkout_pro`). The helper defaults the required
14
+ Checkout Pro fields when omitted, validates conflicting values, and
15
+ returns the created order response with the `checkout_url`.
16
+
17
+ ### Fixed
18
+
19
+ - **Request options**: custom headers now replace generated headers
20
+ case-insensitively, avoiding duplicate idempotency headers.
21
+
22
+ ## [3.2.0-beta.1] - 2026-06-24
23
+
24
+ ### Added
25
+
26
+ - **Orders**: helper for creating Checkout Pro orders
27
+ (`sdk.order.create_checkout_pro`). The helper defaults the required
28
+ Checkout Pro fields when omitted, validates conflicting values, and
29
+ returns the created order response with the `checkout_url`.
30
+
31
+ ### Fixed
32
+
33
+ - **Request options**: custom headers now replace generated headers
34
+ case-insensitively, avoiding duplicate idempotency headers.
35
+
8
36
  ## [3.1.0] - 2026-05-27
9
37
 
10
38
  ### Added
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  group :development, :test do
6
6
  gem 'rake'
7
7
  gem 'minitest', '~> 5.27'
8
- gem 'rubocop', '~> 1.70', require: false
8
+ gem 'rubocop', '~> 1.88', require: false
9
9
  end
10
10
 
11
11
  gemspec
data/Gemfile.lock CHANGED
@@ -1,51 +1,59 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mercadopago-sdk (3.1.0)
4
+ mercadopago-sdk (3.2.1)
5
5
  faraday (~> 2.0)
6
6
  json (~> 2.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.2)
11
+ ast (2.4.3)
12
12
  coderay (1.1.3)
13
- faraday (2.14.2)
13
+ faraday (2.14.3)
14
14
  faraday-net_http (>= 2.0, < 3.5)
15
15
  json
16
16
  logger
17
- faraday-net_http (3.4.3)
17
+ faraday-net_http (3.4.4)
18
18
  net-http (~> 0.5)
19
- json (2.19.5)
20
- language_server-protocol (3.17.0.3)
19
+ io-console (0.8.2)
20
+ json (2.21.1)
21
+ language_server-protocol (3.17.0.6)
22
+ lint_roller (1.1.0)
21
23
  logger (1.7.0)
22
- method_source (1.0.0)
24
+ method_source (1.1.0)
23
25
  minitest (5.27.0)
24
26
  net-http (0.9.1)
25
27
  uri (>= 0.11.1)
26
- parallel (1.26.3)
27
- parser (3.3.6.0)
28
+ parallel (2.1.0)
29
+ parser (3.3.11.1)
28
30
  ast (~> 2.4.1)
29
31
  racc
30
- pry (0.14.1)
32
+ prism (1.9.0)
33
+ pry (0.16.0)
31
34
  coderay (~> 1.1)
32
35
  method_source (~> 1.0)
36
+ reline (>= 0.6.0)
33
37
  racc (1.8.1)
34
38
  rainbow (3.1.1)
35
39
  rake (13.4.2)
36
- regexp_parser (2.10.0)
37
- rubocop (1.70.0)
40
+ regexp_parser (2.12.0)
41
+ reline (0.6.3)
42
+ io-console (~> 0.5)
43
+ rubocop (1.88.2)
38
44
  json (~> 2.3)
39
- language_server-protocol (>= 3.17.0)
40
- parallel (~> 1.10)
45
+ language_server-protocol (~> 3.17.0.2)
46
+ lint_roller (~> 1.1.0)
47
+ parallel (>= 1.10)
41
48
  parser (>= 3.3.0.2)
42
49
  rainbow (>= 2.2.2, < 4.0)
43
50
  regexp_parser (>= 2.9.3, < 3.0)
44
- rubocop-ast (>= 1.36.2, < 2.0)
51
+ rubocop-ast (>= 1.49.0, < 2.0)
45
52
  ruby-progressbar (~> 1.7)
46
53
  unicode-display_width (>= 2.4.0, < 4.0)
47
- rubocop-ast (1.37.0)
48
- parser (>= 3.3.1.0)
54
+ rubocop-ast (1.50.0)
55
+ parser (>= 3.3.7.2)
56
+ prism (~> 1.7)
49
57
  ruby-progressbar (1.13.0)
50
58
  unicode-display_width (3.2.0)
51
59
  unicode-emoji (~> 4.1)
@@ -60,7 +68,7 @@ DEPENDENCIES
60
68
  minitest (~> 5.27)
61
69
  pry (~> 0.14)
62
70
  rake
63
- rubocop (~> 1.70)
71
+ rubocop (~> 1.88)
64
72
 
65
73
  BUNDLED WITH
66
74
  2.5.23
@@ -0,0 +1,167 @@
1
+ require_relative '../../lib/mercadopago'
2
+
3
+
4
+ sdk = Mercadopago::SDK.new('<ACCESS_TOKEN>')
5
+
6
+ def create_checkout_pro_order(sdk)
7
+ request = {
8
+ total_amount: '500.00',
9
+ external_reference: 'ext_ref_checkout_pro',
10
+ capture_mode: 'automatic',
11
+ marketplace_fee: '5.00',
12
+ description: 'Travel package SAO-RIO with insurance',
13
+ expiration_time: 'P1D',
14
+ payer: {
15
+ email: '<PAYER_EMAIL>',
16
+ first_name: 'John',
17
+ last_name: 'Smith',
18
+ phone: {
19
+ area_code: '11',
20
+ number: '999998888'
21
+ },
22
+ identification: {
23
+ type: 'CPF',
24
+ number: '12345678909'
25
+ },
26
+ date_created: '2024-01-01T00:00:00Z',
27
+ authentication_type: 'Gmail',
28
+ is_prime_user: false,
29
+ is_first_purchase_online: false,
30
+ last_purchase: '2024-01-01T00:00:00Z',
31
+ registration_date: '2023-01-01T00:00:00Z'
32
+ },
33
+ shipment: {
34
+ mode: 'custom',
35
+ local_pickup: false,
36
+ express_shipment: false,
37
+ cost: '15.00',
38
+ free_shipping: false,
39
+ address: {
40
+ zip_code: '01310-100',
41
+ street_name: 'Av. Paulista',
42
+ street_number: '1000',
43
+ neighborhood: 'Bela Vista',
44
+ city: 'Sao Paulo',
45
+ state_name: 'Sao Paulo',
46
+ city_name: 'Sao Paulo',
47
+ floor: '2',
48
+ apartment: 'A'
49
+ }
50
+ },
51
+ config: {
52
+ statement_descriptor: 'MYSTORE',
53
+ default_payment_due_date: 'P1D',
54
+ online: {
55
+ available_from: '2026-01-01T00:00:00Z',
56
+ allowed_user_type: 'account_only',
57
+ success_url: 'https://example.com/success',
58
+ failure_url: 'https://example.com/failure',
59
+ pending_url: 'https://example.com/pending',
60
+ auto_return: 'approved',
61
+ tracks: [
62
+ {
63
+ type: 'google_ad',
64
+ values: {
65
+ conversion_id: '21312312312123',
66
+ conversion_label: 'TEST'
67
+ }
68
+ },
69
+ {
70
+ type: 'facebook_ad',
71
+ values: {
72
+ pixel_id: '21312312312123'
73
+ }
74
+ }
75
+ ]
76
+ },
77
+ payment_method: {
78
+ max_installments: 12,
79
+ not_allowed_ids: ['amex'],
80
+ not_allowed_types: ['ticket'],
81
+ installments: {
82
+ interest_free: {
83
+ type: 'range',
84
+ values: [2, 6]
85
+ }
86
+ }
87
+ }
88
+ },
89
+ items: [
90
+ {
91
+ external_code: 'ITEM-001',
92
+ title: 'Flight SAO-RIO',
93
+ description: 'Round trip, economy class',
94
+ category_id: 'travels',
95
+ picture_url: 'https://example.com/img.jpg',
96
+ quantity: 1,
97
+ unit_price: '450.00',
98
+ type: 'travel',
99
+ warranty: false,
100
+ event_date: '2027-01-15T00:00:00.000-03:00',
101
+ category_descriptor: {
102
+ passenger: {
103
+ first_name: 'John',
104
+ last_name: 'Smith',
105
+ identification: {
106
+ type: 'CPF',
107
+ number: '12345678909'
108
+ }
109
+ },
110
+ route: {
111
+ departure: 'SAO',
112
+ destination: 'RIO',
113
+ departure_date_time: '2027-01-15T08:00:00.000-03:00',
114
+ arrival_date_time: '2027-01-15T09:30:00.000-03:00',
115
+ company: 'LATAM'
116
+ }
117
+ }
118
+ },
119
+ {
120
+ external_code: 'ITEM-002',
121
+ title: 'Travel insurance',
122
+ description: 'Basic coverage during trip',
123
+ category_id: 'travels',
124
+ picture_url: 'https://example.com/insurance.jpg',
125
+ quantity: 1,
126
+ unit_price: '50.00',
127
+ type: 'travel',
128
+ warranty: true,
129
+ event_date: '2027-01-15T00:00:00.000-03:00',
130
+ category_descriptor: {
131
+ passenger: {
132
+ first_name: 'John',
133
+ last_name: 'Smith',
134
+ identification: {
135
+ type: 'CPF',
136
+ number: '12345678909'
137
+ }
138
+ },
139
+ route: {
140
+ departure: 'SAO',
141
+ destination: 'RIO',
142
+ departure_date_time: '2027-01-15T08:00:00.000-03:00',
143
+ arrival_date_time: '2027-01-15T09:30:00.000-03:00',
144
+ company: 'LATAM'
145
+ }
146
+ }
147
+ }
148
+ ]
149
+ }
150
+
151
+ custom_headers = {
152
+ 'X-Idempotency-Key': '<SOME_UNIQUE_VALUE>'
153
+ }
154
+ custom_request_options = Mercadopago::RequestOptions.new(custom_headers: custom_headers)
155
+
156
+ result = sdk.order.create_checkout_pro(request, request_options: custom_request_options)
157
+ order = result[:response]
158
+
159
+ puts "Order id: #{order['id']}"
160
+ puts "Status: #{order['status']}"
161
+ puts "Redirect buyer to Checkout Pro: #{order['checkout_url']}"
162
+
163
+ rescue StandardError => e
164
+ puts e.message
165
+ end
166
+
167
+ create_checkout_pro_order(sdk)
@@ -0,0 +1,137 @@
1
+ # Example: Create a Checkout Preference with industry-specific fields.
2
+ # Demonstrates payer authentication info, item category descriptors,
3
+ # passenger/route details, and shipment address enrichment.
4
+
5
+ require_relative '../../lib/mercadopago'
6
+
7
+ sdk = Mercadopago::SDK.new('<ACCESS_TOKEN>')
8
+
9
+ def create_preference_with_industry_fields(sdk)
10
+ request = {
11
+ payer: {
12
+ name: 'John',
13
+ surname: 'Smith',
14
+ email: '<PAYER_EMAIL>',
15
+ phone: {
16
+ area_code: '11',
17
+ number: '999998888'
18
+ },
19
+ identification: {
20
+ type: 'CPF',
21
+ number: '12345678909'
22
+ },
23
+ address: {
24
+ zip_code: '01310-100',
25
+ street_name: 'Av. Paulista',
26
+ street_number: 1000
27
+ },
28
+ date_created: '2024-01-01T00:00:00Z',
29
+ authentication_type: 'Gmail',
30
+ is_prime_user: false,
31
+ is_first_purchase_online: false,
32
+ last_purchase: '2024-01-01T00:00:00Z',
33
+ registration_date: '2023-01-01T00:00:00Z'
34
+ },
35
+ items: [
36
+ {
37
+ id: 'ITEM-001',
38
+ title: 'Flight SAO-RIO',
39
+ description: 'Round trip, economy class',
40
+ category_id: 'travels',
41
+ picture_url: 'https://example.com/img.jpg',
42
+ quantity: 1,
43
+ currency_id: 'BRL',
44
+ unit_price: 450.00,
45
+ warranty: false,
46
+ event_date: '2027-01-15T00:00:00.000-03:00',
47
+ category_descriptor: {
48
+ passenger: {
49
+ first_name: 'John',
50
+ last_name: 'Smith',
51
+ identification: {
52
+ type: 'CPF',
53
+ number: '12345678909'
54
+ }
55
+ },
56
+ route: {
57
+ departure: 'SAO',
58
+ destination: 'RIO',
59
+ departure_date_time: '2027-01-15T08:00:00.000-03:00',
60
+ arrival_date_time: '2027-01-15T09:30:00.000-03:00',
61
+ company: 'LATAM'
62
+ }
63
+ }
64
+ },
65
+ {
66
+ id: 'ITEM-002',
67
+ title: 'Travel insurance',
68
+ description: 'Basic coverage during trip',
69
+ category_id: 'travels',
70
+ picture_url: 'https://example.com/insurance.jpg',
71
+ quantity: 1,
72
+ currency_id: 'BRL',
73
+ unit_price: 50.00,
74
+ warranty: true,
75
+ event_date: '2027-01-15T00:00:00.000-03:00',
76
+ category_descriptor: {
77
+ passenger: {
78
+ first_name: 'John',
79
+ last_name: 'Smith',
80
+ identification: {
81
+ type: 'CPF',
82
+ number: '12345678909'
83
+ }
84
+ },
85
+ route: {
86
+ departure: 'SAO',
87
+ destination: 'RIO',
88
+ departure_date_time: '2027-01-15T08:00:00.000-03:00',
89
+ arrival_date_time: '2027-01-15T09:30:00.000-03:00',
90
+ company: 'LATAM'
91
+ }
92
+ }
93
+ }
94
+ ],
95
+ shipments: {
96
+ mode: 'custom',
97
+ local_pickup: false,
98
+ express_shipment: false,
99
+ cost: 15.0,
100
+ free_shipping: false,
101
+ receiver_address: {
102
+ zip_code: '01310-100',
103
+ street_name: 'Av. Paulista',
104
+ street_number: 1000,
105
+ state_name: 'Sao Paulo',
106
+ city_name: 'Sao Paulo',
107
+ floor: '2',
108
+ apartment: 'A'
109
+ }
110
+ },
111
+ back_urls: {
112
+ success: 'https://example.com/success',
113
+ failure: 'https://example.com/failure',
114
+ pending: 'https://example.com/pending'
115
+ },
116
+ auto_return: 'approved',
117
+ external_reference: 'MP0001',
118
+ notification_url: 'https://example.com/notifications',
119
+ statement_descriptor: 'MYSTORE'
120
+ }
121
+
122
+ custom_headers = {
123
+ 'X-Idempotency-Key': '<SOME_UNIQUE_VALUE>'
124
+ }
125
+ custom_request_options = Mercadopago::RequestOptions.new(custom_headers: custom_headers)
126
+
127
+ result = sdk.preference.create(request, request_options: custom_request_options)
128
+ preference = result[:response]
129
+
130
+ puts "Preference id: #{preference['id']}"
131
+ puts "Init point: #{preference['init_point']}"
132
+
133
+ rescue StandardError => e
134
+ puts e.message
135
+ end
136
+
137
+ create_preference_with_industry_fields(sdk)
@@ -9,7 +9,7 @@ module Mercadopago
9
9
  # there is no need to instantiate this class directly.
10
10
  class Config
11
11
  # Current SDK version following SemVer.
12
- @@VERSION = '3.1.0'
12
+ @@VERSION = '3.2.0'
13
13
 
14
14
  # User-Agent string sent with every HTTP request for server-side tracking.
15
15
  @@USER_AGENT = "MercadoPago Ruby SDK v#{@@VERSION}"
@@ -77,9 +77,7 @@ module Mercadopago
77
77
  headers['x-integrator-id'] = @integrator_id unless @integrator_id.nil?
78
78
  headers['x-platform-id'] = @platform_id unless @platform_id.nil?
79
79
 
80
- headers.merge!(@custom_headers) unless @custom_headers.nil?
81
-
82
- headers
80
+ merge_custom_headers(headers)
83
81
  end
84
82
 
85
83
  # @param value [String, nil] OAuth access token
@@ -137,5 +135,15 @@ module Mercadopago
137
135
 
138
136
  @max_retries = value
139
137
  end
138
+
139
+ private
140
+
141
+ def merge_custom_headers(headers)
142
+ return headers if @custom_headers.nil?
143
+
144
+ custom_header_names = @custom_headers.keys.map { |key| key.to_s.downcase }
145
+ headers.reject! { |key, _value| custom_header_names.include?(key.to_s.downcase) }
146
+ headers.merge!(@custom_headers)
147
+ end
140
148
  end
141
149
  end
@@ -1,6 +1,8 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'cgi'
5
+
4
6
  module Mercadopago
5
7
  # Abstract base class for every API resource (Payment, Customer, Order, etc.).
6
8
  #
@@ -61,6 +63,11 @@ module Mercadopago
61
63
  headers
62
64
  end
63
65
 
66
+ # Encodes a dynamic URL path segment before interpolation.
67
+ def _path_param(value)
68
+ CGI.escape(value.to_s).gsub('+', '%20')
69
+ end
70
+
64
71
  # Performs a GET request against the MercadoPago API.
65
72
  #
66
73
  # @param uri [String] API path (e.g. "/v1/payments/123")
@@ -29,7 +29,7 @@ module Mercadopago
29
29
  # @param request_options [RequestOptions, nil] per-call configuration override
30
30
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with payment details
31
31
  def get(advanced_payment_id, request_options: nil)
32
- _get(uri: "/v1/advanced_payments/#{advanced_payment_id}", request_options: request_options)
32
+ _get(uri: "/v1/advanced_payments/#{_path_param(advanced_payment_id)}", request_options: request_options)
33
33
  end
34
34
 
35
35
  # Creates a new advanced payment with split disbursements.
@@ -54,7 +54,7 @@ module Mercadopago
54
54
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with the captured payment
55
55
  def capture(advanced_payment_id, request_options: nil)
56
56
  capture_data = { capture: true }
57
- _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: capture_data, request_options: request_options)
57
+ _put(uri: "/v1/advanced_payments/#{_path_param(advanced_payment_id)}", data: capture_data, request_options: request_options)
58
58
  end
59
59
 
60
60
  # Updates an existing advanced payment.
@@ -67,7 +67,7 @@ module Mercadopago
67
67
  def update(advanced_payment_id, advanced_payment_data, request_options: nil)
68
68
  raise TypeError, 'Param advanced_payment_data must be a Hash' unless advanced_payment_data.is_a?(Hash)
69
69
 
70
- _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: advanced_payment_data,
70
+ _put(uri: "/v1/advanced_payments/#{_path_param(advanced_payment_id)}", data: advanced_payment_data,
71
71
  request_options: request_options)
72
72
  end
73
73
 
@@ -78,7 +78,7 @@ module Mercadopago
78
78
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with the cancelled payment
79
79
  def cancel(advanced_payment_id, request_options: nil)
80
80
  cancel_data = { status: 'cancelled' }
81
- _put(uri: "/v1/advanced_payments/#{advanced_payment_id}", data: cancel_data, request_options: request_options)
81
+ _put(uri: "/v1/advanced_payments/#{_path_param(advanced_payment_id)}", data: cancel_data, request_options: request_options)
82
82
  end
83
83
 
84
84
  # Changes the money release date for an advanced payment's disbursements.
@@ -89,7 +89,7 @@ module Mercadopago
89
89
  # @return [Hash{Symbol => Object}] +:status+ and +:response+
90
90
  def update_release_date(advanced_payment_id, release_date, request_options: nil)
91
91
  disbursement_data = { money_release_date: release_date.strftime('%Y-%m-%d %H:%M:%S.%f') }
92
- _post(uri: "/v1/advanced_payments/#{advanced_payment_id}/disburses", data: disbursement_data,
92
+ _post(uri: "/v1/advanced_payments/#{_path_param(advanced_payment_id)}/disburses", data: disbursement_data,
93
93
  request_options: request_options)
94
94
  end
95
95
  end
@@ -18,7 +18,7 @@ module Mercadopago
18
18
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with card details
19
19
  # @see https://www.mercadopago.com/developers/en/reference/online-payments/checkout-api/cards/get-card/get
20
20
  def get(customer_id, card_id, request_options: nil)
21
- _get(uri: "/v1/customers/#{customer_id}/cards/#{card_id}", request_options: request_options)
21
+ _get(uri: "/v1/customers/#{_path_param(customer_id)}/cards/#{_path_param(card_id)}", request_options: request_options)
22
22
  end
23
23
 
24
24
  # Saves a new card for a customer using a previously generated card token.
@@ -32,7 +32,7 @@ module Mercadopago
32
32
  def create(customer_id, card_data, request_options: nil)
33
33
  raise TypeError, 'Param card_data must be a Hash' if card_data.nil? || !card_data.is_a?(Hash)
34
34
 
35
- _post(uri: "/v1/customers/#{customer_id}/cards/", data: card_data, request_options: request_options)
35
+ _post(uri: "/v1/customers/#{_path_param(customer_id)}/cards/", data: card_data, request_options: request_options)
36
36
  end
37
37
 
38
38
  # Deletes a saved card from a customer.
@@ -43,7 +43,7 @@ module Mercadopago
43
43
  # @return [Hash{Symbol => Object}] +:status+ and +:response+
44
44
  # @see https://www.mercadopago.com/developers/en/reference/online-payments/checkout-api/cards/delete-card/delete
45
45
  def delete(customer_id, card_id, request_options: nil)
46
- _delete(uri: "/v1/customers/#{customer_id}/cards/#{card_id}", request_options: request_options)
46
+ _delete(uri: "/v1/customers/#{_path_param(customer_id)}/cards/#{_path_param(card_id)}", request_options: request_options)
47
47
  end
48
48
 
49
49
  # Lists all saved cards for a customer.
@@ -53,7 +53,7 @@ module Mercadopago
53
53
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with an array of cards
54
54
  # @see https://www.mercadopago.com/developers/en/reference/online-payments/checkout-api/cards/get-customer-cards/get
55
55
  def list(customer_id, request_options: nil)
56
- _get(uri: "/v1/customers/#{customer_id}/cards", request_options: request_options)
56
+ _get(uri: "/v1/customers/#{_path_param(customer_id)}/cards", request_options: request_options)
57
57
  end
58
58
  end
59
59
  end
@@ -16,7 +16,7 @@ module Mercadopago
16
16
  # @param request_options [RequestOptions, nil] per-call configuration override
17
17
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with token details
18
18
  def get(card_token_id, request_options: nil)
19
- _get(uri: "/v1/card_tokens/#{card_token_id}", request_options: request_options)
19
+ _get(uri: "/v1/card_tokens/#{_path_param(card_token_id)}", request_options: request_options)
20
20
  end
21
21
 
22
22
  # Creates a new card token from raw card data.
@@ -17,7 +17,7 @@ module Mercadopago
17
17
  # @return [Hash{Symbol => Object}] +:status+ and +:response+ with the full chargeback object
18
18
  # @see https://www.mercadopago.com.br/developers/en/reference/chargebacks/
19
19
  def get(chargeback_id, request_options: nil)
20
- _get(uri: "/v1/chargebacks/#{chargeback_id}", request_options: request_options)
20
+ _get(uri: "/v1/chargebacks/#{_path_param(chargeback_id)}", request_options: request_options)
21
21
  end
22
22
 
23
23
  # Searches chargebacks matching the given filters.