modulr-api 0.0.12 → 0.0.15

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: 413315e576a2c3e69679a961e99cdeeecafe47508c32e208213afc7598d9c6ee
4
- data.tar.gz: '07585a8c4482fc9f284942443e4bb557ed05eb2776ca0634644bdc7bb95691c8'
3
+ metadata.gz: 2461042a33c2ef6c899c9bca84bb7aaa06488fc378bb7bd25edf8bde1d26ebec
4
+ data.tar.gz: 4735dc4188f8bb2345f552cc6c950ad7e876780f35d2fe4531d6a6a725822b22
5
5
  SHA512:
6
- metadata.gz: 6e01d522da3a01c6a0025fe835378af4c0797b131e0f8cd766cd9ac463d9d011f07c8efc72b4d2ff8869fdac5aa6e1c55f79ed0d2247e955ff974128aa970e46
7
- data.tar.gz: 8b72174189e8c91d0653471eefaf49143c8764a6dcc26fd5b9f4fecf1f8495cc2cdac01e5f131abd3c69cc5f4537ccdaface65a2c9c5fe41cc65f6bec94f5792
6
+ metadata.gz: ba8e09076f2fd69a474143b32f67e494cb2c9091d1312332da719eff42cc1ad3f4e806a7476f9b6784496515df8c965a0a4e33508aa8a87516ae0477b4e707a8
7
+ data.tar.gz: d884bca4495f5b88ee93c1a303382092f9a52cc633fa25aac5c59ce4206210d8c0302f67dd4f1d5556531c54d3cf8e8e41b47954d415c2c579cb87529cc2b12f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulr-api (0.0.12)
4
+ modulr-api (0.0.15)
5
5
  faraday (~> 1.0)
6
6
  faraday_middleware (~> 1.0)
7
7
 
@@ -127,6 +127,7 @@ GEM
127
127
 
128
128
  PLATFORMS
129
129
  arm64-darwin-20
130
+ arm64-darwin-21
130
131
  x86_64-darwin-20
131
132
  x86_64-linux
132
133
 
@@ -144,4 +145,4 @@ DEPENDENCIES
144
145
  webmock (~> 2.1)
145
146
 
146
147
  BUNDLED WITH
147
- 2.3.15
148
+ 2.4.3
@@ -1,4 +1,4 @@
1
- ### Transactions History
1
+ ### Transactions List
2
2
  GET {{base_url}}/accounts/{{account_id}}/transactions
3
3
  Content-Type: application/json
4
- Authorization: {{api_key}}
4
+ Authorization: {{api_key}}
@@ -3,10 +3,29 @@
3
3
  module Modulr
4
4
  module API
5
5
  class TransactionsService < Service
6
- def history(account_id:)
7
- response = client.get("/accounts/#{account_id}/transactions")
6
+ def list(account_id:, **opts)
7
+ response = client.get("/accounts/#{account_id}/transactions", build_query_params(opts))
8
8
  Resources::Transactions::Transactions.new(response, response.body[:content])
9
9
  end
10
+
11
+ private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
12
+ same_name_params = [:credit, :type]
13
+ date_params = { to: :toTransactionDate, from: :fromTransactionDate, to_posted: :toPostedDate,
14
+ from_posted: :fromPostedDate, }
15
+ mapped_params = {
16
+ source_id: :sourceId,
17
+ description: :q,
18
+ min_amount: :minAmount,
19
+ max_amount: :maxAmount,
20
+ }
21
+ {}.tap do |params|
22
+ same_name_params.each { |param| params[param] = opts[param] if opts[param] }
23
+ date_params.each do |original, mapped|
24
+ params[mapped] = format_datetime(opts[original]) if opts[original]
25
+ end
26
+ mapped_params.each { |original, mapped| params[mapped] = opts[original] if opts[original] }
27
+ end
28
+ end
10
29
  end
11
30
  end
12
31
  end
@@ -17,7 +17,7 @@ module Modulr
17
17
  @timestamp = timestamp
18
18
  @authorization = [
19
19
  "Signature keyId=\"#{apikey}\"",
20
- 'algorithm="hmac-sha1"',
20
+ 'algorithm="hmac-sha512"',
21
21
  'headers="date x-mod-nonce"',
22
22
  "signature=\"#{signature}\"",
23
23
  ].join(",")
@@ -26,7 +26,7 @@ module Modulr
26
26
  def self.calculate(apikey:, apisecret:, nonce: SecureRandom.base64(30), timestamp: DateTime.now.httpdate)
27
27
  signature_string = "date: #{timestamp}\nx-mod-nonce: #{nonce}"
28
28
  digest = OpenSSL::HMAC.digest(
29
- "SHA1",
29
+ "SHA512",
30
30
  apisecret.dup.force_encoding("UTF-8"),
31
31
  signature_string.dup.force_encoding("UTF-8")
32
32
  )
@@ -10,10 +10,10 @@ module Modulr
10
10
  map :amount
11
11
  map :currency
12
12
  map :description
13
+ map :transactionDate, :created_at
14
+ map :postedDate, :final_at
13
15
  map :credit
14
16
  map :type
15
- map :transactionDate, :created_at
16
- map :postedDate, :posted_date
17
17
  map :sourceId, :source_id
18
18
  map :sourceExternalReference, :external_reference
19
19
  map :additionalInfo, :additional_info
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modulr
4
- VERSION = "0.0.12"
4
+ VERSION = "0.0.15"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulr-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aitor García Rey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -201,7 +201,7 @@ files:
201
201
  - doc/modulr_requests/accounts/close.http
202
202
  - doc/modulr_requests/accounts/create.http
203
203
  - doc/modulr_requests/http-client.env.json
204
- - doc/modulr_requests/transactions/history.http
204
+ - doc/modulr_requests/transactions/list.http
205
205
  - lib/modulr.rb
206
206
  - lib/modulr/api/accounts_service.rb
207
207
  - lib/modulr/api/customers_service.rb