starkbank 2.12.0 → 2.14.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/lib/dynamic_brcode/dynamic_brcode.rb +7 -1
- data/lib/dynamic_brcode/rule.rb +46 -0
- data/lib/starkbank.rb +2 -1
- data/lib/transfer/transfer.rb +5 -2
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c363e43adca2efd6e97198b40c1a42e9a71de70188b59fe7561a2f93615f513
|
4
|
+
data.tar.gz: 21954b29ceea88e466182e97920c8d4f0c7df2779b4d8d5c82ec4996f52dd4b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa3872b3bf62808684afac20937bc01d631fe4bf53e097bfcead428fdce52d3810ac5b377b0ff338c932953f6422808298f1e8801553656615bcff96b3306cdf
|
7
|
+
data.tar.gz: 7f1f9bd40722fb9104736896d4a5f1fedbbd0d6b50c70752d2466c71eb6ad2a0a52206a6ba1db5de248b5942f86806aa911b9eee93da547e62a8e6c72519b476
|
@@ -21,6 +21,8 @@ module StarkBank
|
|
21
21
|
# ## Parameters (optional):
|
22
22
|
# - expiration [integer, default 3600 (1 hour)]: time interval in seconds between due date and expiration date. ex 123456789
|
23
23
|
# - tags [list of strings, default []]: list of strings for tagging, these will be passed to the respective DynamicBrcode resource when paid
|
24
|
+
# - display_description [string, default nil]: optional description to be shown in the receiver bank interface. ex: "Payment for service #1234"
|
25
|
+
# - rules [list of Rules, default nil]: list of dynamic brcode rules to be applied to this brcode. ex: [StarkBank::DynamicBrcode::Rule.new(key: "allowedTaxIds", value: ["012.345.678-90"])]
|
24
26
|
#
|
25
27
|
# ## Attributes (return-only):
|
26
28
|
# - id [string]: id returned on creation, this is the BR code. ex: "00020126360014br.gov.bcb.pix0114+552840092118152040000530398654040.095802BR5915Jamie Lannister6009Sao Paulo620705038566304FC6C"
|
@@ -31,7 +33,7 @@ module StarkBank
|
|
31
33
|
class DynamicBrcode < StarkCore::Utils::Resource
|
32
34
|
attr_reader :amount, :expiration, :tags, :id, :uuid, :picture_url, :updated, :created
|
33
35
|
def initialize(
|
34
|
-
amount:, expiration: nil, tags: nil, id: nil, uuid: nil, picture_url: nil, updated: nil, created: nil
|
36
|
+
amount:, expiration: nil, tags: nil, id: nil, uuid: nil, picture_url: nil, display_description: nil, rules: nil, updated: nil, created: nil
|
35
37
|
)
|
36
38
|
super(id)
|
37
39
|
@amount = amount
|
@@ -39,6 +41,8 @@ module StarkBank
|
|
39
41
|
@tags = tags
|
40
42
|
@uuid = uuid
|
41
43
|
@picture_url = picture_url
|
44
|
+
@display_description = display_description
|
45
|
+
@rules = StarkBank::DynamicBrcode::Rule.parse_rules(rules)
|
42
46
|
@created = StarkCore::Utils::Checks.check_datetime(created)
|
43
47
|
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
44
48
|
end
|
@@ -145,6 +149,8 @@ module StarkBank
|
|
145
149
|
tags: json['tags'],
|
146
150
|
uuid: json['uuid'],
|
147
151
|
picture_url: json['picture_url'],
|
152
|
+
display_description: json['display_description'],
|
153
|
+
rules: json['rules'],
|
148
154
|
created: json['created'],
|
149
155
|
updated: json['updated']
|
150
156
|
)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative('../utils/rest')
|
2
|
+
|
3
|
+
module StarkBank
|
4
|
+
class DynamicBrcode
|
5
|
+
# # DynamicBrcode::Rule object
|
6
|
+
#
|
7
|
+
# The DynamicBrcode.Rule object modifies the behavior of DynamicBrcode objects when passed as an argument upon their creation.
|
8
|
+
#
|
9
|
+
# ## Parameters (required):
|
10
|
+
# - key [string]: Rule to be customized, describes what DynamicBrcode behavior will be altered. ex: "allowedTaxIds"
|
11
|
+
# - value [list of strings]: Value of the rule. ex: ["012.345.678-90", "45.059.493/0001-73"]
|
12
|
+
class Rule < StarkCore::Utils::SubResource
|
13
|
+
attr_reader :key, :value
|
14
|
+
def initialize(key:, value:)
|
15
|
+
@key = key
|
16
|
+
@value = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.parse_rules(rules)
|
20
|
+
resource_maker = StarkBank::DynamicBrcode::Rule.resource[:resource_maker]
|
21
|
+
return rules if rules.nil?
|
22
|
+
|
23
|
+
parsed_rules = []
|
24
|
+
rules.each do |rule|
|
25
|
+
unless rule.is_a? Rule
|
26
|
+
rule = StarkCore::Utils::API.from_api_json(resource_maker, rule)
|
27
|
+
end
|
28
|
+
parsed_rules << rule
|
29
|
+
end
|
30
|
+
return parsed_rules
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.resource
|
34
|
+
{
|
35
|
+
resource_name: 'Rule',
|
36
|
+
resource_maker: proc { |json|
|
37
|
+
Rule.new(
|
38
|
+
key: json['key'],
|
39
|
+
value: json['value']
|
40
|
+
)
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/starkbank.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative('invoice/rule')
|
|
9
9
|
require_relative('invoice/payment')
|
10
10
|
require_relative('dict_key/dict_key')
|
11
11
|
require_relative('dynamic_brcode/dynamic_brcode')
|
12
|
+
require_relative('dynamic_brcode/rule')
|
12
13
|
require_relative('deposit/deposit')
|
13
14
|
require_relative('deposit/log')
|
14
15
|
require_relative('card_method/cardmethod')
|
@@ -60,7 +61,7 @@ require_relative('request/request')
|
|
60
61
|
module StarkBank
|
61
62
|
|
62
63
|
API_VERSION = 'v2'
|
63
|
-
SDK_VERSION = '2.
|
64
|
+
SDK_VERSION = '2.14.0'
|
64
65
|
HOST = "bank"
|
65
66
|
public_constant :API_VERSION, :SDK_VERSION, :HOST;
|
66
67
|
|
data/lib/transfer/transfer.rb
CHANGED
@@ -24,6 +24,7 @@ module StarkBank
|
|
24
24
|
# - external_id [string, default nil]: url safe string that must be unique among all your transfers. Duplicated external_ids will cause failures. By default, this parameter will block any transfer that repeats amount and receiver information on the same date. ex: 'my-internal-id-123456'
|
25
25
|
# - scheduled [string, default now]: datetime when the transfer will be processed. May be pushed to next business day if necessary. ex: DateTime.new(2020, 3, 11, 8, 13, 12, 11)
|
26
26
|
# - description [string, default nil]: optional description to override default description to be shown in the bank statement. ex: 'Payment for service #1234'
|
27
|
+
# - display_description [string, default nil]: optional description to be shown in the receiver bank interface. ex: 'Payment for service #1234'
|
27
28
|
# - tags [list of strings]: list of strings for reference when searching for transfers. ex: ['employees', 'monthly']
|
28
29
|
# - rules [list of Transfer::Rules, default []]: list of Transfer::Rule objects for modifying transfer behavior. ex: [Transfer::Rule(key: "resendingLimit", value: 5)]
|
29
30
|
#
|
@@ -36,8 +37,8 @@ module StarkBank
|
|
36
37
|
# - created [DateTime]: creation datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
37
38
|
# - updated [DateTime]: latest update datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
38
39
|
class Transfer < StarkCore::Utils::Resource
|
39
|
-
attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :description, :transaction_ids, :metadata, :fee, :tags, :rules, :status, :id, :created, :updated
|
40
|
-
def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, description: nil, transaction_ids: nil, metadata: nil, fee: nil, tags: nil, rules: nil, status: nil, id: nil, created: nil, updated: nil)
|
40
|
+
attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :description, :display_description, :transaction_ids, :metadata, :fee, :tags, :rules, :status, :id, :created, :updated
|
41
|
+
def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, description: nil, display_description: nil, transaction_ids: nil, metadata: nil, fee: nil, tags: nil, rules: nil, status: nil, id: nil, created: nil, updated: nil)
|
41
42
|
super(id)
|
42
43
|
@amount = amount
|
43
44
|
@name = name
|
@@ -49,6 +50,7 @@ module StarkBank
|
|
49
50
|
@external_id = external_id
|
50
51
|
@scheduled = StarkCore::Utils::Checks.check_date_or_datetime(scheduled)
|
51
52
|
@description = description
|
53
|
+
@display_description = display_description
|
52
54
|
@tags = tags
|
53
55
|
@rules = StarkBank::Transfer::Rule.parse_rules(rules)
|
54
56
|
@fee = fee
|
@@ -210,6 +212,7 @@ module StarkBank
|
|
210
212
|
external_id: json['external_id'],
|
211
213
|
scheduled: json['scheduled'],
|
212
214
|
description: json['description'],
|
215
|
+
display_description: json['display_description'],
|
213
216
|
tags: json['tags'],
|
214
217
|
rules: json['rules'],
|
215
218
|
id: json['id'],
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: starkbank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- starkbank
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: starkcore
|
@@ -66,8 +65,6 @@ dependencies:
|
|
66
65
|
- - "~>"
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '0.81'
|
69
|
-
description:
|
70
|
-
email:
|
71
68
|
executables: []
|
72
69
|
extensions: []
|
73
70
|
extra_rdoc_files: []
|
@@ -101,6 +98,7 @@ files:
|
|
101
98
|
- lib/deposit/log.rb
|
102
99
|
- lib/dict_key/dict_key.rb
|
103
100
|
- lib/dynamic_brcode/dynamic_brcode.rb
|
101
|
+
- lib/dynamic_brcode/rule.rb
|
104
102
|
- lib/error.rb
|
105
103
|
- lib/event/attempt.rb
|
106
104
|
- lib/event/event.rb
|
@@ -135,7 +133,6 @@ homepage: https://github.com/starkbank/sdk-ruby
|
|
135
133
|
licenses:
|
136
134
|
- MIT
|
137
135
|
metadata: {}
|
138
|
-
post_install_message:
|
139
136
|
rdoc_options: []
|
140
137
|
require_paths:
|
141
138
|
- lib
|
@@ -150,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
147
|
- !ruby/object:Gem::Version
|
151
148
|
version: '0'
|
152
149
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
154
|
-
signing_key:
|
150
|
+
rubygems_version: 3.6.9
|
155
151
|
specification_version: 4
|
156
152
|
summary: SDK to facilitate Ruby integrations with Stark Bank
|
157
153
|
test_files: []
|