starkinfra 0.1.0 → 0.3.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 +125 -0
- data/lib/cardmethod/cardmethod.rb +56 -0
- data/lib/creditholmes/creditholmes.rb +160 -0
- data/lib/creditnote/creditnote.rb +51 -355
- data/lib/creditnote/invoice/description.rb +51 -0
- data/lib/creditnote/invoice/discount.rb +49 -0
- data/lib/creditnote/invoice/invoice.rb +124 -0
- data/lib/creditnote/log.rb +18 -19
- data/lib/creditnote/transfer.rb +90 -0
- data/lib/creditpreview/creditnotepreview.rb +85 -0
- data/lib/creditpreview/creditpreview.rb +77 -0
- data/lib/creditsigner/creditsigner.rb +57 -0
- data/lib/dynamicbrcode/dynamicbrcode.rb +350 -0
- data/lib/event/attempt.rb +5 -4
- data/lib/event/event.rb +11 -11
- data/lib/individualdocument/individualdocument.rb +165 -0
- data/lib/individualdocument/log.rb +125 -0
- data/lib/individualidentity/individualidentity.rb +193 -0
- data/lib/individualidentity/log.rb +124 -0
- data/lib/issuingbalance/issuingbalance.rb +4 -4
- data/lib/issuingcard/issuingcard.rb +35 -33
- data/lib/issuingcard/log.rb +21 -21
- data/lib/issuingdesign/issuingdesign.rb +138 -0
- data/lib/issuingembossingkit/issuingembossingkit.rb +121 -0
- data/lib/issuingembossingrequest/issuingembossingrequest.rb +210 -0
- data/lib/issuingembossingrequest/log.rb +128 -0
- data/lib/issuingholder/issuingholder.rb +21 -15
- data/lib/issuingholder/log.rb +19 -19
- data/lib/issuinginvoice/issuinginvoice.rb +29 -14
- data/lib/issuinginvoice/log.rb +18 -18
- data/lib/{issuingbin/issuingbin.rb → issuingproduct/issuingproduct.rb} +27 -30
- data/lib/issuingpurchase/issuingpurchase.rb +111 -31
- data/lib/issuingpurchase/log.rb +16 -16
- data/lib/issuingrestock/issuingrestock.rb +162 -0
- data/lib/issuingrestock/log.rb +127 -0
- data/lib/issuingrule/issuingrule.rb +64 -18
- data/lib/issuingstock/issuingstock.rb +138 -0
- data/lib/issuingstock/log.rb +130 -0
- data/lib/issuingtransaction/issuingtransaction.rb +12 -13
- data/lib/issuingwithdrawal/issuingwithdrawal.rb +12 -11
- data/lib/merchantcategory/merchantcategory.rb +63 -0
- data/lib/merchantcountry/merchantcountry.rb +59 -0
- data/lib/pixbalance/pixbalance.rb +5 -5
- data/lib/pixchargeback/log.rb +15 -15
- data/lib/pixchargeback/pixchargeback.rb +32 -20
- data/lib/pixclaim/log.rb +21 -24
- data/lib/pixclaim/pixclaim.rb +44 -34
- data/lib/pixdirector/pixdirector.rb +9 -11
- data/lib/pixdomain/certificate.rb +1 -1
- data/lib/pixdomain/pixdomain.rb +5 -5
- data/lib/pixinfraction/log.rb +20 -20
- data/lib/pixinfraction/pixinfraction.rb +23 -15
- data/lib/pixkey/log.rb +23 -23
- data/lib/pixkey/pixkey.rb +14 -12
- data/lib/pixrequest/log.rb +24 -20
- data/lib/pixrequest/pixrequest.rb +54 -21
- data/lib/pixreversal/log.rb +3 -3
- data/lib/pixreversal/pixreversal.rb +48 -21
- data/lib/pixstatement/pixstatement.rb +13 -8
- data/lib/starkinfra.rb +40 -15
- data/lib/staticbrcode/staticbrcode.rb +170 -0
- data/lib/user/project.rb +1 -1
- data/lib/utils/api.rb +1 -0
- data/lib/utils/bacenid.rb +1 -1
- data/lib/utils/parse.rb +7 -3
- data/lib/utils/request.rb +1 -1
- data/lib/utils/resource.rb +1 -1
- data/lib/utils/sub_resource.rb +21 -22
- data/lib/webhook/webhook.rb +11 -11
- metadata +29 -4
- data/lib/issuingauthorization/issuingauthorization.rb +0 -141
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative('../utils/rest')
|
4
|
+
require_relative('../utils/sub_resource')
|
5
|
+
|
6
|
+
module StarkInfra
|
7
|
+
# # MerchantCategory object
|
8
|
+
#
|
9
|
+
# MerchantCategory's codes and types are used to define categories filters in IssuingRules.
|
10
|
+
#
|
11
|
+
# A MerchantCategory filter must define exactly one parameter between code and type.
|
12
|
+
# A type, such as 'food', 'services', etc., defines an entire group of merchant codes,
|
13
|
+
# whereas a code only specifies a specific MCC.
|
14
|
+
#
|
15
|
+
# ## Parameters (conditionally required):
|
16
|
+
# - code [string, default nil]: category's code. ex: 'veterinaryServices', 'fastFoodRestaurants'
|
17
|
+
# - type [string, default nil]: category's type. ex: 'pets', 'food'
|
18
|
+
#
|
19
|
+
# Attributes (return-only):
|
20
|
+
# - name [string]: category's name. ex: 'Veterinary services', 'Fast food restaurants'
|
21
|
+
# - number [string]: category's number. ex: '742', '5814'
|
22
|
+
class MerchantCategory < StarkInfra::Utils::SubResource
|
23
|
+
attr_reader :code, :type, :name, :number
|
24
|
+
def initialize(code:, type:, name: nil, number: nil)
|
25
|
+
@code = code
|
26
|
+
@type = type
|
27
|
+
@name = name
|
28
|
+
@number = number
|
29
|
+
end
|
30
|
+
|
31
|
+
# # Retrieve MerchantCategories
|
32
|
+
#
|
33
|
+
# Receive a generator of MerchantCategory objects available in the Stark Infra API
|
34
|
+
#
|
35
|
+
# ## Parameters (optional):
|
36
|
+
# - search [string, default nil]: keyword to search for code, name, number or short_code
|
37
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
|
38
|
+
#
|
39
|
+
# ## Return:
|
40
|
+
# - generator of MerchantCategory objects with updated attributes
|
41
|
+
def self.query(search: nil, user: nil)
|
42
|
+
StarkInfra::Utils::Rest.get_stream(
|
43
|
+
search: search,
|
44
|
+
user: user,
|
45
|
+
**resource
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.resource
|
50
|
+
{
|
51
|
+
resource_name: 'MerchantCategory',
|
52
|
+
resource_maker: proc { |json|
|
53
|
+
MerchantCategory.new(
|
54
|
+
code: json['code'],
|
55
|
+
type: json['type'],
|
56
|
+
name: json['name'],
|
57
|
+
number: json['number']
|
58
|
+
)
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative('../utils/rest')
|
4
|
+
require_relative('../utils/sub_resource')
|
5
|
+
|
6
|
+
module StarkInfra
|
7
|
+
# # MerchantCountry object
|
8
|
+
#
|
9
|
+
# MerchantCountry's codes are used to define countries filters in IssuingRules.
|
10
|
+
#
|
11
|
+
# ## Parameters (required):
|
12
|
+
# - code [string]: country's code. ex: 'BRA'
|
13
|
+
#
|
14
|
+
# Attributes (return-only):
|
15
|
+
# - name [string]: country's name. ex: 'Brazil'
|
16
|
+
# - number [string]: country's number. ex: '076'
|
17
|
+
# - short_code [string]: country's short code. ex: 'BR'
|
18
|
+
class MerchantCountry < StarkInfra::Utils::SubResource
|
19
|
+
attr_reader :code, :short_code, :name, :number
|
20
|
+
def initialize(code:, name: nil, number: nil, short_code: nil)
|
21
|
+
@code = code
|
22
|
+
@name = name
|
23
|
+
@number = number
|
24
|
+
@short_code = short_code
|
25
|
+
end
|
26
|
+
|
27
|
+
# # Retrieve MerchantCountries
|
28
|
+
#
|
29
|
+
# Receive a generator of MerchantCountry objects available in the Stark Infra API
|
30
|
+
#
|
31
|
+
# ## Parameters (optional):
|
32
|
+
# - search [string, default nil]: keyword to search for code, name, number or short_code
|
33
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
|
34
|
+
#
|
35
|
+
# ## Return:
|
36
|
+
# - generator of MerchantCountry objects with updated attributes
|
37
|
+
def self.query(search: nil, user: nil)
|
38
|
+
StarkInfra::Utils::Rest.get_stream(
|
39
|
+
search: search,
|
40
|
+
user: user,
|
41
|
+
**resource
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.resource
|
46
|
+
{
|
47
|
+
resource_name: 'MerchantCountry',
|
48
|
+
resource_maker: proc { |json|
|
49
|
+
MerchantCountry.new(
|
50
|
+
code: json['code'],
|
51
|
+
name: json['name'],
|
52
|
+
number: json['number'],
|
53
|
+
short_code: json['short_code']
|
54
|
+
)
|
55
|
+
}
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative('../utils/resource')
|
4
3
|
require_relative('../utils/rest')
|
5
4
|
require_relative('../utils/checks')
|
5
|
+
require_relative('../utils/resource')
|
6
6
|
|
7
7
|
module StarkInfra
|
8
8
|
# # PixBalance object
|
@@ -18,8 +18,8 @@ module StarkInfra
|
|
18
18
|
# - currency [string]: currency of the current workspace. Expect others to be added eventually. ex: 'BRL'
|
19
19
|
# - updated [DateTime]: latest update datetime for the balance. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
20
20
|
class PixBalance < StarkInfra::Utils::Resource
|
21
|
-
attr_reader :amount, :currency, :updated
|
22
|
-
def initialize(
|
21
|
+
attr_reader :id, :amount, :currency, :updated
|
22
|
+
def initialize(id: nil, amount: nil, currency: nil, updated: nil)
|
23
23
|
super(id)
|
24
24
|
@amount = amount
|
25
25
|
@currency = currency
|
@@ -44,10 +44,10 @@ module StarkInfra
|
|
44
44
|
resource_name: 'PixBalance',
|
45
45
|
resource_maker: proc { |json|
|
46
46
|
PixBalance.new(
|
47
|
+
id: json['id'],
|
47
48
|
amount: json['amount'],
|
48
49
|
currency: json['currency'],
|
49
|
-
updated: json['updated']
|
50
|
-
id: json['id']
|
50
|
+
updated: json['updated']
|
51
51
|
)
|
52
52
|
}
|
53
53
|
}
|
data/lib/pixchargeback/log.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative('
|
3
|
+
require_relative('pixchargeback')
|
4
4
|
require_relative('../utils/rest')
|
5
5
|
require_relative('../utils/checks')
|
6
|
-
require_relative('
|
6
|
+
require_relative('../utils/resource')
|
7
7
|
|
8
8
|
module StarkInfra
|
9
9
|
class PixChargeback
|
@@ -13,7 +13,7 @@ module StarkInfra
|
|
13
13
|
# is generated for the entity. This log is never generated by the
|
14
14
|
# user.
|
15
15
|
#
|
16
|
-
# ## Attributes:
|
16
|
+
# ## Attributes (return-only):
|
17
17
|
# - id [string]: unique id returned when the log is created. ex: '5656565656565656'
|
18
18
|
# - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
19
19
|
# - type [string]: type of the PixChargeback event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
|
@@ -29,9 +29,9 @@ module StarkInfra
|
|
29
29
|
@chargeback = chargeback
|
30
30
|
end
|
31
31
|
|
32
|
-
# # Retrieve a specific Log
|
32
|
+
# # Retrieve a specific PixChargeback::Log
|
33
33
|
#
|
34
|
-
# Receive a single Log object previously created by the Stark Infra API by passing its id
|
34
|
+
# Receive a single PixChargeback::Log object previously created by the Stark Infra API by passing its id
|
35
35
|
#
|
36
36
|
# ## Parameters (required):
|
37
37
|
# - id [string]: object unique id. ex: '5656565656565656'
|
@@ -40,26 +40,26 @@ module StarkInfra
|
|
40
40
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
41
41
|
#
|
42
42
|
# ## Return:
|
43
|
-
# - Log object with updated attributes
|
43
|
+
# - PixChargeback::Log object with updated attributes
|
44
44
|
def self.get(id, user: nil)
|
45
45
|
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
46
46
|
end
|
47
|
-
|
48
|
-
# # Retrieve Logs
|
47
|
+
|
48
|
+
# # Retrieve PixChargeback::Logs
|
49
49
|
#
|
50
|
-
# Receive a generator of Log objects previously created in the Stark Infra API
|
50
|
+
# Receive a generator of PixChargeback::Log objects previously created in the Stark Infra API
|
51
51
|
#
|
52
52
|
# ## Parameters (optional):
|
53
|
-
# - ids [list of strings, default nil]: Log ids to filter PixChargeback Logs. ex: ['5656565656565656']
|
54
53
|
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
55
54
|
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
56
55
|
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
57
56
|
# - types [list of strings, default nil]: filter retrieved objects by types. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
|
58
57
|
# - chargeback_ids [list of strings, default nil]: list of PixChargeback ids to filter retrieved objects. ex: %w[5656565656565656 4545454545454545]
|
58
|
+
# - ids [list of strings, default nil]: Log ids to filter PixChargeback Logs. ex: ['5656565656565656']
|
59
59
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
|
-
# - generator of Log objects with updated attributes
|
62
|
+
# - generator of PixChargeback::Log objects with updated attributes
|
63
63
|
def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_ids: nil, user: nil)
|
64
64
|
after = StarkInfra::Utils::Checks.check_date(after)
|
65
65
|
before = StarkInfra::Utils::Checks.check_date(before)
|
@@ -75,23 +75,23 @@ module StarkInfra
|
|
75
75
|
)
|
76
76
|
end
|
77
77
|
|
78
|
-
# # Retrieve paged Logs
|
78
|
+
# # Retrieve paged PixChargeback::Logs
|
79
79
|
#
|
80
|
-
# Receive a list of up to 100 Log objects previously created in the Stark Infra API and the cursor to the next page.
|
80
|
+
# Receive a list of up to 100 PixChargeback::Log objects previously created in the Stark Infra API and the cursor to the next page.
|
81
81
|
# Use this function instead of query if you want to manually page your chargebacks.
|
82
82
|
#
|
83
83
|
# ## Parameters (optional):
|
84
84
|
# - cursor [string, default nil]: cursor returned on the previous page function call
|
85
|
-
# - ids [list of strings, default nil]: Log ids to filter PixChargeback Logs. ex: ['5656565656565656']
|
86
85
|
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
87
86
|
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
88
87
|
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
89
88
|
# - types [list of strings, default nil]: filter retrieved objects by types. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
|
90
89
|
# - chargeback_ids [list of strings, default nil]: list of PixChargeback ids to filter retrieved objects. ex: %w[5656565656565656 4545454545454545]
|
90
|
+
# - ids [list of strings, default nil]: Log ids to filter PixChargeback Logs. ex: ['5656565656565656']
|
91
91
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
92
92
|
#
|
93
93
|
# ## Return:
|
94
|
-
# - list of Log objects with updated attributes
|
94
|
+
# - list of PixChargeback::Log objects with updated attributes
|
95
95
|
# - cursor to retrieve the next page of Log objects
|
96
96
|
def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_ids: nil, user: nil)
|
97
97
|
after = StarkInfra::Utils::Checks.check_date(after)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative('../utils/resource')
|
4
3
|
require_relative('../utils/rest')
|
5
4
|
require_relative('../utils/checks')
|
5
|
+
require_relative('../utils/resource')
|
6
6
|
|
7
7
|
module StarkInfra
|
8
8
|
# # PixChargeback object
|
@@ -10,8 +10,10 @@ module StarkInfra
|
|
10
10
|
# A Pix chargeback can be created when fraud is detected on a transaction or a system malfunction
|
11
11
|
# results in an erroneous transaction.
|
12
12
|
# It notifies another participant of your request to reverse the payment they have received.
|
13
|
+
#
|
13
14
|
# When you initialize a PixChargeback, the entity will not be automatically
|
14
15
|
# created in the Stark Infra API. The 'create' function sends the objects
|
16
|
+
# to the Stark Infra API and returns the created object.
|
15
17
|
#
|
16
18
|
# ## Parameters (required):
|
17
19
|
# - amount [integer]: amount in cents to be reversed. ex: 11234 (= R$ 112.34)
|
@@ -20,40 +22,41 @@ module StarkInfra
|
|
20
22
|
#
|
21
23
|
# ## Parameters (optional):
|
22
24
|
# - description [string, default nil]: description for the PixChargeback. ex: 'Payment for service #1234'
|
25
|
+
# - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
|
23
26
|
#
|
24
27
|
# ## Attributes (return-only):
|
25
|
-
# - id [string]: unique id returned when PixChargeback is created. ex: '5656565656565656'
|
28
|
+
# - id [string]: unique id returned when the PixChargeback is created. ex: '5656565656565656'
|
26
29
|
# - analysis [string]: analysis that led to the result.
|
27
|
-
# - bacen_id [string]: central bank's unique UUID that identifies the PixChargeback.
|
28
30
|
# - sender_bank_code [string]: bank_code of the Pix participant that created the PixChargeback. ex: '20018183'
|
29
31
|
# - receiver_bank_code [string]: bank_code of the Pix participant that received the PixChargeback. ex: '20018183'
|
30
32
|
# - rejection_reason [string]: reason for the rejection of the Pix chargeback. Options: 'noBalance', 'accountClosed', 'unableToReverse'
|
31
33
|
# - reversal_reference_id [string]: return id of the reversal transaction. ex: 'D20018183202202030109X3OoBHG74wo'.
|
32
|
-
# - id [string]: unique id returned when the PixChargeback is created. ex: '5656565656565656'
|
33
34
|
# - result [string]: result after the analysis of the PixChargeback by the receiving party. Options: 'rejected', 'accepted', 'partiallyAccepted'
|
35
|
+
# - flow [string]: direction of the Pix Chargeback. Options: 'in' for received chargebacks, 'out' for chargebacks you requested
|
34
36
|
# - status [string]: current PixChargeback status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
|
35
37
|
# - created [DateTime]: creation datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
36
38
|
# - updated [DateTime]: latest update datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
37
39
|
class PixChargeback < StarkInfra::Utils::Resource
|
38
|
-
attr_reader :amount, :reference_id, :reason, :description, :
|
39
|
-
:receiver_bank_code, :rejection_reason, :reversal_reference_id, :result, :status, :created, :updated
|
40
|
+
attr_reader :amount, :reference_id, :reason, :description, :tags, :id, :analysis, :sender_bank_code,
|
41
|
+
:receiver_bank_code, :rejection_reason, :reversal_reference_id, :result, :flow, :status, :created, :updated
|
40
42
|
def initialize(
|
41
|
-
amount:, reference_id:, reason:, description: nil, id: nil, analysis: nil,
|
42
|
-
|
43
|
-
|
43
|
+
amount:, reference_id:, reason:, description: nil, tags: nil, id: nil, analysis: nil, sender_bank_code: nil,
|
44
|
+
receiver_bank_code: nil, rejection_reason: nil, reversal_reference_id: nil, result: nil, flow: nil, status: nil,
|
45
|
+
created: nil, updated: nil
|
44
46
|
)
|
45
47
|
super(id)
|
46
48
|
@amount = amount
|
47
49
|
@reference_id = reference_id
|
48
50
|
@reason = reason
|
49
51
|
@description = description
|
52
|
+
@tags = tags
|
50
53
|
@analysis = analysis
|
51
|
-
@bacen_id = bacen_id
|
52
54
|
@sender_bank_code = sender_bank_code
|
53
55
|
@receiver_bank_code = receiver_bank_code
|
54
56
|
@rejection_reason = rejection_reason
|
55
57
|
@reversal_reference_id = reversal_reference_id
|
56
58
|
@result = result
|
59
|
+
@flow = flow
|
57
60
|
@status = status
|
58
61
|
@created = StarkInfra::Utils::Checks.check_datetime(created)
|
59
62
|
@updated = StarkInfra::Utils::Checks.check_datetime(updated)
|
@@ -61,10 +64,10 @@ module StarkInfra
|
|
61
64
|
|
62
65
|
# # Create PixChargebacks
|
63
66
|
#
|
64
|
-
#
|
67
|
+
# Create PixChargebacks in the Stark Infra API
|
65
68
|
#
|
66
69
|
# ## Parameters (required):
|
67
|
-
# - chargebacks [list of PixChargeback objects]: list of PixChargeback objects to be created in the API.
|
70
|
+
# - chargebacks [list of PixChargeback objects]: list of PixChargeback objects to be created in the API.
|
68
71
|
#
|
69
72
|
# ## Parameters (optional):
|
70
73
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
@@ -75,9 +78,9 @@ module StarkInfra
|
|
75
78
|
StarkInfra::Utils::Rest.post(entities: chargebacks, user: user, **resource)
|
76
79
|
end
|
77
80
|
|
78
|
-
# # Retrieve a
|
81
|
+
# # Retrieve a PixChargeback object
|
79
82
|
#
|
80
|
-
#
|
83
|
+
# Retrieve a PixChargeback object linked to your Workspace in the Stark Infra API using its id.
|
81
84
|
#
|
82
85
|
# ## Parameters (required):
|
83
86
|
# - id [string]: object unique id. ex: '5656565656565656'
|
@@ -101,11 +104,13 @@ module StarkInfra
|
|
101
104
|
# - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
|
102
105
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
|
103
106
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
107
|
+
# - flow [string, default nil]: direction of the Pix Chargeback. Options: 'in' for received chargebacks, 'out' for chargebacks you requested
|
108
|
+
# - tags [list of strings, default nil]: filter for tags of retrieved objects. ex: ['travel', 'food']
|
104
109
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
105
110
|
#
|
106
111
|
# ## Return:
|
107
112
|
# - generator of PixChargeback objects with updated attributes
|
108
|
-
def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, user: nil)
|
113
|
+
def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
|
109
114
|
after = StarkInfra::Utils::Checks.check_date(after)
|
110
115
|
before = StarkInfra::Utils::Checks.check_date(before)
|
111
116
|
StarkInfra::Utils::Rest.get_stream(
|
@@ -114,6 +119,8 @@ module StarkInfra
|
|
114
119
|
before: before,
|
115
120
|
status: status,
|
116
121
|
ids: ids,
|
122
|
+
flow: flow,
|
123
|
+
tags: tags,
|
117
124
|
user: user,
|
118
125
|
**resource
|
119
126
|
)
|
@@ -131,12 +138,14 @@ module StarkInfra
|
|
131
138
|
# - before [Date or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
|
132
139
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
|
133
140
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
141
|
+
# - flow [string, default nil]: direction of the Pix Chargeback. Options: 'in' for received chargebacks, 'out' for chargebacks you requested
|
142
|
+
# - tags [list of strings, default nil]: filter for tags of retrieved objects. ex: ['travel', 'food']
|
134
143
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
135
144
|
#
|
136
145
|
# ## Return:
|
137
146
|
# - list of PixChargeback objects with updated attributes
|
138
147
|
# - cursor to retrieve the next page of PixChargeback objects
|
139
|
-
def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, user: nil)
|
148
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
|
140
149
|
after = StarkInfra::Utils::Checks.check_date(after)
|
141
150
|
before = StarkInfra::Utils::Checks.check_date(before)
|
142
151
|
StarkInfra::Utils::Rest.get_page(
|
@@ -146,6 +155,8 @@ module StarkInfra
|
|
146
155
|
before: before,
|
147
156
|
status: status,
|
148
157
|
ids: ids,
|
158
|
+
flow: flow,
|
159
|
+
tags: tags,
|
149
160
|
user: user,
|
150
161
|
**resource
|
151
162
|
)
|
@@ -157,7 +168,7 @@ module StarkInfra
|
|
157
168
|
#
|
158
169
|
# ## Parameters (required):
|
159
170
|
# - id [string]: PixChargeback unique id. ex: '5656565656565656'
|
160
|
-
# - result [string]: result of the PixChargeback. Options: 'rejected', 'accepted', 'partiallyAccepted'.
|
171
|
+
# - result [string]: result after the analysis of the PixChargeback. Options: 'rejected', 'accepted', 'partiallyAccepted'.
|
161
172
|
#
|
162
173
|
# ## Parameters (conditionally required):
|
163
174
|
# - rejection_reason [string, default nil]: if the PixChargeback is rejected a reason is required. Options: 'noBalance', 'accountClosed', 'unableToReverse',
|
@@ -174,8 +185,8 @@ module StarkInfra
|
|
174
185
|
id: id,
|
175
186
|
result: result,
|
176
187
|
rejection_reason: rejection_reason,
|
177
|
-
analysis: analysis,
|
178
188
|
reversal_reference_id: reversal_reference_id,
|
189
|
+
analysis: analysis,
|
179
190
|
user: user,
|
180
191
|
**resource
|
181
192
|
)
|
@@ -202,18 +213,19 @@ module StarkInfra
|
|
202
213
|
resource_name: 'PixChargeback',
|
203
214
|
resource_maker: proc { |json|
|
204
215
|
PixChargeback.new(
|
216
|
+
id: json['id'],
|
205
217
|
amount: json['amount'],
|
206
218
|
reference_id: json['reference_id'],
|
207
219
|
reason: json['reason'],
|
208
220
|
description: json['description'],
|
209
|
-
|
221
|
+
tags: json['tags'],
|
210
222
|
analysis: json['analysis'],
|
211
|
-
bacen_id: json['bacen_id'],
|
212
223
|
sender_bank_code: json['sender_bank_code'],
|
213
224
|
receiver_bank_code: json['receiver_bank_code'],
|
214
225
|
rejection_reason: json['rejection_reason'],
|
215
226
|
reversal_reference_id: json['reversal_reference_id'],
|
216
227
|
result: json['result'],
|
228
|
+
flow: json['flow'],
|
217
229
|
status: json['status'],
|
218
230
|
created: json['created'],
|
219
231
|
updated: json['updated']
|
data/lib/pixclaim/log.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative('
|
3
|
+
require_relative('pixclaim')
|
4
4
|
require_relative('../utils/rest')
|
5
5
|
require_relative('../utils/checks')
|
6
|
-
require_relative('
|
6
|
+
require_relative('../utils/resource')
|
7
7
|
|
8
8
|
module StarkInfra
|
9
9
|
class PixClaim
|
@@ -13,29 +13,27 @@ module StarkInfra
|
|
13
13
|
# is generated for the entity. This log is never generated by the
|
14
14
|
# user.
|
15
15
|
#
|
16
|
-
# ## Attributes:
|
16
|
+
# ## Attributes (return-only):
|
17
17
|
# - id [string]: unique id returned when the log is created. ex: '5656565656565656'
|
18
|
-
# -
|
18
|
+
# - claim [PixClaim]: PixClaim entity to which the log refers to.
|
19
19
|
# - type [string]: type of the PixClaim event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'confirming', 'confirmed', 'success', 'canceling', 'canceled'.
|
20
20
|
# - errors [list of strings]: list of errors linked to this PixClaim event.
|
21
|
-
# - agent [string]: agent that modified the PixClaim resulting in the Log. Options: 'claimer', 'claimed'.
|
22
21
|
# - reason [string]: reason why the PixClaim was modified, resulting in the Log. Options: 'fraud', 'userRequested', 'accountClosure', 'defaultOperation', 'reconciliation'
|
23
|
-
# -
|
22
|
+
# - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
24
23
|
class Log < StarkInfra::Utils::Resource
|
25
|
-
attr_reader :id, :created, :type, :errors, :
|
26
|
-
def initialize(id:, created:, type:, errors:,
|
24
|
+
attr_reader :id, :created, :type, :errors, :reason, :claim
|
25
|
+
def initialize(id:, created:, type:, errors:, reason:, claim:)
|
27
26
|
super(id)
|
28
27
|
@created = StarkInfra::Utils::Checks.check_datetime(created)
|
29
28
|
@type = type
|
30
29
|
@errors = errors
|
31
|
-
@agent = agent
|
32
30
|
@reason = reason
|
33
31
|
@claim = claim
|
34
32
|
end
|
35
33
|
|
36
|
-
# # Retrieve a specific Log
|
34
|
+
# # Retrieve a specific PixClaim::Log
|
37
35
|
#
|
38
|
-
# Receive a single Log object previously created by the Stark Infra API by passing its id
|
36
|
+
# Receive a single PixClaim::Log object previously created by the Stark Infra API by passing its id
|
39
37
|
#
|
40
38
|
# ## Parameters (required):
|
41
39
|
# - id [string]: object unique id. ex: '5656565656565656'
|
@@ -44,26 +42,26 @@ module StarkInfra
|
|
44
42
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
45
43
|
#
|
46
44
|
# ## Return:
|
47
|
-
# - Log object with updated attributes
|
45
|
+
# - PixClaim::Log object with updated attributes
|
48
46
|
def self.get(id, user: nil)
|
49
47
|
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
50
48
|
end
|
51
49
|
|
52
|
-
# # Retrieve Logs
|
50
|
+
# # Retrieve PixClaim::Logs
|
53
51
|
#
|
54
|
-
# Receive a generator of Log objects previously created in the Stark Infra API
|
52
|
+
# Receive a generator of PixClaim::Log objects previously created in the Stark Infra API
|
55
53
|
#
|
56
54
|
# ## Parameters (optional):
|
57
|
-
# - ids [list of strings, default nil]: Log ids to filter PixClaim Logs. ex: ['5656565656565656']
|
58
55
|
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
59
56
|
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
60
57
|
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
61
|
-
# - types [list of strings]: filter PixClaim Logs by their types. Options: 'created', 'failed', 'delivering', 'delivered', 'confirming', 'confirmed', 'success', 'canceling', 'canceled'.
|
62
|
-
# - claim_ids [list of strings, default nil]: list of PixClaim ids to filter retrieved objects. ex:
|
58
|
+
# - types [list of strings, default nil]: filter PixClaim Logs by their types. Options: 'created', 'failed', 'delivering', 'delivered', 'confirming', 'confirmed', 'success', 'canceling', 'canceled'.
|
59
|
+
# - claim_ids [list of strings, default nil]: list of PixClaim ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
60
|
+
# - ids [list of strings, default nil]: Log ids to filter PixClaim Logs. ex: ['5656565656565656']
|
63
61
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
64
62
|
#
|
65
63
|
# ## Return:
|
66
|
-
# - generator of Log objects with updated attributes
|
64
|
+
# - generator of PixClaim::Log objects with updated attributes
|
67
65
|
def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, claim_ids: nil, user: nil)
|
68
66
|
after = StarkInfra::Utils::Checks.check_date(after)
|
69
67
|
before = StarkInfra::Utils::Checks.check_date(before)
|
@@ -79,19 +77,19 @@ module StarkInfra
|
|
79
77
|
)
|
80
78
|
end
|
81
79
|
|
82
|
-
# # Retrieve paged Logs
|
80
|
+
# # Retrieve paged PixClaim::Logs
|
83
81
|
#
|
84
|
-
# Receive a list of up to 100 Log objects previously created in the Stark Infra API and the cursor to the next page.
|
82
|
+
# Receive a list of up to 100 PixClaim::Log objects previously created in the Stark Infra API and the cursor to the next page.
|
85
83
|
# Use this function instead of query if you want to manually page your claims.
|
86
84
|
#
|
87
85
|
# ## Parameters (optional):
|
88
|
-
# - ids [list of strings, default nil]: Log ids to filter PixClaim Logs. ex: ['5656565656565656']
|
89
86
|
# - cursor [string, default nil]: cursor returned on the previous page function call
|
90
87
|
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
91
88
|
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
92
89
|
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
93
|
-
# - types [list of strings]: filter PixClaim Logs by their types. Options: 'created', 'failed', 'delivering', 'delivered', 'confirming', 'confirmed', 'success', 'canceling', 'canceled'.
|
94
|
-
# - claim_ids [list of strings, default nil]: list of PixClaim ids to filter retrieved objects. ex:
|
90
|
+
# - types [list of strings, default nil]: filter PixClaim Logs by their types. Options: 'created', 'failed', 'delivering', 'delivered', 'confirming', 'confirmed', 'success', 'canceling', 'canceled'.
|
91
|
+
# - claim_ids [list of strings, default nil]: list of PixClaim ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
92
|
+
# - ids [list of strings, default nil]: Log ids to filter PixClaim Logs. ex: ['5656565656565656']
|
95
93
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
96
94
|
#
|
97
95
|
# ## Return:
|
@@ -123,7 +121,6 @@ module StarkInfra
|
|
123
121
|
created: json['created'],
|
124
122
|
type: json['type'],
|
125
123
|
errors: json['errors'],
|
126
|
-
agent: json['agent'],
|
127
124
|
reason: json['reason'],
|
128
125
|
claim: StarkInfra::Utils::API.from_api_json(claim_maker, json['claim'])
|
129
126
|
)
|