mollie-api-ruby 4.7.0 → 4.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 199d37cfa91ad1e3132c095248ea54a26e7a25dddb748b02b2fa17b7d58334a3
4
- data.tar.gz: 30ad0213bd7ed35038eecac7c48e4c3b965ca56b9f445c2ff6d723d2f223b741
3
+ metadata.gz: aedb86d7ed96dc6a88685737259c150e3c676b31bf14411eb7f0dac3147c357f
4
+ data.tar.gz: f7f3745b6575a583621bcb643a5167306d0198a12a076ccabea392c2f4793579
5
5
  SHA512:
6
- metadata.gz: 3bee04cf11e085a6886ded95949e996f66d78d4a5a5479b96fb6c4d74d8ef588ae2de6040966df27432c147062988370667c0ef601b908feeeca55b7cadb4eb5
7
- data.tar.gz: '080873b112c5878455a65faad416ce9e5fa6af4c8acf0f3784986c5a2c8ea52895740c3d55a2fd84dff672ad83031d08b85d7a1a86c1b58aeffe7deaf2d21bb6'
6
+ metadata.gz: 75e51b046272954999861f8ffa45a0eadce969ee28383d917b7911d9117d72964b8e8cd1e34cff9dcffa3f5f7d7fc51770d23bd5e1be87aa6a739b619f738421
7
+ data.tar.gz: 65181e4965486b3f61d3a2bdb287daa2967cdf81b6be4813be04f114ef9483941e5e8d295a92141779bfb6b748fe5a910e9717c2b2b1eea8cd2dfbef3310750e
@@ -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)
@@ -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
@@ -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,
@@ -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,
@@ -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 = {})
@@ -1,3 +1,3 @@
1
1
  module Mollie
2
- VERSION = '4.7.0'.freeze
2
+ VERSION = '4.7.1'.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
+ }
@@ -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
@@ -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: {})
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.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-03 00:00:00.000000000 Z
11
+ date: 2020-02-13 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
@@ -296,6 +298,8 @@ test_files:
296
298
  - test/fixtures/shipments/create.json
297
299
  - test/fixtures/shipments/update.json
298
300
  - test/fixtures/shipments/list.json
301
+ - test/fixtures/payments/get.json
302
+ - test/fixtures/methods/get-includes-pricing.json
299
303
  - test/fixtures/refunds/get.json
300
304
  - test/fixtures/orders/get.json
301
305
  - test/fixtures/orders/create_refund.json