mollie-api-ruby 4.15.0 → 4.19.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: 06f14768975850db4a88530cf6cfbe4d4b80f274c2616736ba6af908e83a044c
4
- data.tar.gz: d7eae71e95f7d0b06646fcc39b069658dc0d808874654fdfd9b2353f1af70d3c
3
+ metadata.gz: 9b880b88741d936827f705eeb56bd21578c6d7d002935cf213a9b441472b8482
4
+ data.tar.gz: 215aab779fa5562b9f93fac08623e5309d7d36bd679bc9aa7e627123496aa7a3
5
5
  SHA512:
6
- metadata.gz: d450cb135d44a6b17b51cdb5921aa03fa9a3796c540b427fb8796251177c776f5d3541f4bccf10739f1bf17fdc65611a318ae6ed17938718d915d487000ac435
7
- data.tar.gz: 9a8fad769b51f90ecf0a4d464661b5e22cda7304b32388091019bb754d66eed1abe731f598547778e8357e302500f32a33a2c740a60b725625e03ed261ec29a2
6
+ metadata.gz: 144686f8cb4d64b3ced9cd6b5c15b764e1dceb632f87cb3b90ac8fcde770c8ec587f862a1b555454c4b2ea21bf846ab8990f6e18fe7df209fac6c2488978af7a
7
+ data.tar.gz: 2894ce4bf3a5dcf9400c6fa957baf55c6d4864ff6e90284e1d82d1af66706c734f8acfc48bcf9c14563becac5a069119aa85c17e5d836e8e87fb20d94b002e51
data/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@
4
4
 
5
5
  All notable changes to this project will be documented in this file.
6
6
 
7
+ ## 4.19.0 - 2026-02-03
8
+
9
+ - (c61808e) Allow bigdecimal 4.x
10
+
11
+ ## 4.18.0 - 2025-07-20
12
+
13
+ - (0ab3a06) Add order attributes to Payment API
14
+
15
+ ## 4.17.0 - 2025-04-21
16
+
17
+ - (bc414d0) Payment: add release payment authorization API
18
+
19
+ ## 4.16.0 - 2025-03-19
20
+
21
+ - (9caf303) Support embedded payment captures and chargebacks
22
+ - (ed1916e) Add support for embedded refunds
23
+ - (c322aca) Avoid frozen string literals warnings with Ruby 3.4
24
+
7
25
  ## 4.15.0 - 2024-12-01
8
26
 
9
27
  - (f659c19) Add Balance API
@@ -1,11 +1,4 @@
1
1
  method = Mollie::Method.get('ideal')
2
2
 
3
- # Include issuers available for the payment method (e.g. for
4
- # iDEAL, KBC/CBC payment button or gift cards).
3
+ # Include issuer details such as which iDEAL or gift card issuers are available
5
4
  method = Mollie::Method.get('ideal', include: 'issuers')
6
-
7
- # Include pricing for each payment method
8
- method = Mollie::Method.get('ideal', include: 'pricing')
9
-
10
- # Include both issuers and pricing
11
- method = Mollie::Method.get('ideal', include: 'issuers,pricing')
@@ -1,8 +1,17 @@
1
+ # Retrieve all enabled payment methods
1
2
  methods = Mollie::Method.all
2
3
 
3
4
  # Filter by amount and currency
4
5
  methods = Mollie::Method.all(amount: { value: '100.00', currency: 'EUR' })
5
6
 
6
- # Retrieve all payment methods that Mollie offers and can be activated by
7
- # the Organization.
7
+ # Retrieve all payment methods that Mollie offers and can be activated by the Organization
8
8
  methods = Mollie::Method.all_available
9
+
10
+ # Include issuer details such as which iDEAL or gift card issuers are available
11
+ methods = Mollie::Method.all_available(include: "issuers")
12
+
13
+ # Include pricing for each payment method
14
+ methods = Mollie::Method.all_available(include: "pricing")
15
+
16
+ # Include issuer details and pricing
17
+ methods = Mollie::Method.all_available(include: "issuers,pricing")
@@ -1 +1,4 @@
1
1
  payment = Mollie::Payment.get('tr_7UhSN1zuXS')
2
+
3
+ # With embedded resources
4
+ payment = Mollie::Payment.get('tr_7UhSN1zuXS', embed: 'captures,chargebacks,refunds')
data/lib/mollie/client.rb CHANGED
@@ -50,8 +50,8 @@ module Mollie
50
50
  @api_key = api_key
51
51
  @version_strings = []
52
52
 
53
- add_version_string 'Mollie/' << VERSION
54
- add_version_string 'Ruby/' << RUBY_VERSION
53
+ add_version_string "Mollie/#{VERSION}"
54
+ add_version_string "Ruby/#{RUBY_VERSION}"
55
55
  add_version_string OpenSSL::OPENSSL_VERSION.split(' ').slice(0, 2).join '/'
56
56
  end
57
57
 
@@ -126,6 +126,8 @@ module Mollie
126
126
  case http_code
127
127
  when 200, 201
128
128
  Util.nested_underscore_keys(JSON.parse(response.body))
129
+ when 202
130
+ JSON.parse(response.body)
129
131
  when 204
130
132
  {} # No Content
131
133
  when 404
@@ -0,0 +1,50 @@
1
+ module Mollie
2
+ class Payment
3
+ class Line < Base
4
+ attr_accessor :type,
5
+ :description,
6
+ :quantity,
7
+ :quantity_unit,
8
+ :vat_rate,
9
+ :sku,
10
+ :categories,
11
+ :image_url,
12
+ :product_url
13
+
14
+ attr_reader :unit_price,
15
+ :discount_amount,
16
+ :recurring,
17
+ :total_amount,
18
+ :vat_amount
19
+
20
+ def discounted?
21
+ !@discount_amount.nil?
22
+ end
23
+
24
+ def unit_price=(amount)
25
+ @unit_price = Mollie::Amount.new(amount)
26
+ end
27
+
28
+ def discount_amount=(amount)
29
+ @discount_amount = Mollie::Amount.new(amount)
30
+ end
31
+
32
+ def recurring=(object)
33
+ return if object.nil?
34
+
35
+ @recurring = OpenStruct.new(object).tap do |r|
36
+ r.amount = Mollie::Amount.new(r.amount) if r.amount
37
+ r.start_date = Date.parse(r.start_date) if r.start_date
38
+ end
39
+ end
40
+
41
+ def total_amount=(amount)
42
+ @total_amount = Mollie::Amount.new(amount)
43
+ end
44
+
45
+ def vat_amount=(amount)
46
+ @vat_amount = Mollie::Amount.new(amount)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -49,6 +49,10 @@ module Mollie
49
49
  :cancel_url,
50
50
  :webhook_url
51
51
 
52
+ attr_reader :lines,
53
+ :billing_address,
54
+ :shipping_address
55
+
52
56
  alias links _links
53
57
 
54
58
  def open?
@@ -185,6 +189,18 @@ module Mollie
185
189
  @amount_refunded = Mollie::Amount.new(amount_refunded)
186
190
  end
187
191
 
192
+ def lines=(lines)
193
+ @lines = lines.map { |line| Payment::Line.new(line) }
194
+ end
195
+
196
+ def billing_address=(address)
197
+ @billing_address = OpenStruct.new(address) if address.is_a?(Hash)
198
+ end
199
+
200
+ def shipping_address=(address)
201
+ @shipping_address = OpenStruct.new(address) if address.is_a?(Hash)
202
+ end
203
+
188
204
  def checkout_url
189
205
  Util.extract_url(links, 'checkout')
190
206
  end
@@ -196,16 +212,38 @@ module Mollie
196
212
  Payment::Refund.create(options)
197
213
  end
198
214
 
215
+ def release_authorization(options = {})
216
+ Client.instance.perform_http_call("POST", "payments/#{id}", "release-authorization", {}, options) == {}
217
+ end
218
+
199
219
  def refunds(options = {})
200
- Payment::Refund.all(options.merge(payment_id: id))
220
+ resources = (attributes['_embedded']['refunds'] if attributes['_embedded'])
221
+
222
+ if resources.nil?
223
+ Payment::Refund.all(options.merge(payment_id: id))
224
+ else
225
+ List.new({ '_embedded' => { 'refunds' => resources } }, Payment::Refund)
226
+ end
201
227
  end
202
228
 
203
229
  def chargebacks(options = {})
204
- Payment::Chargeback.all(options.merge(payment_id: id))
230
+ resources = (attributes['_embedded']['chargebacks'] if attributes['_embedded'])
231
+
232
+ if resources.nil?
233
+ Payment::Chargeback.all(options.merge(payment_id: id))
234
+ else
235
+ List.new({ '_embedded' => { 'chargebacks' => resources } }, Payment::Chargeback)
236
+ end
205
237
  end
206
238
 
207
239
  def captures(options = {})
208
- Payment::Capture.all(options.merge(payment_id: id))
240
+ resources = (attributes['_embedded']['captures'] if attributes['_embedded'])
241
+
242
+ if resources.nil?
243
+ Payment::Capture.all(options.merge(payment_id: id))
244
+ else
245
+ List.new({ '_embedded' => { 'captures' => resources } }, Payment::Capture)
246
+ end
209
247
  end
210
248
 
211
249
  def customer(options = {})
data/lib/mollie/util.rb CHANGED
@@ -14,9 +14,31 @@ module Mollie
14
14
  end
15
15
  end
16
16
 
17
- def camelize_keys(hash)
18
- hash.each_with_object({}) do |(key, value), camelized|
19
- camelized[camelize(key)] = value
17
+ CAMELIZE_NESTED = [
18
+ :lines,
19
+ "lines",
20
+ :recurring,
21
+ "recurring",
22
+ :billing_address,
23
+ "billing_address",
24
+ :shipping_address,
25
+ "shipping_address"
26
+ ].freeze
27
+
28
+ def camelize_keys(object)
29
+ case object
30
+ when Hash
31
+ object.each_with_object({}) do |(key, value), camelized|
32
+ camelized[camelize(key)] = if CAMELIZE_NESTED.include?(key)
33
+ camelize_keys(value)
34
+ else
35
+ value
36
+ end
37
+ end
38
+ when Array
39
+ object.map { |value| camelize_keys(value) }
40
+ else
41
+ object
20
42
  end
21
43
  end
22
44
 
@@ -1,3 +1,3 @@
1
1
  module Mollie
2
- VERSION = '4.15.0'.freeze
2
+ VERSION = '4.19.0'.freeze
3
3
  end
data/lib/mollie.rb CHANGED
@@ -44,6 +44,7 @@ require 'mollie/order/refund'
44
44
  require 'mollie/order/shipment'
45
45
  require 'mollie/payment/capture'
46
46
  require 'mollie/payment/chargeback'
47
+ require 'mollie/payment/line'
47
48
  require 'mollie/payment/refund'
48
49
  require 'mollie/settlement/capture'
49
50
  require 'mollie/settlement/chargeback'
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.test_files = Dir['test/**/*']
27
27
 
28
28
  s.add_dependency('ostruct', '~> 0.6.0')
29
- s.add_dependency('bigdecimal', '~> 3.1', '>= 3.1.8')
29
+ s.add_dependency('bigdecimal', '>= 3.1.8', '< 5.0')
30
30
 
31
31
  s.add_development_dependency('rake')
32
32
  s.add_development_dependency('rubocop', '~> 0.57.2')
@@ -0,0 +1,126 @@
1
+ {
2
+ "resource": "payment",
3
+ "id": "tr_WDqYK6vllg",
4
+ "mode": "test",
5
+ "createdAt": "2018-03-20T13:13:37+00:00",
6
+ "amount": {
7
+ "value": "10.00",
8
+ "currency": "EUR"
9
+ },
10
+ "description": "Order #12345",
11
+ "method": null,
12
+ "metadata": {
13
+ "order_id": "12345"
14
+ },
15
+ "status": "open",
16
+ "isCancelable": false,
17
+ "locale": "nl_NL",
18
+ "restrictPaymentMethodsToCountry": "NL",
19
+ "expiresAt": "2018-03-20T13:28:37+00:00",
20
+ "details": null,
21
+ "profileId": "pfl_QkEhN94Ba",
22
+ "sequenceType": "oneoff",
23
+ "redirectUrl": "https://webshop.example.org/order/12345/",
24
+ "webhookUrl": "https://webshop.example.org/payments/webhook/",
25
+ "_embedded": {
26
+ "captures": [
27
+ {
28
+ "resource": "capture",
29
+ "id": "cpt_mNepDkEtco6ah3QNPUGYH",
30
+ "mode": "test",
31
+ "amount": {
32
+ "value": "10.00",
33
+ "currency": "EUR"
34
+ },
35
+ "status": "succeeded",
36
+ "createdAt": "2025-03-19T15:03:34+00:00",
37
+ "description": "Capture for order #12345",
38
+ "settlementAmount": {
39
+ "value": "10.00",
40
+ "currency": "EUR"
41
+ },
42
+ "paymentId": "tr_WDqYK6vllg",
43
+ "_links": {
44
+ "self": {
45
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/captures/cpt_mNepDkEtco6ah3QNPUGYH",
46
+ "type": "application/hal+json"
47
+ },
48
+ "payment": {
49
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
50
+ "type": "application/hal+json"
51
+ }
52
+ }
53
+ }
54
+ ],
55
+ "chargebacks": [
56
+ {
57
+ "resource": "chargeback",
58
+ "id": "chb_ls7ahg",
59
+ "amount": {
60
+ "value": "10.00",
61
+ "currency": "EUR"
62
+ },
63
+ "created_at": "2022-01-03T13:20:37+00:00",
64
+ "payment_id": "tr_WDqYK6vllg",
65
+ "settlement_amount": {
66
+ "value": "-10.00",
67
+ "currency": "EUR"
68
+ },
69
+ "_links": {
70
+ "self": {
71
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/chargebacks/chb_ls7ahg",
72
+ "type": "application/hal+json"
73
+ },
74
+ "payment": {
75
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
76
+ "type": "application/hal+json"
77
+ }
78
+ }
79
+ }
80
+ ],
81
+ "refunds": [
82
+ {
83
+ "resource": "refund",
84
+ "id": "re_vD3Jm32wQt",
85
+ "mode": "test",
86
+ "amount": {
87
+ "value": "329.99",
88
+ "currency": "EUR"
89
+ },
90
+ "status": "pending",
91
+ "createdAt": "2019-01-15T15:41:21+00:00",
92
+ "description": "Required quantity not in stock, refunding one photo book.",
93
+ "metadata": null,
94
+ "paymentId": "tr_WDqYK6vllg",
95
+ "settlementAmount": {
96
+ "value": "-329.99",
97
+ "currency": "EUR"
98
+ },
99
+ "_links": {
100
+ "self": {
101
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/refunds/re_vD3Jm32wQt",
102
+ "type": "application/hal+json"
103
+ },
104
+ "payment": {
105
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
106
+ "type": "application/hal+json"
107
+ }
108
+ }
109
+ }
110
+ ]
111
+ },
112
+ "_links": {
113
+ "self": {
114
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
115
+ "type": "application/hal+json"
116
+ },
117
+ "checkout": {
118
+ "href": "https://www.mollie.com/payscreen/select-method/WDqYK6vllg",
119
+ "type": "text/html"
120
+ },
121
+ "documentation": {
122
+ "href": "https://docs.mollie.com/reference/v2/payments-api/get-payment",
123
+ "type": "text/html"
124
+ }
125
+ }
126
+ }
@@ -2,6 +2,8 @@ require 'helper'
2
2
 
3
3
  module Mollie
4
4
  class PaymentTest < Test::Unit::TestCase
5
+ GET_PAYMENT_WITH_EMBEDDED_RESOURCES = read_fixture('payments/get_embedded_resources.json')
6
+
5
7
  def test_setting_attributes
6
8
  attributes = {
7
9
  resource: 'payment',
@@ -122,6 +124,135 @@ module Mollie
122
124
  assert_false Payment.new([]).refunded?
123
125
  end
124
126
 
127
+ def test_payment_lines_attributes
128
+ attributes = {
129
+ resource: "payment",
130
+ id: "tr_7UhSN1zuXS",
131
+ lines: [{
132
+ type: "physical",
133
+ description: "LEGO 4440 Forest Police Station",
134
+ quantity: 1,
135
+ quantity_unit: "pcs",
136
+ unit_price: { value: "89.00", currency: "EUR" },
137
+ discount_amount: { value: "10.00", currency: "EUR" },
138
+ recurring: {
139
+ description: "A description of the recurring item.",
140
+ interval: "3 months",
141
+ amount: { value: "29.00", currency: "EUR" },
142
+ times: 4,
143
+ start_date: "2025-05-04"
144
+ },
145
+ total_amount: { value: "95.59", currency: "EUR" },
146
+ vat_rate: "21.00",
147
+ vat_amount: { value: "16.59", currency: "EUR" },
148
+ sku: "SKU-12345",
149
+ categories: ["eco", "meal", "gift", "sport_culture"],
150
+ image_url: "https://example.org/lego-4440-forest-police-station.jpg",
151
+ product_url: "https://example.org/lego-4440-forest-police-station"
152
+ }]
153
+ }
154
+
155
+ payment = Payment.new(attributes)
156
+ line = payment.lines.first
157
+
158
+ assert_equal Payment::Line, line.class
159
+ assert_equal "physical", line.type
160
+ assert_equal "LEGO 4440 Forest Police Station", line.description
161
+ assert_equal 1, line.quantity
162
+ assert_equal "pcs", line.quantity_unit
163
+ assert_equal 89.00, line.unit_price.value
164
+ assert_equal "EUR", line.unit_price.currency
165
+ assert_equal 10.00, line.discount_amount.value
166
+ assert_equal "EUR", line.discount_amount.currency
167
+ assert_equal 95.59, line.total_amount.value
168
+ assert_equal "EUR", line.total_amount.currency
169
+ assert_equal "21.00", line.vat_rate
170
+ assert_equal 16.59, line.vat_amount.value
171
+ assert_equal "EUR", line.vat_amount.currency
172
+ assert_equal "SKU-12345", line.sku
173
+ assert_equal ["eco", "meal", "gift", "sport_culture"], line.categories
174
+ assert_equal "https://example.org/lego-4440-forest-police-station.jpg", line.image_url
175
+ assert_equal "https://example.org/lego-4440-forest-police-station", line.product_url
176
+
177
+ # Recurring object
178
+ assert_equal "A description of the recurring item.", line.recurring.description
179
+ assert_equal "3 months", line.recurring.interval
180
+ assert_equal 29.00, line.recurring.amount.value
181
+ assert_equal "EUR", line.recurring.amount.currency
182
+ assert_equal 4, line.recurring.times
183
+ assert_equal Date.parse("2025-05-04"), line.recurring.start_date
184
+ end
185
+
186
+ def test_billing_address
187
+ attributes = {
188
+ resource: "payment",
189
+ id: "tr_7UhSN1zuXS",
190
+ billing_address: {
191
+ title: "Dhr",
192
+ given_name: "Piet",
193
+ family_name: "Mondriaan",
194
+ organization_name: "Mollie B.V.",
195
+ street_and_number: "Keizersgracht 313",
196
+ street_additional: "apt",
197
+ postal_code: "1234AB",
198
+ email: "piet@mondriaan.com",
199
+ phone: "+31208202070",
200
+ city: "Amsterdam",
201
+ region: "Noord-Holland",
202
+ country: "NL"
203
+ }
204
+ }
205
+
206
+ payment = Payment.new(attributes)
207
+ assert_equal "Dhr", payment.billing_address.title
208
+ assert_equal "Piet", payment.billing_address.given_name
209
+ assert_equal "Mondriaan", payment.billing_address.family_name
210
+ assert_equal "Mollie B.V.", payment.billing_address.organization_name
211
+ assert_equal "Keizersgracht 313", payment.billing_address.street_and_number
212
+ assert_equal "apt", payment.billing_address.street_additional
213
+ assert_equal "1234AB", payment.billing_address.postal_code
214
+ assert_equal "piet@mondriaan.com", payment.billing_address.email
215
+ assert_equal "+31208202070", payment.billing_address.phone
216
+ assert_equal "Amsterdam", payment.billing_address.city
217
+ assert_equal "Noord-Holland", payment.billing_address.region
218
+ assert_equal "NL", payment.billing_address.country
219
+ end
220
+
221
+ def test_shipping_address
222
+ attributes = {
223
+ resource: "payment",
224
+ id: "tr_7UhSN1zuXS",
225
+ shipping_address: {
226
+ title: "Dhr",
227
+ given_name: "Piet",
228
+ family_name: "Mondriaan",
229
+ organization_name: "Mollie B.V.",
230
+ street_and_number: "Keizersgracht 313",
231
+ street_additional: "apt",
232
+ postal_code: "1234AB",
233
+ email: "piet@mondriaan.com",
234
+ phone: "+31208202070",
235
+ city: "Amsterdam",
236
+ region: "Noord-Holland",
237
+ country: "NL"
238
+ }
239
+ }
240
+
241
+ payment = Payment.new(attributes)
242
+ assert_equal "Dhr", payment.shipping_address.title
243
+ assert_equal "Piet", payment.shipping_address.given_name
244
+ assert_equal "Mondriaan", payment.shipping_address.family_name
245
+ assert_equal "Mollie B.V.", payment.shipping_address.organization_name
246
+ assert_equal "Keizersgracht 313", payment.shipping_address.street_and_number
247
+ assert_equal "apt", payment.shipping_address.street_additional
248
+ assert_equal "1234AB", payment.shipping_address.postal_code
249
+ assert_equal "piet@mondriaan.com", payment.shipping_address.email
250
+ assert_equal "+31208202070", payment.shipping_address.phone
251
+ assert_equal "Amsterdam", payment.shipping_address.city
252
+ assert_equal "Noord-Holland", payment.shipping_address.region
253
+ assert_equal "NL", payment.shipping_address.country
254
+ end
255
+
125
256
  def test_create_payment
126
257
  stub_request(:post, 'https://api.mollie.com/v2/payments')
127
258
  .with(body: %({"amount":{"value":1.95,"currency":"EUR"}}))
@@ -149,6 +280,22 @@ module Mollie
149
280
  assert_equal 'cst_8wmqcHMN4U', payment.customer_id
150
281
  end
151
282
 
283
+ def test_release_authorization
284
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg')
285
+ .to_return(status: 200, body: %(
286
+ {
287
+ "resource": "payment",
288
+ "id": "tr_WDqYK6vllg"
289
+ }
290
+ ), headers: {})
291
+
292
+ stub_request(:post, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg/release-authorization')
293
+ .to_return(status: 202, body: %({}), headers: {})
294
+
295
+ payment = Payment.get('tr_WDqYK6vllg')
296
+ assert payment.release_authorization
297
+ end
298
+
152
299
  def test_refund!
153
300
  stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg')
154
301
  .to_return(status: 200, body: %(
@@ -233,6 +380,36 @@ module Mollie
233
380
  assert_equal 'NL', payment.restrict_payment_methods_to_country
234
381
  end
235
382
 
383
+ def test_embedded_captures
384
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg?embed=captures')
385
+ .to_return(status: 200, body: GET_PAYMENT_WITH_EMBEDDED_RESOURCES, headers: {})
386
+
387
+ payment = Payment.get('tr_WDqYK6vllg', embed: 'captures')
388
+
389
+ assert_equal 'cpt_mNepDkEtco6ah3QNPUGYH', payment.captures.first.id
390
+ assert_equal 1, payment.captures.size
391
+ end
392
+
393
+ def test_embedded_chargebacks
394
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg?embed=chargebacks')
395
+ .to_return(status: 200, body: GET_PAYMENT_WITH_EMBEDDED_RESOURCES, headers: {})
396
+
397
+ payment = Payment.get('tr_WDqYK6vllg', embed: 'chargebacks')
398
+
399
+ assert_equal 'chb_ls7ahg', payment.chargebacks.first.id
400
+ assert_equal 1, payment.chargebacks.size
401
+ end
402
+
403
+ def test_embedded_refunds
404
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg?embed=refunds')
405
+ .to_return(status: 200, body: GET_PAYMENT_WITH_EMBEDDED_RESOURCES, headers: {})
406
+
407
+ payment = Payment.get('tr_WDqYK6vllg', embed: 'refunds')
408
+
409
+ assert_equal 're_vD3Jm32wQt', payment.refunds.first.id
410
+ assert_equal 1, payment.refunds.size
411
+ end
412
+
236
413
  def test_list_refunds
237
414
  stub_request(:get, 'https://api.mollie.com/v2/payments/pay-id/refunds')
238
415
  .to_return(status: 200, body: %({"_embedded" : {"refunds" : [{"id":"ref-id", "payment_id":"pay-id"}]}}), headers: {})
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.15.0
4
+ version: 4.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ostruct
@@ -28,22 +27,22 @@ dependencies:
28
27
  name: bigdecimal
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '3.1'
34
30
  - - ">="
35
31
  - !ruby/object:Gem::Version
36
32
  version: 3.1.8
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '5.0'
37
36
  type: :runtime
38
37
  prerelease: false
39
38
  version_requirements: !ruby/object:Gem::Requirement
40
39
  requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '3.1'
44
40
  - - ">="
45
41
  - !ruby/object:Gem::Version
46
42
  version: 3.1.8
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '5.0'
47
46
  - !ruby/object:Gem::Dependency
48
47
  name: rake
49
48
  requirement: !ruby/object:Gem::Requirement
@@ -256,6 +255,7 @@ files:
256
255
  - lib/mollie/payment.rb
257
256
  - lib/mollie/payment/capture.rb
258
257
  - lib/mollie/payment/chargeback.rb
258
+ - lib/mollie/payment/line.rb
259
259
  - lib/mollie/payment/refund.rb
260
260
  - lib/mollie/payment_link.rb
261
261
  - lib/mollie/permission.rb
@@ -304,6 +304,7 @@ files:
304
304
  - test/fixtures/payment_links/list.json
305
305
  - test/fixtures/payment_links/update.json
306
306
  - test/fixtures/payments/get.json
307
+ - test/fixtures/payments/get_embedded_resources.json
307
308
  - test/fixtures/refunds/get.json
308
309
  - test/fixtures/shipments/create.json
309
310
  - test/fixtures/shipments/get.json
@@ -355,7 +356,6 @@ licenses:
355
356
  - BSD
356
357
  metadata:
357
358
  changelog_uri: https://github.com/mollie/mollie-api-ruby/blob/master/CHANGELOG.md
358
- post_install_message:
359
359
  rdoc_options: []
360
360
  require_paths:
361
361
  - lib
@@ -370,8 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
370
  - !ruby/object:Gem::Version
371
371
  version: '0'
372
372
  requirements: []
373
- rubygems_version: 3.5.22
374
- signing_key:
373
+ rubygems_version: 4.0.3
375
374
  specification_version: 4
376
375
  summary: Official Mollie API Client for Ruby
377
376
  test_files:
@@ -408,6 +407,7 @@ test_files:
408
407
  - test/fixtures/payment_links/list.json
409
408
  - test/fixtures/payment_links/update.json
410
409
  - test/fixtures/payments/get.json
410
+ - test/fixtures/payments/get_embedded_resources.json
411
411
  - test/fixtures/refunds/get.json
412
412
  - test/fixtures/shipments/create.json
413
413
  - test/fixtures/shipments/get.json