mollie-api-ruby 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +10 -0
  3. data/.rubocop_todo.yml +92 -0
  4. data/.travis.yml +3 -1
  5. data/CHANGELOG.md +1 -1
  6. data/Gemfile +1 -1
  7. data/Rakefile +1 -2
  8. data/bin/console +4 -4
  9. data/docs/migration_v2_2_x.md +1 -1
  10. data/docs/migration_v3_x.md +2 -2
  11. data/examples/chargebacks/get.rb +2 -2
  12. data/examples/customers/create-payment.rb +4 -4
  13. data/examples/customers/create.rb +3 -3
  14. data/examples/customers/delete.rb +1 -1
  15. data/examples/customers/get.rb +1 -1
  16. data/examples/customers/list-payments.rb +1 -1
  17. data/examples/customers/update.rb +2 -2
  18. data/examples/invoices/get.rb +1 -1
  19. data/examples/mandates/create.rb +7 -7
  20. data/examples/mandates/delete.rb +1 -1
  21. data/examples/mandates/get.rb +1 -1
  22. data/examples/mandates/list.rb +1 -1
  23. data/examples/methods/get.rb +2 -2
  24. data/examples/organisations/get.rb +1 -1
  25. data/examples/payments/delete.rb +1 -1
  26. data/examples/payments/get-customer.rb +1 -1
  27. data/examples/payments/get-mandate.rb +1 -1
  28. data/examples/payments/get-settlement.rb +1 -1
  29. data/examples/payments/get-subscription.rb +1 -1
  30. data/examples/payments/get.rb +1 -1
  31. data/examples/payments/webhook.rb +1 -1
  32. data/examples/permissions/get.rb +1 -1
  33. data/examples/profiles/create.rb +6 -6
  34. data/examples/profiles/delete.rb +1 -1
  35. data/examples/profiles/get.rb +1 -1
  36. data/examples/profiles/list-chargebacks.rb +1 -1
  37. data/examples/profiles/list-methods.rb +1 -1
  38. data/examples/profiles/list-payments.rb +1 -1
  39. data/examples/profiles/list-refunds.rb +1 -1
  40. data/examples/profiles/update.rb +3 -3
  41. data/examples/refunds/create.rb +3 -3
  42. data/examples/refunds/delete.rb +2 -2
  43. data/examples/refunds/get.rb +2 -2
  44. data/examples/settlements/get.rb +1 -1
  45. data/examples/settlements/list-chargebacks.rb +1 -1
  46. data/examples/settlements/list-payments.rb +1 -1
  47. data/examples/settlements/list-refunds.rb +1 -1
  48. data/examples/subscriptions/create.rb +5 -5
  49. data/examples/subscriptions/delete.rb +2 -2
  50. data/examples/subscriptions/get.rb +2 -2
  51. data/examples/subscriptions/list.rb +1 -1
  52. data/examples/subscriptions/update.rb +1 -1
  53. data/lib/cacert.pem +2 -26
  54. data/lib/mollie.rb +0 -1
  55. data/lib/mollie/amount.rb +1 -1
  56. data/lib/mollie/base.rb +8 -8
  57. data/lib/mollie/chargeback.rb +12 -6
  58. data/lib/mollie/client.rb +17 -17
  59. data/lib/mollie/customer/mandate.rb +10 -6
  60. data/lib/mollie/customer/subscription.rb +15 -7
  61. data/lib/mollie/exception.rb +1 -1
  62. data/lib/mollie/invoice.rb +14 -6
  63. data/lib/mollie/list.rb +9 -13
  64. data/lib/mollie/method.rb +15 -15
  65. data/lib/mollie/organization.rb +1 -1
  66. data/lib/mollie/payment.rb +36 -16
  67. data/lib/mollie/permission.rb +18 -17
  68. data/lib/mollie/profile.rb +11 -7
  69. data/lib/mollie/refund.rb +12 -8
  70. data/lib/mollie/settlement.rb +17 -9
  71. data/lib/mollie/util.rb +8 -8
  72. data/lib/mollie/version.rb +1 -1
  73. data/mollie-api-ruby.gemspec +5 -4
  74. data/test/helper.rb +1 -1
  75. data/test/mollie/amount_test.rb +1 -1
  76. data/test/mollie/base_test.rb +72 -72
  77. data/test/mollie/chargeback_test.rb +36 -37
  78. data/test/mollie/client_test.rb +49 -49
  79. data/test/mollie/customer/mandate_test.rb +40 -40
  80. data/test/mollie/customer/payment_test.rb +5 -6
  81. data/test/mollie/customer/subscription_test.rb +45 -45
  82. data/test/mollie/customer_test.rb +12 -12
  83. data/test/mollie/invoice_test.rb +29 -29
  84. data/test/mollie/list_test.rb +23 -23
  85. data/test/mollie/method_test.rb +8 -8
  86. data/test/mollie/organization_test.rb +9 -9
  87. data/test/mollie/payment/chargeback_test.rb +4 -4
  88. data/test/mollie/payment/refund_test.rb +4 -4
  89. data/test/mollie/payment_test.rb +111 -111
  90. data/test/mollie/profile_test.rb +41 -42
  91. data/test/mollie/refund_test.rb +39 -39
  92. data/test/mollie/settlement/chargeback_test.rb +4 -4
  93. data/test/mollie/settlement/payment_test.rb +5 -5
  94. data/test/mollie/settlement/refund_test.rb +4 -4
  95. data/test/mollie/settlement_test.rb +53 -53
  96. data/test/mollie/util_test.rb +9 -11
  97. data/test/run-test.rb +4 -4
  98. metadata +46 -30
@@ -17,33 +17,33 @@ module Mollie
17
17
  },
18
18
  created_at: '2017-04-20T09:03:58.0Z',
19
19
  _links: {
20
- "self" => {
21
- "href" => "https://api.mollie.com/v2/profiles/pfl_v9hTwCvYqw",
22
- "type" => "application/hal+json"
20
+ 'self' => {
21
+ 'href' => 'https://api.mollie.com/v2/profiles/pfl_v9hTwCvYqw',
22
+ 'type' => 'application/hal+json'
23
23
  },
24
- "chargebacks" => {
25
- "href" => "https://api.mollie.com/v2/chargebacks?profileId=pfl_v9hTwCvYqw",
26
- "type" => "application/hal+json"
24
+ 'chargebacks' => {
25
+ 'href' => 'https://api.mollie.com/v2/chargebacks?profileId=pfl_v9hTwCvYqw',
26
+ 'type' => 'application/hal+json'
27
27
  },
28
- "methods" => {
29
- "href" => "https://api.mollie.com/v2/methods?profileId=pfl_v9hTwCvYqw",
30
- "type" => "application/hal+json"
28
+ 'methods' => {
29
+ 'href' => 'https://api.mollie.com/v2/methods?profileId=pfl_v9hTwCvYqw',
30
+ 'type' => 'application/hal+json'
31
31
  },
32
- "payments" => {
33
- "href" => "https://api.mollie.com/v2/payments?profileId=pfl_v9hTwCvYqw",
34
- "type" => "application/hal+json"
32
+ 'payments' => {
33
+ 'href' => 'https://api.mollie.com/v2/payments?profileId=pfl_v9hTwCvYqw',
34
+ 'type' => 'application/hal+json'
35
35
  },
36
- "refunds" => {
37
- "href" => "https://api.mollie.com/v2/refunds?profileId=pfl_v9hTwCvYqw",
38
- "type" => "application/hal+json"
36
+ 'refunds' => {
37
+ 'href' => 'https://api.mollie.com/v2/refunds?profileId=pfl_v9hTwCvYqw',
38
+ 'type' => 'application/hal+json'
39
39
  },
40
- "checkout_preview_url" => {
41
- "href" => "https://www.mollie.com/payscreen/preview/pfl_v9hTwCvYqw",
42
- "type" => "text/html"
40
+ 'checkout_preview_url' => {
41
+ 'href' => 'https://www.mollie.com/payscreen/preview/pfl_v9hTwCvYqw',
42
+ 'type' => 'text/html'
43
43
  },
44
- "documentation" => {
45
- "href" => "https://docs.mollie.com/reference/v2/profiles-api/create-profile",
46
- "type" => "text/html"
44
+ 'documentation' => {
45
+ 'href' => 'https://docs.mollie.com/reference/v2/profiles-api/create-profile',
46
+ 'type' => 'text/html'
47
47
  }
48
48
  }
49
49
  }
@@ -89,8 +89,8 @@ module Mollie
89
89
  end
90
90
 
91
91
  def test_list_chargebacks
92
- stub_request(:get, "https://api.mollie.com/v2/chargebacks?profileId=pfl_v9hTwCvYqw")
93
- .to_return(:status => 200, :body => %{
92
+ stub_request(:get, 'https://api.mollie.com/v2/chargebacks?profileId=pfl_v9hTwCvYqw')
93
+ .to_return(status: 200, body: %(
94
94
  {
95
95
  "count": 2,
96
96
  "_embedded": {
@@ -106,16 +106,16 @@ module Mollie
106
106
  ]
107
107
  }
108
108
  }
109
- }, :headers => {})
109
+ ), headers: {})
110
110
 
111
- profile = Profile.new(id: "pfl_v9hTwCvYqw")
111
+ profile = Profile.new(id: 'pfl_v9hTwCvYqw')
112
112
  chargebacks = profile.chargebacks
113
- assert_equal "chb_n9z0tp", chargebacks.first.id
113
+ assert_equal 'chb_n9z0tp', chargebacks.first.id
114
114
  end
115
115
 
116
116
  def test_list_methods
117
- stub_request(:get, "https://api.mollie.com/v2/methods?profileId=pfl_v9hTwCvYqw")
118
- .to_return(:status => 200, :body => %{
117
+ stub_request(:get, 'https://api.mollie.com/v2/methods?profileId=pfl_v9hTwCvYqw')
118
+ .to_return(status: 200, body: %(
119
119
  {
120
120
  "count": 2,
121
121
  "_embedded": {
@@ -131,16 +131,16 @@ module Mollie
131
131
  ]
132
132
  }
133
133
  }
134
- }, :headers => {})
134
+ ), headers: {})
135
135
 
136
- profile = Profile.new(id: "pfl_v9hTwCvYqw")
136
+ profile = Profile.new(id: 'pfl_v9hTwCvYqw')
137
137
  methods = profile.methods
138
- assert_equal "ideal", methods.first.id
138
+ assert_equal 'ideal', methods.first.id
139
139
  end
140
140
 
141
141
  def test_list_payments
142
- stub_request(:get, "https://api.mollie.com/v2/payments?profileId=pfl_v9hTwCvYqw")
143
- .to_return(:status => 200, :body => %{
142
+ stub_request(:get, 'https://api.mollie.com/v2/payments?profileId=pfl_v9hTwCvYqw')
143
+ .to_return(status: 200, body: %(
144
144
  {
145
145
  "count": 2,
146
146
  "_embedded": {
@@ -156,16 +156,16 @@ module Mollie
156
156
  ]
157
157
  }
158
158
  }
159
- }, :headers => {})
159
+ ), headers: {})
160
160
 
161
- profile = Profile.new(id: "pfl_v9hTwCvYqw")
161
+ profile = Profile.new(id: 'pfl_v9hTwCvYqw')
162
162
  payments = profile.payments
163
- assert_equal "tr_7UhSN1zuXS", payments.first.id
163
+ assert_equal 'tr_7UhSN1zuXS', payments.first.id
164
164
  end
165
165
 
166
166
  def test_list_refunds
167
- stub_request(:get, "https://api.mollie.com/v2/refunds?profileId=pfl_v9hTwCvYqw")
168
- .to_return(:status => 200, :body => %{
167
+ stub_request(:get, 'https://api.mollie.com/v2/refunds?profileId=pfl_v9hTwCvYqw')
168
+ .to_return(status: 200, body: %(
169
169
  {
170
170
  "count": 2,
171
171
  "_embedded": {
@@ -181,12 +181,11 @@ module Mollie
181
181
  ]
182
182
  }
183
183
  }
184
- }, :headers => {})
184
+ ), headers: {})
185
185
 
186
- profile = Profile.new(id: "pfl_v9hTwCvYqw")
186
+ profile = Profile.new(id: 'pfl_v9hTwCvYqw')
187
187
  refunds = profile.refunds
188
- assert_equal "re_4qqhO89gsT", refunds.first.id
188
+ assert_equal 're_4qqhO89gsT', refunds.first.id
189
189
  end
190
-
191
190
  end
192
191
  end
@@ -4,26 +4,26 @@ module Mollie
4
4
  class RefundTest < Test::Unit::TestCase
5
5
  def test_setting_attributes
6
6
  attributes = {
7
- id: "re_4qqhO89gsT",
8
- amount: { "value" => "5.95", "currency" => "EUR" },
9
- status: "pending",
10
- created_at: "2016-10-08T07:59:53.0Z",
11
- description: "Order",
12
- payment_id: "tr_WDqYK6vllg",
13
- settlement_amount: { "value" => "-5.95", "currency" => "EUR" }
7
+ id: 're_4qqhO89gsT',
8
+ amount: { 'value' => '5.95', 'currency' => 'EUR' },
9
+ status: 'pending',
10
+ created_at: '2016-10-08T07:59:53.0Z',
11
+ description: 'Order',
12
+ payment_id: 'tr_WDqYK6vllg',
13
+ settlement_amount: { 'value' => '-5.95', 'currency' => 'EUR' }
14
14
  }
15
15
 
16
16
  refund = Refund.new(attributes)
17
17
 
18
- assert_equal "re_4qqhO89gsT", refund.id
19
- assert_equal BigDecimal.new("5.95"), refund.amount.value
20
- assert_equal "EUR", refund.amount.currency
18
+ assert_equal 're_4qqhO89gsT', refund.id
19
+ assert_equal BigDecimal('5.95'), refund.amount.value
20
+ assert_equal 'EUR', refund.amount.currency
21
21
  assert_equal Refund::STATUS_PENDING, refund.status
22
- assert_equal Time.parse("2016-10-08T07:59:53.0Z"), refund.created_at
23
- assert_equal "Order", refund.description
24
- assert_equal "tr_WDqYK6vllg", refund.payment_id
25
- assert_equal BigDecimal.new("-5.95"), refund.settlement_amount.value
26
- assert_equal "EUR", refund.settlement_amount.currency
22
+ assert_equal Time.parse('2016-10-08T07:59:53.0Z'), refund.created_at
23
+ assert_equal 'Order', refund.description
24
+ assert_equal 'tr_WDqYK6vllg', refund.payment_id
25
+ assert_equal BigDecimal('-5.95'), refund.settlement_amount.value
26
+ assert_equal 'EUR', refund.settlement_amount.currency
27
27
  end
28
28
 
29
29
  def test_pending?
@@ -47,46 +47,46 @@ module Mollie
47
47
  end
48
48
 
49
49
  def test_get_refund
50
- stub_request(:get, "https://api.mollie.com/v2/payments/pay-id/refunds/ref-id")
51
- .to_return(:status => 200, :body => %{{"id":"ref-id"}}, :headers => {})
50
+ stub_request(:get, 'https://api.mollie.com/v2/payments/pay-id/refunds/ref-id')
51
+ .to_return(status: 200, body: %({"id":"ref-id"}), headers: {})
52
52
 
53
- refund = Payment::Refund.get("ref-id", payment_id: "pay-id")
54
- assert_equal "ref-id", refund.id
53
+ refund = Payment::Refund.get('ref-id', payment_id: 'pay-id')
54
+ assert_equal 'ref-id', refund.id
55
55
  end
56
56
 
57
57
  def test_delete_refund
58
- stub_request(:delete, "https://api.mollie.com/v2/payments/pay-id/refunds/ref-id")
59
- .to_return(:status => 204, :headers => {})
58
+ stub_request(:delete, 'https://api.mollie.com/v2/payments/pay-id/refunds/ref-id')
59
+ .to_return(status: 204, headers: {})
60
60
 
61
- refund = Payment::Refund.delete("ref-id", payment_id: "pay-id")
61
+ refund = Payment::Refund.delete('ref-id', payment_id: 'pay-id')
62
62
  assert_equal nil, refund
63
63
  end
64
64
 
65
65
  def test_get_payment
66
- stub_request(:get, "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/refunds/re_4qqhO89gsT")
67
- .to_return(:status => 200, :body => %{
66
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg/refunds/re_4qqhO89gsT')
67
+ .to_return(status: 200, body: %(
68
68
  {
69
69
  "resource": "refund",
70
70
  "id": "re_4qqhO89gsT",
71
71
  "paymentId": "tr_WDqYK6vllg"
72
72
  }
73
- }, :headers => {})
73
+ ), headers: {})
74
74
 
75
- stub_request(:get, "https://api.mollie.com/v2/payments/tr_WDqYK6vllg")
76
- .to_return(:status => 200, :body => %{
75
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg')
76
+ .to_return(status: 200, body: %(
77
77
  {
78
78
  "resource": "payment",
79
79
  "id": "tr_WDqYK6vllg"
80
80
  }
81
- }, :headers => {})
81
+ ), headers: {})
82
82
 
83
- refund = Payment::Refund.get("re_4qqhO89gsT", payment_id: "tr_WDqYK6vllg")
84
- assert_equal "tr_WDqYK6vllg", refund.payment.id
83
+ refund = Payment::Refund.get('re_4qqhO89gsT', payment_id: 'tr_WDqYK6vllg')
84
+ assert_equal 'tr_WDqYK6vllg', refund.payment.id
85
85
  end
86
86
 
87
87
  def test_get_settlement
88
- stub_request(:get, "https://api.mollie.com/v2/payments/tr_WDqYK6vllg/refunds/re_4qqhO89gsT")
89
- .to_return(:status => 200, :body => %{
88
+ stub_request(:get, 'https://api.mollie.com/v2/payments/tr_WDqYK6vllg/refunds/re_4qqhO89gsT')
89
+ .to_return(status: 200, body: %(
90
90
  {
91
91
  "resource": "refund",
92
92
  "id": "re_4qqhO89gsT",
@@ -98,22 +98,22 @@ module Mollie
98
98
  }
99
99
  }
100
100
  }
101
- }, :headers => {})
101
+ ), headers: {})
102
102
 
103
- stub_request(:get, "https://api.mollie.com/v2/settlements/stl_jDk30akdN")
104
- .to_return(:status => 200, :body => %{
103
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/stl_jDk30akdN')
104
+ .to_return(status: 200, body: %(
105
105
  {
106
106
  "resource": "settlement",
107
107
  "id": "stl_jDk30akdN"
108
108
  }
109
- }, :headers => {})
109
+ ), headers: {})
110
110
 
111
- chargeback = Payment::Refund.get("re_4qqhO89gsT", payment_id: "tr_WDqYK6vllg")
112
- assert_equal "stl_jDk30akdN", chargeback.settlement.id
111
+ chargeback = Payment::Refund.get('re_4qqhO89gsT', payment_id: 'tr_WDqYK6vllg')
112
+ assert_equal 'stl_jDk30akdN', chargeback.settlement.id
113
113
  end
114
114
 
115
115
  def test_nil_settlement
116
- refund = Payment::Refund.new(id: "tr_WDqYK6vllg")
116
+ refund = Payment::Refund.new(id: 'tr_WDqYK6vllg')
117
117
  assert refund.settlement.nil?
118
118
  end
119
119
  end
@@ -9,11 +9,11 @@ module Mollie
9
9
  end
10
10
 
11
11
  def test_list_chargebacks
12
- stub_request(:get, "https://api.mollie.com/v2/settlements/set-id/chargebacks")
13
- .to_return(:status => 200, :body => %{{"_embedded" : { "chargebacks" : [{"id":"chg-id", "settlement_id":"set-id"}]}} }, :headers => {})
12
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/set-id/chargebacks')
13
+ .to_return(status: 200, body: %({"_embedded" : { "chargebacks" : [{"id":"chg-id", "settlement_id":"set-id"}]}} ), headers: {})
14
14
 
15
- chargebacks = Chargeback.all(settlement_id: "set-id")
16
- assert_equal "chg-id", chargebacks.first.id
15
+ chargebacks = Chargeback.all(settlement_id: 'set-id')
16
+ assert_equal 'chg-id', chargebacks.first.id
17
17
  end
18
18
  end
19
19
  end
@@ -9,13 +9,13 @@ module Mollie
9
9
  end
10
10
 
11
11
  def test_list_payments
12
- stub_request(:get, "https://api.mollie.com/v2/settlements/set-id/payments")
13
- .to_return(:status => 200, :body => %{{"_embedded" : { "payments" : [{"id":"pay-id", "settlement_id":"set-id"}]}}}, :headers => {})
12
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/set-id/payments')
13
+ .to_return(status: 200, body: %({"_embedded" : { "payments" : [{"id":"pay-id", "settlement_id":"set-id"}]}}), headers: {})
14
14
 
15
- payments = Payment.all(settlement_id: "set-id")
15
+ payments = Payment.all(settlement_id: 'set-id')
16
16
 
17
- assert_equal "pay-id", payments.first.id
18
- assert_equal "set-id", payments.first.settlement_id
17
+ assert_equal 'pay-id', payments.first.id
18
+ assert_equal 'set-id', payments.first.settlement_id
19
19
  end
20
20
  end
21
21
  end
@@ -9,12 +9,12 @@ module Mollie
9
9
  end
10
10
 
11
11
  def test_list_refunds
12
- stub_request(:get, "https://api.mollie.com/v2/settlements/set-id/refunds")
13
- .to_return(:status => 200, :body => %{{"_embedded" : {"refunds" : [{"id":"re-id"}]}}}, :headers => {})
12
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/set-id/refunds')
13
+ .to_return(status: 200, body: %({"_embedded" : {"refunds" : [{"id":"re-id"}]}}), headers: {})
14
14
 
15
- refunds = Mollie::Settlement::Refund.all(settlement_id: "set-id")
15
+ refunds = Mollie::Settlement::Refund.all(settlement_id: 'set-id')
16
16
 
17
- assert_equal "re-id", refunds.first.id
17
+ assert_equal 're-id', refunds.first.id
18
18
  end
19
19
  end
20
20
  end
@@ -7,10 +7,10 @@ module Mollie
7
7
  id: 'stl_jDk30akdN',
8
8
  reference: '1234567.1511.03',
9
9
  settled_at: '2015-11-06T06:00:02.0Z',
10
- amount: { "value" => 39.75, "currency" => "EUR" },
10
+ amount: { 'value' => 39.75, 'currency' => 'EUR' },
11
11
  periods: {
12
- "2015" => {
13
- "11" => {
12
+ '2015' => {
13
+ '11' => {
14
14
  revenue: [
15
15
  {
16
16
  description: 'iDEAL',
@@ -95,19 +95,19 @@ module Mollie
95
95
  }
96
96
  },
97
97
  _links: {
98
- "payments" => {
99
- "href" => "https://api.mollie.com/v2/settlements/stl_jDk30akdN/payments",
100
- "type" => "application/hal+json"
98
+ 'payments' => {
99
+ 'href' => 'https://api.mollie.com/v2/settlements/stl_jDk30akdN/payments',
100
+ 'type' => 'application/hal+json'
101
101
  },
102
- "refunds" => {
103
- "href" => "https://api.mollie.com/v2/settlements/stl_jDk30akdN/refunds",
104
- "type" => "application/hal+json"
102
+ 'refunds' => {
103
+ 'href' => 'https://api.mollie.com/v2/settlements/stl_jDk30akdN/refunds',
104
+ 'type' => 'application/hal+json'
105
105
  },
106
- "chargebacks" => {
107
- "href" => "https://api.mollie.com/v2/settlements/stl_jDk30akdN/chargebacks",
108
- "type" => "application/hal+json"
106
+ 'chargebacks' => {
107
+ 'href' => 'https://api.mollie.com/v2/settlements/stl_jDk30akdN/chargebacks',
108
+ 'type' => 'application/hal+json'
109
109
  }
110
- },
110
+ }
111
111
  }
112
112
 
113
113
  settlement = Settlement.new(attributes)
@@ -128,27 +128,27 @@ module Mollie
128
128
  assert_equal 'Refunds iDEAL', settlement.periods[:'2015'][:'11'].revenue[1].description
129
129
  assert_equal 'refund', settlement.periods[:'2015'][:'11'].revenue[1][:method]
130
130
  assert_equal 2, settlement.periods[:'2015'][:'11'].revenue[1].count
131
- assert_equal "-43.2000", settlement.periods[:'2015'][:'11'].revenue[1].amount_net.value
131
+ assert_equal '-43.2000', settlement.periods[:'2015'][:'11'].revenue[1].amount_net.value
132
132
  assert_equal nil, settlement.periods[:'2015'][:'11'].revenue[1].amount_vat
133
- assert_equal "43.2000", settlement.periods[:'2015'][:'11'].revenue[1].amount_gross.value
133
+ assert_equal '43.2000', settlement.periods[:'2015'][:'11'].revenue[1].amount_gross.value
134
134
 
135
135
  assert_equal 'iDEAL', settlement.periods[:'2015'][:'11'].costs[0].description
136
136
  assert_equal 'ideal', settlement.periods[:'2015'][:'11'].costs[0][:method]
137
137
  assert_equal 6, settlement.periods[:'2015'][:'11'].costs[0].count
138
- assert_equal "0.3500", settlement.periods[:'2015'][:'11'].costs[0].rate.fixed.value
138
+ assert_equal '0.3500', settlement.periods[:'2015'][:'11'].costs[0].rate.fixed.value
139
139
  assert_equal nil, settlement.periods[:'2015'][:'11'].costs[0].rate.percentage
140
- assert_equal "2.1000", settlement.periods[:'2015'][:'11'].costs[0].amount_net.value
141
- assert_equal "0.4410", settlement.periods[:'2015'][:'11'].costs[0].amount_vat.value
142
- assert_equal "2.5410", settlement.periods[:'2015'][:'11'].costs[0].amount_gross.value
140
+ assert_equal '2.1000', settlement.periods[:'2015'][:'11'].costs[0].amount_net.value
141
+ assert_equal '0.4410', settlement.periods[:'2015'][:'11'].costs[0].amount_vat.value
142
+ assert_equal '2.5410', settlement.periods[:'2015'][:'11'].costs[0].amount_gross.value
143
143
 
144
144
  assert_equal 'Refunds iDEAL', settlement.periods[:'2015'][:'11'].costs[1].description
145
145
  assert_equal 'refund', settlement.periods[:'2015'][:'11'].costs[1][:method]
146
146
  assert_equal 2, settlement.periods[:'2015'][:'11'].costs[1].count
147
- assert_equal "0.3500", settlement.periods[:'2015'][:'11'].costs[1].rate.fixed.value
147
+ assert_equal '0.3500', settlement.periods[:'2015'][:'11'].costs[1].rate.fixed.value
148
148
  assert_equal nil, settlement.periods[:'2015'][:'11'].costs[1].rate.percentage
149
- assert_equal "0.5000", settlement.periods[:'2015'][:'11'].costs[1].amount_net.value
150
- assert_equal "0.1050", settlement.periods[:'2015'][:'11'].costs[1].amount_vat.value
151
- assert_equal "0.6050", settlement.periods[:'2015'][:'11'].costs[1].amount_gross.value
149
+ assert_equal '0.5000', settlement.periods[:'2015'][:'11'].costs[1].amount_net.value
150
+ assert_equal '0.1050', settlement.periods[:'2015'][:'11'].costs[1].amount_vat.value
151
+ assert_equal '0.6050', settlement.periods[:'2015'][:'11'].costs[1].amount_gross.value
152
152
  end
153
153
 
154
154
  def test_status_open
@@ -172,85 +172,85 @@ module Mollie
172
172
  end
173
173
 
174
174
  def test_open_settlement
175
- stub_request(:get, "https://api.mollie.com/v2/settlements/open")
176
- .to_return(:status => 200, :body => %{{"id":"set-id"}}, :headers => {})
175
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/open')
176
+ .to_return(status: 200, body: %({"id":"set-id"}), headers: {})
177
177
 
178
178
  settlement = Settlement.open
179
179
 
180
180
  assert_kind_of Settlement, settlement
181
- assert_equal "set-id", settlement.id
181
+ assert_equal 'set-id', settlement.id
182
182
  end
183
183
 
184
184
  def test_next_settlement
185
- stub_request(:get, "https://api.mollie.com/v2/settlements/next")
186
- .to_return(:status => 200, :body => %{{"id":"set-id"}}, :headers => {})
185
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/next')
186
+ .to_return(status: 200, body: %({"id":"set-id"}), headers: {})
187
187
 
188
188
  settlement = Settlement.next
189
189
 
190
190
  assert_kind_of Settlement, settlement
191
- assert_equal "set-id", settlement.id
191
+ assert_equal 'set-id', settlement.id
192
192
  end
193
193
 
194
194
  def test_list_payments
195
- stub_request(:get, "https://api.mollie.com/v2/settlements/stl-id/payments")
196
- .to_return(:status => 200, :body => %{
195
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/stl-id/payments')
196
+ .to_return(status: 200, body: %(
197
197
  { "_embedded" : {"payments" : [{ "id": "pay-id", "settlement_id": "stl-id" }]}}
198
- }, :headers => {})
198
+ ), headers: {})
199
199
 
200
- payments = Settlement.new(id: "stl-id").payments
200
+ payments = Settlement.new(id: 'stl-id').payments
201
201
  assert_equal Settlement::Payment, payments.klass
202
- assert_equal "pay-id", payments.first.id
202
+ assert_equal 'pay-id', payments.first.id
203
203
  end
204
204
 
205
205
  def test_list_refunds
206
- stub_request(:get, "https://api.mollie.com/v2/settlements/stl-id/refunds")
207
- .to_return(:status => 200, :body => %{
206
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/stl-id/refunds')
207
+ .to_return(status: 200, body: %(
208
208
  { "_embedded" : {"refunds" : [{ "id": "ref-id", "settlement_id": "stl-id" }]}}
209
- }, :headers => {})
209
+ ), headers: {})
210
210
 
211
- refunds = Settlement.new(id: "stl-id").refunds
211
+ refunds = Settlement.new(id: 'stl-id').refunds
212
212
  assert_equal Settlement::Refund, refunds.klass
213
- assert_equal "ref-id", refunds.first.id
213
+ assert_equal 'ref-id', refunds.first.id
214
214
  end
215
215
 
216
216
  def test_list_chargebacks
217
- stub_request(:get, "https://api.mollie.com/v2/settlements/stl-id/chargebacks")
218
- .to_return(:status => 200, :body => %{
217
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/stl-id/chargebacks')
218
+ .to_return(status: 200, body: %(
219
219
  { "_embedded" : {"chargebacks" : [{ "id": "chb-id", "settlement_id": "stl-id" }]}}
220
- }, :headers => {})
220
+ ), headers: {})
221
221
 
222
- chargebacks = Settlement.new(id: "stl-id").chargebacks
222
+ chargebacks = Settlement.new(id: 'stl-id').chargebacks
223
223
  assert_equal Settlement::Chargeback, chargebacks.klass
224
- assert_equal "chb-id", chargebacks.first.id
224
+ assert_equal 'chb-id', chargebacks.first.id
225
225
  end
226
226
 
227
227
  def test_get_invoice
228
- stub_request(:get, "https://api.mollie.com/v2/settlements/stl_jDk30akdN")
228
+ stub_request(:get, 'https://api.mollie.com/v2/settlements/stl_jDk30akdN')
229
229
  .to_return(
230
230
  status: 200,
231
- body: %{
231
+ body: %(
232
232
  {
233
233
  "resource": "settlement",
234
234
  "id": "stl_jDk30akdN",
235
235
  "invoice_id": "inv_FrvewDA3Pr"
236
236
  }
237
- }
237
+ )
238
238
  )
239
239
 
240
- stub_request(:get, "https://api.mollie.com/v2/invoices/inv_FrvewDA3Pr")
241
- .to_return(status: 200, body: %{
240
+ stub_request(:get, 'https://api.mollie.com/v2/invoices/inv_FrvewDA3Pr')
241
+ .to_return(status: 200, body: %(
242
242
  {
243
243
  "resource": "invoice",
244
244
  "id": "inv_FrvewDA3Pr"
245
245
  }
246
- })
246
+ ))
247
247
 
248
- settlement = Settlement.get("stl_jDk30akdN")
249
- assert_equal "inv_FrvewDA3Pr", settlement.invoice.id
248
+ settlement = Settlement.get('stl_jDk30akdN')
249
+ assert_equal 'inv_FrvewDA3Pr', settlement.invoice.id
250
250
  end
251
251
 
252
252
  def test_nil_invoice
253
- settlement = Settlement.new(id: "stl_jDk30akdN")
253
+ settlement = Settlement.new(id: 'stl_jDk30akdN')
254
254
  assert_nil settlement.invoice
255
255
  end
256
256
  end