modulr-api 0.0.32 → 0.0.34
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/Gemfile.lock +1 -1
- data/lib/modulr/api/accounts_service.rb +5 -1
- data/lib/modulr/api/payments_service.rb +1 -1
- data/lib/modulr/api/transactions_service.rb +1 -1
- data/lib/modulr/resources/accounts/account.rb +3 -2
- data/lib/modulr/resources/base_collection.rb +1 -1
- data/lib/modulr/resources/payments/payment.rb +7 -6
- data/lib/modulr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec032b7c3bc1a5a8b4026a6dc1f988776f9d45e828f34a64020e6c27e0aeeaf1
|
4
|
+
data.tar.gz: d20822c10c838562a7382f298c9910309ae99b3196012c9b4d068854a325de28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902adc699d5fdf3fe2bf39405a7764efdceed0be7cb5fef6af7160ddeb84730755d5b243b10ad3c89009abea85534446c7e17bd1dd8b4118de488ab084061ec3
|
7
|
+
data.tar.gz: 7185aff5c87482639aa6228022bd0405509fc846f98c82063e11190e0cfe56d1ea3c0b17c38d00c21ccf264492285f381656c319e9124f49a7b61799e23d4a96
|
data/Gemfile.lock
CHANGED
@@ -5,7 +5,11 @@ module Modulr
|
|
5
5
|
class AccountsService < Service
|
6
6
|
def find(id:)
|
7
7
|
response = client.get("/accounts/#{id}")
|
8
|
-
Resources::Accounts::Account.new(
|
8
|
+
Resources::Accounts::Account.new(
|
9
|
+
response.env[:raw_body],
|
10
|
+
response.body,
|
11
|
+
{ requested_at: response.headers["date"] }
|
12
|
+
)
|
9
13
|
end
|
10
14
|
|
11
15
|
def create(customer_id:, currency:, product_code:, **opts)
|
@@ -35,7 +35,7 @@ module Modulr
|
|
35
35
|
end
|
36
36
|
|
37
37
|
private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
|
38
|
-
same_name_params = [:type, :status]
|
38
|
+
same_name_params = [:type, :status, :size, :page]
|
39
39
|
date_params = { to: :toCreatedDate, from: :fromCreatedDate, updated_since: :modifiedSince }
|
40
40
|
mapped_params = {
|
41
41
|
external_reference: :externalReference,
|
@@ -9,7 +9,7 @@ module Modulr
|
|
9
9
|
end
|
10
10
|
|
11
11
|
private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
|
12
|
-
same_name_params = [:credit, :type]
|
12
|
+
same_name_params = [:credit, :type, :size, :page]
|
13
13
|
date_params = { to: :toTransactionDate, from: :fromTransactionDate, to_posted: :toPostedDate,
|
14
14
|
from_posted: :fromPostedDate, }
|
15
15
|
mapped_params = {
|
@@ -4,7 +4,7 @@ module Modulr
|
|
4
4
|
module Resources
|
5
5
|
module Accounts
|
6
6
|
class Account < Base
|
7
|
-
attr_reader :identifiers
|
7
|
+
attr_reader :identifiers, :requested_at
|
8
8
|
|
9
9
|
STATUS = {
|
10
10
|
active: "ACTIVE",
|
@@ -23,8 +23,9 @@ module Modulr
|
|
23
23
|
map :createdDate, :created_at
|
24
24
|
map :directDebit, :direct_debit
|
25
25
|
|
26
|
-
def initialize(raw_response, attributes = {})
|
26
|
+
def initialize(raw_response, attributes = {}, opts = { requested_at: nil })
|
27
27
|
super(raw_response, attributes)
|
28
|
+
@requested_at = opts[:requested_at]
|
28
29
|
@identifiers = Accounts::Identifiers.new(nil, attributes[:identifiers])
|
29
30
|
end
|
30
31
|
end
|
@@ -78,10 +78,10 @@ module Modulr
|
|
78
78
|
private def payment_type
|
79
79
|
@type = if incoming?
|
80
80
|
@attr_details[:type]
|
81
|
+
elsif outgoing?
|
82
|
+
outgoing_type
|
81
83
|
elsif internal?
|
82
84
|
"INT_INTERC"
|
83
|
-
else
|
84
|
-
outgoing_type
|
85
85
|
end
|
86
86
|
@type
|
87
87
|
end
|
@@ -96,8 +96,6 @@ module Modulr
|
|
96
96
|
faster_payments
|
97
97
|
when "INT_INTERC"
|
98
98
|
internal
|
99
|
-
else
|
100
|
-
raise "Unable to find network and scheme for payment with ID: #{id} and Type: #{type}"
|
101
99
|
end
|
102
100
|
end
|
103
101
|
|
@@ -148,10 +146,13 @@ module Modulr
|
|
148
146
|
!@attr_details.key?(:sourceAccountId)
|
149
147
|
end
|
150
148
|
|
149
|
+
private def outgoing?
|
150
|
+
@attributes.key?(:schemeInfo) && !@attributes[:schemeInfo].empty?
|
151
|
+
end
|
152
|
+
|
151
153
|
private def internal?
|
152
154
|
(@attr_details[:sourceAccountId] && @attr_details.key?(:destinationId)) ||
|
153
|
-
|
154
|
-
@attributes[:schemeInfo].empty?
|
155
|
+
(@attributes.key?(:schemeInfo) && @attributes[:schemeInfo].empty?)
|
155
156
|
end
|
156
157
|
end
|
157
158
|
end
|
data/lib/modulr/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.34
|
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-07
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|