mollie-api-ruby 4.7.0 → 4.8.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: 199d37cfa91ad1e3132c095248ea54a26e7a25dddb748b02b2fa17b7d58334a3
4
- data.tar.gz: 30ad0213bd7ed35038eecac7c48e4c3b965ca56b9f445c2ff6d723d2f223b741
3
+ metadata.gz: a8dad5d626838847afab5862ba970b57c12cc7b4dc90b8bf69e85b97e8ff0f7c
4
+ data.tar.gz: 24330936807862e829261848ceee6ba0a65558829988d467f63172e201d78daa
5
5
  SHA512:
6
- metadata.gz: 3bee04cf11e085a6886ded95949e996f66d78d4a5a5479b96fb6c4d74d8ef588ae2de6040966df27432c147062988370667c0ef601b908feeeca55b7cadb4eb5
7
- data.tar.gz: '080873b112c5878455a65faad416ce9e5fa6af4c8acf0f3784986c5a2c8ea52895740c3d55a2fd84dff672ad83031d08b85d7a1a86c1b58aeffe7deaf2d21bb6'
6
+ metadata.gz: 6c3ea236e726013cc39d580cd4ef25ee40fe0734b906c7dfc89402929b758435944562033e90fa2657604426113f4a1fb5806cd2a127e935eabd9cd5faa12b1f
7
+ data.tar.gz: 4c68d947f24b2594cbc912cf33ab3124b8b9d6deb1493f4dfd4f6384375b0d9a11e5e0b81cc511f12ba3223594be4402e893992adad60f14e8dd6899a4bc27ff
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  All notable changes to this project will be documented in this file.
6
6
 
7
+ ## 4.7.1 - 2020-02-13
8
+
9
+ - Fix `Capture#shipment` API call.
10
+
7
11
  ## 4.7.0 - 2020-02-03
8
12
 
9
13
  - Implemented various API features from the changelog up to and including Tuesday, September 24th, 2019.
data/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
 
6
6
  <img src="https://info.mollie.com/hubfs/github/ruby/editor.png" />
7
7
 
8
- > LOOKING FOR VERSION v2.2.X README? [CLICK HERE](https://github.com/mollie/mollie-api-ruby/tree/2.2.x)
8
+ > LOOKING FOR VERSION v2.2.X README? [CLICK HERE](https://github.com/mollie/mollie-api-ruby/tree/v2.2.1)
9
9
 
10
- > LOOKING FOR VERSION v3.1.X README? [CLICK HERE](https://github.com/mollie/mollie-api-ruby/tree/3.1.x)
10
+ > LOOKING FOR VERSION v3.1.X README? [CLICK HERE](https://github.com/mollie/mollie-api-ruby/tree/v3.1.6)
11
11
 
12
12
  [![Gem Version](https://badge.fury.io/rb/mollie-api-ruby.svg)](https://badge.fury.io/rb/mollie-api-ruby)
13
13
  [![](https://travis-ci.org/mollie/mollie-api-ruby.png)](https://travis-ci.org/mollie/mollie-api-ruby)
data/lib/mollie/method.rb CHANGED
@@ -24,7 +24,8 @@ module Mollie
24
24
  :minimum_amount,
25
25
  :maximum_amount,
26
26
  :image,
27
- :issuers
27
+ :issuers,
28
+ :pricing
28
29
 
29
30
  def minimum_amount=(minimum_amount)
30
31
  @minimum_amount = Mollie::Amount.new(minimum_amount)
@@ -41,5 +42,16 @@ module Mollie
41
42
  def bigger_image
42
43
  image['size2x']
43
44
  end
45
+
46
+ def pricing=(pricing)
47
+ @pricing = pricing.map do |price|
48
+ OpenStruct.new(
49
+ description: price['description'],
50
+ fixed: Mollie::Amount.new(price['fixed']),
51
+ variable: price['variable'],
52
+ fee_region: price['fee_region']
53
+ )
54
+ end
55
+ end
44
56
  end
45
57
  end
data/lib/mollie/order.rb CHANGED
@@ -18,6 +18,7 @@ module Mollie
18
18
  :status,
19
19
  :is_cancelable,
20
20
  :billing_address,
21
+ :shopper_country_must_match_billing_country,
21
22
  :consumer_date_of_birth,
22
23
  :order_number,
23
24
  :shipping_address,
@@ -19,5 +19,9 @@ module Mollie
19
19
  def address=(address)
20
20
  @address = OpenStruct.new(address) if address.is_a?(Hash)
21
21
  end
22
+
23
+ def dashboard_url
24
+ Util.extract_url(links, 'dashboard')
25
+ end
22
26
  end
23
27
  end
@@ -30,8 +30,9 @@ module Mollie
30
30
  end
31
31
 
32
32
  def shipment(options = {})
33
- return if shipment_id.nil?
34
- Order::Shipment.get(shipment_id, options)
33
+ resource_url = Util.extract_url(links, 'shipment')
34
+ response = Client.instance.perform_http_call('GET', resource_url, nil, {}, options)
35
+ Order::Shipment.new(response)
35
36
  end
36
37
 
37
38
  def settlement(options = {})
@@ -31,6 +31,7 @@ module Mollie
31
31
  :method,
32
32
  :metadata,
33
33
  :locale,
34
+ :restrict_payment_methods_to_country,
34
35
  :country_code,
35
36
  :profile_id,
36
37
  :settlement_amount,
@@ -1,3 +1,3 @@
1
1
  module Mollie
2
- VERSION = '4.7.0'.freeze
2
+ VERSION = '4.8.0'.freeze
3
3
  end
@@ -0,0 +1,57 @@
1
+ {
2
+ "resource": "method",
3
+ "id": "creditcard",
4
+ "description": "Credit card",
5
+ "minimumAmount": {
6
+ "value": "0.01",
7
+ "currency": "EUR"
8
+ },
9
+ "maximumAmount": {
10
+ "value": "2000.00",
11
+ "currency": "EUR"
12
+ },
13
+ "image": {
14
+ "size1x": "https://www.mollie.com/external/icons/payment-methods/creditcard.png",
15
+ "size2x": "https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png",
16
+ "svg": "https://www.mollie.com/external/icons/payment-methods/creditcard.svg"
17
+ },
18
+ "pricing": [
19
+ {
20
+ "description": "Commercial & non-European cards",
21
+ "fixed": {
22
+ "value": "0.25",
23
+ "currency": "EUR"
24
+ },
25
+ "variable": "2.8",
26
+ "feeRegion": "other"
27
+ },
28
+ {
29
+ "description": "European cards",
30
+ "fixed": {
31
+ "value": "0.25",
32
+ "currency": "EUR"
33
+ },
34
+ "variable": "1.8",
35
+ "feeRegion": "eu-cards"
36
+ },
37
+ {
38
+ "description": "Maestro",
39
+ "fixed": {
40
+ "value": "0.39",
41
+ "currency": "EUR"
42
+ },
43
+ "variable": "0",
44
+ "feeRegion": "maestro"
45
+ }
46
+ ],
47
+ "_links": {
48
+ "self": {
49
+ "href": "https://api.mollie.com/v2/methods/creditcard?include=pricing",
50
+ "type": "application/hal+json"
51
+ },
52
+ "documentation": {
53
+ "href": "https://docs.mollie.com/reference/v2/methods-api/get-method",
54
+ "type": "text/html"
55
+ }
56
+ }
57
+ }
@@ -35,6 +35,8 @@
35
35
  "familyName": "Skywalker",
36
36
  "email": "luke@skywalker.com"
37
37
  },
38
+ "shopperCountryMustMatchBillingCountry": false,
39
+ "consumerDateOfBirth": "1993-10-21",
38
40
  "orderNumber": "18475",
39
41
  "shippingAddress": {
40
42
  "organizationName": "Mollie B.V.",
@@ -0,0 +1,39 @@
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
+ "_links": {
26
+ "self": {
27
+ "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
28
+ "type": "application/hal+json"
29
+ },
30
+ "checkout": {
31
+ "href": "https://www.mollie.com/payscreen/select-method/WDqYK6vllg",
32
+ "type": "text/html"
33
+ },
34
+ "documentation": {
35
+ "href": "https://docs.mollie.com/reference/v2/payments-api/get-payment",
36
+ "type": "text/html"
37
+ }
38
+ }
39
+ }
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "_links": {
88
88
  "self": {
89
- "href": "https://api.mollie.com/v2/shipments/shp_bjylrn",
89
+ "href": "https://api.mollie.com/v2/order/ord_kEn1PlbGa/shipments/shp_3wmsgCJN4U",
90
90
  "type": "application/hal+json"
91
91
  },
92
92
  "order": {
@@ -27,5 +27,20 @@ module Mollie
27
27
  assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png', method.bigger_image
28
28
  assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard.svg', method.image['svg']
29
29
  end
30
+
31
+ def test_pricing
32
+ stub_request(:get, 'https://api.mollie.com/v2/methods/creditcard?include=pricing')
33
+ .to_return(status: 200, body: read_fixture('methods/get-includes-pricing.json'), headers: {})
34
+
35
+ creditcard = Method.get('creditcard', include: 'pricing')
36
+ creditcard_pricing = creditcard.pricing
37
+
38
+ assert_equal 3, creditcard_pricing.size
39
+ assert_equal 'Commercial & non-European cards', creditcard_pricing.first.description
40
+ assert_equal BigDecimal('0.25'), creditcard_pricing.first.fixed.value
41
+ assert_equal 'EUR', creditcard_pricing.first.fixed.currency
42
+ assert_equal '2.8', creditcard_pricing.first.variable
43
+ assert_equal 'other', creditcard_pricing.first.fee_region
44
+ end
30
45
  end
31
46
  end
@@ -65,6 +65,8 @@ module Mollie
65
65
  assert_equal 'EUR', order.amount_refunded.currency
66
66
  assert_equal 'created', order.status
67
67
  assert_equal true, order.is_cancelable
68
+ assert_equal false, order.shopper_country_must_match_billing_country
69
+ assert_equal '1993-10-21', order.consumer_date_of_birth
68
70
  assert_equal '18475', order.order_number
69
71
  assert_equal 'nl_NL', order.locale
70
72
  assert_equal '1337', order.metadata.order_id
@@ -21,7 +21,11 @@ module Mollie
21
21
  'self' => {
22
22
  'href' => 'https://api.mollie.com/v2/organizations/org_12345678',
23
23
  'type' => 'application/hal+json'
24
- },
24
+ },
25
+ 'dashboard' => {
26
+ 'href' => 'https://mollie.com/dashboard/org_12345678',
27
+ 'type' => 'text/html'
28
+ },
25
29
  'documentation' => {
26
30
  'href' => 'https://docs.mollie.com/reference/v2/organizations-api/get-organization',
27
31
  'type' => 'text/html'
@@ -43,6 +47,7 @@ module Mollie
43
47
  assert_equal 'NL815839091B01', organization.vat_number
44
48
  assert_equal 'dutch', organization.vat_regulation
45
49
  assert_equal 'https://api.mollie.com/v2/organizations/org_12345678', organization.links['self']['href']
50
+ assert_equal 'https://mollie.com/dashboard/org_12345678', organization.dashboard_url
46
51
  end
47
52
 
48
53
  def test_current_organization
@@ -53,7 +53,7 @@ module Mollie
53
53
  stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg/captures/cpt_4qqhO89gsT')
54
54
  .to_return(status: 200, body: GET_CAPTURE, headers: {})
55
55
 
56
- stub_request(:get, 'https://api.mollie.com/v2/shipments/shp_3wmsgCJN4U')
56
+ stub_request(:get, 'https://api.mollie.com/v2/orders/ord_8wmqcHMN4U/shipments/shp_3wmsgCJN4U')
57
57
  .to_return(status: 200, body: SHIPMENT_STUB, headers: {})
58
58
 
59
59
  capture = Payment::Capture.get('cpt_4qqhO89gsT', payment_id: 'tr_WDqYK6vllg')
@@ -223,6 +223,14 @@ module Mollie
223
223
  assert_equal 'EUR', payment.application_fee.amount.currency
224
224
  end
225
225
 
226
+ def test_restrict_payment_methods_to_country
227
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg')
228
+ .to_return(status: 200, body: read_fixture('payments/get.json'), headers: {})
229
+
230
+ payment = Payment.get('tr_WDqYK6vllg')
231
+ assert_equal 'NL', payment.restrict_payment_methods_to_country
232
+ end
233
+
226
234
  def test_list_refunds
227
235
  stub_request(:get, 'https://api.mollie.com/v2/payments/pay-id/refunds')
228
236
  .to_return(status: 200, body: %({"_embedded" : {"refunds" : [{"id":"ref-id", "payment_id":"pay-id"}]}}), headers: {})
@@ -90,7 +90,8 @@ module Mollie
90
90
  currency: 'EUR'
91
91
  }
92
92
  }
93
- ]
93
+ ],
94
+ invoice_id: 'inv_FrvewDA3Pr'
94
95
  }
95
96
  }
96
97
  },
@@ -149,6 +150,8 @@ module Mollie
149
150
  assert_equal '0.5000', settlement.periods[:'2015'][:'11'].costs[1].amount_net.value
150
151
  assert_equal '0.1050', settlement.periods[:'2015'][:'11'].costs[1].amount_vat.value
151
152
  assert_equal '0.6050', settlement.periods[:'2015'][:'11'].costs[1].amount_gross.value
153
+
154
+ assert_equal 'inv_FrvewDA3Pr', settlement.periods[:'2015'][:'11'].invoice_id
152
155
  end
153
156
 
154
157
  def test_status_open
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-03 00:00:00.000000000 Z
11
+ date: 2024-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -212,6 +212,7 @@ files:
212
212
  - mollie-api-ruby.gemspec
213
213
  - test/fixtures/captures/get.json
214
214
  - test/fixtures/captures/list.json
215
+ - test/fixtures/methods/get-includes-pricing.json
215
216
  - test/fixtures/onboarding/me.json
216
217
  - test/fixtures/onboarding/submit.json
217
218
  - test/fixtures/orders/cancel_line.json
@@ -224,6 +225,7 @@ files:
224
225
  - test/fixtures/orders/refund.json
225
226
  - test/fixtures/orders/refund_all.json
226
227
  - test/fixtures/orders/update.json
228
+ - test/fixtures/payments/get.json
227
229
  - test/fixtures/refunds/get.json
228
230
  - test/fixtures/shipments/create.json
229
231
  - test/fixtures/shipments/get.json
@@ -265,7 +267,7 @@ homepage: https://github.com/mollie/mollie-api-ruby
265
267
  licenses:
266
268
  - BSD
267
269
  metadata: {}
268
- post_install_message:
270
+ post_install_message:
269
271
  rdoc_options: []
270
272
  require_paths:
271
273
  - lib
@@ -280,60 +282,61 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
282
  - !ruby/object:Gem::Version
281
283
  version: '0'
282
284
  requirements: []
283
- rubyforge_project:
284
- rubygems_version: 2.7.7
285
- signing_key:
285
+ rubygems_version: 3.5.10
286
+ signing_key:
286
287
  specification_version: 4
287
288
  summary: Official Mollie API Client for Ruby
288
289
  test_files:
289
290
  - test/fixtures/captures/get.json
290
291
  - test/fixtures/captures/list.json
291
- - test/fixtures/subscriptions/get.json
292
- - test/fixtures/subscriptions/get_payments.json
293
- - test/fixtures/onboarding/submit.json
292
+ - test/fixtures/methods/get-includes-pricing.json
294
293
  - test/fixtures/onboarding/me.json
295
- - test/fixtures/shipments/get.json
296
- - test/fixtures/shipments/create.json
297
- - test/fixtures/shipments/update.json
298
- - test/fixtures/shipments/list.json
299
- - test/fixtures/refunds/get.json
300
- - test/fixtures/orders/get.json
301
- - test/fixtures/orders/create_refund.json
302
- - test/fixtures/orders/cancel_line_qty.json
294
+ - test/fixtures/onboarding/submit.json
303
295
  - test/fixtures/orders/cancel_line.json
304
- - test/fixtures/orders/refund_all.json
305
- - test/fixtures/orders/refund.json
306
- - test/fixtures/orders/list_refunds.json
296
+ - test/fixtures/orders/cancel_line_qty.json
307
297
  - test/fixtures/orders/create.json
308
- - test/fixtures/orders/update.json
298
+ - test/fixtures/orders/create_refund.json
299
+ - test/fixtures/orders/get.json
309
300
  - test/fixtures/orders/list.json
301
+ - test/fixtures/orders/list_refunds.json
302
+ - test/fixtures/orders/refund.json
303
+ - test/fixtures/orders/refund_all.json
304
+ - test/fixtures/orders/update.json
305
+ - test/fixtures/payments/get.json
306
+ - test/fixtures/refunds/get.json
307
+ - test/fixtures/shipments/create.json
308
+ - test/fixtures/shipments/get.json
309
+ - test/fixtures/shipments/list.json
310
+ - test/fixtures/shipments/update.json
311
+ - test/fixtures/subscriptions/get.json
312
+ - test/fixtures/subscriptions/get_payments.json
310
313
  - test/helper.rb
311
- - test/run-test.rb
312
- - test/mollie/list_test.rb
313
- - test/mollie/invoice_test.rb
314
- - test/mollie/order/shipment_test.rb
315
- - test/mollie/order/line_test.rb
316
- - test/mollie/payment_test.rb
317
314
  - test/mollie/amount_test.rb
318
- - test/mollie/refund_test.rb
315
+ - test/mollie/base_test.rb
316
+ - test/mollie/chargeback_test.rb
317
+ - test/mollie/client_test.rb
318
+ - test/mollie/customer/mandate_test.rb
319
+ - test/mollie/customer/payment_test.rb
320
+ - test/mollie/customer/subscription_test.rb
321
+ - test/mollie/customer_test.rb
322
+ - test/mollie/invoice_test.rb
323
+ - test/mollie/list_test.rb
324
+ - test/mollie/method_test.rb
319
325
  - test/mollie/onboarding_test.rb
320
- - test/mollie/util_test.rb
321
- - test/mollie/settlement_test.rb
322
- - test/mollie/payment/refund_test.rb
323
- - test/mollie/payment/capture_test.rb
324
- - test/mollie/payment/chargeback_test.rb
326
+ - test/mollie/order/line_test.rb
327
+ - test/mollie/order/shipment_test.rb
325
328
  - test/mollie/order_test.rb
326
- - test/mollie/customer_test.rb
327
329
  - test/mollie/organization_test.rb
328
- - test/mollie/client_test.rb
330
+ - test/mollie/payment/capture_test.rb
331
+ - test/mollie/payment/chargeback_test.rb
332
+ - test/mollie/payment/refund_test.rb
333
+ - test/mollie/payment_test.rb
334
+ - test/mollie/permission_test.rb
329
335
  - test/mollie/profile_test.rb
336
+ - test/mollie/refund_test.rb
337
+ - test/mollie/settlement/chargeback_test.rb
330
338
  - test/mollie/settlement/payment_test.rb
331
339
  - test/mollie/settlement/refund_test.rb
332
- - test/mollie/settlement/chargeback_test.rb
333
- - test/mollie/chargeback_test.rb
334
- - test/mollie/customer/payment_test.rb
335
- - test/mollie/customer/subscription_test.rb
336
- - test/mollie/customer/mandate_test.rb
337
- - test/mollie/permission_test.rb
338
- - test/mollie/base_test.rb
339
- - test/mollie/method_test.rb
340
+ - test/mollie/settlement_test.rb
341
+ - test/mollie/util_test.rb
342
+ - test/run-test.rb