starkinfra 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +2 -5
  3. data/lib/cardmethod/cardmethod.rb +2 -2
  4. data/lib/creditholmes/creditholmes.rb +8 -11
  5. data/lib/creditnote/creditnote.rb +10 -11
  6. data/lib/creditnote/invoice/description.rb +3 -5
  7. data/lib/creditnote/invoice/discount.rb +3 -4
  8. data/lib/creditnote/invoice/invoice.rb +5 -6
  9. data/lib/creditnote/log.rb +8 -9
  10. data/lib/creditnote/transfer.rb +4 -5
  11. data/lib/creditpreview/creditnotepreview.rb +2 -3
  12. data/lib/creditpreview/creditpreview.rb +3 -4
  13. data/lib/creditsigner/creditsigner.rb +3 -6
  14. data/lib/dynamicbrcode/dynamicbrcode.rb +17 -19
  15. data/lib/error.rb +7 -40
  16. data/lib/event/attempt.rb +7 -8
  17. data/lib/event/event.rb +8 -11
  18. data/lib/individualdocument/individualdocument.rb +7 -8
  19. data/lib/individualdocument/log.rb +8 -9
  20. data/lib/individualidentity/individualidentity.rb +7 -8
  21. data/lib/individualidentity/log.rb +8 -9
  22. data/lib/issuingbalance/issuingbalance.rb +2 -3
  23. data/lib/issuingcard/issuingcard.rb +9 -10
  24. data/lib/issuingcard/log.rb +8 -9
  25. data/lib/issuingdesign/issuingdesign.rb +5 -6
  26. data/lib/issuingembossingkit/issuingembossingkit.rb +4 -5
  27. data/lib/issuingembossingrequest/issuingembossingrequest.rb +8 -9
  28. data/lib/issuingembossingrequest/log.rb +8 -9
  29. data/lib/issuingholder/issuingholder.rb +9 -10
  30. data/lib/issuingholder/log.rb +8 -9
  31. data/lib/issuinginvoice/issuinginvoice.rb +8 -9
  32. data/lib/issuinginvoice/log.rb +8 -9
  33. data/lib/issuingproduct/issuingproduct.rb +3 -4
  34. data/lib/issuingpurchase/issuingpurchase.rb +32 -24
  35. data/lib/issuingpurchase/log.rb +8 -9
  36. data/lib/issuingrestock/issuingrestock.rb +8 -9
  37. data/lib/issuingrestock/log.rb +8 -9
  38. data/lib/issuingrule/issuingrule.rb +6 -7
  39. data/lib/issuingstock/issuingstock.rb +8 -9
  40. data/lib/issuingstock/log.rb +8 -9
  41. data/lib/issuingtransaction/issuingtransaction.rb +7 -8
  42. data/lib/issuingwithdrawal/issuingwithdrawal.rb +8 -9
  43. data/lib/merchantcategory/merchantcategory.rb +2 -2
  44. data/lib/merchantcountry/merchantcountry.rb +2 -2
  45. data/lib/pixbalance/pixbalance.rb +2 -3
  46. data/lib/pixchargeback/log.rb +8 -9
  47. data/lib/pixchargeback/pixchargeback.rb +8 -9
  48. data/lib/pixclaim/log.rb +8 -9
  49. data/lib/pixclaim/pixclaim.rb +8 -9
  50. data/lib/pixdirector/pixdirector.rb +2 -2
  51. data/lib/pixdomain/certificate.rb +2 -2
  52. data/lib/pixdomain/pixdomain.rb +3 -3
  53. data/lib/pixinfraction/log.rb +8 -9
  54. data/lib/pixinfraction/pixinfraction.rb +8 -9
  55. data/lib/pixkey/log.rb +8 -9
  56. data/lib/pixkey/pixkey.rb +8 -9
  57. data/lib/pixrequest/log.rb +8 -9
  58. data/lib/pixrequest/pixrequest.rb +9 -10
  59. data/lib/pixreversal/log.rb +7 -9
  60. data/lib/pixreversal/pixreversal.rb +9 -10
  61. data/lib/pixstatement/pixstatement.rb +6 -7
  62. data/lib/request/request.rb +152 -0
  63. data/lib/starkinfra.rb +14 -6
  64. data/lib/staticbrcode/staticbrcode.rb +8 -9
  65. data/lib/utils/parse.rb +23 -42
  66. data/lib/utils/rest.rb +211 -110
  67. data/lib/webhook/webhook.rb +2 -3
  68. metadata +6 -21
  69. data/lib/key.rb +0 -33
  70. data/lib/user/organization.rb +0 -54
  71. data/lib/user/project.rb +0 -37
  72. data/lib/user/user.rb +0 -20
  73. data/lib/utils/api.rb +0 -89
  74. data/lib/utils/bacenid.rb +0 -19
  75. data/lib/utils/cache.rb +0 -10
  76. data/lib/utils/case.rb +0 -21
  77. data/lib/utils/checks.rb +0 -100
  78. data/lib/utils/endtoendid.rb +0 -11
  79. data/lib/utils/environment.rb +0 -14
  80. data/lib/utils/request.rb +0 -79
  81. data/lib/utils/resource.rb +0 -13
  82. data/lib/utils/returnid.rb +0 -11
  83. data/lib/utils/sub_resource.rb +0 -27
  84. data/lib/utils/url.rb +0 -28
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingHolder object
@@ -27,7 +26,7 @@ module StarkInfra
27
26
  # - status [string]: current IssuingHolder status. ex: 'active', 'blocked', 'canceled'
28
27
  # - updated [DateTime]: latest update datetime for the IssuingHolder. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
29
28
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
30
- class IssuingHolder < StarkInfra::Utils::Resource
29
+ class IssuingHolder < StarkCore::Utils::Resource
31
30
  attr_reader :id, :name, :tax_id, :external_id, :rules, :tags, :status, :updated, :created
32
31
  def initialize(
33
32
  name:, tax_id:, external_id:, rules: nil, tags: nil, id: nil, status: nil, updated: nil, created: nil
@@ -39,8 +38,8 @@ module StarkInfra
39
38
  @rules = StarkInfra::IssuingRule.parse_rules(rules)
40
39
  @tags = tags
41
40
  @status = status
42
- @created = StarkInfra::Utils::Checks.check_datetime(created)
43
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
41
+ @created = StarkCore::Utils::Checks.check_datetime(created)
42
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
44
43
  end
45
44
 
46
45
  # # Create IssuingHolders
@@ -94,8 +93,8 @@ module StarkInfra
94
93
  # ## Return:
95
94
  # - generator of IssuingHolders objects with updated attributes
96
95
  def self.query(limit: nil, ids: nil, after: nil, before: nil, status: nil, tags: nil, expand: nil, user: nil)
97
- after = StarkInfra::Utils::Checks.check_date(after)
98
- before = StarkInfra::Utils::Checks.check_date(before)
96
+ after = StarkCore::Utils::Checks.check_date(after)
97
+ before = StarkCore::Utils::Checks.check_date(before)
99
98
  StarkInfra::Utils::Rest.get_stream(
100
99
  limit: limit,
101
100
  ids: ids,
@@ -130,8 +129,8 @@ module StarkInfra
130
129
  # - cursor to retrieve the next page of IssuingHolders objects
131
130
  def self.page(cursor: nil, limit: nil, ids: nil, after: nil, before: nil, status: nil, tags: nil, expand: nil,
132
131
  user: nil)
133
- after = StarkInfra::Utils::Checks.check_date(after)
134
- before = StarkInfra::Utils::Checks.check_date(before)
132
+ after = StarkCore::Utils::Checks.check_date(after)
133
+ before = StarkCore::Utils::Checks.check_date(before)
135
134
  StarkInfra::Utils::Rest.get_page(
136
135
  cursor: cursor,
137
136
  limit: limit,
@@ -187,7 +186,7 @@ module StarkInfra
187
186
  # ## Return:
188
187
  # - canceled IssuingHolder object
189
188
  def self.cancel(id, user: nil)
190
- StarkInfra::Utils::Rest.delete_id(id: id, user: user, **resource)
189
+ StarkCore::Utils::Rest.delete_id(id: id, user: user, **resource)
191
190
  end
192
191
 
193
192
  def self.resource
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('issuingholder')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingHolder
@@ -17,13 +16,13 @@ module StarkInfra
17
16
  # - holder [IssuingHolder]: IssuingHolder entity to which the log refers to.
18
17
  # - type [string]: type of the IssuingHolder event which triggered the log creation. ex: 'blocked', 'canceled', 'created', 'unblocked', 'updated'
19
18
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class Log < StarkInfra::Utils::Resource
19
+ class Log < StarkCore::Utils::Resource
21
20
  attr_reader :id, :created, :type, :holder
22
21
  def initialize(id:, created:, type:, holder:)
23
22
  super(id)
24
23
  @type = type
25
24
  @holder = holder
26
- @created = StarkInfra::Utils::Checks.check_datetime(created)
25
+ @created = StarkCore::Utils::Checks.check_datetime(created)
27
26
  end
28
27
 
29
28
  # # Retrieve a specific IssuingHolder::Log
@@ -58,8 +57,8 @@ module StarkInfra
58
57
  # ## Return:
59
58
  # - generator of IssuingHolder::Log objects with updated attributes
60
59
  def self.query(limit: nil, after: nil, before: nil, types: nil, holder_ids: nil, user: nil)
61
- after = StarkInfra::Utils::Checks.check_date(after)
62
- before = StarkInfra::Utils::Checks.check_date(before)
60
+ after = StarkCore::Utils::Checks.check_date(after)
61
+ before = StarkCore::Utils::Checks.check_date(before)
63
62
  StarkInfra::Utils::Rest.get_stream(
64
63
  limit: limit,
65
64
  after: after,
@@ -90,8 +89,8 @@ module StarkInfra
90
89
  # - list of IssuingHolder::Log objects with updated attributes
91
90
  # - cursor to retrieve the next page of Log objects
92
91
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, holder_ids: nil, user: nil)
93
- after = StarkInfra::Utils::Checks.check_date(after)
94
- before = StarkInfra::Utils::Checks.check_date(before)
92
+ after = StarkCore::Utils::Checks.check_date(after)
93
+ before = StarkCore::Utils::Checks.check_date(before)
95
94
  StarkInfra::Utils::Rest.get_page(
96
95
  cursor: cursor,
97
96
  limit: limit,
@@ -113,7 +112,7 @@ module StarkInfra
113
112
  id: json['id'],
114
113
  created: json['created'],
115
114
  type: json['type'],
116
- holder: StarkInfra::Utils::API.from_api_json(request_maker, json['holder'])
115
+ holder: StarkCore::Utils::API.from_api_json(request_maker, json['holder'])
117
116
  )
118
117
  }
119
118
  }
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingInvoice object
@@ -30,7 +29,7 @@ module StarkInfra
30
29
  # - issuing_transaction_id [string]: ledger transaction ids linked to this IssuingInvoice. ex: 'issuing-invoice/5656565656565656'
31
30
  # - updated [DateTime]: latest update datetime for the IssuingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
32
31
  # - created [DateTime]: creation datetime for the IssuingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
33
- class IssuingInvoice < StarkInfra::Utils::Resource
32
+ class IssuingInvoice < StarkCore::Utils::Resource
34
33
  attr_reader :id, :amount, :tax_id, :name, :tags, :brcode, :due, :link, :status, :issuing_transaction_id, :updated, :created
35
34
  def initialize(
36
35
  amount:, id: nil, tax_id: nil, name: nil, tags: nil, brcode: nil, due: nil, link: nil, status: nil, issuing_transaction_id: nil,
@@ -46,8 +45,8 @@ module StarkInfra
46
45
  @link = link
47
46
  @status = status
48
47
  @issuing_transaction_id = issuing_transaction_id
49
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
50
- @created = StarkInfra::Utils::Checks.check_datetime(created)
48
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
49
+ @created = StarkCore::Utils::Checks.check_datetime(created)
51
50
  end
52
51
 
53
52
  # # Create an IssuingInvoice
@@ -97,8 +96,8 @@ module StarkInfra
97
96
  # ## Return:
98
97
  # - generator of IssuingInvoices objects with updated attributes
99
98
  def self.query(limit: nil, after: nil, before: nil, status: nil, tags: nil, user: nil)
100
- after = StarkInfra::Utils::Checks.check_date(after)
101
- before = StarkInfra::Utils::Checks.check_date(before)
99
+ after = StarkCore::Utils::Checks.check_date(after)
100
+ before = StarkCore::Utils::Checks.check_date(before)
102
101
  StarkInfra::Utils::Rest.get_stream(
103
102
  limit: limit,
104
103
  after: after,
@@ -128,8 +127,8 @@ module StarkInfra
128
127
  # - list of IssuingInvoice objects with updated attributes
129
128
  # - cursor to retrieve the next page of IssuingInvoice objects
130
129
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, user: nil)
131
- after = StarkInfra::Utils::Checks.check_date(after)
132
- before = StarkInfra::Utils::Checks.check_date(before)
130
+ after = StarkCore::Utils::Checks.check_date(after)
131
+ before = StarkCore::Utils::Checks.check_date(before)
133
132
  StarkInfra::Utils::Rest.get_page(
134
133
  cursor: cursor,
135
134
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
5
  require_relative('issuinginvoice')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingInvoice
@@ -18,13 +17,13 @@ module StarkInfra
18
17
  # - invoice [IssuingInvoice]: IssuingInvoice entity to which the log refers to.
19
18
  # - type [string]: type of the IssuingInvoice event which triggered the log creation. ex: 'created', 'credited', 'expired', 'overdue', 'paid'.
20
19
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
21
- class Log < StarkInfra::Utils::Resource
20
+ class Log < StarkCore::Utils::Resource
22
21
  attr_reader :id, :created, :type, :invoice
23
22
  def initialize(id:, created:, type:, invoice:)
24
23
  super(id)
25
24
  @type = type
26
25
  @invoice = invoice
27
- @created = StarkInfra::Utils::Checks.check_datetime(created)
26
+ @created = StarkCore::Utils::Checks.check_datetime(created)
28
27
  end
29
28
 
30
29
  # # Retrieve a specific IssuingInvoice::Log
@@ -58,8 +57,8 @@ module StarkInfra
58
57
  # ## Return:
59
58
  # - generator of IssuingInvoice::Log objects with updated attributes
60
59
  def self.query(limit: nil, after: nil, before: nil, types: nil, user: nil)
61
- after = StarkInfra::Utils::Checks.check_date(after)
62
- before = StarkInfra::Utils::Checks.check_date(before)
60
+ after = StarkCore::Utils::Checks.check_date(after)
61
+ before = StarkCore::Utils::Checks.check_date(before)
63
62
  StarkInfra::Utils::Rest.get_stream(
64
63
  limit: limit,
65
64
  after: after,
@@ -88,8 +87,8 @@ module StarkInfra
88
87
  # - list of IssuingInvoice::Log objects with updated attributes
89
88
  # - cursor to retrieve the next page of Log objects
90
89
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, user: nil)
91
- after = StarkInfra::Utils::Checks.check_date(after)
92
- before = StarkInfra::Utils::Checks.check_date(before)
90
+ after = StarkCore::Utils::Checks.check_date(after)
91
+ before = StarkCore::Utils::Checks.check_date(before)
93
92
  StarkInfra::Utils::Rest.get_page(
94
93
  cursor: cursor,
95
94
  limit: limit,
@@ -110,7 +109,7 @@ module StarkInfra
110
109
  id: json['id'],
111
110
  created: json['created'],
112
111
  type: json['type'],
113
- invoice: StarkInfra::Utils::API.from_api_json(request_maker, json['invoice'])
112
+ invoice: StarkCore::Utils::API.from_api_json(request_maker, json['invoice'])
114
113
  )
115
114
  }
116
115
  }
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingProduct object
@@ -17,7 +16,7 @@ module StarkInfra
17
16
  # - holder_type [string]: holder type. ex: 'business', 'individual'
18
17
  # - code [string]: internal code from card flag informing the product. ex: 'MRW', 'MCO', 'MWB', 'MCS'
19
18
  # - created [DateTime]: creation datetime for the IssuingProduct. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class IssuingProduct < StarkInfra::Utils::Resource
19
+ class IssuingProduct < StarkCore::Utils::Resource
21
20
  attr_reader :id, :network, :funding_type, :holder_type, :code, :created
22
21
  def initialize(id: nil, network: nil, funding_type: nil, holder_type: nil, code: nil, created: nil)
23
22
  super(id)
@@ -25,7 +24,7 @@ module StarkInfra
25
24
  @funding_type = funding_type
26
25
  @holder_type = holder_type
27
26
  @code = code
28
- @created = StarkInfra::Utils::Checks.check_datetime(created)
27
+ @created = StarkCore::Utils::Checks.check_datetime(created)
29
28
  end
30
29
 
31
30
  # # Retrieve IssuingProducts
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingPurchase object
@@ -10,7 +9,6 @@ module StarkInfra
10
9
  # Displays the IssuingPurchase objects created in your Workspace.
11
10
  #
12
11
  # ## Attributes (return-only):
13
- # - id [string]: unique id returned when IssuingPurchase is created. ex: '5656565656565656'
14
12
  # - holder_name [string]: card holder name. ex: 'Tony Stark'
15
13
  # - product_id [string]: unique card product number (BIN) registered within the card network. ex: "53810200"
16
14
  # - card_id [string]: unique id returned when IssuingCard is created. ex: '5656565656565656'
@@ -23,45 +21,49 @@ module StarkInfra
23
21
  # - issuer_currency_symbol [string]: issuer currency symbol. ex: '$'
24
22
  # - merchant_amount [integer]: merchant amount. ex: 1234 (= R$ 12.34)
25
23
  # - merchant_currency_code [string]: merchant currency code. ex: 'USD'
24
+ # - merchant_category_type [string]: merchant category type. ex 'food'
26
25
  # - merchant_currency_symbol [string]: merchant currency symbol. ex: '$'
27
26
  # - merchant_category_code [string]: merchant category code. ex: 'fastFoodRestaurants'
28
27
  # - merchant_country_code [string]: merchant country code. ex: 'USA'
29
28
  # - acquirer_id [string]: acquirer ID. ex: '5656565656565656'
30
29
  # - merchant_id [string]: merchant ID. ex: '5656565656565656'
31
30
  # - merchant_name [string]: merchant name. ex: 'Google Cloud Platform'
32
- # - metadata [dictionary object]: dictionary object used to store additional information about the IssuingPurchase object. ex: { authorizationId: 'OjZAqj' }
33
31
  # - merchant_fee [integer]: fee charged by the merchant to cover specific costs, such as ATM withdrawal logistics, etc. ex: 200 (= R$ 2.00)
34
32
  # - wallet_id [string]: virtual wallet ID. ex: '5656565656565656'
35
33
  # - method_code [string]: method code. Options: 'chip', 'token', 'server', 'manual', 'magstripe' or 'contactless'
36
34
  # - score [float]: internal score calculated for the authenticity of the purchase. nil in case of insufficient data. ex: 7.6
37
35
  # - end_to_end_id [string]: Unique id used to identify the transaction through all of its life cycle, even before the purchase is denied or approved and gets its usual id. ex: '679cd385-642b-49d0-96b7-89491e1249a5'
38
36
  # - tags [string]: list of strings for tagging returned by the sub-issuer during the authorization. ex: ['travel', 'food']
39
- # - zip_code [string]: zip code of the merchant location. ex: '02101234'
40
37
  #
41
38
  # ## Attributes (IssuingPurchase only):
39
+ # - id [string]: unique id returned when IssuingPurchase is created. ex: '5656565656565656'
42
40
  # - issuing_transaction_ids [string]: ledger transaction ids linked to this Purchase
43
41
  # - status [string]: current IssuingCard status. Options: 'approved', 'canceled', 'denied', 'confirmed', 'voided'
42
+ # - description [string]: IssuingPurchase description. ex: 'Office Supplies'
43
+ # - metadata [dictionary object]: dictionary object used to store additional information about the IssuingPurchase object. ex: { authorizationId: 'OjZAqj' }
44
+ # - zip_code [string]: zip code of the merchant location. ex: '02101234'
44
45
  # - updated [DateTime]: latest update datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
45
46
  # - created [DateTime]: creation datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
46
47
  #
47
48
  # ## Attributes (authorization request only):
48
49
  # - is_partial_allowed [bool]: true if the merchant allows partial purchases. ex: False
49
50
  # - card_tags [list of strings]: tags of the IssuingCard responsible for this purchase. ex: ['travel', 'food']
51
+ # - holder_id [string]: card holder ID. ex: '5656565656565656'
50
52
  # - holder_tags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ['technology', 'john snow']
51
- class IssuingPurchase < StarkInfra::Utils::Resource
53
+ class IssuingPurchase < StarkCore::Utils::Resource
52
54
  attr_reader :id, :holder_name, :product_id, :card_id, :card_ending, :purpose, :amount, :tax, :issuer_amount, :issuer_currency_code,
53
55
  :issuer_currency_symbol, :merchant_amount, :merchant_currency_code, :merchant_currency_symbol,
54
- :merchant_category_code, :merchant_country_code, :acquirer_id, :merchant_id, :merchant_name, :metadata,
55
- :merchant_fee, :wallet_id, :method_code, :score, :end_to_end_id, :tags, :zip_code,
56
- :issuing_transaction_ids, :status, :updated, :created, :is_partial_allowed, :card_tags, :holder_tags
56
+ :merchant_category_code, :merchant_category_type, :merchant_country_code, :acquirer_id, :merchant_id, :merchant_name,
57
+ :merchant_fee, :wallet_id, :method_code, :score, :end_to_end_id, :tags,
58
+ :issuing_transaction_ids, :status, :description, :metadata, :zip_code, :updated, :created, :is_partial_allowed, :card_tags, :holder_id, :holder_tags
57
59
 
58
60
  def initialize(
59
61
  id: nil, holder_name: nil, product_id: nil, card_id: nil, card_ending: nil, purpose: nil, amount: nil, tax: nil, issuer_amount: nil,
60
62
  issuer_currency_code: nil, issuer_currency_symbol: nil, merchant_amount: nil, merchant_currency_code: nil,
61
- merchant_currency_symbol: nil, merchant_category_code: nil, merchant_country_code: nil, acquirer_id: nil,
62
- merchant_id: nil, merchant_name: nil, metadata: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil,
63
- end_to_end_id: nil, tags: nil, zip_code: nil, issuing_transaction_ids: nil, status: nil, updated: nil, created: nil,
64
- is_partial_allowed: nil, card_tags:nil, holder_tags:nil
63
+ merchant_currency_symbol: nil, merchant_category_code: nil, merchant_category_type: nil, merchant_country_code: nil, acquirer_id: nil,
64
+ merchant_id: nil, merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil,
65
+ end_to_end_id: nil, tags: nil, issuing_transaction_ids: nil, status: nil, description: nil, metadata: nil, zip_code: nil, updated: nil, created: nil,
66
+ is_partial_allowed: nil, card_tags:nil, holder_id: nil, holder_tags:nil
65
67
  )
66
68
  super(id)
67
69
  @holder_name = holder_name
@@ -78,24 +80,27 @@ module StarkInfra
78
80
  @merchant_currency_code = merchant_currency_code
79
81
  @merchant_currency_symbol = merchant_currency_symbol
80
82
  @merchant_category_code = merchant_category_code
83
+ @merchant_category_type = merchant_category_type
81
84
  @merchant_country_code = merchant_country_code
82
85
  @acquirer_id = acquirer_id
83
86
  @merchant_id = merchant_id
84
87
  @merchant_name = merchant_name
85
- @metadata = metadata
86
88
  @merchant_fee = merchant_fee
87
89
  @wallet_id = wallet_id
88
90
  @method_code = method_code
89
91
  @score = score
90
92
  @end_to_end_id = end_to_end_id
91
93
  @tags = tags
92
- @zip_code = zip_code
93
94
  @issuing_transaction_ids = issuing_transaction_ids
94
95
  @status = status
95
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
96
- @created = StarkInfra::Utils::Checks.check_datetime(created)
96
+ @description = description
97
+ @metadata = metadata
98
+ @zip_code = zip_code
99
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
100
+ @created = StarkCore::Utils::Checks.check_datetime(created)
97
101
  @is_partial_allowed = is_partial_allowed
98
102
  @card_tags = card_tags
103
+ @holder_id = holder_id
99
104
  @holder_tags = holder_tags
100
105
 
101
106
  end
@@ -135,8 +140,8 @@ module StarkInfra
135
140
  # - generator of IssuingPurchases objects with updated attributes
136
141
  def self.query(ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil, status: nil, user: nil)
137
142
 
138
- after = StarkInfra::Utils::Checks.check_date(after)
139
- before = StarkInfra::Utils::Checks.check_date(before)
143
+ after = StarkCore::Utils::Checks.check_date(after)
144
+ before = StarkCore::Utils::Checks.check_date(before)
140
145
  StarkInfra::Utils::Rest.get_stream(
141
146
  ids: ids,
142
147
  limit: limit,
@@ -173,8 +178,8 @@ module StarkInfra
173
178
  # - cursor to retrieve the next page of IssuingPurchases objects
174
179
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil,
175
180
  card_ids: nil, status: nil, user: nil)
176
- after = StarkInfra::Utils::Checks.check_date(after)
177
- before = StarkInfra::Utils::Checks.check_date(before)
181
+ after = StarkCore::Utils::Checks.check_date(after)
182
+ before = StarkCore::Utils::Checks.check_date(before)
178
183
  StarkInfra::Utils::Rest.get_page(
179
184
  cursor: cursor,
180
185
  ids: ids,
@@ -209,7 +214,7 @@ module StarkInfra
209
214
  # ## Return:
210
215
  # - Parsed IssuingPurchase object
211
216
  def self.parse(content:, signature:, user: nil)
212
- StarkInfra::Utils::Parse.parse_and_verify(
217
+ StarkCore::Utils::Parse.parse_and_verify(
213
218
  content: content,
214
219
  signature: signature,
215
220
  user: user,
@@ -265,24 +270,27 @@ module StarkInfra
265
270
  merchant_currency_code: json['merchant_currency_code'],
266
271
  merchant_currency_symbol: json['merchant_currency_symbol'],
267
272
  merchant_category_code: json['merchant_category_code'],
273
+ merchant_category_type: json['merchant_category_type'],
268
274
  merchant_country_code: json['merchant_country_code'],
269
275
  acquirer_id: json['acquirer_id'],
270
276
  merchant_id: json['merchant_id'],
271
277
  merchant_name: json['merchant_name'],
272
- metadata: json['metadata'],
273
278
  merchant_fee: json['merchant_fee'],
274
279
  wallet_id: json['wallet_id'],
275
280
  method_code: json['method_code'],
276
281
  score: json['score'],
277
282
  end_to_end_id: json['end_to_end_id'],
278
283
  tags: json['tags'],
279
- zip_code: json['zip_code'],
280
284
  issuing_transaction_ids: json['issuing_transaction_ids'],
281
285
  status: json['status'],
286
+ description: json['description'],
287
+ metadata: json['metadata'],
288
+ zip_code: json['zip_code'],
282
289
  updated: json['updated'],
283
290
  created: json['created'],
284
291
  is_partial_allowed: json['is_partial_allowed'],
285
292
  card_tags: json['card_tags'],
293
+ holder_id: json['holder_id'],
286
294
  holder_tags: json['holder_tags']
287
295
  )
288
296
  }
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
5
  require_relative('issuingpurchase')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingPurchase
@@ -19,7 +18,7 @@ module StarkInfra
19
18
  # - errors [list of strings]: list of errors linked to this IssuingPurchase event
20
19
  # - type [string]: type of the IssuingPurchase event which triggered the log creation. ex: 'approved', 'canceled', 'confirmed', 'denied', 'reversed', 'voided'.
21
20
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
22
- class Log < StarkInfra::Utils::Resource
21
+ class Log < StarkCore::Utils::Resource
23
22
  attr_reader :id, :purchase, :issuing_transaction_id, :errors, :type, :created
24
23
  def initialize(id: nil, purchase: nil, issuing_transaction_id: nil, errors: nil, type: nil, created: nil)
25
24
  super(id)
@@ -27,7 +26,7 @@ module StarkInfra
27
26
  @issuing_transaction_id = issuing_transaction_id
28
27
  @errors = errors
29
28
  @type = type
30
- @created = StarkInfra::Utils::Checks.check_datetime(created)
29
+ @created = StarkCore::Utils::Checks.check_datetime(created)
31
30
  end
32
31
 
33
32
  # # Retrieve a specific IssuingPurchase::Log
@@ -62,8 +61,8 @@ module StarkInfra
62
61
  # ## Return:
63
62
  # - generator of IssuingPurchase::Log objects with updated attributes
64
63
  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, purchase_ids: nil, user: nil)
65
- after = StarkInfra::Utils::Checks.check_date(after)
66
- before = StarkInfra::Utils::Checks.check_date(before)
64
+ after = StarkCore::Utils::Checks.check_date(after)
65
+ before = StarkCore::Utils::Checks.check_date(before)
67
66
  StarkInfra::Utils::Rest.get_stream(
68
67
  ids: ids,
69
68
  limit: limit,
@@ -95,8 +94,8 @@ module StarkInfra
95
94
  # - list of IssuingPurchase::Log objects with updated attributes
96
95
  # - cursor to retrieve the next page of Log objects
97
96
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, purchase_ids: nil, user: nil)
98
- after = StarkInfra::Utils::Checks.check_date(after)
99
- before = StarkInfra::Utils::Checks.check_date(before)
97
+ after = StarkCore::Utils::Checks.check_date(after)
98
+ before = StarkCore::Utils::Checks.check_date(before)
100
99
  StarkInfra::Utils::Rest.get_page(
101
100
  cursor: cursor,
102
101
  ids: ids,
@@ -117,7 +116,7 @@ module StarkInfra
117
116
  resource_maker: proc { |json|
118
117
  Log.new(
119
118
  id: json['id'],
120
- purchase: StarkInfra::Utils::API.from_api_json(request_maker, json['purchase']),
119
+ purchase: StarkCore::Utils::API.from_api_json(request_maker, json['purchase']),
121
120
  issuing_transaction_id: json['issuing_transaction_id'],
122
121
  errors: json['errors'],
123
122
  type: json['type'],
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingRestock object
@@ -22,7 +21,7 @@ module StarkInfra
22
21
  # - status [string]: current IssuingRestock status. ex: "created", "processing", "confirmed"
23
22
  # - updated [DateTime]: latest update datetime for the IssuingRestock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
24
23
  # - created [DateTime]: creation datetime for the IssuingRestock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
25
- class IssuingRestock < StarkInfra::Utils::Resource
24
+ class IssuingRestock < StarkCore::Utils::Resource
26
25
  attr_reader :count, :stock_id, :tags, :id, :status, :updated, :created
27
26
  def initialize(
28
27
  count:, stock_id:, tags: nil, id: nil, status: nil, updated: nil, created: nil
@@ -32,8 +31,8 @@ module StarkInfra
32
31
  @stock_id = stock_id
33
32
  @tags = tags
34
33
  @status = status
35
- @created = StarkInfra::Utils::Checks.check_datetime(created)
36
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
34
+ @created = StarkCore::Utils::Checks.check_datetime(created)
35
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
37
36
  end
38
37
 
39
38
  # # Create IssuingRestocks
@@ -88,8 +87,8 @@ module StarkInfra
88
87
  limit: nil, after: nil, before: nil, status: nil, stock_ids: nil, ids: nil,
89
88
  tags: nil, user: nil
90
89
  )
91
- after = StarkInfra::Utils::Checks.check_date(after)
92
- before = StarkInfra::Utils::Checks.check_date(before)
90
+ after = StarkCore::Utils::Checks.check_date(after)
91
+ before = StarkCore::Utils::Checks.check_date(before)
93
92
  StarkInfra::Utils::Rest.get_stream(
94
93
  limit: limit,
95
94
  after: after,
@@ -126,8 +125,8 @@ module StarkInfra
126
125
  cursor: nil, limit: nil, after: nil, before: nil, status: nil, stock_ids: nil,
127
126
  ids: nil, tags: nil, user: nil
128
127
  )
129
- after = StarkInfra::Utils::Checks.check_date(after)
130
- before = StarkInfra::Utils::Checks.check_date(before)
128
+ after = StarkCore::Utils::Checks.check_date(after)
129
+ before = StarkCore::Utils::Checks.check_date(before)
131
130
  StarkInfra::Utils::Rest.get_page(
132
131
  cursor: cursor,
133
132
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('IssuingRestock')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingRestock
@@ -17,13 +16,13 @@ module StarkInfra
17
16
  # - restock [IssuingRestock]: IssuingRestock entity to which the log refers to.
18
17
  # - type [string]: type of the IssuingRestock event which triggered the log creation. ex: "created", "processing", "confirmed"
19
18
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class Log < StarkInfra::Utils::Resource
19
+ class Log < StarkCore::Utils::Resource
21
20
  attr_reader :id, :restock, :type, :created
22
21
  def initialize(id: nil, restock: nil, type: nil, created: nil)
23
22
  super(id)
24
23
  @restock = restock
25
24
  @type = type
26
- @created = StarkInfra::Utils::Checks.check_datetime(created)
25
+ @created = StarkCore::Utils::Checks.check_datetime(created)
27
26
  end
28
27
 
29
28
  # # Retrieve a specific IssuingRestock::Log
@@ -60,8 +59,8 @@ module StarkInfra
60
59
  def self.query(
61
60
  limit: nil, after: nil, before: nil, types: nil, restock_ids: nil, ids: nil, user: nil
62
61
  )
63
- after = StarkInfra::Utils::Checks.check_date(after)
64
- before = StarkInfra::Utils::Checks.check_date(before)
62
+ after = StarkCore::Utils::Checks.check_date(after)
63
+ before = StarkCore::Utils::Checks.check_date(before)
65
64
  StarkInfra::Utils::Rest.get_stream(
66
65
  limit: limit,
67
66
  after: after,
@@ -93,8 +92,8 @@ module StarkInfra
93
92
  # - list of IssuingRestock::Log objects with updated attributes
94
93
  # - Cursor to retrieve the next page of Log objects
95
94
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, restock_ids: nil, ids: nil, user: nil)
96
- after = StarkInfra::Utils::Checks.check_date(after)
97
- before = StarkInfra::Utils::Checks.check_date(before)
95
+ after = StarkCore::Utils::Checks.check_date(after)
96
+ before = StarkCore::Utils::Checks.check_date(before)
98
97
  StarkInfra::Utils::Rest.get_page(
99
98
  cursor: cursor,
100
99
  limit: limit,
@@ -115,7 +114,7 @@ module StarkInfra
115
114
  resource_maker: proc { |json|
116
115
  Log.new(
117
116
  id: json['id'],
118
- restock: StarkInfra::Utils::API.from_api_json(request_maker, json['restock']),
117
+ restock: StarkCore::Utils::API.from_api_json(request_maker, json['restock']),
119
118
  type: json['type'],
120
119
  created: json['created']
121
120
  )
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingRule object
@@ -25,7 +24,7 @@ module StarkInfra
25
24
  # - counter_amount [integer]: current rule spent amount. ex: 1000
26
25
  # - currency_symbol [string]: currency symbol. ex: 'R$'
27
26
  # - currency_name [string]: currency name. ex: 'Brazilian Real'
28
- class IssuingRule < StarkInfra::Utils::Resource
27
+ class IssuingRule < StarkCore::Utils::Resource
29
28
  attr_reader :name, :interval, :amount, :currency_code, :counter_amount, :currency_name, :currency_symbol,
30
29
  :categories, :countries, :methods
31
30
  def initialize(
@@ -52,7 +51,7 @@ module StarkInfra
52
51
  parsed_categories = []
53
52
  categories.each do |category|
54
53
  unless category.is_a? MerchantCategory
55
- category = StarkInfra::Utils::API.from_api_json(resource_maker, category)
54
+ category = StarkCore::Utils::API.from_api_json(resource_maker, category)
56
55
  end
57
56
  parsed_categories << category
58
57
  end
@@ -66,7 +65,7 @@ module StarkInfra
66
65
  parsed_countries = []
67
66
  countries.each do |country|
68
67
  unless country.is_a? MerchantCountry
69
- country = StarkInfra::Utils::API.from_api_json(resource_maker, country)
68
+ country = StarkCore::Utils::API.from_api_json(resource_maker, country)
70
69
  end
71
70
  parsed_countries << country
72
71
  end
@@ -80,7 +79,7 @@ module StarkInfra
80
79
  parsed_methods = []
81
80
  methods.each do |method|
82
81
  unless method.is_a? CardMethod
83
- method = StarkInfra::Utils::API.from_api_json(resource_maker, method)
82
+ method = StarkCore::Utils::API.from_api_json(resource_maker, method)
84
83
  end
85
84
  parsed_methods << method
86
85
  end
@@ -94,7 +93,7 @@ module StarkInfra
94
93
  parsed_rules = []
95
94
  rules.each do |rule|
96
95
  unless rule.is_a? IssuingRule
97
- rule = StarkInfra::Utils::API.from_api_json(rule_maker, rule)
96
+ rule = StarkCore::Utils::API.from_api_json(rule_maker, rule)
98
97
  end
99
98
  parsed_rules << rule
100
99
  end