mollie-api-ruby 4.3.1 → 4.4.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: e5bb4016d641dd695ccc385a2838d6a0508ead55a8d986b415398cc9447a7123
4
- data.tar.gz: f4c7906be0ecd490e2c9a39eac0b9629d875932c5e6d61a60fa7c7aebb47eb65
3
+ metadata.gz: bda09fc2f11315a55ec2855fe42c43563bd7df1bd9eb7ab04068a9338fb9b7a7
4
+ data.tar.gz: 1b3f950d14b5e3317ee95fec61e5a41b216dc4b23414e6696622ca275647eb91
5
5
  SHA512:
6
- metadata.gz: f07b10b408fb65d2e4b29053721e99d746c18d524a24c52254807ddaae4870b54dcbce2c5451531da0a4015881a3c009453a33ce4c3da768220cd4ed24c7865b
7
- data.tar.gz: dd48679095687fb2d41018131efd866345d13d3812693138dcb73db64f98c381323e4364e17acc4c39dd02a4063ac55ea95917dd565bd1108cab98b1f0626127
6
+ metadata.gz: e1cb2f00bf7c074f9e5fbe0bef6ec8a53ec164cdf1d917db1f551553c7c029e2859195a78af18bb2fb8208d5d059ae5868bf6740d83d2b31582ce9b1a6d7eb7f
7
+ data.tar.gz: adbcb09e6260362af9d666e1e4f351a0ee7b7da5b64efdbfdebb65d83c0bbe4ba33516e99b659a8234e4bf0ee6665f940fd284b1db14b28559f9ba3f83b0ac5e
@@ -4,6 +4,14 @@
4
4
 
5
5
  All notable changes to this project will be documented in this file.
6
6
 
7
+ ## 4.4.0 - 2019-07-11
8
+
9
+ - Mandate: add `mode` attribute
10
+ - Organization: add `_links` helper method
11
+ - Organization: add `locale` attribute
12
+ - OrderLine: add `metadata` attribute
13
+ - Method: add `minimumAmount` and `maximumAmount` attributes
14
+
7
15
  ### 4.3.1 - 2019-06-08
8
16
 
9
17
  - Added the option to pass additional request options when creating a new resource.
@@ -6,6 +6,7 @@ module Mollie
6
6
  STATUS_PENDING = 'pending'.freeze
7
7
 
8
8
  attr_accessor :id,
9
+ :mode,
9
10
  :status,
10
11
  :method,
11
12
  :details,
@@ -23,9 +23,9 @@ module Mollie
23
23
  :canceled_at,
24
24
  :webhook_url,
25
25
  :metadata,
26
- :_links,
27
- :application_fee
28
-
26
+ :application_fee,
27
+ :_links
28
+
29
29
  alias links _links
30
30
 
31
31
  def active?
@@ -21,9 +21,19 @@ module Mollie
21
21
 
22
22
  attr_accessor :id,
23
23
  :description,
24
+ :minimum_amount,
25
+ :maximum_amount,
24
26
  :image,
25
27
  :issuers
26
28
 
29
+ def minimum_amount=(minimum_amount)
30
+ @minimum_amount = Mollie::Amount.new(minimum_amount)
31
+ end
32
+
33
+ def maximum_amount=(maximum_amount)
34
+ @maximum_amount = Mollie::Amount.new(maximum_amount)
35
+ end
36
+
27
37
  def normal_image
28
38
  image['size1x']
29
39
  end
@@ -6,6 +6,7 @@ module Mollie
6
6
  :type,
7
7
  :name,
8
8
  :status,
9
+ :metadata,
9
10
  :is_cancelable,
10
11
  :quantity,
11
12
  :quantity_shipped,
@@ -52,6 +53,10 @@ module Mollie
52
53
  Util.extract_url(links, 'image_url')
53
54
  end
54
55
 
56
+ def metadata=(metadata)
57
+ @metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash)
58
+ end
59
+
55
60
  def amount_shipped=(amount)
56
61
  @amount_shipped = Mollie::Amount.new(amount)
57
62
  end
@@ -2,10 +2,14 @@ module Mollie
2
2
  class Organization < Base
3
3
  attr_accessor :id,
4
4
  :name,
5
+ :locale,
5
6
  :email,
6
7
  :address,
7
8
  :registration_number,
8
- :vat_number
9
+ :vat_number,
10
+ :_links
11
+
12
+ alias links _links
9
13
 
10
14
  def self.current(options = {})
11
15
  get('me', options)
@@ -1,3 +1,3 @@
1
1
  module Mollie
2
- VERSION = '4.3.1'.freeze
2
+ VERSION = '4.4.0'.freeze
3
3
  end
@@ -4,6 +4,7 @@
4
4
  "currency": "EUR"
5
5
  },
6
6
  "billingAddress": {
7
+ "organizationName": "Mollie B.V.",
7
8
  "streetAndNumber": "Keizersgracht 313",
8
9
  "city": "Amsterdam",
9
10
  "region": "Noord-Holland",
@@ -16,6 +17,7 @@
16
17
  "phone": "+31208202070"
17
18
  },
18
19
  "shippingAddress": {
20
+ "organizationName": "Mollie B.V.",
19
21
  "streetAndNumber": "Prinsengracht 313",
20
22
  "streetAdditional": "4th floor",
21
23
  "city": "Haarlem",
@@ -44,6 +46,10 @@
44
46
  "name": "LEGO 42083 Bugatti Chiron",
45
47
  "productUrl": "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083",
46
48
  "imageUrl": "https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$",
49
+ "metadata": {
50
+ "order_id": "1337",
51
+ "description": "Bugatti Chiron"
52
+ },
47
53
  "quantity": 2,
48
54
  "vatRate": "21.00",
49
55
  "unitPrice": {
@@ -26,6 +26,7 @@
26
26
  "mode": "live",
27
27
  "locale": "nl_NL",
28
28
  "billingAddress": {
29
+ "organizationName": "Mollie B.V.",
29
30
  "streetAndNumber": "Keizersgracht 313",
30
31
  "postalCode": "1016 EE",
31
32
  "city": "Amsterdam",
@@ -36,6 +37,7 @@
36
37
  },
37
38
  "orderNumber": "18475",
38
39
  "shippingAddress": {
40
+ "organizationName": "Mollie B.V.",
39
41
  "streetAndNumber": "Keizersgracht 313",
40
42
  "postalCode": "1016 EE",
41
43
  "city": "Amsterdam",
@@ -60,6 +62,10 @@
60
62
  "sku": "5702016116977",
61
63
  "type": "physical",
62
64
  "status": "created",
65
+ "metadata": {
66
+ "order_id": "1337",
67
+ "description": "Bugatti Chiron"
68
+ },
63
69
  "isCancelable": true,
64
70
  "quantity": 2,
65
71
  "quantityShipped": 0,
@@ -6,6 +6,7 @@ module Mollie
6
6
  def test_setting_attributes
7
7
  attributes = {
8
8
  id: 'mdt_h3gAaD5zP',
9
+ mode: 'test',
9
10
  status: 'valid',
10
11
  method: 'creditcard',
11
12
  details: {
@@ -34,6 +35,7 @@ module Mollie
34
35
  mandate = Mandate.new(attributes)
35
36
 
36
37
  assert_equal 'mdt_h3gAaD5zP', mandate.id
38
+ assert_equal 'test', mandate.mode
37
39
  assert_equal 'valid', mandate.status
38
40
  assert_equal 'creditcard', mandate.method
39
41
  assert_equal 'YOUR-COMPANY-MD1380', mandate.mandate_reference
@@ -6,9 +6,12 @@ module Mollie
6
6
  attributes = {
7
7
  id: 'creditcard',
8
8
  description: 'Credit card',
9
- image: {
10
- 'size1x' => 'https://www.mollie.com/images/payscreen/methods/creditcard.png',
11
- 'size2x' => 'https://www.mollie.com/images/payscreen/methods/creditcard@2x.png'
9
+ minimum_amount: { value: '0.01', currency: 'EUR' },
10
+ maximum_amount: { value: '2000.00', currency: 'EUR' },
11
+ image: {
12
+ 'size1x' => 'https://www.mollie.com/external/icons/payment-methods/creditcard.png',
13
+ 'size2x' => 'https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png',
14
+ 'svg' => 'https://www.mollie.com/external/icons/payment-methods/creditcard.svg'
12
15
  }
13
16
  }
14
17
 
@@ -16,8 +19,13 @@ module Mollie
16
19
 
17
20
  assert_equal 'creditcard', method.id
18
21
  assert_equal 'Credit card', method.description
19
- assert_equal 'https://www.mollie.com/images/payscreen/methods/creditcard.png', method.normal_image
20
- assert_equal 'https://www.mollie.com/images/payscreen/methods/creditcard@2x.png', method.bigger_image
22
+ assert_equal BigDecimal('0.01'), method.minimum_amount.value
23
+ assert_equal 'EUR', method.minimum_amount.currency
24
+ assert_equal BigDecimal('2000.00'), method.maximum_amount.value
25
+ assert_equal 'EUR', method.maximum_amount.currency
26
+ assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard.png', method.normal_image
27
+ assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png', method.bigger_image
28
+ assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard.svg', method.image['svg']
21
29
  end
22
30
  end
23
31
  end
@@ -102,6 +102,7 @@ module Mollie
102
102
  .to_return(status: 200, body: GET_ORDER, headers: {})
103
103
 
104
104
  order = Order.get('ord_kEn1PlbGa')
105
+ assert_equal 'Mollie B.V.', order.billing_address.organization_name
105
106
  assert_equal 'Keizersgracht 313', order.billing_address.street_and_number
106
107
  assert_equal '1016 EE', order.billing_address.postal_code
107
108
  assert_equal 'Amsterdam', order.billing_address.city
@@ -116,6 +117,7 @@ module Mollie
116
117
  .to_return(status: 200, body: GET_ORDER, headers: {})
117
118
 
118
119
  order = Order.get('ord_kEn1PlbGa')
120
+ assert_equal 'Mollie B.V.', order.shipping_address.organization_name
119
121
  assert_equal 'Keizersgracht 313', order.shipping_address.street_and_number
120
122
  assert_equal '1016 EE', order.shipping_address.postal_code
121
123
  assert_equal 'Amsterdam', order.shipping_address.city
@@ -141,6 +143,8 @@ module Mollie
141
143
  assert_equal '5702016116977', line.sku
142
144
  assert_equal 'physical', line.type
143
145
  assert_equal 'created', line.status
146
+ assert_equal '1337', line.metadata.order_id
147
+ assert_equal 'Bugatti Chiron', line.metadata.description
144
148
  assert_equal true, line.is_cancelable
145
149
  assert_equal true, line.cancelable?
146
150
  assert_equal 2, line.quantity
@@ -6,6 +6,7 @@ module Mollie
6
6
  attributes = {
7
7
  id: 'org_12345678',
8
8
  name: 'Mollie B.V.',
9
+ locale: 'nl_NL',
9
10
  email: 'info@mollie.com',
10
11
  address: {
11
12
  street_and_number: 'Keizersgracht 313',
@@ -14,13 +15,24 @@ module Mollie
14
15
  country: 'NL'
15
16
  },
16
17
  registration_number: '30204462',
17
- vat_number: 'NL815839091B01'
18
+ vat_number: 'NL815839091B01',
19
+ _links: {
20
+ 'self' => {
21
+ 'href' => 'https://api.mollie.com/v2/organizations/org_12345678',
22
+ 'type' => 'application/hal+json'
23
+ },
24
+ 'documentation' => {
25
+ 'href' => 'https://docs.mollie.com/reference/v2/organizations-api/get-organization',
26
+ 'type' => 'text/html'
27
+ }
28
+ }
18
29
  }
19
30
 
20
31
  organization = Organization.new(attributes)
21
32
 
22
33
  assert_equal 'org_12345678', organization.id
23
34
  assert_equal 'Mollie B.V.', organization.name
35
+ assert_equal 'nl_NL', organization.locale
24
36
  assert_equal 'info@mollie.com', organization.email
25
37
  assert_equal 'Keizersgracht 313', organization.address.street_and_number
26
38
  assert_equal '1016 EE', organization.address.postal_code
@@ -28,6 +40,7 @@ module Mollie
28
40
  assert_equal 'NL', organization.address.country
29
41
  assert_equal '30204462', organization.registration_number
30
42
  assert_equal 'NL815839091B01', organization.vat_number
43
+ assert_equal 'https://api.mollie.com/v2/organizations/org_12345678', organization.links['self']['href']
31
44
  end
32
45
 
33
46
  def test_current_organization
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.3.1
4
+ version: 4.4.0
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: 2019-06-08 00:00:00.000000000 Z
11
+ date: 2019-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.0.3
273
+ rubygems_version: 3.0.4
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Official Mollie API Client for Ruby