mollie-api-ruby 4.9.0 → 4.10.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.
@@ -8,6 +8,7 @@ module Mollie
8
8
  description: 'Credit card',
9
9
  minimum_amount: { value: '0.01', currency: 'EUR' },
10
10
  maximum_amount: { value: '2000.00', currency: 'EUR' },
11
+ status: 'approved',
11
12
  image: {
12
13
  'size1x' => 'https://www.mollie.com/external/icons/payment-methods/creditcard.png',
13
14
  'size2x' => 'https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png',
@@ -23,11 +24,23 @@ module Mollie
23
24
  assert_equal 'EUR', method.minimum_amount.currency
24
25
  assert_equal BigDecimal('2000.00'), method.maximum_amount.value
25
26
  assert_equal 'EUR', method.maximum_amount.currency
27
+ assert_equal 'approved', method.status
26
28
  assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard.png', method.normal_image
27
29
  assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png', method.bigger_image
28
30
  assert_equal 'https://www.mollie.com/external/icons/payment-methods/creditcard.svg', method.image['svg']
29
31
  end
30
32
 
33
+ def test_all_available
34
+ stub_request(:get, 'https://api.mollie.com/v2/methods/all')
35
+ .to_return(status: 200, body: read_fixture('methods/all.json'), headers: {})
36
+
37
+ available_methods = Method.all_available
38
+ assert_equal 3, available_methods.size
39
+
40
+ ideal_method = available_methods.first
41
+ assert_equal "pending-boarding", ideal_method.status
42
+ end
43
+
31
44
  def test_pricing
32
45
  stub_request(:get, 'https://api.mollie.com/v2/methods/creditcard?include=pricing')
33
46
  .to_return(status: 200, body: read_fixture('methods/get-includes-pricing.json'), headers: {})
@@ -0,0 +1,20 @@
1
+ require 'helper'
2
+
3
+ module Mollie
4
+ class Order
5
+ class PaymentTest < Test::Unit::TestCase
6
+ CREATE_PAYMENT = read_fixture("orders/create_payment.json")
7
+
8
+ def test_create_payment
9
+ stub_request(:post, "https://api.mollie.com/v2/orders/ord_kEn1PlbGa/payments")
10
+ .to_return(status: 201, body: CREATE_PAYMENT, headers: {})
11
+
12
+ payment = Order::Payment.create(order_id: "ord_kEn1PlbGa")
13
+
14
+ assert_kind_of Order::Payment, payment
15
+ assert_equal "tr_ncaPcAhuUV", payment.id
16
+ assert_equal "ord_kEn1PlbGa", payment.order_id
17
+ end
18
+ end
19
+ end
20
+ end
@@ -6,6 +6,7 @@ module Mollie
6
6
  GET_ORDER = read_fixture('orders/get.json')
7
7
  CANCEL_LINE = read_fixture('orders/cancel_line.json')
8
8
  CANCEL_QTY = read_fixture('orders/cancel_line_qty.json')
9
+ UPDATE_LINE = read_fixture('orders/update_line.json')
9
10
 
10
11
  def test_discounted
11
12
  stub_request(:get, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa')
@@ -40,6 +41,23 @@ module Mollie
40
41
  assert_nil order.lines.first.cancel(quantity: 1)
41
42
  end
42
43
 
44
+ def test_update_orderline
45
+ stub_request(:patch, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa/lines/odl_dgtxyl')
46
+ .with(body: { sku: "new-sku-12345678" }.to_json)
47
+ .to_return(status: 200, body: UPDATE_LINE, headers: {})
48
+
49
+ order = Mollie::Order::Line.update(
50
+ 'odl_dgtxyl',
51
+ order_id: 'ord_kEn1PlbGa',
52
+ sku: "new-sku-12345678"
53
+ )
54
+
55
+ # The `update order line`-API returns an `order` instead of `orderline`
56
+ assert_equal Mollie::Order, order.class
57
+
58
+ line = order.lines.find { |line| line.id == 'odl_dgtxyl' }
59
+ assert_equal "new-sku-12345678", line.sku
60
+ end
43
61
  end
44
62
  end
45
63
  end
@@ -7,6 +7,9 @@ module Mollie
7
7
  UPDATE_ORDER = read_fixture('orders/update.json')
8
8
  LIST_ORDER = read_fixture('orders/list.json')
9
9
 
10
+ GET_ORDER_WITH_EMBEDDED_RESOURCES =
11
+ read_fixture('orders/get_embedded_resources.json')
12
+
10
13
  # Refunds
11
14
  CREATE_ORDER_REFUND = read_fixture('orders/create_refund.json')
12
15
  REFUND_ALL_LINES = read_fixture('orders/refund_all.json')
@@ -82,6 +85,36 @@ module Mollie
82
85
  assert_equal Time.parse('2018-08-28T09:29:56+00:00'), order.completed_at
83
86
  end
84
87
 
88
+ def test_embedded_payments
89
+ stub_request(:get, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa')
90
+ .to_return(status: 200, body: GET_ORDER_WITH_EMBEDDED_RESOURCES, headers: {})
91
+
92
+ order = Order.get('ord_kEn1PlbGa')
93
+
94
+ assert_equal 'tr_ncaPcAhuUV', order.payments.first.id
95
+ assert_equal 1, order.payments.size
96
+ end
97
+
98
+ def test_embedded_refunds
99
+ stub_request(:get, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa')
100
+ .to_return(status: 200, body: GET_ORDER_WITH_EMBEDDED_RESOURCES, headers: {})
101
+
102
+ order = Order.get('ord_kEn1PlbGa')
103
+
104
+ assert_equal 're_vD3Jm32wQt', order.refunds.first.id
105
+ assert_equal 1, order.refunds.size
106
+ end
107
+
108
+ def test_embedded_shipments
109
+ stub_request(:get, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa')
110
+ .to_return(status: 200, body: GET_ORDER_WITH_EMBEDDED_RESOURCES, headers: {})
111
+
112
+ order = Order.get('ord_kEn1PlbGa')
113
+
114
+ assert_equal 'shp_3wmsgCJN4U', order.shipments.first.id
115
+ assert_equal 1, order.shipments.size
116
+ end
117
+
85
118
  def test_cancelable?
86
119
  stub_request(:get, 'https://api.mollie.com/v2/orders/ord_kEn1PlbGa')
87
120
  .to_return(status: 200, body: GET_ORDER, headers: {})
@@ -10,6 +10,7 @@ module Mollie
10
10
  website: 'https://www.mywebsite.com',
11
11
  email: 'info@mywebsite.com',
12
12
  phone: '+31208202070',
13
+ business_category: 'OTHER_MERCHANDISE',
13
14
  category_code: 5399,
14
15
  status: 'unverified',
15
16
  review: {
@@ -56,6 +57,7 @@ module Mollie
56
57
  assert_equal 'https://www.mywebsite.com', profile.website
57
58
  assert_equal 'info@mywebsite.com', profile.email
58
59
  assert_equal '+31208202070', profile.phone
60
+ assert_equal 'OTHER_MERCHANDISE', profile.business_category
59
61
  assert_equal 5399, profile.category_code
60
62
  assert_equal Profile::STATUS_UNVERIFIED, profile.status
61
63
  assert_equal Profile::REVIEW_STATUS_PENDING, profile.review.status
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mollie-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mollie B.V.
@@ -79,6 +79,7 @@ executables: []
79
79
  extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
+ - ".github/workflows/build.yml"
82
83
  - ".gitignore"
83
84
  - ".rubocop.yml"
84
85
  - ".rubocop_todo.yml"
@@ -121,11 +122,13 @@ files:
121
122
  - examples/onboarding/submit.rb
122
123
  - examples/orders/cancel-lines.rb
123
124
  - examples/orders/cancel.rb
125
+ - examples/orders/create-payment.rb
124
126
  - examples/orders/create-refund.rb
125
127
  - examples/orders/create.rb
126
128
  - examples/orders/get.rb
127
129
  - examples/orders/list-refunds.rb
128
130
  - examples/orders/list.rb
131
+ - examples/orders/update-orderline.rb
129
132
  - examples/orders/update.rb
130
133
  - examples/organisations/get-current.rb
131
134
  - examples/organisations/get.rb
@@ -193,6 +196,7 @@ files:
193
196
  - lib/mollie/onboarding.rb
194
197
  - lib/mollie/order.rb
195
198
  - lib/mollie/order/line.rb
199
+ - lib/mollie/order/payment.rb
196
200
  - lib/mollie/order/refund.rb
197
201
  - lib/mollie/order/shipment.rb
198
202
  - lib/mollie/organization.rb
@@ -214,19 +218,26 @@ files:
214
218
  - mollie-api-ruby.gemspec
215
219
  - test/fixtures/captures/get.json
216
220
  - test/fixtures/captures/list.json
221
+ - test/fixtures/customer/get.json
222
+ - test/fixtures/customer/list-payments-next.json
223
+ - test/fixtures/customer/list-payments.json
224
+ - test/fixtures/methods/all.json
217
225
  - test/fixtures/methods/get-includes-pricing.json
218
226
  - test/fixtures/onboarding/me.json
219
227
  - test/fixtures/onboarding/submit.json
220
228
  - test/fixtures/orders/cancel_line.json
221
229
  - test/fixtures/orders/cancel_line_qty.json
222
230
  - test/fixtures/orders/create.json
231
+ - test/fixtures/orders/create_payment.json
223
232
  - test/fixtures/orders/create_refund.json
224
233
  - test/fixtures/orders/get.json
234
+ - test/fixtures/orders/get_embedded_resources.json
225
235
  - test/fixtures/orders/list.json
226
236
  - test/fixtures/orders/list_refunds.json
227
237
  - test/fixtures/orders/refund.json
228
238
  - test/fixtures/orders/refund_all.json
229
239
  - test/fixtures/orders/update.json
240
+ - test/fixtures/orders/update_line.json
230
241
  - test/fixtures/payments/get.json
231
242
  - test/fixtures/refunds/get.json
232
243
  - test/fixtures/shipments/create.json
@@ -248,6 +259,7 @@ files:
248
259
  - test/mollie/list_test.rb
249
260
  - test/mollie/method_test.rb
250
261
  - test/mollie/onboarding_test.rb
262
+ - test/mollie/order/create_payment_test.rb
251
263
  - test/mollie/order/line_test.rb
252
264
  - test/mollie/order/shipment_test.rb
253
265
  - test/mollie/order_test.rb
@@ -291,19 +303,26 @@ summary: Official Mollie API Client for Ruby
291
303
  test_files:
292
304
  - test/fixtures/captures/get.json
293
305
  - test/fixtures/captures/list.json
306
+ - test/fixtures/customer/get.json
307
+ - test/fixtures/customer/list-payments-next.json
308
+ - test/fixtures/customer/list-payments.json
309
+ - test/fixtures/methods/all.json
294
310
  - test/fixtures/methods/get-includes-pricing.json
295
311
  - test/fixtures/onboarding/me.json
296
312
  - test/fixtures/onboarding/submit.json
297
313
  - test/fixtures/orders/cancel_line.json
298
314
  - test/fixtures/orders/cancel_line_qty.json
299
315
  - test/fixtures/orders/create.json
316
+ - test/fixtures/orders/create_payment.json
300
317
  - test/fixtures/orders/create_refund.json
301
318
  - test/fixtures/orders/get.json
319
+ - test/fixtures/orders/get_embedded_resources.json
302
320
  - test/fixtures/orders/list.json
303
321
  - test/fixtures/orders/list_refunds.json
304
322
  - test/fixtures/orders/refund.json
305
323
  - test/fixtures/orders/refund_all.json
306
324
  - test/fixtures/orders/update.json
325
+ - test/fixtures/orders/update_line.json
307
326
  - test/fixtures/payments/get.json
308
327
  - test/fixtures/refunds/get.json
309
328
  - test/fixtures/shipments/create.json
@@ -325,6 +344,7 @@ test_files:
325
344
  - test/mollie/list_test.rb
326
345
  - test/mollie/method_test.rb
327
346
  - test/mollie/onboarding_test.rb
347
+ - test/mollie/order/create_payment_test.rb
328
348
  - test/mollie/order/line_test.rb
329
349
  - test/mollie/order/shipment_test.rb
330
350
  - test/mollie/order_test.rb