mollie-api-ruby 4.11.0 → 4.12.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 +4 -4
- data/.github/workflows/codeql.yml +72 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/README.md +2 -2
- data/lib/mollie/base.rb +2 -0
- data/lib/mollie/client.rb +5 -0
- data/lib/mollie/order.rb +1 -0
- data/lib/mollie/payment.rb +1 -0
- data/lib/mollie/version.rb +1 -1
- data/test/fixtures/orders/get.json +1 -0
- data/test/mollie/base_test.rb +7 -0
- data/test/mollie/client_test.rb +12 -0
- data/test/mollie/order_test.rb +1 -0
- data/test/mollie/payment_test.rb +3 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74f551510fa882249e3224bd53e50334ccce5d9f4538b0c9fdf94cd86eb25bd1
|
4
|
+
data.tar.gz: 2208eac855cb783b5183c4b64f604ce9981b2196eeaa92cdfd71061b0e98a56a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50eb679501ae91cdf624127d13d5e45be32624864c166c3ff75fff563e0accc9e24874142b279c019b48f848f061e87c18f3c8092a34120588ca869de7e01498
|
7
|
+
data.tar.gz: 54cd23ca6361f723a622d00b05724373632f2ab395dcb51d8343e37467c0a14d7da23b758cd127fc7340c0e7bdd57fea837a1cfaa0b18eb0fb0a8889d1fd3c7c
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ "master" ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ "master" ]
|
20
|
+
schedule:
|
21
|
+
- cron: '30 20 * * 4'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v3
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v2
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
53
|
+
# queries: security-extended,security-and-quality
|
54
|
+
|
55
|
+
|
56
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
57
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
58
|
+
- name: Autobuild
|
59
|
+
uses: github/codeql-action/autobuild@v2
|
60
|
+
|
61
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
62
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
63
|
+
|
64
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
65
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
66
|
+
|
67
|
+
# - run: |
|
68
|
+
# echo "Run, Build Application using script"
|
69
|
+
# ./location_of_script_within_repo/buildscript.sh
|
70
|
+
|
71
|
+
- name: Perform CodeQL Analysis
|
72
|
+
uses: github/codeql-action/analyze@v2
|
data/.travis.yml
CHANGED
@@ -8,7 +8,7 @@ deploy:
|
|
8
8
|
gem: mollie-api-ruby
|
9
9
|
provider: rubygems
|
10
10
|
api_key:
|
11
|
-
secure: "
|
11
|
+
secure: "OQobSXpfwELzuh5prnwADPGwt3LHyD/EMuKlJ7aJ6CNveGQzvgGOtK52Cn3X9X8yAkX/PNJVXnPeFaKSQopcAJB30ySJMnPYGjQvIoiUOglMB8lJDFxcLtZ/21NXDf2f3cxYPmZkBGtFQeb/EEYBg4/vwjgWlJ/mcwnesLpwj5A="
|
12
12
|
on:
|
13
13
|
tags: true
|
14
14
|
repo: mollie/mollie-api-ruby
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@
|
|
4
4
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
6
6
|
|
7
|
+
## 4.12.0 - 2023-01-29
|
8
|
+
|
9
|
+
- (f180b47) Add support for idempotency keys
|
10
|
+
- (f0a47d1) Payment: add support for cancel_url
|
11
|
+
- (9db60b3) Order: add support for cancel_url
|
12
|
+
- (2f88990) Require non-empty ID when fetching a resource
|
13
|
+
|
7
14
|
## 4.11.0 - 2022-03-01
|
8
15
|
|
9
16
|
- (1ef339e) Add Partner API
|
data/README.md
CHANGED
@@ -24,11 +24,11 @@ To use the Mollie API client, the following things are required:
|
|
24
24
|
|
25
25
|
## Installation
|
26
26
|
|
27
|
-
By far the easiest way to install the Mollie API client is to install it with [gem](http://rubygems.org/).
|
27
|
+
By far the easiest way to install the Mollie API client is to install it with [gem](http://rubygems.org/). Note: v4.8.0 and higher are not published on rubygems.org, see [GH-140](https://github.com/mollie/mollie-api-ruby/issues/140) for details.
|
28
28
|
|
29
29
|
```
|
30
30
|
# Gemfile
|
31
|
-
gem
|
31
|
+
gem "mollie-api-ruby", github: "mollie/mollie-api-ruby", tag: "v4.11.0"
|
32
32
|
|
33
33
|
$ gem install mollie-api-ruby
|
34
34
|
```
|
data/lib/mollie/base.rb
CHANGED
data/lib/mollie/client.rb
CHANGED
@@ -72,6 +72,7 @@ module Mollie
|
|
72
72
|
|
73
73
|
api_key = http_body.delete(:api_key) || query.delete(:api_key) || @api_key
|
74
74
|
api_endpoint = http_body.delete(:api_endpoint) || query.delete(:api_endpoint) || @api_endpoint
|
75
|
+
idempotency_key = http_body.delete(:idempotency_key) || query.delete(:idempotency_key)
|
75
76
|
|
76
77
|
unless query.empty?
|
77
78
|
camelized_query = Util.camelize_keys(query)
|
@@ -110,6 +111,10 @@ module Mollie
|
|
110
111
|
request['Authorization'] = "Bearer #{api_key}"
|
111
112
|
request['User-Agent'] = @version_strings.join(' ')
|
112
113
|
|
114
|
+
if http_method == 'POST' && idempotency_key
|
115
|
+
request['Idempotency-Key'] = idempotency_key
|
116
|
+
end
|
117
|
+
|
113
118
|
begin
|
114
119
|
response = client.request(request)
|
115
120
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
data/lib/mollie/order.rb
CHANGED
data/lib/mollie/payment.rb
CHANGED
data/lib/mollie/version.rb
CHANGED
@@ -49,6 +49,7 @@
|
|
49
49
|
"email": "luke@skywalker.com"
|
50
50
|
},
|
51
51
|
"redirectUrl": "https://example.org/redirect",
|
52
|
+
"cancelUrl": "https://example.org/cancel",
|
52
53
|
"webhookUrl": "https://example.org/webhook",
|
53
54
|
"expiredAt": "2018-08-30T09:29:56+00:02",
|
54
55
|
"paidAt": "2018-08-26T09:29:56+00:00",
|
data/test/mollie/base_test.rb
CHANGED
@@ -44,6 +44,13 @@ module Mollie
|
|
44
44
|
assert_equal 'my-id', resource.id
|
45
45
|
assert_equal 'object-id', resource.testobject_id
|
46
46
|
end
|
47
|
+
def test_get_with_invalid_identifiers
|
48
|
+
assert_raises(Mollie::Exception) { TestObject.get(nil) }
|
49
|
+
assert_raises(Mollie::Exception) { TestObject.get(" ") }
|
50
|
+
assert_raises(Mollie::Exception) { TestObject.get(" ") }
|
51
|
+
assert_raises(Mollie::Exception) { TestObject.get("\t") }
|
52
|
+
assert_raises(Mollie::Exception) { TestObject.get("\n") }
|
53
|
+
end
|
47
54
|
|
48
55
|
def test_create
|
49
56
|
stub_request(:post, 'https://api.mollie.com/v2/testobjects')
|
data/test/mollie/client_test.rb
CHANGED
@@ -53,6 +53,18 @@ module Mollie
|
|
53
53
|
assert_equal 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM', Mollie::Client.instance.api_key
|
54
54
|
end
|
55
55
|
|
56
|
+
def test_post_with_idempotency_key
|
57
|
+
stub_request(:post, 'https://api.mollie.com/v2/payments')
|
58
|
+
.with(headers: { "Idempotency-Key" => '91d42bd5-e47f-4f4a-b38e-99333b264e78' })
|
59
|
+
.to_return(status: 200, body: '{}', headers: {})
|
60
|
+
|
61
|
+
payment = Mollie::Payment.create(
|
62
|
+
amount: { value: '10.00', currency: 'EUR' },
|
63
|
+
redirect_url: 'https://webshop.example.org/order/12345/',
|
64
|
+
idempotency_key: '91d42bd5-e47f-4f4a-b38e-99333b264e78'
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
56
68
|
def test_get_request_convert_to_camel_case
|
57
69
|
stub_request(:get, 'https://api.mollie.com/v2/my-method?myParam=ok')
|
58
70
|
.to_return(status: 200, body: '{}', headers: {})
|
data/test/mollie/order_test.rb
CHANGED
@@ -75,6 +75,7 @@ module Mollie
|
|
75
75
|
assert_equal '1337', order.metadata.order_id
|
76
76
|
assert_equal 'Lego cars', order.metadata.description
|
77
77
|
assert_equal 'https://example.org/redirect', order.redirect_url
|
78
|
+
assert_equal 'https://example.org/cancel', order.cancel_url
|
78
79
|
assert_equal 'https://example.org/webhook', order.webhook_url
|
79
80
|
assert_equal Time.parse('2018-08-02T09:29:56+00:00'), order.created_at
|
80
81
|
assert_equal Time.parse('2018-08-30T09:29:56+00:00'), order.expires_at
|
data/test/mollie/payment_test.rb
CHANGED
@@ -32,6 +32,7 @@ module Mollie
|
|
32
32
|
profile_id: 'pfl_QkEhN94Ba',
|
33
33
|
sequence_type: 'oneoff',
|
34
34
|
redirect_url: 'https://webshop.example.org/order/12345',
|
35
|
+
cancel_url: 'https://webshop.example.org/payments/cancel',
|
35
36
|
webhook_url: 'https://webshop.example.org/payments/webhook',
|
36
37
|
_links: {
|
37
38
|
'self' => {
|
@@ -72,8 +73,9 @@ module Mollie
|
|
72
73
|
assert_equal 'nl_NL', payment.locale
|
73
74
|
assert_equal 'NL', payment.country_code
|
74
75
|
assert_equal 'pfl_QkEhN94Ba', payment.profile_id
|
75
|
-
assert_equal 'https://webshop.example.org/payments/webhook', payment.webhook_url
|
76
76
|
assert_equal 'https://webshop.example.org/order/12345', payment.redirect_url
|
77
|
+
assert_equal 'https://webshop.example.org/payments/cancel', payment.cancel_url
|
78
|
+
assert_equal 'https://webshop.example.org/payments/webhook', payment.webhook_url
|
77
79
|
assert_equal 'https://www.mollie.com/payscreen/select-method/7UhSN1zuXS', payment.checkout_url
|
78
80
|
assert_equal false, payment.cancelable?
|
79
81
|
end
|
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.
|
4
|
+
version: 4.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mollie B.V.
|
@@ -80,6 +80,7 @@ extensions: []
|
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
82
|
- ".github/workflows/build.yml"
|
83
|
+
- ".github/workflows/codeql.yml"
|
83
84
|
- ".gitignore"
|
84
85
|
- ".rubocop.yml"
|
85
86
|
- ".rubocop_todo.yml"
|