starkinfra 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/brcodepreview/brcodepreview.rb +2 -5
- data/lib/cardmethod/cardmethod.rb +2 -2
- data/lib/creditholmes/creditholmes.rb +8 -11
- data/lib/creditnote/creditnote.rb +10 -11
- data/lib/creditnote/invoice/description.rb +3 -5
- data/lib/creditnote/invoice/discount.rb +3 -4
- data/lib/creditnote/invoice/invoice.rb +5 -6
- data/lib/creditnote/log.rb +8 -9
- data/lib/creditnote/transfer.rb +4 -5
- data/lib/creditpreview/creditnotepreview.rb +2 -3
- data/lib/creditpreview/creditpreview.rb +3 -4
- data/lib/creditsigner/creditsigner.rb +3 -6
- data/lib/dynamicbrcode/dynamicbrcode.rb +17 -19
- data/lib/error.rb +7 -40
- data/lib/event/attempt.rb +7 -8
- data/lib/event/event.rb +8 -11
- data/lib/individualdocument/individualdocument.rb +7 -8
- data/lib/individualdocument/log.rb +8 -9
- data/lib/individualidentity/individualidentity.rb +7 -8
- data/lib/individualidentity/log.rb +8 -9
- data/lib/issuingbalance/issuingbalance.rb +2 -3
- data/lib/issuingcard/issuingcard.rb +9 -10
- data/lib/issuingcard/log.rb +8 -9
- data/lib/issuingdesign/issuingdesign.rb +5 -6
- data/lib/issuingembossingkit/issuingembossingkit.rb +4 -5
- data/lib/issuingembossingrequest/issuingembossingrequest.rb +8 -9
- data/lib/issuingembossingrequest/log.rb +8 -9
- data/lib/issuingholder/issuingholder.rb +9 -10
- data/lib/issuingholder/log.rb +8 -9
- data/lib/issuinginvoice/issuinginvoice.rb +8 -9
- data/lib/issuinginvoice/log.rb +8 -9
- data/lib/issuingproduct/issuingproduct.rb +3 -4
- data/lib/issuingpurchase/issuingpurchase.rb +33 -22
- data/lib/issuingpurchase/log.rb +8 -9
- data/lib/issuingrestock/issuingrestock.rb +8 -9
- data/lib/issuingrestock/log.rb +8 -9
- data/lib/issuingrule/issuingrule.rb +6 -7
- data/lib/issuingstock/issuingstock.rb +8 -9
- data/lib/issuingstock/log.rb +8 -9
- data/lib/issuingtransaction/issuingtransaction.rb +7 -8
- data/lib/issuingwithdrawal/issuingwithdrawal.rb +8 -9
- data/lib/merchantcategory/merchantcategory.rb +2 -2
- data/lib/merchantcountry/merchantcountry.rb +2 -2
- data/lib/pixbalance/pixbalance.rb +2 -3
- data/lib/pixchargeback/log.rb +8 -9
- data/lib/pixchargeback/pixchargeback.rb +8 -9
- data/lib/pixclaim/log.rb +8 -9
- data/lib/pixclaim/pixclaim.rb +8 -9
- data/lib/pixdirector/pixdirector.rb +2 -2
- data/lib/pixdomain/certificate.rb +2 -2
- data/lib/pixdomain/pixdomain.rb +3 -3
- data/lib/pixinfraction/log.rb +8 -9
- data/lib/pixinfraction/pixinfraction.rb +8 -9
- data/lib/pixkey/log.rb +8 -9
- data/lib/pixkey/pixkey.rb +8 -9
- data/lib/pixrequest/log.rb +8 -9
- data/lib/pixrequest/pixrequest.rb +9 -10
- data/lib/pixreversal/log.rb +7 -9
- data/lib/pixreversal/pixreversal.rb +9 -10
- data/lib/pixstatement/pixstatement.rb +6 -7
- data/lib/request/request.rb +152 -0
- data/lib/starkinfra.rb +14 -6
- data/lib/staticbrcode/staticbrcode.rb +8 -9
- data/lib/utils/parse.rb +23 -42
- data/lib/utils/rest.rb +211 -110
- data/lib/webhook/webhook.rb +2 -3
- metadata +6 -21
- data/lib/key.rb +0 -33
- data/lib/user/organization.rb +0 -54
- data/lib/user/project.rb +0 -37
- data/lib/user/user.rb +0 -20
- data/lib/utils/api.rb +0 -89
- data/lib/utils/bacenid.rb +0 -19
- data/lib/utils/cache.rb +0 -10
- data/lib/utils/case.rb +0 -21
- data/lib/utils/checks.rb +0 -100
- data/lib/utils/endtoendid.rb +0 -11
- data/lib/utils/environment.rb +0 -14
- data/lib/utils/request.rb +0 -79
- data/lib/utils/resource.rb +0 -13
- data/lib/utils/returnid.rb +0 -11
- data/lib/utils/sub_resource.rb +0 -27
- 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 <
|
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 =
|
43
|
-
@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 =
|
98
|
-
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 =
|
134
|
-
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
|
-
|
189
|
+
StarkCore::Utils::Rest.delete_id(id: id, user: user, **resource)
|
191
190
|
end
|
192
191
|
|
193
192
|
def self.resource
|
data/lib/issuingholder/log.rb
CHANGED
@@ -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 <
|
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 =
|
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 =
|
62
|
-
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 =
|
94
|
-
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:
|
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 <
|
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 =
|
50
|
-
@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 =
|
101
|
-
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 =
|
132
|
-
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,
|
data/lib/issuinginvoice/log.rb
CHANGED
@@ -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 <
|
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 =
|
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 =
|
62
|
-
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 =
|
92
|
-
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:
|
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 <
|
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 =
|
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,6 +21,7 @@ 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'
|
@@ -35,32 +34,36 @@ module StarkInfra
|
|
35
34
|
# - score [float]: internal score calculated for the authenticity of the purchase. nil in case of insufficient data. ex: 7.6
|
36
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'
|
37
36
|
# - tags [string]: list of strings for tagging returned by the sub-issuer during the authorization. ex: ['travel', 'food']
|
38
|
-
# - zip_code [string]: zip code of the merchant location. ex: '02101234'
|
39
37
|
#
|
40
38
|
# ## Attributes (IssuingPurchase only):
|
39
|
+
# - id [string]: unique id returned when IssuingPurchase is created. ex: '5656565656565656'
|
41
40
|
# - issuing_transaction_ids [string]: ledger transaction ids linked to this Purchase
|
42
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'
|
43
45
|
# - updated [DateTime]: latest update datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
44
46
|
# - created [DateTime]: creation datetime for the IssuingPurchase. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
45
47
|
#
|
46
48
|
# ## Attributes (authorization request only):
|
47
49
|
# - is_partial_allowed [bool]: true if the merchant allows partial purchases. ex: False
|
48
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'
|
49
52
|
# - holder_tags [list of strings]: tags of the IssuingHolder responsible for this purchase. ex: ['technology', 'john snow']
|
50
|
-
class IssuingPurchase <
|
53
|
+
class IssuingPurchase < StarkCore::Utils::Resource
|
51
54
|
attr_reader :id, :holder_name, :product_id, :card_id, :card_ending, :purpose, :amount, :tax, :issuer_amount, :issuer_currency_code,
|
52
55
|
:issuer_currency_symbol, :merchant_amount, :merchant_currency_code, :merchant_currency_symbol,
|
53
|
-
:merchant_category_code, :merchant_country_code, :acquirer_id, :merchant_id, :merchant_name,
|
54
|
-
:merchant_fee, :wallet_id, :method_code, :score, :end_to_end_id, :tags,
|
55
|
-
: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
|
56
59
|
|
57
60
|
def initialize(
|
58
61
|
id: nil, holder_name: nil, product_id: nil, card_id: nil, card_ending: nil, purpose: nil, amount: nil, tax: nil, issuer_amount: nil,
|
59
62
|
issuer_currency_code: nil, issuer_currency_symbol: nil, merchant_amount: nil, merchant_currency_code: nil,
|
60
|
-
merchant_currency_symbol: nil, merchant_category_code: nil, merchant_country_code: nil, acquirer_id: nil,
|
63
|
+
merchant_currency_symbol: nil, merchant_category_code: nil, merchant_category_type: nil, merchant_country_code: nil, acquirer_id: nil,
|
61
64
|
merchant_id: nil, merchant_name: nil, merchant_fee: nil, wallet_id: nil, method_code: nil, score: nil,
|
62
|
-
end_to_end_id: nil, tags: nil,
|
63
|
-
is_partial_allowed: nil, card_tags:nil, holder_tags: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
|
64
67
|
)
|
65
68
|
super(id)
|
66
69
|
@holder_name = holder_name
|
@@ -77,6 +80,7 @@ module StarkInfra
|
|
77
80
|
@merchant_currency_code = merchant_currency_code
|
78
81
|
@merchant_currency_symbol = merchant_currency_symbol
|
79
82
|
@merchant_category_code = merchant_category_code
|
83
|
+
@merchant_category_type = merchant_category_type
|
80
84
|
@merchant_country_code = merchant_country_code
|
81
85
|
@acquirer_id = acquirer_id
|
82
86
|
@merchant_id = merchant_id
|
@@ -87,13 +91,16 @@ module StarkInfra
|
|
87
91
|
@score = score
|
88
92
|
@end_to_end_id = end_to_end_id
|
89
93
|
@tags = tags
|
90
|
-
@zip_code = zip_code
|
91
94
|
@issuing_transaction_ids = issuing_transaction_ids
|
92
95
|
@status = status
|
93
|
-
@
|
94
|
-
@
|
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)
|
95
101
|
@is_partial_allowed = is_partial_allowed
|
96
102
|
@card_tags = card_tags
|
103
|
+
@holder_id = holder_id
|
97
104
|
@holder_tags = holder_tags
|
98
105
|
|
99
106
|
end
|
@@ -131,10 +138,10 @@ module StarkInfra
|
|
131
138
|
#
|
132
139
|
# ## Return:
|
133
140
|
# - generator of IssuingPurchases objects with updated attributes
|
134
|
-
def self.query(ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil, card_ids: nil,
|
135
|
-
|
136
|
-
after =
|
137
|
-
before =
|
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)
|
142
|
+
|
143
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
144
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
138
145
|
StarkInfra::Utils::Rest.get_stream(
|
139
146
|
ids: ids,
|
140
147
|
limit: limit,
|
@@ -171,8 +178,8 @@ module StarkInfra
|
|
171
178
|
# - cursor to retrieve the next page of IssuingPurchases objects
|
172
179
|
def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, end_to_end_ids: nil, holder_ids: nil,
|
173
180
|
card_ids: nil, status: nil, user: nil)
|
174
|
-
after =
|
175
|
-
before =
|
181
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
182
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
176
183
|
StarkInfra::Utils::Rest.get_page(
|
177
184
|
cursor: cursor,
|
178
185
|
ids: ids,
|
@@ -207,7 +214,7 @@ module StarkInfra
|
|
207
214
|
# ## Return:
|
208
215
|
# - Parsed IssuingPurchase object
|
209
216
|
def self.parse(content:, signature:, user: nil)
|
210
|
-
|
217
|
+
StarkCore::Utils::Parse.parse_and_verify(
|
211
218
|
content: content,
|
212
219
|
signature: signature,
|
213
220
|
user: user,
|
@@ -263,6 +270,7 @@ module StarkInfra
|
|
263
270
|
merchant_currency_code: json['merchant_currency_code'],
|
264
271
|
merchant_currency_symbol: json['merchant_currency_symbol'],
|
265
272
|
merchant_category_code: json['merchant_category_code'],
|
273
|
+
merchant_category_type: json['merchant_category_type'],
|
266
274
|
merchant_country_code: json['merchant_country_code'],
|
267
275
|
acquirer_id: json['acquirer_id'],
|
268
276
|
merchant_id: json['merchant_id'],
|
@@ -273,13 +281,16 @@ module StarkInfra
|
|
273
281
|
score: json['score'],
|
274
282
|
end_to_end_id: json['end_to_end_id'],
|
275
283
|
tags: json['tags'],
|
276
|
-
zip_code: json['zip_code'],
|
277
284
|
issuing_transaction_ids: json['issuing_transaction_ids'],
|
278
285
|
status: json['status'],
|
286
|
+
description: json['description'],
|
287
|
+
metadata: json['metadata'],
|
288
|
+
zip_code: json['zip_code'],
|
279
289
|
updated: json['updated'],
|
280
290
|
created: json['created'],
|
281
291
|
is_partial_allowed: json['is_partial_allowed'],
|
282
292
|
card_tags: json['card_tags'],
|
293
|
+
holder_id: json['holder_id'],
|
283
294
|
holder_tags: json['holder_tags']
|
284
295
|
)
|
285
296
|
}
|
data/lib/issuingpurchase/log.rb
CHANGED
@@ -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 <
|
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 =
|
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 =
|
66
|
-
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 =
|
99
|
-
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:
|
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 <
|
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 =
|
36
|
-
@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 =
|
92
|
-
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 =
|
130
|
-
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,
|
data/lib/issuingrestock/log.rb
CHANGED
@@ -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 <
|
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 =
|
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 =
|
64
|
-
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 =
|
97
|
-
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:
|
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 <
|
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 =
|
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 =
|
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 =
|
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 =
|
96
|
+
rule = StarkCore::Utils::API.from_api_json(rule_maker, rule)
|
98
97
|
end
|
99
98
|
parsed_rules << rule
|
100
99
|
end
|