starkinfra 0.1.0 → 0.2.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +121 -0
  3. data/lib/cardmethod/cardmethod.rb +56 -0
  4. data/lib/creditnote/creditnote.rb +37 -342
  5. data/lib/creditnote/invoice/description.rb +51 -0
  6. data/lib/creditnote/invoice/discount.rb +49 -0
  7. data/lib/creditnote/invoice/invoice.rb +123 -0
  8. data/lib/creditnote/log.rb +2 -2
  9. data/lib/creditnote/transfer.rb +90 -0
  10. data/lib/creditpreview/creditnotepreview.rb +85 -0
  11. data/lib/creditpreview/creditpreview.rb +83 -0
  12. data/lib/creditsigner/creditsigner.rb +57 -0
  13. data/lib/dynamicbrcode/dynamicbrcode.rb +350 -0
  14. data/lib/event/attempt.rb +4 -3
  15. data/lib/event/event.rb +10 -10
  16. data/lib/issuingbalance/issuingbalance.rb +4 -4
  17. data/lib/issuingcard/issuingcard.rb +32 -29
  18. data/lib/issuingcard/log.rb +2 -2
  19. data/lib/issuingholder/issuingholder.rb +13 -8
  20. data/lib/issuingholder/log.rb +2 -2
  21. data/lib/issuinginvoice/issuinginvoice.rb +23 -9
  22. data/lib/issuinginvoice/log.rb +2 -2
  23. data/lib/{issuingbin/issuingbin.rb → issuingproduct/issuingproduct.rb} +27 -30
  24. data/lib/issuingpurchase/issuingpurchase.rb +99 -23
  25. data/lib/issuingpurchase/log.rb +1 -1
  26. data/lib/issuingrule/issuingrule.rb +64 -18
  27. data/lib/issuingtransaction/issuingtransaction.rb +5 -7
  28. data/lib/issuingwithdrawal/issuingwithdrawal.rb +10 -6
  29. data/lib/merchantcategory/merchantcategory.rb +63 -0
  30. data/lib/merchantcountry/merchantcountry.rb +59 -0
  31. data/lib/pixbalance/pixbalance.rb +5 -5
  32. data/lib/pixchargeback/log.rb +3 -3
  33. data/lib/pixchargeback/pixchargeback.rb +32 -20
  34. data/lib/pixclaim/log.rb +8 -11
  35. data/lib/pixclaim/pixclaim.rb +42 -32
  36. data/lib/pixdirector/pixdirector.rb +9 -11
  37. data/lib/pixdomain/certificate.rb +1 -1
  38. data/lib/pixdomain/pixdomain.rb +4 -4
  39. data/lib/pixinfraction/log.rb +2 -2
  40. data/lib/pixinfraction/pixinfraction.rb +21 -13
  41. data/lib/pixkey/log.rb +5 -5
  42. data/lib/pixkey/pixkey.rb +10 -9
  43. data/lib/pixrequest/log.rb +2 -2
  44. data/lib/pixrequest/pixrequest.rb +51 -21
  45. data/lib/pixreversal/log.rb +2 -2
  46. data/lib/pixreversal/pixreversal.rb +48 -21
  47. data/lib/pixstatement/pixstatement.rb +12 -7
  48. data/lib/starkinfra.rb +27 -15
  49. data/lib/staticbrcode/staticbrcode.rb +164 -0
  50. data/lib/user/project.rb +1 -1
  51. data/lib/utils/api.rb +1 -0
  52. data/lib/utils/parse.rb +7 -3
  53. data/lib/utils/request.rb +1 -1
  54. data/lib/utils/resource.rb +1 -1
  55. data/lib/utils/sub_resource.rb +21 -22
  56. data/lib/webhook/webhook.rb +3 -3
  57. metadata +16 -4
  58. data/lib/issuingauthorization/issuingauthorization.rb +0 -141
@@ -1,43 +1,48 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
5
4
  require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
8
  # # PixClaim object
9
9
  #
10
- # PixClaims intend to transfer a PixClaim from one account to another.
10
+ # A Pix Claim is a request to transfer a Pix Key from an account hosted at another
11
+ # Pix participant to an account under your bank code. Pix Claims must always be requested by the claimer.
12
+ #
11
13
  # When you initialize a PixClaim, the entity will not be automatically
12
14
  # created in the Stark Infra API. The 'create' function sends the objects
13
15
  # to the Stark Infra API and returns the created object.
14
16
  #
15
17
  # ## Parameters (required):
16
- # - account_created [Date, DateTime or string]: opening Date or DateTime for the account claiming the PixClaim. ex: '2022-01-01'.
17
- # - account_number [string]: number of the account claiming the PixClaim. ex: '76543'.
18
- # - account_type [string]: type of the account claiming the PixClaim. Options: 'checking', 'savings', 'salary' or 'payment'.
19
- # - branch_code [string]: branch code of the account claiming the PixClaim. ex: 1234'.
20
- # - name [string]: holder's name of the account claiming the PixClaim. ex: 'Jamie Lannister'.
21
- # - tax_id [string]: holder's taxId of the account claiming the PixClaim (CPF/CNPJ). ex: '012.345.678-90'.
18
+ # - account_created [Date, DateTime or string]: opening Date or DateTime for the account claiming the PixKey. ex: '2022-01-01', Date.new(2020, 3, 10) or DateTime.new(2020, 3, 10, 10, 30, 0, 0)
19
+ # - account_number [string]: number of the account claiming the PixKey. ex: '76543'.
20
+ # - account_type [string]: type of the account claiming the PixKey. Options: 'checking', 'savings', 'salary' or 'payment'.
21
+ # - branch_code [string]: branch code of the account claiming the PixKey. ex: 1234'.
22
+ # - name [string]: holder's name of the account claiming the PixKey. ex: 'Jamie Lannister'.
23
+ # - tax_id [string]: holder's taxId of the account claiming the PixKey (CPF/CNPJ). ex: '012.345.678-90'.
22
24
  # - key_id [string]: id of the registered Pix Key to be claimed. Allowed keyTypes are CPF, CNPJ, phone number or email. ex: '+5511989898989'.
23
25
  #
26
+ # ## Parameters (optional):
27
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
28
+ #
24
29
  # ## Attributes (return-only):
25
30
  # - id [string]: unique id returned when the PixClaim is created. ex: '5656565656565656'
26
31
  # - status [string]: current PixClaim status. Options: 'created', 'failed', 'delivered', 'confirmed', 'success', 'canceled'
27
32
  # - type [string]: type of Pix Claim. Options: 'ownership', 'portability'.
28
33
  # - key_type [string]: keyType of the claimed Pix Key. Options: 'CPF', 'CNPJ', 'phone' or 'email'
29
- # - agent [string]: Options: 'claimer' if you requested the PixClaim or 'claimed' if you received a PixClaim request.
30
- # - bank_code [string]: bank_code of the account linked to the PixClaim being claimed. ex: '20018183'.
34
+ # - flow [string]: direction of the Pix Claim. Options: 'in' if you received the PixClaim or 'out' if you created the PixClaim.
35
+ # - claimer_bank_code [string]: bank_code of the Pix participant that created the PixClaim. ex: '20018183'.
31
36
  # - claimed_bank_code [string]: bank_code of the account donating the PixClaim. ex: '20018183'.
32
37
  # - created [DateTime]: creation datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
33
38
  # - updated [DateTime]: update datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
34
39
  class PixClaim < StarkInfra::Utils::Resource
35
40
  attr_reader :account_created, :account_number, :account_type, :branch_code, :name, :tax_id, :key_id,
36
- :id, :status, :type, :key_type, :agent, :bank_code, :claimed_bank_code, :created, :updated
41
+ :tags, :id, :status, :type, :key_type, :flow, :claimer_bank_code, :claimed_bank_code, :created, :updated
37
42
  def initialize(
38
43
  account_created:, account_number:, account_type:, branch_code:, name:,
39
- tax_id:, key_id:, id: nil, status: nil, type: nil, key_type: nil, agent: nil,
40
- bank_code: nil, claimed_bank_code: nil, created: nil, updated: nil
44
+ tax_id:, key_id:, tags: nil, id: nil, status: nil, type: nil, key_type: nil, flow: nil,
45
+ claimer_bank_code: nil, claimed_bank_code: nil, created: nil, updated: nil
41
46
  )
42
47
  super(id)
43
48
  @account_created = account_created
@@ -47,22 +52,24 @@ module StarkInfra
47
52
  @name = name
48
53
  @tax_id = tax_id
49
54
  @key_id = key_id
55
+ @tags = tags
50
56
  @status = status
51
57
  @type = type
52
58
  @key_type = key_type
53
- @agent = agent
54
- @bank_code = bank_code
59
+ @flow = flow
60
+ @claimer_bank_code = claimer_bank_code
55
61
  @claimed_bank_code = claimed_bank_code
56
62
  @created = StarkInfra::Utils::Checks.check_datetime(created)
57
63
  @updated = StarkInfra::Utils::Checks.check_datetime(updated)
58
64
  end
59
65
 
60
- # # Create a PixClaim
66
+ # # Create a PixClaim object
61
67
  #
62
- # Send a PixClaim object for creation in the Stark Infra API
68
+ # Create a PixClaim to request the transfer of a Pix Key from an account
69
+ # hosted at another Pix participants to an account under you bank code.
63
70
  #
64
71
  # ## Parameters (required):
65
- # - claim [PixClaim object]: PixClaim object to be created in the API. ex: PixClaim.new()
72
+ # - claim [PixClaim object]: PixClaim object to be created in the API.
66
73
  #
67
74
  # ## Parameters (optional):
68
75
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
@@ -73,9 +80,9 @@ module StarkInfra
73
80
  StarkInfra::Utils::Rest.post_single(entity: claim, user: user, **resource)
74
81
  end
75
82
 
76
- # # Retrieve a specific PixClaim
83
+ # # Retrieve a PixClaim object
77
84
  #
78
- # Receive a single PixClaim object previously created in the Stark Infra API by passing its id
85
+ # Retrieve a PixClaim object linked to your Workspace in the Stark Infra API by its id.
79
86
  #
80
87
  # ## Parameters (required):
81
88
  # - id [string]: object unique id. ex: '5656565656565656'
@@ -84,7 +91,7 @@ module StarkInfra
84
91
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
85
92
  #
86
93
  # ## Return:
87
- # - PixClaim object with updated attributes
94
+ # - PixClaim object that corresponds to the given id.
88
95
  def self.get(id, user: nil)
89
96
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
90
97
  end
@@ -98,19 +105,19 @@ module StarkInfra
98
105
  # - after [Date or string, default nil]: date filter for objects created or updated only after specified date. ex: Date.new(2020, 3, 10)
99
106
  # - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
100
107
  # - status [string, default nil]: filter for status of retrieved objects. Options: 'created', 'failed', 'delivered', 'confirmed', 'success', 'canceled'
101
- # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
102
108
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
103
109
  # - type [string, default nil]: filter for the type of retrieved PixClaims. Options: 'ownership' or 'portability'
104
- # - agent [string, default nil]: filter for the agent of retrieved PixClaims. Options: 'claimer' or 'claimed'.
105
110
  # - key_type [string, default nil]: filter for the PixKey type of retrieved PixClaims. Options: 'cpf', 'cnpj', 'phone', 'email' and 'evp',
106
111
  # - key_id [string, default nil]: filter PixClaims linked to a specific PixKey id. Example: '+5511989898989'.
112
+ # - flow [string, default nil]: direction of the Pix Claim. Options: 'in' if you received the PixClaim or 'out' if you created the PixClaim.
113
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
107
114
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
108
115
  #
109
116
  # ## Return:
110
117
  # - generator of PixClaim objects with updated attributes
111
118
  def self.query(
112
119
  limit: nil, after: nil, before: nil, status: nil, ids: nil,
113
- type: nil, agent: nil, key_type: nil, key_id: nil, user: nil
120
+ type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
114
121
  )
115
122
  after = StarkInfra::Utils::Checks.check_date(after)
116
123
  before = StarkInfra::Utils::Checks.check_date(before)
@@ -121,7 +128,8 @@ module StarkInfra
121
128
  status: status,
122
129
  ids: ids,
123
130
  type: type,
124
- agent: agent,
131
+ flow: flow,
132
+ tags: tags,
125
133
  key_type: key_type,
126
134
  key_id: key_id,
127
135
  user: user,
@@ -140,12 +148,12 @@ module StarkInfra
140
148
  # - after [Date or string, default nil]: date filter for objects created or updated only after specified date. ex: Date.new(2020, 3, 10)
141
149
  # - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
142
150
  # - status [string, default nil]: filter for status of retrieved objects. Options: 'created', 'failed', 'delivered', 'confirmed', 'success', 'canceled'
143
- # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
144
151
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
145
152
  # - type [string, default nil]: filter for the type of retrieved PixClaims. Options: 'ownership' or 'portability'
146
- # - agent [string, default nil]: filter for the agent of retrieved PixClaims. Options: 'claimer' or 'claimed'.
147
153
  # - key_type [string, default nil]: filter for the PixKey type of retrieved PixClaims. Options: 'cpf', 'cnpj', 'phone', 'email' and 'evp',
148
154
  # - key_id [string, default nil]: filter PixClaims linked to a specific PixKey id. Example: '+5511989898989'.
155
+ # - flow [string, default nil]: direction of the Pix Claim. Options: 'in' if you received the PixClaim or 'out' if you created the PixClaim.
156
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
149
157
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
150
158
  #
151
159
  # ## Return:
@@ -153,7 +161,7 @@ module StarkInfra
153
161
  # - cursor to retrieve the next page of PixClaim objects
154
162
  def self.page(
155
163
  cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil,
156
- type: nil, agent: nil, key_type: nil, key_id: nil, user: nil
164
+ type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
157
165
  )
158
166
  after = StarkInfra::Utils::Checks.check_date(after)
159
167
  before = StarkInfra::Utils::Checks.check_date(before)
@@ -165,7 +173,8 @@ module StarkInfra
165
173
  status: status,
166
174
  ids: ids,
167
175
  type: type,
168
- agent: agent,
176
+ flow: flow,
177
+ tags: tags,
169
178
  key_type: key_type,
170
179
  key_id: key_id,
171
180
  user: user,
@@ -202,6 +211,7 @@ module StarkInfra
202
211
  resource_name: 'PixClaim',
203
212
  resource_maker: proc { |json|
204
213
  PixClaim.new(
214
+ id: json['id'],
205
215
  account_created: json['account_created'],
206
216
  account_number: json['account_number'],
207
217
  account_type: json['account_type'],
@@ -209,12 +219,12 @@ module StarkInfra
209
219
  name: json['name'],
210
220
  tax_id: json['tax_id'],
211
221
  key_id: json['key_id'],
212
- id: json['id'],
222
+ tags: json['tags'],
213
223
  status: json['status'],
214
224
  type: json['type'],
215
225
  key_type: json['key_type'],
216
- agent: json['agent'],
217
- bank_code: json['bank_code'],
226
+ flow: json['flow'],
227
+ claimer_bank_code: json['claimer_bank_code'],
218
228
  claimed_bank_code: json['claimed_bank_code'],
219
229
  created: json['created'],
220
230
  updated: json['updated']
@@ -1,16 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
4
+ require_relative('../utils/resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # PixDirector object
8
8
  #
9
9
  # Mandatory data that must be registered within the Central Bank for
10
- # emergency contact purposes. When you initialize a PixDirector,
11
- # the entity will not be automatically created in the Stark Infra API.
12
- # The 'create' function sends the objects to the Stark Infra API and
13
- # returns the list of created objects.
10
+ # emergency contact purposes.
11
+ #
12
+ # When you initialize a PixDirector, the entity will not be automatically
13
+ # created in the Stark Infra API. The 'create' function sends the objects
14
+ # to the Stark Infra API and returns the created object.
14
15
  #
15
16
  # ## Parameters (required):
16
17
  # - name [string]: name of the PixDirector. ex: 'Edward Stark'.
@@ -22,12 +23,10 @@ module StarkInfra
22
23
  # - team_phones [list of strings]: list of phones of the team. ex: ['+5511988889999', '+5511988889998']
23
24
  #
24
25
  # ## Attributes (return-only):
25
- # - id [string]: unique id returned when the PixDirector is created. ex: '5656565656565656'
26
26
  # - status [string]: current PixDirector status. ex: 'success'
27
- class PixDirector < StarkInfra::Utils::Resource
28
- attr_reader :name, :tax_id, :phone, :email, :password, :team_email, :team_phones, :id, :status
29
- def initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, id: nil, status: nil)
30
- super(id)
27
+ class PixDirector < StarkInfra::Utils::SubResource
28
+ attr_reader :name, :tax_id, :phone, :email, :password, :team_email, :team_phones, :status
29
+ def initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, status: nil)
31
30
  @name = name
32
31
  @tax_id = tax_id
33
32
  @phone = phone
@@ -59,7 +58,6 @@ module StarkInfra
59
58
  resource_name: 'PixDirector',
60
59
  resource_maker: proc { |json|
61
60
  PixDirector.new(
62
- id: json['id'],
63
61
  name: json['name'],
64
62
  tax_id: json['tax_id'],
65
63
  phone: json['phone'],
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
4
+ require_relative('../utils/resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # PixDomain::Certificate object
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
- require_relative('../utils/rest')
5
3
  require_relative('certificate')
4
+ require_relative('../utils/rest')
5
+ require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
8
  # # PixDomain object
9
9
  #
10
- # The PixDomain object displays the domain name and the QR Code
11
- # domain certificate of Pix participants.
10
+ # The PixDomain object displays the domain name and the QR Code domain
11
+ # certificate of Pix participants.
12
12
  # All certificates must be registered with the Central Bank.
13
13
  #
14
14
  # ## Attributes (return-only):
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
3
+ require_relative('pixinfraction')
4
4
  require_relative('../utils/rest')
5
5
  require_relative('../utils/checks')
6
- require_relative('pixinfraction')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class PixInfraction
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
5
4
  require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
8
  # # PixInfraction object
@@ -19,34 +19,34 @@ module StarkInfra
19
19
  #
20
20
  # ## Parameters (optional):
21
21
  # - description [string, default nil]: description for any details that can help with the infraction investigation.
22
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
22
23
  #
23
24
  # ## Attributes (return-only):
24
25
  # - id [string]: unique id returned when the PixInfraction is created. ex: '5656565656565656'
25
26
  # - credited_bank_code [string]: bank_code of the credited Pix participant in the reported transaction. ex: '20018183'
26
27
  # - debited_bank_code [string]: bank_code of the debited Pix participant in the reported transaction. ex: '20018183'
27
- # - agent [string]: Options: 'reporter' if you created the PixInfraction, 'reported' if you received the PixInfraction.
28
+ # - flow [string]: direction of the PixInfraction flow. Options: 'out' if you created the PixInfraction, 'in' if you received the PixInfraction.
28
29
  # - analysis [string]: analysis that led to the result.
29
- # - bacen_id [string]: central bank's unique UUID that identifies the infraction report.
30
30
  # - reported_by [string]: agent that reported the PixInfraction. Options: 'debited', 'credited'.
31
31
  # - result [string]: result after the analysis of the PixInfraction by the receiving party. Options: 'agreed', 'disagreed'
32
32
  # - status [string]: current PixInfraction status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
33
33
  # - created [DateTime]: creation datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
34
34
  # - updated [DateTime]: latest update datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
35
35
  class PixInfraction < StarkInfra::Utils::Resource
36
- attr_reader :reference_id, :type, :description, :id, :credited_bank_code, :agent, :analysis, :bacen_id,
36
+ attr_reader :reference_id, :type, :description, :tags, :id, :credited_bank_code, :flow, :analysis,
37
37
  :debited_bank_code, :reported_by, :result, :status, :created, :updated
38
38
  def initialize(
39
- reference_id:, type:, description:, id: nil, credited_bank_code: nil, agent: nil, analysis: nil, bacen_id: nil,
40
- debited_bank_code: nil, reported_by: nil, result: nil, status: nil, created: nil, updated: nil
39
+ reference_id:, type:, description: nil, id: nil, tags: nil, credited_bank_code: nil, debited_bank_code: nil,
40
+ flow: nil, analysis: nil, reported_by: nil, result: nil, status: nil, created: nil, updated: nil
41
41
  )
42
42
  super(id)
43
43
  @reference_id = reference_id
44
44
  @type = type
45
45
  @description = description
46
+ @tags = tags
46
47
  @credited_bank_code = credited_bank_code
47
- @agent = agent
48
+ @flow = flow
48
49
  @analysis = analysis
49
- @bacen_id = bacen_id
50
50
  @debited_bank_code = debited_bank_code
51
51
  @reported_by = reported_by
52
52
  @result = result
@@ -98,11 +98,13 @@ module StarkInfra
98
98
  # - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
99
99
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
100
100
  # - type [string]: filter for the type of retrieved PixInfractions. Options: 'fraud', 'reversal', 'reversalChargeback'
101
+ # - flow [string, default nil]: direction of the PixInfraction flow. Options: 'out' if you created the PixInfraction, 'in' if you received the PixInfraction.
102
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
101
103
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
102
104
  #
103
105
  # ## Return:
104
106
  # - generator of PixInfraction objects with updated attributes
105
- def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, type: nil, user: nil)
107
+ def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, type: nil, flow: nil, tags: nil, user: nil)
106
108
  after = StarkInfra::Utils::Checks.check_date(after)
107
109
  before = StarkInfra::Utils::Checks.check_date(before)
108
110
  StarkInfra::Utils::Rest.get_stream(
@@ -112,6 +114,8 @@ module StarkInfra
112
114
  status: status,
113
115
  ids: ids,
114
116
  type: type,
117
+ flow: flow,
118
+ tags: tags,
115
119
  user: user,
116
120
  **resource
117
121
  )
@@ -130,12 +134,14 @@ module StarkInfra
130
134
  # - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
131
135
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
132
136
  # - type [string, default nil]: filter for the type of retrieved PixInfractions. Options: 'fraud', 'reversal', 'reversalChargeback'
137
+ # - flow [string, default nil]: direction of the PixInfraction flow. Options: 'out' if you created the PixInfraction, 'in' if you received the PixInfraction.
138
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
133
139
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
134
140
  #
135
141
  # ## Return:
136
142
  # - list of PixInfraction objects with updated attributes
137
143
  # - cursor to retrieve the next page of PixInfraction objects
138
- def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, type: nil, user: nil)
144
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, type: nil, user: nil)
139
145
  after = StarkInfra::Utils::Checks.check_date(after)
140
146
  before = StarkInfra::Utils::Checks.check_date(before)
141
147
  StarkInfra::Utils::Rest.get_page(
@@ -145,6 +151,8 @@ module StarkInfra
145
151
  before: before,
146
152
  status: status,
147
153
  ids: ids,
154
+ flow: flow,
155
+ tags: tags,
148
156
  type: type,
149
157
  user: user,
150
158
  **resource
@@ -194,11 +202,11 @@ module StarkInfra
194
202
  reference_id: json['reference_id'],
195
203
  type: json['type'],
196
204
  description: json['description'],
205
+ tags: json['tags'],
197
206
  credited_bank_code: json['credited_bank_code'],
198
- agent: json['agent'],
199
- analysis: json['analysis'],
200
- bacen_id: json['bacen_id'],
201
207
  debited_bank_code: json['debited_bank_code'],
208
+ flow: json['flow'],
209
+ analysis: json['analysis'],
202
210
  reported_by: json['reported_by'],
203
211
  result: json['result'],
204
212
  status: json['status'],
data/lib/pixkey/log.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
3
+ require_relative('pixkey')
4
4
  require_relative('../utils/rest')
5
5
  require_relative('../utils/checks')
6
- require_relative('pixkey')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class PixKey
@@ -54,7 +54,7 @@ module StarkInfra
54
54
  # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
55
55
  # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
56
56
  # - types [list of strings, default nil]: filter PixKey Logs by their types. Options: 'created', 'registered', 'updated', 'failed', 'canceling', 'canceled'.
57
- # - key_ids [list of strings, default nil]: list of PixKey ids to filter retrieved objects. ex: %w[5656565656565656 4545454545454545]
57
+ # - key_ids [list of strings, default nil]: list of PixKey ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
58
58
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
59
59
  #
60
60
  # ## Return:
@@ -85,8 +85,8 @@ module StarkInfra
85
85
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
86
86
  # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
87
87
  # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
88
- # - types [list of strings]: filter PixKey Logs by their types. Options: 'created', 'registered', 'updated', 'failed', 'canceling', 'canceled'.
89
- # - key_ids [list of strings, default nil]: list of PixKey ids to filter retrieved objects. ex: %w[5656565656565656 4545454545454545]
88
+ # - types [list of strings, default nil]: filter PixKey Logs by their types. Options: 'created', 'registered', 'updated', 'failed', 'canceling', 'canceled'.
89
+ # - key_ids [list of strings, default nil]: list of PixKey ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
90
90
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
91
91
  #
92
92
  # ## Return:
data/lib/pixkey/pixkey.rb CHANGED
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
5
4
  require_relative('../utils/checks')
5
+ require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
8
  # # PixKey object
9
9
  # PixKeys link bank account information to key ids.
10
10
  # Key ids are a convenient way to search and pass bank account information.
11
+ #
11
12
  # When you initialize a Pix Key, the entity will not be automatically
12
13
  # created in the Stark Infra API. The 'create' function sends the objects
13
14
  # to the Stark Infra API and returns the created object.
14
15
  #
15
16
  # ## Parameters (required):
16
- # - account_created [DateTime, Date or string]: opening Date or DateTime for the linked account. ex: '2022-01-01T12:00:00:00'.
17
+ # - account_created [DateTime or string]: opening Date or DateTime for the linked account. ex: '2020-03-10T10:30:00.000000+00:00' or DateTime.new(2020, 3, 10, 10, 30, 0, 0).
17
18
  # - account_number [string]: number of the linked account. ex: '76543'.
18
19
  # - account_type [string]: type of the linked account. Options: 'checking', 'savings', 'salary' or 'payment'.
19
20
  # - branch_code [string]: branch code of the linked account. ex: '1234'.
@@ -77,7 +78,7 @@ module StarkInfra
77
78
  # Receive a single PixKey object previously created in the Stark Infra API by passing its id
78
79
  #
79
80
  # ## Parameters (required):
80
- # - id [string]: object unique id. ex: '5656565656565656'
81
+ # - id [string]: object unique id. ex: '+5511989898989'
81
82
  # - payer_id [string]: tax id (CPF/CNPJ) of the individual or business requesting the PixKey information. This id is used by the Central Bank to limit request rates. ex: '20.018.183/0001-80'.
82
83
  #
83
84
  # ## Parameters (optional):
@@ -106,7 +107,7 @@ module StarkInfra
106
107
  # - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
107
108
  # - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
108
109
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
109
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
110
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['+5511989898989', '+5511967676767']
110
111
  # - type [string, default nil]: filter for the type of retrieved PixKeys. Options: 'cpf', 'cnpj', 'phone', 'email' and 'evp'
111
112
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
112
113
  #
@@ -140,7 +141,7 @@ module StarkInfra
140
141
  # - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
141
142
  # - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
142
143
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
143
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
144
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['+5511989898989', '+5511967676767']
144
145
  # - type [string, default nil]: filter for the type of retrieved PixKeys. Options: 'cpf', 'cnpj', 'phone', 'email' and 'evp'
145
146
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
146
147
  #
@@ -169,11 +170,11 @@ module StarkInfra
169
170
  # Respond to a received PixKey.
170
171
  #
171
172
  # ## Parameters (required):
172
- # - id [string]: PixKey unique id. ex: '5656565656565656'
173
+ # - id [string]: PixKey unique id. ex: '+5511989898989'
173
174
  # - reason [string]: reason why the PixKey is being patched. Options: 'branchTransfer', 'reconciliation' or 'userRequested'.
174
175
  #
175
176
  # ## Parameters (optional):
176
- # - account_created [Date, DateTime or string, default nil]: opening Date or DateTime for the account to be linked. ex: '2022-01-01.
177
+ # - account_created [Date, DateTime or string, default nil]: opening Date or DateTime for the account to be linked. ex: '2022-01-01', Date.new(2020, 3, 10) or DateTime.new(2020, 3, 10, 10, 30, 0, 0)
177
178
  # - account_number [string, default nil]: number of the account to be linked. ex: '76543'.
178
179
  # - account_type [string, default nil]: type of the account to be linked. Options: 'checking', 'savings', 'salary' or 'payment'.
179
180
  # - branch_code [string, default nil]: branch code of the account to be linked. ex: 1234'.
@@ -201,7 +202,7 @@ module StarkInfra
201
202
  # Cancel a PixKey entity previously created in the Stark Infra API
202
203
  #
203
204
  # ## Parameters (required):
204
- # - id [string]: PixKey unique id. ex: '5656565656565656'
205
+ # - id [string]: PixKey unique id. ex: '+5511989898989'
205
206
  #
206
207
  # ## Parameters (optional):
207
208
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
@@ -217,13 +218,13 @@ module StarkInfra
217
218
  resource_name: 'PixKey',
218
219
  resource_maker: proc { |json|
219
220
  PixKey.new(
221
+ id: json['id'],
220
222
  account_created: json['account_created'],
221
223
  account_number: json['account_number'],
222
224
  account_type: json['account_type'],
223
225
  branch_code: json['branch_code'],
224
226
  name: json['name'],
225
227
  tax_id: json['tax_id'],
226
- id: json['id'],
227
228
  tags: json['tags'],
228
229
  owned: json['owned'],
229
230
  owner_type: json['owner_type'],
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
3
+ require_relative('pixrequest')
4
4
  require_relative('../utils/rest')
5
5
  require_relative('../utils/checks')
6
- require_relative('pixrequest')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class PixRequest