starkinfra 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +125 -0
  3. data/lib/cardmethod/cardmethod.rb +56 -0
  4. data/lib/creditholmes/creditholmes.rb +160 -0
  5. data/lib/creditnote/creditnote.rb +51 -355
  6. data/lib/creditnote/invoice/description.rb +51 -0
  7. data/lib/creditnote/invoice/discount.rb +49 -0
  8. data/lib/creditnote/invoice/invoice.rb +124 -0
  9. data/lib/creditnote/log.rb +18 -19
  10. data/lib/creditnote/transfer.rb +90 -0
  11. data/lib/creditpreview/creditnotepreview.rb +85 -0
  12. data/lib/creditpreview/creditpreview.rb +77 -0
  13. data/lib/creditsigner/creditsigner.rb +57 -0
  14. data/lib/dynamicbrcode/dynamicbrcode.rb +350 -0
  15. data/lib/event/attempt.rb +5 -4
  16. data/lib/event/event.rb +11 -11
  17. data/lib/individualdocument/individualdocument.rb +165 -0
  18. data/lib/individualdocument/log.rb +125 -0
  19. data/lib/individualidentity/individualidentity.rb +193 -0
  20. data/lib/individualidentity/log.rb +124 -0
  21. data/lib/issuingbalance/issuingbalance.rb +4 -4
  22. data/lib/issuingcard/issuingcard.rb +35 -33
  23. data/lib/issuingcard/log.rb +21 -21
  24. data/lib/issuingdesign/issuingdesign.rb +138 -0
  25. data/lib/issuingembossingkit/issuingembossingkit.rb +121 -0
  26. data/lib/issuingembossingrequest/issuingembossingrequest.rb +210 -0
  27. data/lib/issuingembossingrequest/log.rb +128 -0
  28. data/lib/issuingholder/issuingholder.rb +21 -15
  29. data/lib/issuingholder/log.rb +19 -19
  30. data/lib/issuinginvoice/issuinginvoice.rb +29 -14
  31. data/lib/issuinginvoice/log.rb +18 -18
  32. data/lib/{issuingbin/issuingbin.rb → issuingproduct/issuingproduct.rb} +27 -30
  33. data/lib/issuingpurchase/issuingpurchase.rb +111 -31
  34. data/lib/issuingpurchase/log.rb +16 -16
  35. data/lib/issuingrestock/issuingrestock.rb +162 -0
  36. data/lib/issuingrestock/log.rb +127 -0
  37. data/lib/issuingrule/issuingrule.rb +64 -18
  38. data/lib/issuingstock/issuingstock.rb +138 -0
  39. data/lib/issuingstock/log.rb +130 -0
  40. data/lib/issuingtransaction/issuingtransaction.rb +12 -13
  41. data/lib/issuingwithdrawal/issuingwithdrawal.rb +12 -11
  42. data/lib/merchantcategory/merchantcategory.rb +63 -0
  43. data/lib/merchantcountry/merchantcountry.rb +59 -0
  44. data/lib/pixbalance/pixbalance.rb +5 -5
  45. data/lib/pixchargeback/log.rb +15 -15
  46. data/lib/pixchargeback/pixchargeback.rb +32 -20
  47. data/lib/pixclaim/log.rb +21 -24
  48. data/lib/pixclaim/pixclaim.rb +44 -34
  49. data/lib/pixdirector/pixdirector.rb +9 -11
  50. data/lib/pixdomain/certificate.rb +1 -1
  51. data/lib/pixdomain/pixdomain.rb +5 -5
  52. data/lib/pixinfraction/log.rb +20 -20
  53. data/lib/pixinfraction/pixinfraction.rb +23 -15
  54. data/lib/pixkey/log.rb +23 -23
  55. data/lib/pixkey/pixkey.rb +14 -12
  56. data/lib/pixrequest/log.rb +24 -20
  57. data/lib/pixrequest/pixrequest.rb +54 -21
  58. data/lib/pixreversal/log.rb +3 -3
  59. data/lib/pixreversal/pixreversal.rb +48 -21
  60. data/lib/pixstatement/pixstatement.rb +13 -8
  61. data/lib/starkinfra.rb +40 -15
  62. data/lib/staticbrcode/staticbrcode.rb +170 -0
  63. data/lib/user/project.rb +1 -1
  64. data/lib/utils/api.rb +1 -0
  65. data/lib/utils/bacenid.rb +1 -1
  66. data/lib/utils/parse.rb +7 -3
  67. data/lib/utils/request.rb +1 -1
  68. data/lib/utils/resource.rb +1 -1
  69. data/lib/utils/sub_resource.rb +21 -22
  70. data/lib/webhook/webhook.rb +11 -11
  71. metadata +29 -4
  72. data/lib/issuingauthorization/issuingauthorization.rb +0 -141
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative('IssuingEmbossingRequest')
4
+ require_relative('../utils/rest')
5
+ require_relative('../utils/checks')
6
+ require_relative('../utils/resource')
7
+
8
+ module StarkInfra
9
+ class IssuingEmbossingRequest
10
+ # # IssuingEmbossingRequest::Log object
11
+ #
12
+ # Every time an IssuingEmbossingRequest entity is updated, a corresponding IssuingEmbossingRequest::Log is generated for the entity. This log
13
+ # is never generated by the user, but it can be retrieved to check additional information on the IssuingEmbossingRequest.
14
+ #
15
+ # ## Attributes (return-only):
16
+ # - id [string]: unique id returned when the log is created. ex: '5656565656565656'
17
+ # - request [IssuingEmbossingRequest]: IssuingEmbossingRequest entity to which the log refers to.
18
+ # - errors [list of string]: list of errors linked to this IssuingEmbossingRequest event.
19
+ # - type [string]: type of the IssuingEmbossingRequest event which triggered the log creation. ex: "created", "sending", "sent", "processing", "success", "failed"
20
+ # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
21
+ class Log < StarkInfra::Utils::Resource
22
+ attr_reader :id, :request,:errors,:type, :created
23
+ def initialize(id: nil, request: nil, errors: nil, type: nil, created: nil)
24
+ super(id)
25
+ @request = request
26
+ @type = type
27
+ @errors = errors
28
+ @created = StarkInfra::Utils::Checks.check_datetime(created)
29
+ end
30
+
31
+ # # Retrieve a specific IssuingEmbossingRequest::Log
32
+ #
33
+ # Receive a single IssuingEmbossingRequest::Log object previously created by the Stark Infra API by passing its id
34
+ #
35
+ # ## Parameters (required):
36
+ # - id [string]: object unique id. ex: '5656565656565656'
37
+ #
38
+ # ## Parameters (optional):
39
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
40
+ #
41
+ # ## Return:
42
+ # - IssuingEmbossingRequest::Log object with updated attributes
43
+ def self.get(id, user: nil)
44
+ StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
45
+ end
46
+
47
+ # # Retrieve IssuingEmbossingRequest::Logs
48
+ #
49
+ # Receive a generator of IssuingEmbossingRequest::Log objects previously created in the Stark Infra API
50
+ #
51
+ # ## Parameters (optional):
52
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
53
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
54
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
55
+ # - types [list of strings, default nil]: filter for log event types. ex: ["created", "sending", "sent", "processing", "success", "failed"]
56
+ # - request_ids [list of strings, default nil]: list of IssuingEmbossingRequest ids to filter logs. ex: ['5656565656565656', '4545454545454545']
57
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
58
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
59
+ #
60
+ # ## Return:
61
+ # - generator of IssuingEmbossingRequest::Log objects with updated attributes
62
+ def self.query(limit: nil, after: nil, before: nil, types: nil, request_ids: nil, ids: nil, user: nil)
63
+ after = StarkInfra::Utils::Checks.check_date(after)
64
+ before = StarkInfra::Utils::Checks.check_date(before)
65
+ StarkInfra::Utils::Rest.get_stream(
66
+ limit: limit,
67
+ after: after,
68
+ before: before,
69
+ types: types,
70
+ request_ids: request_ids,
71
+ ids: ids,
72
+ user: user,
73
+ **resource
74
+ )
75
+ end
76
+
77
+ # # Retrieve paged IssuingEmbossingRequest::Logs
78
+ #
79
+ # Receive a list of up to 100 IssuingEmbossingRequest::Log objects previously created in the Stark Infra API and the cursor to the next page.
80
+ # Use this function instead of query if you want to manually page your logs.
81
+ #
82
+ # ## Parameters (optional):
83
+ # - cursor [string, default nil]: cursor returned on the previous page function call
84
+ # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
85
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
86
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
87
+ # - types [list of strings, default nil]: filter for log event types. ex: ["created", "sending", "sent", "processing", "success", "failed"]
88
+ # - request_ids [list of strings, default nil]: list of IssuingEmbossingRequest ids to filter logs. ex: ['5656565656565656', '4545454545454545']
89
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
90
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
91
+ #
92
+ # ## Return:
93
+ # - list of IssuingEmbossingRequest::Log objects with updated attributes
94
+ # - Cursor to retrieve the next page of Log objects
95
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, request_ids: nil, ids: nil, user: nil)
96
+ after = StarkInfra::Utils::Checks.check_date(after)
97
+ before = StarkInfra::Utils::Checks.check_date(before)
98
+ StarkInfra::Utils::Rest.get_page(
99
+ cursor: cursor,
100
+ limit: limit,
101
+ after: after,
102
+ before: before,
103
+ types: types,
104
+ request_ids: request_ids,
105
+ ids: ids,
106
+ user: user,
107
+ **resource
108
+ )
109
+ end
110
+
111
+ def self.resource
112
+ request_maker = StarkInfra::IssuingEmbossingRequest.resource[:resource_maker]
113
+ {
114
+ resource_name: 'IssuingEmbossingRequestLog',
115
+ resource_maker: proc { |json|
116
+ Log.new(
117
+ id: json['id'],
118
+ request: StarkInfra::Utils::API.from_api_json(request_maker, json['request']),
119
+ errors: json['errors'],
120
+ created: json['created'],
121
+ type: json['type']
122
+ )
123
+ }
124
+ }
125
+ end
126
+ end
127
+ end
128
+ end
@@ -1,14 +1,18 @@
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
  # # IssuingHolder object
9
9
  #
10
10
  # The IssuingHolder describes a card holder that may group several cards.
11
11
  #
12
+ # When you initialize a IssuingHolder, 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.
15
+ #
12
16
  # ## Parameters (required):
13
17
  # - name [string]: card holder name.
14
18
  # - tax_id [string]: card holder tax ID
@@ -16,7 +20,7 @@ module StarkInfra
16
20
  #
17
21
  # ## Parameters (optional):
18
22
  # - rules [list of IssuingRule objects, default nil]: [EXPANDABLE] list of holder spending rules.
19
- # - tags [list of strings, default []]: list of strings for tagging. ex: ['travel', 'food']
23
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
20
24
  #
21
25
  # ## Attributes (return-only):
22
26
  # - id [string]: unique id returned when IssuingHolder is created. ex: '5656565656565656'
@@ -24,17 +28,17 @@ module StarkInfra
24
28
  # - updated [DateTime]: latest update datetime for the IssuingHolder. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
25
29
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
26
30
  class IssuingHolder < StarkInfra::Utils::Resource
27
- attr_reader :id, :name, :tax_id, :external_id, :status, :rules, :tags, :updated, :created
31
+ attr_reader :id, :name, :tax_id, :external_id, :rules, :tags, :status, :updated, :created
28
32
  def initialize(
29
- name:, tax_id:, external_id:, id: nil, status: nil, rules: nil, tags: nil, updated: nil, created: nil
33
+ name:, tax_id:, external_id:, rules: nil, tags: nil, id: nil, status: nil, updated: nil, created: nil
30
34
  )
31
35
  super(id)
32
36
  @name = name
33
37
  @tax_id = tax_id
34
38
  @external_id = external_id
35
- @status = status
36
39
  @rules = StarkInfra::IssuingRule.parse_rules(rules)
37
40
  @tags = tags
41
+ @status = status
38
42
  @created = StarkInfra::Utils::Checks.check_datetime(created)
39
43
  @updated = StarkInfra::Utils::Checks.check_datetime(updated)
40
44
  end
@@ -47,12 +51,13 @@ module StarkInfra
47
51
  # - holders [list of IssuingHolder objects]: list of IssuingHolder objects to be created in the API
48
52
  #
49
53
  # ## Parameters (optional):
54
+ # - expand [list of strings, default nil]: fields to expand information. Options: ['rules']
50
55
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
51
56
  #
52
57
  # ## Return:
53
58
  # - list of IssuingHolder objects with updated attributes
54
- def self.create(holders:, user: nil)
55
- StarkInfra::Utils::Rest.post(entities: holders, user: user, **resource)
59
+ def self.create(holders:, expand: nil, user: nil)
60
+ StarkInfra::Utils::Rest.post(entities: holders, expand: expand, user: user, **resource)
56
61
  end
57
62
 
58
63
  # # Retrieve a specific IssuingHolder
@@ -78,12 +83,12 @@ module StarkInfra
78
83
  #
79
84
  # ## Parameters (optional):
80
85
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
81
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
82
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
83
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
86
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
87
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
84
88
  # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['active', 'blocked', 'canceled']
85
89
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
86
90
  # - expand [string, default nil]: fields to expand information. ex: ['rules']
91
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
87
92
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
88
93
  #
89
94
  # ## Return:
@@ -106,17 +111,18 @@ module StarkInfra
106
111
 
107
112
  # # Retrieve paged IssuingHolders
108
113
  #
109
- # Receive a list of IssuingHolder objects previously created in the Stark Infra API and the cursor to the next page.
114
+ # Receive a list of up to 100 IssuingHolders objects previously created in the Stark Infra API and the cursor to the next page.
115
+ # Use this function instead of query if you want to manually page your logs.
110
116
  #
111
117
  # ## Parameters (optional):
112
118
  # - cursor [string, default nil]: cursor returned on the previous page function call.
113
119
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
114
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
115
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
116
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
120
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
121
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
117
122
  # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['active', 'blocked', 'canceled']
118
123
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
119
124
  # - expand [string, default nil]: fields to expand information. ex: ['rules']
125
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
120
126
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
121
127
  #
122
128
  # ## Return:
@@ -193,9 +199,9 @@ module StarkInfra
193
199
  name: json['name'],
194
200
  tax_id: json['tax_id'],
195
201
  external_id: json['external_id'],
196
- status: json['status'],
197
202
  rules: json['rules'],
198
203
  tags: json['tags'],
204
+ status: json['status'],
199
205
  updated: json['updated'],
200
206
  created: json['created']
201
207
  )
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
3
+ require_relative('issuingholder')
4
4
  require_relative('../utils/rest')
5
5
  require_relative('../utils/checks')
6
- require_relative('issuingholder')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class IssuingHolder
10
10
  # # IssuingHolder::Log object
11
11
  #
12
- # Every time an IssuingHolder entity is updated, a corresponding IssuingHolder.Log is generated for the entity. This
12
+ # Every time an IssuingHolder entity is updated, a corresponding IssuingHolder::Log is generated for the entity. This
13
13
  # log is never generated by the user, but it can be retrieved to check additional information on the IssuingHolder.
14
14
  #
15
- # ## Attributes:
15
+ # ## Attributes (return-only):
16
16
  # - id [string]: unique id returned when the log is created. ex: '5656565656565656'
17
17
  # - holder [IssuingHolder]: IssuingHolder entity to which the log refers to.
18
18
  # - type [string]: type of the IssuingHolder event which triggered the log creation. ex: 'blocked', 'canceled', 'created', 'unblocked', 'updated'
@@ -26,9 +26,9 @@ module StarkInfra
26
26
  @created = StarkInfra::Utils::Checks.check_datetime(created)
27
27
  end
28
28
 
29
- # # Retrieve a specific Log
29
+ # # Retrieve a specific IssuingHolder::Log
30
30
  #
31
- # Receive a single Log object previously created by the Stark Infra API by passing its id
31
+ # Receive a single IssuingHolder::Log object previously created by the Stark Infra API by passing its id
32
32
  #
33
33
  # ## Parameters (required):
34
34
  # - id [string]: object unique id. ex: '5656565656565656'
@@ -37,26 +37,26 @@ module StarkInfra
37
37
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
38
38
  #
39
39
  # ## Return:
40
- # - Log object with updated attributes
40
+ # - IssuingHolder::Log object with updated attributes
41
41
  def self.get(id, user: nil)
42
42
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
43
43
  end
44
44
 
45
- # # Retrieve Logs
45
+ # # Retrieve IssuingHolder::Logs
46
46
  #
47
- # Receive a generator of Log objects previously created in the Stark Infra API
47
+ # Receive a generator of IssuingHolder::Log objects previously created in the Stark Infra API
48
48
  #
49
49
  # ## Parameters (optional):
50
50
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Max = 100. ex: 35
51
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
52
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
53
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
51
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
52
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
54
53
  # - types [list of strings, default nil]: filter for log event types. ex: ['created', 'blocked']
55
54
  # - holder_ids [list of strings, default nil]: list of IssuingHolder ids to filter logs. ex: ['5656565656565656', '4545454545454545']
55
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
56
56
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
57
57
  #
58
58
  # ## Return:
59
- # - generator of Log objects with updated attributes
59
+ # - generator of IssuingHolder::Log objects with updated attributes
60
60
  def self.query(limit: nil, after: nil, before: nil, types: nil, holder_ids: nil, user: nil)
61
61
  after = StarkInfra::Utils::Checks.check_date(after)
62
62
  before = StarkInfra::Utils::Checks.check_date(before)
@@ -71,23 +71,23 @@ module StarkInfra
71
71
  )
72
72
  end
73
73
 
74
- # # Retrieve paged Logs
74
+ # # Retrieve paged IssuingHolder::Logs
75
75
  #
76
- # Receive a list of up to 100 Log objects previously created in the Stark Infra API and the cursor to the next page.
76
+ # Receive a list of up to 100 IssuingHolder::Log objects previously created in the Stark Infra API and the cursor to the next page.
77
77
  # Use this function instead of query if you want to manually page your holders.
78
78
  #
79
79
  # ## Parameters (optional):
80
80
  # - cursor [string, default nil]: cursor returned on the previous page function call
81
81
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
82
- # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
83
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
84
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
82
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
83
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
85
84
  # - types [list of strings, default nil]: filter for log event types. ex: ['created', 'blocked']
86
85
  # - holder_ids [list of strings, default nil]: list of IssuingHolder ids to filter logs. ex: ['5656565656565656', '4545454545454545']
86
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
87
87
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
88
88
  #
89
89
  # ## Return:
90
- # - list of Log objects with updated attributes
90
+ # - list of IssuingHolder::Log objects with updated attributes
91
91
  # - cursor to retrieve the next page of Log objects
92
92
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, holder_ids: nil, user: nil)
93
93
  after = StarkInfra::Utils::Checks.check_date(after)
@@ -1,42 +1,53 @@
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
  # # IssuingInvoice object
9
9
  #
10
10
  # The IssuingInvoice objects created in your Workspace load your Issuing balance when paid.
11
11
  #
12
+ # When you initialize a IssuingInvoice, 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.
15
+ #
12
16
  # ## Parameters (required):
13
17
  # - amount [integer]: IssuingInvoice value in cents. ex: 1234 (= R$ 12.34)
14
18
  #
15
19
  # ## Parameters (optional):
16
20
  # - tax_id [string, default sub-issuer tax ID]: payer tax ID (CPF or CNPJ) with or without formatting. ex: '01234567890' or '20.018.183/0001-80'
17
21
  # - name [string, default sub-issuer name]: payer name. ex: 'Iron Bank S.A.'
18
- # - tags [list of strings, default []]: list of strings for tagging. ex: ['travel', 'food']
22
+ # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
19
23
  #
20
24
  # ## Attributes (return-only):
21
25
  # - id [string]: unique id returned when IssuingInvoice is created. ex: '5656565656565656'
26
+ # - brcode [string]: BR Code for the Invoice payment. ex: '00020101021226930014br.gov.bcb.pix2571brcode-h.development.starkinfra.com/v2/d7f6546e194d4c64a153e8f79f1c41ac5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63042109'
27
+ # - due [DateTime, Date or string]: Invoice due and expiration date in UTC ISO format. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0), Date.new(2020, 3, 10) or '2020-03-10T10:30:00.000000+00:00'
28
+ # - link [string]: public Invoice webpage URL. ex: 'https://starkbank-card-issuer.development.starkbank.com/invoicelink/d7f6546e194d4c64a153e8f79f1c41ac'
22
29
  # - status [string]: current IssuingInvoice status. ex: 'created', 'expired', 'overdue', 'paid'
23
30
  # - issuing_transaction_id [string]: ledger transaction ids linked to this IssuingInvoice. ex: 'issuing-invoice/5656565656565656'
24
31
  # - updated [DateTime]: latest update datetime for the IssuingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
25
32
  # - created [DateTime]: creation datetime for the IssuingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
26
33
  class IssuingInvoice < StarkInfra::Utils::Resource
27
- attr_reader :amount, :id, :name, :tax_id, :status, :issuing_transaction_id, :tags, :updated, :created
34
+ attr_reader :id, :amount, :tax_id, :name, :tags, :brcode, :due, :link, :status, :issuing_transaction_id, :updated, :created
28
35
  def initialize(
29
- amount:, id: nil, name: nil, tax_id: nil, status: nil, issuing_transaction_id: nil, tags: nil, updated: nil, created: nil
36
+ amount:, id: nil, tax_id: nil, name: nil, tags: nil, brcode: nil, due: nil, link: nil, status: nil, issuing_transaction_id: nil,
37
+ updated: nil, created: nil
30
38
  )
31
39
  super(id)
32
40
  @amount = amount
33
- @name = name
34
41
  @tax_id = tax_id
42
+ @name = name
43
+ @tags = tags
44
+ @brcode = brcode
45
+ @due = due
46
+ @link = link
35
47
  @status = status
36
48
  @issuing_transaction_id = issuing_transaction_id
37
- @tags = tags
38
- @created = StarkInfra::Utils::Checks.check_datetime(created)
39
49
  @updated = StarkInfra::Utils::Checks.check_datetime(updated)
50
+ @created = StarkInfra::Utils::Checks.check_datetime(created)
40
51
  end
41
52
 
42
53
  # # Create an IssuingInvoice
@@ -77,8 +88,8 @@ module StarkInfra
77
88
  #
78
89
  # ## Parameters (optional):
79
90
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
80
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
81
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
91
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
92
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
82
93
  # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'expired', 'overdue', 'paid']
83
94
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
84
95
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
@@ -101,13 +112,14 @@ module StarkInfra
101
112
 
102
113
  # # Retrieve paged IssuingInvoices
103
114
  #
104
- # Receive a list of IssuingInvoices objects previously created in the Stark Infra API and the cursor to the next page.
115
+ # Receive a list of up to 100 IssuingInvoices objects previously created in the Stark Infra API and the cursor to the next page.
116
+ # Use this function instead of query if you want to manually page your logs.
105
117
  #
106
118
  # ## Parameters (optional):
107
119
  # - cursor [string, default nil]: cursor returned on the previous page function call.
108
120
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
109
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
110
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
121
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
122
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
111
123
  # - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'expired', 'overdue', 'paid']
112
124
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
113
125
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
@@ -137,11 +149,14 @@ module StarkInfra
137
149
  IssuingInvoice.new(
138
150
  id: json['id'],
139
151
  amount: json['amount'],
140
- name: json['name'],
141
152
  tax_id: json['tax_id'],
153
+ name: json['name'],
154
+ tags: json['tags'],
155
+ brcode: json['brcode'],
156
+ due: json['due'],
157
+ link: json['link'],
142
158
  status: json['status'],
143
159
  issuing_transaction_id: json['issuing_transaction_id'],
144
- tags: json['tags'],
145
160
  updated: json['updated'],
146
161
  created: json['created']
147
162
  )
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative('../utils/resource')
4
3
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
4
  require_relative('issuinginvoice')
5
+ require_relative('../utils/checks')
6
+ require_relative('../utils/resource')
7
7
 
8
8
  module StarkInfra
9
9
  class IssuingInvoice
@@ -13,7 +13,7 @@ module StarkInfra
13
13
  # This log is never generated by the user, but it can be retrieved to check additional information on the
14
14
  # IssuingInvoice.
15
15
  #
16
- # ## Attributes:
16
+ # ## Attributes (return-only):
17
17
  # - id [string]: unique id returned when the log is created. ex: '5656565656565656'
18
18
  # - invoice [IssuingInvoice]: IssuingInvoice entity to which the log refers to.
19
19
  # - type [string]: type of the IssuingInvoice event which triggered the log creation. ex: 'created', 'credited', 'expired', 'overdue', 'paid'.
@@ -27,9 +27,9 @@ module StarkInfra
27
27
  @created = StarkInfra::Utils::Checks.check_datetime(created)
28
28
  end
29
29
 
30
- # # Retrieve a specific Log
30
+ # # Retrieve a specific IssuingInvoice::Log
31
31
  #
32
- # Receive a single Log object previously created by the Stark Infra API by its id
32
+ # Receive a single IssuingInvoice::Log object previously created by the Stark Infra API by its id
33
33
  #
34
34
  # ## Parameters (required):
35
35
  # - id [string]: object unique id. ex: '5656565656565656'
@@ -38,25 +38,25 @@ module StarkInfra
38
38
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
39
39
  #
40
40
  # ## Return:
41
- # - Log object with updated attributes
41
+ # - IssuingInvoice::Log object with updated attributes
42
42
  def self.get(id, user: nil)
43
43
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
44
44
  end
45
45
 
46
- # # Retrieve Logs
46
+ # # Retrieve IssuingInvoice::Logs
47
47
  #
48
- # Receive a generator of Log objects previously created in the Stark Infra API
48
+ # Receive a generator of IssuingInvoice::Log objects previously created in the Stark Infra API
49
49
  #
50
50
  # ## Parameters (optional):
51
- # - ids [list of strings, default nil]: list of IssuingInvoice ids to filter logs. ex: ['5656565656565656', '4545454545454545']
52
51
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Max = 100. ex: 35
53
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
54
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
52
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
53
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
55
54
  # - types [list of strings, default nil]: filter for log event types. ex: ['created', 'credited', 'expired', 'overdue', 'paid']
55
+ # - ids [list of strings, default nil]: list of IssuingInvoice ids to filter logs. ex: ['5656565656565656', '4545454545454545']
56
56
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
57
57
  #
58
58
  # ## Return:
59
- # - generator of Log objects with updated attributes
59
+ # - generator of IssuingInvoice::Log objects with updated attributes
60
60
  def self.query(limit: nil, after: nil, before: nil, types: nil, user: nil)
61
61
  after = StarkInfra::Utils::Checks.check_date(after)
62
62
  before = StarkInfra::Utils::Checks.check_date(before)
@@ -70,22 +70,22 @@ module StarkInfra
70
70
  )
71
71
  end
72
72
 
73
- # # Retrieve paged Logs
73
+ # # Retrieve paged IssuingInvoice::Logs
74
74
  #
75
- # Receive a list of up to 100 issuinginvoice.Log objects previously created in the Stark Infra API and the cursor
75
+ # Receive a list of up to 100 IssuingInvoice::Log objects previously created in the Stark Infra API and the cursor
76
76
  # to the next page. Use this function instead of query if you want to manually page your invoices.
77
77
  #
78
78
  # ## Parameters (optional):
79
79
  # - cursor [string, default nil]: cursor returned on the previous page function call
80
- # - ids [list of strings, default nil]: list of IssuingInvoice ids to filter logs. ex: ['5656565656565656', '4545454545454545']
81
80
  # - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
82
- # - after [Date or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
83
- # - before [Date or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
81
+ # - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
82
+ # - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
84
83
  # - types [list of strings, default nil]: filter for log event types. ex: ['created', 'credited', 'expired', 'overdue', 'paid']
84
+ # - ids [list of strings, default nil]: list of IssuingInvoice ids to filter logs. ex: ['5656565656565656', '4545454545454545']
85
85
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
86
86
  #
87
87
  # ## Return:
88
- # - list of Log objects with updated attributes
88
+ # - list of IssuingInvoice::Log objects with updated attributes
89
89
  # - cursor to retrieve the next page of Log objects
90
90
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, user: nil)
91
91
  after = StarkInfra::Utils::Checks.check_date(after)