starkinfra 0.6.0 → 0.7.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/brcode_preview/brcode_preview.rb +22 -4
- data/lib/brcode_preview/subscription.rb +2 -2
- data/lib/business_account_request/business_account_request.rb +276 -0
- data/lib/{individual_document → business_account_request}/log.rb +35 -35
- data/lib/business_attachment/business_attachment.rb +6 -3
- data/lib/business_identity/business_identity.rb +7 -4
- data/lib/credit_holmes/credit_holmes.rb +2 -1
- data/lib/credit_holmes/log.rb +125 -0
- data/lib/credit_note/credit_note.rb +42 -5
- data/lib/credit_note/rule.rb +9 -0
- data/lib/credit_note/transfer.rb +1 -1
- data/lib/credit_preview/credit_note_preview.rb +10 -2
- data/lib/credit_preview/credit_preview.rb +2 -1
- data/lib/credit_signer/credit_signer.rb +27 -2
- data/lib/dynamic_brcode/dynamic_brcode.rb +5 -2
- data/lib/event/event.rb +2 -2
- data/lib/individual_account_attachment/individual_account_attachment.rb +178 -0
- data/lib/individual_account_attachment/log.rb +124 -0
- data/lib/individual_account_request/individual_account_request.rb +271 -0
- data/lib/individual_account_request/log.rb +124 -0
- data/lib/individual_identity/individual_identity.rb +4 -7
- data/lib/issuing_card/issuing_card.rb +5 -4
- data/lib/issuing_design/issuing_design.rb +9 -0
- data/lib/issuing_embossing_request/issuing_embossing_request.rb +3 -2
- data/lib/issuing_holder/issuing_holder.rb +6 -5
- data/lib/issuing_product/issuing_product.rb +2 -2
- data/lib/issuing_purchase/issuing_purchase.rb +25 -1
- data/lib/issuing_restock/issuing_restock.rb +3 -2
- data/lib/issuing_rule/issuing_rule.rb +36 -0
- data/lib/issuing_stock_rule/issuing_stock_rule.rb +6 -5
- data/lib/issuing_token/issuing_token.rb +2 -2
- data/lib/issuing_token/log.rb +127 -0
- data/lib/issuing_token_activation/issuing_token_activation.rb +62 -0
- data/lib/issuing_token_request/issuing_token_request.rb +1 -1
- data/lib/issuing_withdrawal/issuing_withdrawal.rb +2 -2
- data/lib/ledger/ledger.rb +175 -0
- data/lib/ledger/log.rb +122 -0
- data/lib/ledger/rule.rb +55 -0
- data/lib/ledger_transaction/ledger_transaction.rb +179 -0
- data/lib/pix_balance/pix_balance.rb +1 -1
- data/lib/pix_chargeback/pix_chargeback.rb +10 -7
- data/lib/pix_claim/pix_claim.rb +14 -6
- data/lib/pix_director/pix_director.rb +1 -1
- data/lib/pix_dispute/pix_dispute.rb +1 -1
- data/lib/pix_dispute/transaction.rb +4 -4
- data/lib/pix_fraud/pix_fraud.rb +1 -1
- data/lib/pix_infraction/pix_infraction.rb +21 -5
- data/lib/pix_internal_transaction_report/pix_internal_transaction_report.rb +1 -1
- data/lib/pix_key/pix_key.rb +1 -1
- data/lib/pix_key_holmes/log.rb +129 -0
- data/lib/pix_key_holmes/pix_key_holmes.rb +19 -2
- data/lib/pix_pull_request/pix_pull_request.rb +6 -3
- data/lib/pix_pull_subscription/pix_pull_subscription.rb +31 -5
- data/lib/pix_request/pix_request.rb +13 -7
- data/lib/pix_reversal/pix_reversal.rb +14 -8
- data/lib/pix_statement/pix_statement.rb +11 -5
- data/lib/pix_user/pix_user.rb +52 -0
- data/lib/pix_user/statistics.rb +64 -0
- data/lib/starkinfra.rb +20 -3
- data/lib/static_brcode/static_brcode.rb +8 -4
- data/lib/utils/bacen_id.rb +27 -0
- data/lib/utils/end_to_end_id.rb +20 -0
- data/lib/utils/pix_subscription_bacen_id.rb +21 -0
- data/lib/utils/return_id.rb +1 -4
- data/lib/webhook/webhook.rb +2 -2
- metadata +21 -4
- data/lib/individual_document/individual_document.rb +0 -164
|
@@ -44,7 +44,8 @@ module StarkInfra
|
|
|
44
44
|
|
|
45
45
|
# # Create IssuingHolders
|
|
46
46
|
#
|
|
47
|
-
# Send a list of IssuingHolder objects for creation in the Stark Infra API
|
|
47
|
+
# Send a list of IssuingHolder objects for creation in the Stark Infra API. Use this method to create up
|
|
48
|
+
# to 100 new IssuingHolders at a time.
|
|
48
49
|
#
|
|
49
50
|
# ## Parameters (required):
|
|
50
51
|
# - holders [list of IssuingHolder objects]: list of IssuingHolder objects to be created in the API
|
|
@@ -147,13 +148,13 @@ module StarkInfra
|
|
|
147
148
|
|
|
148
149
|
# # Update IssuingHolder entity
|
|
149
150
|
#
|
|
150
|
-
# Update an IssuingHolder by passing id
|
|
151
|
+
# Update an IssuingHolder by passing id. A canceled holder can no longer be updated.
|
|
151
152
|
#
|
|
152
153
|
# ## Parameters (required):
|
|
153
154
|
# - id [string]: IssuingHolder id. ex: '5656565656565656'
|
|
154
155
|
#
|
|
155
156
|
# ## Parameters (optional):
|
|
156
|
-
# - status [string, default nil]:
|
|
157
|
+
# - status [string, default nil]: status to update the holder to. Options: 'active', 'blocked'.
|
|
157
158
|
# - name [string, default nil]: card holder name.
|
|
158
159
|
# - tags [list of strings, default nil]: list of strings for tagging
|
|
159
160
|
# - rules [list of IssuingRule objects, default nil]: list of objects that represent the holder's spending rules.
|
|
@@ -175,7 +176,7 @@ module StarkInfra
|
|
|
175
176
|
|
|
176
177
|
# # Cancel an IssuingHolder entity
|
|
177
178
|
#
|
|
178
|
-
# Cancel an IssuingHolder entity previously created in the Stark Infra API
|
|
179
|
+
# Cancel an IssuingHolder entity previously created in the Stark Infra API. This action is irreversible.
|
|
179
180
|
#
|
|
180
181
|
# ## Parameters (required):
|
|
181
182
|
# - id [string]: IssuingHolder unique id. ex: '5656565656565656'
|
|
@@ -186,7 +187,7 @@ module StarkInfra
|
|
|
186
187
|
# ## Return:
|
|
187
188
|
# - canceled IssuingHolder object
|
|
188
189
|
def self.cancel(id, user: nil)
|
|
189
|
-
|
|
190
|
+
StarkInfra::Utils::Rest.delete_id(id: id, user: user, **resource)
|
|
190
191
|
end
|
|
191
192
|
|
|
192
193
|
def self.resource
|
|
@@ -12,10 +12,10 @@ module StarkInfra
|
|
|
12
12
|
# ## Attributes (return-only):
|
|
13
13
|
# - id [string]: unique card product number (BIN) registered within the card network. ex: '53810200'
|
|
14
14
|
# - network [string]: card network flag. ex: 'mastercard'
|
|
15
|
-
# - funding_type [string]: type of funding used for payment.
|
|
15
|
+
# - funding_type [string]: type of funding used for payment. Options: 'prepaid', 'credit'.
|
|
16
16
|
# - holder_type [string]: holder type. ex: 'business', 'individual'
|
|
17
17
|
# - code [string]: internal code from card flag informing the product. ex: 'MRW', 'MCO', 'MWB', 'MCS'
|
|
18
|
-
# - customer_type [string]:
|
|
18
|
+
# - customer_type [string]: same as holder_type. Kept for backward compatibility.
|
|
19
19
|
# - created [DateTime]: creation datetime for the IssuingProduct. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
20
20
|
class IssuingProduct < StarkCore::Utils::Resource
|
|
21
21
|
attr_reader :id, :network, :funding_type, :holder_type, :code, :customer_type, :created
|
|
@@ -13,7 +13,7 @@ module StarkInfra
|
|
|
13
13
|
# - product_id [string]: unique card product number (BIN) registered within the card network. ex: "53810200"
|
|
14
14
|
# - card_id [string]: unique id returned when IssuingCard is created. ex: '5656565656565656'
|
|
15
15
|
# - card_ending [string]: last 4 digits of the card number. ex: '1234'
|
|
16
|
-
# - purpose [string]: purchase purpose.
|
|
16
|
+
# - purpose [string]: purchase purpose. Options: 'purchase', 'withdrawal', 'verification', 'purchaseRefund', 'cashbackPurchase', 'paymentTransaction'.
|
|
17
17
|
# - installment_count [integer]: quantity of installments to be confirmed. Minimum = 1. ex: 12
|
|
18
18
|
# - amount [integer]: IssuingPurchase value in cents. Minimum = 0. ex: 1234 (= R$ 12.34)
|
|
19
19
|
# - tax [integer]: IOF amount taxed for international purchases. ex: 1234 (= R$ 12.34)
|
|
@@ -201,6 +201,30 @@ module StarkInfra
|
|
|
201
201
|
)
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
+
# # Update IssuingPurchase entity
|
|
205
|
+
#
|
|
206
|
+
# Update an IssuingPurchase by passing id.
|
|
207
|
+
#
|
|
208
|
+
# ## Parameters (required):
|
|
209
|
+
# - id [string]: IssuingPurchase id. ex: '5656565656565656'
|
|
210
|
+
#
|
|
211
|
+
# ## Parameters (optional):
|
|
212
|
+
# - tags [list of strings, default nil]: list of strings for tagging. ex: ['tony', 'stark']
|
|
213
|
+
# - description [string, default nil]: new IssuingPurchase description. Max of 140 characters. ex: 'Office Supplies'
|
|
214
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
|
|
215
|
+
#
|
|
216
|
+
# ## Return:
|
|
217
|
+
# - target IssuingPurchase with updated attributes
|
|
218
|
+
def self.update(id, description: nil, tags: nil, user: nil)
|
|
219
|
+
StarkInfra::Utils::Rest.patch_id(
|
|
220
|
+
id: id,
|
|
221
|
+
description: description,
|
|
222
|
+
tags: tags,
|
|
223
|
+
user: user,
|
|
224
|
+
**resource
|
|
225
|
+
)
|
|
226
|
+
end
|
|
227
|
+
|
|
204
228
|
# # Create a single verified IssuingPurchase authorization request from a content string
|
|
205
229
|
#
|
|
206
230
|
# Use this method to parse and verify the authenticity of the authorization request received at the informed endpoint.
|
|
@@ -18,7 +18,7 @@ module StarkInfra
|
|
|
18
18
|
#
|
|
19
19
|
# ## Attributes (return-only):
|
|
20
20
|
# - id [string]: unique id returned when IssuingRestock is created. ex: '5656565656565656'
|
|
21
|
-
# - status [string]: current IssuingRestock status.
|
|
21
|
+
# - status [string]: current IssuingRestock status. Options: 'created', 'processing', 'confirmed', 'canceled'.
|
|
22
22
|
# - updated [DateTime]: latest update datetime for the IssuingRestock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
23
23
|
# - created [DateTime]: creation datetime for the IssuingRestock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
24
24
|
class IssuingRestock < StarkCore::Utils::Resource
|
|
@@ -37,7 +37,8 @@ module StarkInfra
|
|
|
37
37
|
|
|
38
38
|
# # Create IssuingRestocks
|
|
39
39
|
#
|
|
40
|
-
# Send a list of IssuingRestock objects for creation in the Stark Infra API
|
|
40
|
+
# Send a list of IssuingRestock objects for creation in the Stark Infra API. Use this method to create up
|
|
41
|
+
# to 100 new IssuingRestocks at a time.
|
|
41
42
|
#
|
|
42
43
|
# ## Parameters (required):
|
|
43
44
|
# - restocks [list of IssuingRestock objects]: list of IssuingRestock objects to be created in the API
|
|
@@ -48,6 +48,15 @@ module StarkInfra
|
|
|
48
48
|
@purposes = purposes
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
# # Parse MerchantCategories
|
|
52
|
+
#
|
|
53
|
+
# Converts a list of hashes into a list of MerchantCategory objects.
|
|
54
|
+
#
|
|
55
|
+
# ## Parameters (required):
|
|
56
|
+
# - categories [list of hashes]: list to be parsed.
|
|
57
|
+
#
|
|
58
|
+
# ## Return:
|
|
59
|
+
# - list of parsed MerchantCategory objects
|
|
51
60
|
def self.parse_categories(categories)
|
|
52
61
|
resource_maker = StarkInfra::MerchantCategory.resource[:resource_maker]
|
|
53
62
|
return categories if categories.nil?
|
|
@@ -62,6 +71,15 @@ module StarkInfra
|
|
|
62
71
|
parsed_categories
|
|
63
72
|
end
|
|
64
73
|
|
|
74
|
+
# # Parse MerchantCountries
|
|
75
|
+
#
|
|
76
|
+
# Converts a list of hashes into a list of MerchantCountry objects.
|
|
77
|
+
#
|
|
78
|
+
# ## Parameters (required):
|
|
79
|
+
# - countries [list of hashes]: list to be parsed.
|
|
80
|
+
#
|
|
81
|
+
# ## Return:
|
|
82
|
+
# - list of parsed MerchantCountry objects
|
|
65
83
|
def self.parse_countries(countries)
|
|
66
84
|
resource_maker = StarkInfra::MerchantCountry.resource[:resource_maker]
|
|
67
85
|
return countries if countries.nil?
|
|
@@ -76,6 +94,15 @@ module StarkInfra
|
|
|
76
94
|
parsed_countries
|
|
77
95
|
end
|
|
78
96
|
|
|
97
|
+
# # Parse CardMethods
|
|
98
|
+
#
|
|
99
|
+
# Converts a list of hashes into a list of CardMethod objects.
|
|
100
|
+
#
|
|
101
|
+
# ## Parameters (required):
|
|
102
|
+
# - methods [list of hashes]: list to be parsed.
|
|
103
|
+
#
|
|
104
|
+
# ## Return:
|
|
105
|
+
# - list of parsed CardMethod objects
|
|
79
106
|
def self.parse_methods(methods)
|
|
80
107
|
resource_maker = StarkInfra::CardMethod.resource[:resource_maker]
|
|
81
108
|
return methods if methods.nil?
|
|
@@ -90,6 +117,15 @@ module StarkInfra
|
|
|
90
117
|
parsed_methods
|
|
91
118
|
end
|
|
92
119
|
|
|
120
|
+
# # Parse IssuingRules
|
|
121
|
+
#
|
|
122
|
+
# Converts a list of hashes into a list of IssuingRule objects.
|
|
123
|
+
#
|
|
124
|
+
# ## Parameters (required):
|
|
125
|
+
# - rules [list of hashes]: list to be parsed.
|
|
126
|
+
#
|
|
127
|
+
# ## Return:
|
|
128
|
+
# - list of parsed IssuingRule objects
|
|
93
129
|
def self.parse_rules(rules)
|
|
94
130
|
rule_maker = StarkInfra::IssuingRule.resource[:resource_maker]
|
|
95
131
|
return rules if rules.nil?
|
|
@@ -8,7 +8,7 @@ module StarkInfra
|
|
|
8
8
|
#
|
|
9
9
|
# The IssuingStockRule object displays the notification rules attached to an IssuingStock.
|
|
10
10
|
# When the linked stock balance reaches the minimum_balance, the recipients listed in
|
|
11
|
-
# emails and phones are notified.
|
|
11
|
+
# emails and phones are notified. Each IssuingStock can have only one active IssuingStockRule at a time.
|
|
12
12
|
#
|
|
13
13
|
# ## Parameters (required):
|
|
14
14
|
# - minimum_balance [integer]: stock balance threshold that triggers a notification. ex: 10000
|
|
@@ -16,8 +16,8 @@ module StarkInfra
|
|
|
16
16
|
#
|
|
17
17
|
# ## Parameters (optional):
|
|
18
18
|
# - tags [list of strings, default nil]: list of strings for tagging. ex: ['card', 'corporate']
|
|
19
|
-
# - emails [list of strings, default nil]: emails notified when the stock reaches the minimum balance. ex: ['john.doe@enterprise.com']
|
|
20
|
-
# - phones [list of strings, default nil]: phones notified when the stock reaches the minimum balance. ex: ['+5511912345678']
|
|
19
|
+
# - emails [list of up to 10 strings, default nil]: emails notified when the stock reaches the minimum balance. ex: ['john.doe@enterprise.com']
|
|
20
|
+
# - phones [list of up to 10 strings, default nil]: phones notified when the stock reaches the minimum balance. ex: ['+5511912345678']
|
|
21
21
|
#
|
|
22
22
|
# ## Attributes (return-only):
|
|
23
23
|
# - id [string]: unique id returned when IssuingStockRule is created. ex: '5664445921492992'
|
|
@@ -43,7 +43,8 @@ module StarkInfra
|
|
|
43
43
|
|
|
44
44
|
# # Create IssuingStockRules
|
|
45
45
|
#
|
|
46
|
-
# Send a list of IssuingStockRule objects for creation in the Stark Infra API
|
|
46
|
+
# Send a list of IssuingStockRule objects for creation in the Stark Infra API. At least one of emails or
|
|
47
|
+
# phones must be informed per rule.
|
|
47
48
|
#
|
|
48
49
|
# ## Parameters (required):
|
|
49
50
|
# - rules [list of IssuingStockRule objects]: list of IssuingStockRule objects to be created in the API
|
|
@@ -177,7 +178,7 @@ module StarkInfra
|
|
|
177
178
|
|
|
178
179
|
# # Cancel an IssuingStockRule entity
|
|
179
180
|
#
|
|
180
|
-
# Cancel an IssuingStockRule entity previously created in the Stark Infra API
|
|
181
|
+
# Cancel an IssuingStockRule entity previously created in the Stark Infra API. This action is irreversible.
|
|
181
182
|
#
|
|
182
183
|
# ## Parameters (required):
|
|
183
184
|
# - id [string]: IssuingStockRule unique id. ex: '5664445921492992'
|
|
@@ -15,7 +15,7 @@ module StarkInfra
|
|
|
15
15
|
# - wallet_id [string]: wallet provider which the token is bounded to. ex: 'google'
|
|
16
16
|
# - wallet_name [string]: wallet name. ex: 'GOOGLE'
|
|
17
17
|
# - merchant_id [string]: merchant unique id. ex: '5656565656565656'
|
|
18
|
-
# - status [string]: current IssuingToken status.
|
|
18
|
+
# - status [string]: current IssuingToken status. Options: 'active', 'blocked', 'canceled', 'frozen', 'pending', 'denied'.
|
|
19
19
|
# - wallet_device_score [number]: Device score informed by the digital wallet.
|
|
20
20
|
# - wallet_account_score [number]: Account score informed by the digital wallet
|
|
21
21
|
# - updated [DateTime]: latest update datetime for the IssuingToken. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
@@ -180,7 +180,7 @@ module StarkInfra
|
|
|
180
180
|
|
|
181
181
|
# # Cancel an IssuingToken entity
|
|
182
182
|
#
|
|
183
|
-
# Cancel an IssuingToken entity previously created in the Stark Infra API by its id
|
|
183
|
+
# Cancel an IssuingToken entity previously created in the Stark Infra API by its id. This action is irreversible.
|
|
184
184
|
#
|
|
185
185
|
# ## Parameters (required):
|
|
186
186
|
# - id [string]: IssuingToken unique id. ex: '5656565656565656'
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
require_relative('issuing_token')
|
|
6
|
+
|
|
7
|
+
module StarkInfra
|
|
8
|
+
class IssuingToken
|
|
9
|
+
# # IssuingToken::Log object
|
|
10
|
+
#
|
|
11
|
+
# Every time an IssuingToken entity is modified, a corresponding IssuingToken::Log
|
|
12
|
+
# is generated for the entity. This log is never generated by the user.
|
|
13
|
+
#
|
|
14
|
+
# ## Attributes (return-only):
|
|
15
|
+
# - id [string]: unique id returned when the log is created. ex: '5656565656565656'
|
|
16
|
+
# - token [IssuingToken]: IssuingToken entity to which the log refers to.
|
|
17
|
+
# - errors [list of hashes]: list of errors linked to this IssuingToken event, each with 'code' and 'message' keys.
|
|
18
|
+
# - type [string]: type of the IssuingToken event which triggered the log creation. ex: 'active', 'blocked', 'canceled', 'frozen' or 'pending'
|
|
19
|
+
# - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
20
|
+
class Log < StarkCore::Utils::Resource
|
|
21
|
+
attr_reader :id, :created, :type, :errors, :token
|
|
22
|
+
def initialize(id:, created:, type:, errors:, token:)
|
|
23
|
+
super(id)
|
|
24
|
+
@token = token
|
|
25
|
+
@errors = errors
|
|
26
|
+
@type = type
|
|
27
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# # Retrieve a specific IssuingToken::Log
|
|
31
|
+
#
|
|
32
|
+
# Receive a single IssuingToken::Log object previously created by the Stark Infra API by its id
|
|
33
|
+
#
|
|
34
|
+
# ## Parameters (required):
|
|
35
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
|
36
|
+
#
|
|
37
|
+
# ## Parameters (optional):
|
|
38
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
39
|
+
#
|
|
40
|
+
# ## Return:
|
|
41
|
+
# - IssuingToken::Log object with updated attributes
|
|
42
|
+
def self.get(id, user: nil)
|
|
43
|
+
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# # Retrieve IssuingToken::Logs
|
|
47
|
+
#
|
|
48
|
+
# Receive a generator of IssuingToken::Log objects previously created in the Stark Infra API
|
|
49
|
+
#
|
|
50
|
+
# ## Parameters (optional):
|
|
51
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
52
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
53
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
54
|
+
# - types [list of strings, default nil]: filter for log event types. ex: ['active', 'blocked', 'canceled', 'frozen', 'pending']
|
|
55
|
+
# - token_ids [list of strings, default nil]: list of IssuingToken ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
|
56
|
+
# - ids [list of strings, default nil]: list of ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
|
57
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
58
|
+
#
|
|
59
|
+
# ## Return:
|
|
60
|
+
# - generator of IssuingToken::Log objects with updated attributes
|
|
61
|
+
def self.query(limit: nil, after: nil, before: nil, types: nil, token_ids: nil, ids: nil, user: nil)
|
|
62
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
63
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
64
|
+
StarkInfra::Utils::Rest.get_stream(
|
|
65
|
+
limit: limit,
|
|
66
|
+
after: after,
|
|
67
|
+
before: before,
|
|
68
|
+
types: types,
|
|
69
|
+
token_ids: token_ids,
|
|
70
|
+
ids: ids,
|
|
71
|
+
user: user,
|
|
72
|
+
**resource
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# # Retrieve paged IssuingToken::Logs
|
|
77
|
+
#
|
|
78
|
+
# Receive a list of up to 100 IssuingToken::Log objects previously created in the Stark Infra API and the cursor to the next page.
|
|
79
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
80
|
+
#
|
|
81
|
+
# ## Parameters (optional):
|
|
82
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call
|
|
83
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
84
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
85
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
86
|
+
# - types [list of strings, default nil]: filter for log event types. ex: ['active', 'blocked', 'canceled', 'frozen', 'pending']
|
|
87
|
+
# - token_ids [list of strings, default nil]: list of IssuingToken ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
|
88
|
+
# - ids [list of strings, default nil]: list of ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
|
89
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
90
|
+
#
|
|
91
|
+
# ## Return:
|
|
92
|
+
# - list of IssuingToken::Log objects with updated attributes
|
|
93
|
+
# - cursor to retrieve the next page of IssuingToken::Log objects
|
|
94
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, token_ids: nil, ids: nil, user: nil)
|
|
95
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
96
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
97
|
+
StarkInfra::Utils::Rest.get_page(
|
|
98
|
+
cursor: cursor,
|
|
99
|
+
limit: limit,
|
|
100
|
+
after: after,
|
|
101
|
+
before: before,
|
|
102
|
+
types: types,
|
|
103
|
+
token_ids: token_ids,
|
|
104
|
+
ids: ids,
|
|
105
|
+
user: user,
|
|
106
|
+
**resource
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.resource
|
|
111
|
+
token_maker = StarkInfra::IssuingToken.resource[:resource_maker]
|
|
112
|
+
{
|
|
113
|
+
resource_name: 'IssuingTokenLog',
|
|
114
|
+
resource_maker: proc { |json|
|
|
115
|
+
Log.new(
|
|
116
|
+
id: json['id'],
|
|
117
|
+
token: StarkCore::Utils::API.from_api_json(token_maker, json['token']),
|
|
118
|
+
errors: json['errors'],
|
|
119
|
+
type: json['type'],
|
|
120
|
+
created: json['created']
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/parse')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # IssuingTokenActivation object
|
|
8
|
+
#
|
|
9
|
+
# The IssuingTokenActivation object displays the necessary information to proceed with the card tokenization.
|
|
10
|
+
# You will receive this object at your registered URL to notify you which method your user want to receive the activation code.
|
|
11
|
+
# The POST request must be answered with no content, within 2 seconds, and with an HTTP status code 200.
|
|
12
|
+
# After that, you may generate the activation code and send it to the cardholder.
|
|
13
|
+
#
|
|
14
|
+
# ## Attributes (return-only):
|
|
15
|
+
# - card_id [string]: card ID which the token is bounded to. ex: '5656565656565656'
|
|
16
|
+
# - token_id [string]: token unique id. ex: '5656565656565656'
|
|
17
|
+
# - tags [list of strings]: tags to filter retrieved object. ex: ['tony', 'stark']
|
|
18
|
+
# - activation_method [dictionary]: dictionary object with 'type':string and 'value':string pairs
|
|
19
|
+
class IssuingTokenActivation < StarkCore::Utils::SubResource
|
|
20
|
+
attr_reader :card_id, :token_id, :tags, :activation_method
|
|
21
|
+
def initialize(card_id: nil, token_id: nil, tags: nil, activation_method: nil)
|
|
22
|
+
@card_id = card_id
|
|
23
|
+
@token_id = token_id
|
|
24
|
+
@tags = tags
|
|
25
|
+
@activation_method = activation_method
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# # Create a single verified IssuingTokenActivation request from a content string
|
|
29
|
+
#
|
|
30
|
+
# Use this method to parse and verify the authenticity of the request received at the informed endpoint.
|
|
31
|
+
# Activation requests are posted to your registered endpoint whenever IssuingTokenActivations are received.
|
|
32
|
+
# If the provided digital signature does not check out with the StarkInfra public key, a
|
|
33
|
+
# StarkInfra::Error::InvalidSignatureError will be raised.
|
|
34
|
+
#
|
|
35
|
+
# ## Parameters (required):
|
|
36
|
+
# - content [string]: response content from request received at user endpoint (not parsed)
|
|
37
|
+
# - signature [string]: base-64 digital signature received at response header 'Digital-Signature'
|
|
38
|
+
#
|
|
39
|
+
# ## Parameters (optional):
|
|
40
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
41
|
+
#
|
|
42
|
+
# ## Return:
|
|
43
|
+
# - Parsed IssuingTokenActivation object
|
|
44
|
+
def self.parse(content:, signature:, user: nil)
|
|
45
|
+
StarkInfra::Utils::Parse.parse_and_verify(content: content, signature: signature, user: user, resource: resource, key: nil)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.resource
|
|
49
|
+
{
|
|
50
|
+
resource_name: 'IssuingTokenActivation',
|
|
51
|
+
resource_maker: proc { |json|
|
|
52
|
+
IssuingTokenActivation.new(
|
|
53
|
+
card_id: json['card_id'],
|
|
54
|
+
token_id: json['token_id'],
|
|
55
|
+
tags: json['tags'],
|
|
56
|
+
activation_method: json['activation_method']
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -10,7 +10,7 @@ module StarkInfra
|
|
|
10
10
|
#
|
|
11
11
|
# ## Parameters (required):
|
|
12
12
|
# - card_id [string]: card id to be tokenized. ex: '5734340247945216'
|
|
13
|
-
# - wallet_id [string]: desired wallet to be integrated.
|
|
13
|
+
# - wallet_id [string]: desired wallet to be integrated. Options: 'apple', 'google', 'merchant'.
|
|
14
14
|
# - method_code [string]: method code. ex: 'app' or 'manual'
|
|
15
15
|
#
|
|
16
16
|
# ## Attributes (return-only):
|
|
@@ -9,8 +9,8 @@ module StarkInfra
|
|
|
9
9
|
# The IssuingWithdrawal objects created in your Workspace return cash from your Issuing balance to your Banking balance.
|
|
10
10
|
#
|
|
11
11
|
# ## Parameters (required):
|
|
12
|
-
# - amount [integer]: IssuingWithdrawal value in cents.
|
|
13
|
-
# - external_id [string]
|
|
12
|
+
# - amount [integer]: IssuingWithdrawal value in cents. ex: 1234 (= R$ 12.34)
|
|
13
|
+
# - external_id [string]: unique identifier for this withdrawal, used to prevent duplicates on retries. ex: '12345'
|
|
14
14
|
# - description [string]: IssuingWithdrawal description. ex: 'sending money back'
|
|
15
15
|
#
|
|
16
16
|
# ## Parameters (optional):
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # Ledger object
|
|
8
|
+
#
|
|
9
|
+
# Ledgers are used to track the balance of a given amount by inserting LedgerTransactions to them.
|
|
10
|
+
# They can represent a bank account, a digital wallet, an inventory product, etc.
|
|
11
|
+
#
|
|
12
|
+
# ## Parameters (required):
|
|
13
|
+
# - external_id [string]: string that must be unique among all your Ledgers. ex: 'my-internal-id-123456'
|
|
14
|
+
#
|
|
15
|
+
# ## Parameters (optional):
|
|
16
|
+
# - rules [list of Ledger::Rule objects, default []]: list of Rule objects linked to the Ledger. Rules are used to limit the balance of the Ledger. ex: [Ledger::Rule.new(key: 'minimumBalance', value: 0)]
|
|
17
|
+
# - tags [list of strings, default []]: list of strings for reference when searching for Ledgers. ex: ['account/123', 'savings']
|
|
18
|
+
# - metadata [dictionary, default {}]: dictionary object used to store additional information about the Ledger object. ex: { 'accountId': '123', 'accountType': 'savings' }
|
|
19
|
+
#
|
|
20
|
+
# ## Attributes (return-only):
|
|
21
|
+
# - id [string]: unique id returned when the Ledger is created. ex: '5656565656565656'
|
|
22
|
+
# - created [DateTime]: creation datetime for the Ledger. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
23
|
+
# - updated [DateTime]: latest update datetime for the Ledger. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
24
|
+
class Ledger < StarkCore::Utils::Resource
|
|
25
|
+
attr_reader :external_id, :rules, :tags, :metadata, :id, :created, :updated
|
|
26
|
+
def initialize(external_id:, id: nil, rules: nil, tags: nil, metadata: nil, created: nil, updated: nil)
|
|
27
|
+
super(id)
|
|
28
|
+
@external_id = external_id
|
|
29
|
+
@rules = StarkInfra::Ledger::Rule.parse_rules(rules)
|
|
30
|
+
@tags = tags
|
|
31
|
+
@metadata = metadata
|
|
32
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
33
|
+
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# # Create Ledgers
|
|
37
|
+
#
|
|
38
|
+
# Send a list of Ledger objects for creation at the Stark Infra API
|
|
39
|
+
#
|
|
40
|
+
# ## Parameters (required):
|
|
41
|
+
# - ledgers [list of Ledger objects]: list of Ledger objects to be created in the Stark Infra API. You can send up to 100 Ledger objects in a single request.
|
|
42
|
+
#
|
|
43
|
+
# ## Parameters (optional):
|
|
44
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
45
|
+
#
|
|
46
|
+
# ## Return:
|
|
47
|
+
# - list of Ledger objects with updated attributes
|
|
48
|
+
def self.create(ledgers, user: nil)
|
|
49
|
+
StarkInfra::Utils::Rest.post(entities: ledgers, user: user, **resource)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# # Retrieve a specific Ledger
|
|
53
|
+
#
|
|
54
|
+
# Receive a single Ledger object previously created in the Stark Infra API by its id
|
|
55
|
+
#
|
|
56
|
+
# ## Parameters (required):
|
|
57
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
|
58
|
+
#
|
|
59
|
+
# ## Parameters (optional):
|
|
60
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
61
|
+
#
|
|
62
|
+
# ## Return:
|
|
63
|
+
# - Ledger object with updated attributes
|
|
64
|
+
def self.get(id, user: nil)
|
|
65
|
+
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# # Retrieve Ledgers
|
|
69
|
+
#
|
|
70
|
+
# Receive a generator of Ledger objects previously created in the Stark Infra API
|
|
71
|
+
#
|
|
72
|
+
# ## Parameters (optional):
|
|
73
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
74
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
75
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
76
|
+
# - ids [list of strings, default nil]: list of Ledger ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
|
77
|
+
# - external_ids [list of strings, default nil]: list of Ledger external ids to filter retrieved objects. ex: ['my-internal-id-123456', 'my-internal-id-654321']
|
|
78
|
+
# - tags [list of strings, default nil]: list of tags to filter retrieved objects. ex: ['account/123', 'savings']
|
|
79
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
80
|
+
#
|
|
81
|
+
# ## Return:
|
|
82
|
+
# - generator of Ledger objects with updated attributes
|
|
83
|
+
def self.query(limit: nil, after: nil, before: nil, ids: nil, external_ids: nil, tags: nil, user: nil)
|
|
84
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
85
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
86
|
+
StarkInfra::Utils::Rest.get_stream(
|
|
87
|
+
limit: limit,
|
|
88
|
+
after: after,
|
|
89
|
+
before: before,
|
|
90
|
+
ids: ids,
|
|
91
|
+
external_ids: external_ids,
|
|
92
|
+
tags: tags,
|
|
93
|
+
user: user,
|
|
94
|
+
**resource
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# # Retrieve paged Ledgers
|
|
99
|
+
#
|
|
100
|
+
# Receive a list of up to 100 Ledger objects previously created in the Stark Infra API and the cursor to the next page.
|
|
101
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
102
|
+
#
|
|
103
|
+
# ## Parameters (optional):
|
|
104
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call
|
|
105
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
106
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
107
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
108
|
+
# - ids [list of strings, default nil]: list of Ledger ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
|
109
|
+
# - external_ids [list of strings, default nil]: list of Ledger external ids to filter retrieved objects. ex: ['my-internal-id-123456', 'my-internal-id-654321']
|
|
110
|
+
# - tags [list of strings, default nil]: list of tags to filter retrieved objects. ex: ['account/123', 'savings']
|
|
111
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
112
|
+
#
|
|
113
|
+
# ## Return:
|
|
114
|
+
# - list of Ledger objects with updated attributes
|
|
115
|
+
# - cursor to retrieve the next page of Ledger objects
|
|
116
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, ids: nil, external_ids: nil, tags: nil, user: nil)
|
|
117
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
118
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
119
|
+
StarkInfra::Utils::Rest.get_page(
|
|
120
|
+
cursor: cursor,
|
|
121
|
+
limit: limit,
|
|
122
|
+
after: after,
|
|
123
|
+
before: before,
|
|
124
|
+
ids: ids,
|
|
125
|
+
external_ids: external_ids,
|
|
126
|
+
tags: tags,
|
|
127
|
+
user: user,
|
|
128
|
+
**resource
|
|
129
|
+
)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# # Update Ledger
|
|
133
|
+
#
|
|
134
|
+
# Update a Ledger by passing id.
|
|
135
|
+
#
|
|
136
|
+
# ## Parameters (required):
|
|
137
|
+
# - id [string]: Ledger id. ex: '5656565656565656'
|
|
138
|
+
#
|
|
139
|
+
# ## Parameters (optional):
|
|
140
|
+
# - rules [list of Ledger::Rule objects, default nil]: list of Rule objects linked to the Ledger. Rules are used to limit the balance of the Ledger. ex: [Ledger::Rule.new(key: 'minimumBalance', value: 0)]
|
|
141
|
+
# - tags [list of strings, default nil]: list of strings for reference when searching for Ledgers. ex: ['account/123', 'savings']
|
|
142
|
+
# - metadata [dictionary, default nil]: dictionary object used to store additional information about the Ledger object. ex: { 'accountId': '123', 'accountType': 'savings' }
|
|
143
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
144
|
+
#
|
|
145
|
+
# ## Return:
|
|
146
|
+
# - target Ledger object with updated attributes
|
|
147
|
+
def self.update(id, rules: nil, tags: nil, metadata: nil, user: nil)
|
|
148
|
+
StarkInfra::Utils::Rest.patch_id(
|
|
149
|
+
id: id,
|
|
150
|
+
rules: rules,
|
|
151
|
+
tags: tags,
|
|
152
|
+
metadata: metadata,
|
|
153
|
+
user: user,
|
|
154
|
+
**resource
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def self.resource
|
|
159
|
+
{
|
|
160
|
+
resource_name: 'Ledger',
|
|
161
|
+
resource_maker: proc { |json|
|
|
162
|
+
Ledger.new(
|
|
163
|
+
id: json['id'],
|
|
164
|
+
external_id: json['external_id'],
|
|
165
|
+
rules: json['rules'],
|
|
166
|
+
tags: json['tags'],
|
|
167
|
+
metadata: json['metadata'],
|
|
168
|
+
created: json['created'],
|
|
169
|
+
updated: json['updated']
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|