starkinfra 0.5.2 → 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 +25 -4
- data/lib/brcode_preview/subscription.rb +102 -0
- data/lib/business_account_request/business_account_request.rb +276 -0
- data/lib/business_account_request/log.rb +124 -0
- data/lib/business_attachment/business_attachment.rb +189 -0
- data/lib/{individual_document → business_attachment}/log.rb +35 -32
- data/lib/business_identity/business_identity.rb +228 -0
- data/lib/business_identity/log.rb +127 -0
- data/lib/credit_holmes/credit_holmes.rb +2 -1
- data/lib/credit_holmes/log.rb +125 -0
- data/lib/credit_note/credit_note.rb +51 -8
- data/lib/credit_note/rule.rb +55 -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 +10 -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_balance/issuing_balance.rb +8 -2
- data/lib/issuing_billing_invoice/issuing_billing_invoice.rb +155 -0
- data/lib/issuing_billing_transaction/issuing_billing_transaction.rb +142 -0
- data/lib/issuing_card/issuing_card.rb +10 -6
- 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 +6 -3
- data/lib/issuing_purchase/issuing_purchase.rb +41 -8
- data/lib/issuing_restock/issuing_restock.rb +3 -2
- data/lib/issuing_rule/issuing_rule.rb +45 -3
- data/lib/issuing_stock/issuing_stock.rb +5 -2
- data/lib/issuing_stock_rule/issuing_stock_rule.rb +214 -0
- data/lib/issuing_token/issuing_token.rb +309 -0
- data/lib/issuing_token/log.rb +127 -0
- data/lib/issuing_token_activation/issuing_token_activation.rb +62 -0
- data/lib/issuing_token_design/issuing_token_design.rb +118 -0
- data/lib/issuing_token_request/issuing_token_request.rb +63 -0
- 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/merchant_category/merchant_category.rb +6 -3
- data/lib/pix_balance/pix_balance.rb +1 -1
- data/lib/pix_chargeback/pix_chargeback.rb +34 -7
- data/lib/pix_claim/pix_claim.rb +14 -6
- data/lib/pix_director/pix_director.rb +1 -1
- data/lib/pix_dispute/log.rb +127 -0
- data/lib/pix_dispute/pix_dispute.rb +210 -0
- data/lib/pix_dispute/transaction.rb +91 -0
- data/lib/pix_fraud/log.rb +128 -0
- data/lib/pix_fraud/pix_fraud.rb +180 -0
- data/lib/pix_infraction/pix_infraction.rb +37 -7
- data/lib/pix_internal_transaction_report/log.rb +129 -0
- data/lib/pix_internal_transaction_report/pix_internal_transaction_report.rb +200 -0
- data/lib/pix_key/pix_key.rb +1 -1
- data/lib/pix_key_holmes/log.rb +129 -0
- data/lib/{individual_document/individual_document.rb → pix_key_holmes/pix_key_holmes.rb} +48 -56
- data/lib/pix_pull_request/log.rb +127 -0
- data/lib/pix_pull_request/pix_pull_request.rb +268 -0
- data/lib/pix_pull_subscription/log.rb +127 -0
- data/lib/pix_pull_subscription/pix_pull_subscription.rb +307 -0
- data/lib/pix_request/pix_request.rb +19 -6
- 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 +45 -4
- 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 +21 -0
- data/lib/webhook/webhook.rb +3 -3
- metadata +48 -11
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
require_relative('individual_account_request')
|
|
6
|
+
|
|
7
|
+
module StarkInfra
|
|
8
|
+
class IndividualAccountRequest
|
|
9
|
+
# # IndividualAccountRequest::Log object
|
|
10
|
+
#
|
|
11
|
+
# Every time an IndividualAccountRequest entity is modified, a corresponding IndividualAccountRequest::Log
|
|
12
|
+
# is generated for the entity. This Log is never generated by the user, but it can be retrieved to check
|
|
13
|
+
# additional information on the IndividualAccountRequest.
|
|
14
|
+
#
|
|
15
|
+
# ## Attributes (return-only):
|
|
16
|
+
# - id [string]: unique id returned when the log is created. ex: '5656565656565656'
|
|
17
|
+
# - request [IndividualAccountRequest]: IndividualAccountRequest entity to which the log refers to.
|
|
18
|
+
# - errors [list of strings]: list of errors linked to this IndividualAccountRequest event.
|
|
19
|
+
# - type [string]: type of the IndividualAccountRequest event which triggered the log creation. Options: 'approved', 'created', 'denied', 'processing', 'updated'
|
|
20
|
+
# - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
21
|
+
class Log < StarkCore::Utils::Resource
|
|
22
|
+
attr_reader :id, :request, :errors, :type, :created
|
|
23
|
+
def initialize(id: nil, request: nil, errors: nil, type: nil, created: nil)
|
|
24
|
+
super(id)
|
|
25
|
+
@request = request
|
|
26
|
+
@errors = errors
|
|
27
|
+
@type = type
|
|
28
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# # Retrieve a specific IndividualAccountRequest::Log
|
|
32
|
+
#
|
|
33
|
+
# Receive a single IndividualAccountRequest::Log object previously created by the Stark Infra API by passing its id
|
|
34
|
+
#
|
|
35
|
+
# ## Parameters (required):
|
|
36
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
|
37
|
+
#
|
|
38
|
+
# ## Parameters (optional):
|
|
39
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
40
|
+
#
|
|
41
|
+
# ## Return:
|
|
42
|
+
# - IndividualAccountRequest::Log object with updated attributes
|
|
43
|
+
def self.get(id, user: nil)
|
|
44
|
+
StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# # Retrieve IndividualAccountRequest::Logs
|
|
48
|
+
#
|
|
49
|
+
# Receive a generator of IndividualAccountRequest::Log objects previously created in the Stark Infra API
|
|
50
|
+
#
|
|
51
|
+
# ## Parameters (optional):
|
|
52
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
53
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
54
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
55
|
+
# - types [list of strings, default nil]: filter for log event types. Options: 'approved', 'created', 'denied', 'processing', 'updated'
|
|
56
|
+
# - account_request_ids [list of strings, default nil]: list of IndividualAccountRequest 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 IndividualAccountRequest::Log objects with updated attributes
|
|
61
|
+
def self.query(limit: nil, after: nil, before: nil, types: nil, account_request_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
|
+
account_request_ids: account_request_ids,
|
|
70
|
+
user: user,
|
|
71
|
+
**resource
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# # Retrieve paged IndividualAccountRequest::Logs
|
|
76
|
+
#
|
|
77
|
+
# Receive a list of up to 100 IndividualAccountRequest::Log objects previously created in the Stark Infra API and the cursor to the next page.
|
|
78
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
79
|
+
#
|
|
80
|
+
# ## Parameters (optional):
|
|
81
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call
|
|
82
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
83
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
84
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
85
|
+
# - types [list of strings, default nil]: filter for log event types. Options: 'approved', 'created', 'denied', 'processing', 'updated'
|
|
86
|
+
# - account_request_ids [list of strings, default nil]: list of IndividualAccountRequest ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
|
87
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
88
|
+
#
|
|
89
|
+
# ## Return:
|
|
90
|
+
# - list of IndividualAccountRequest::Log objects with updated attributes
|
|
91
|
+
# - cursor to retrieve the next page of Log objects
|
|
92
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, account_request_ids: nil, user: nil)
|
|
93
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
94
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
95
|
+
StarkInfra::Utils::Rest.get_page(
|
|
96
|
+
cursor: cursor,
|
|
97
|
+
limit: limit,
|
|
98
|
+
after: after,
|
|
99
|
+
before: before,
|
|
100
|
+
types: types,
|
|
101
|
+
account_request_ids: account_request_ids,
|
|
102
|
+
user: user,
|
|
103
|
+
**resource
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.resource
|
|
108
|
+
request_maker = StarkInfra::IndividualAccountRequest.resource[:resource_maker]
|
|
109
|
+
{
|
|
110
|
+
resource_name: 'IndividualAccountRequestLog',
|
|
111
|
+
resource_maker: proc { |json|
|
|
112
|
+
Log.new(
|
|
113
|
+
id: json['id'],
|
|
114
|
+
request: StarkCore::Utils::API.from_api_json(request_maker, json['request']),
|
|
115
|
+
errors: json['errors'],
|
|
116
|
+
type: json['type'],
|
|
117
|
+
created: json['created']
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -7,11 +7,8 @@ require_relative('../utils/parse')
|
|
|
7
7
|
module StarkInfra
|
|
8
8
|
# # IndividualIdentity object
|
|
9
9
|
#
|
|
10
|
-
# An
|
|
11
|
-
#
|
|
12
|
-
# documents must be attached to it using the created method of the individual document resource. When all the required
|
|
13
|
-
# individual documents are attached to an individual identity it can be sent to validation by patching its status to
|
|
14
|
-
# processing.
|
|
10
|
+
# An IndividualIdentity represents an individual to be validated. Once an individual identity is created,
|
|
11
|
+
# it can be sent to validation by patching its status to processing.
|
|
15
12
|
#
|
|
16
13
|
# When you initialize a IndividualIdentity, the entity will not be automatically
|
|
17
14
|
# created in the Stark Infra API. The 'create' function sends the objects
|
|
@@ -26,7 +23,7 @@ module StarkInfra
|
|
|
26
23
|
#
|
|
27
24
|
# ## Attributes (return-only):
|
|
28
25
|
# - id [string]: unique id returned when the IndividualIdentity is created. ex: "5656565656565656"
|
|
29
|
-
# - status [string]: current status of the IndividualIdentity. Options: "created", "
|
|
26
|
+
# - status [string]: current status of the IndividualIdentity. Options: "created", "processing", "pending", "success", "failed" — there is no "canceled" value; canceling an identity moves it to "failed".
|
|
30
27
|
# - created [DateTime]: creation datetime for the IndividualIdentity. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
31
28
|
class IndividualIdentity < StarkCore::Utils::Resource
|
|
32
29
|
attr_reader :name, :tax_id, :tags, :id, :status, :created
|
|
@@ -141,7 +138,7 @@ module StarkInfra
|
|
|
141
138
|
#
|
|
142
139
|
# ## Parameters (required):
|
|
143
140
|
# - id [string]: IndividualIdentity unique id. ex: '5656565656565656'
|
|
144
|
-
# - status [string]: You may send
|
|
141
|
+
# - status [string]: You may send an IndividualIdentity to validation by passing 'processing' in the status
|
|
145
142
|
#
|
|
146
143
|
# ## Parameters (optional):
|
|
147
144
|
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
|
|
@@ -13,13 +13,17 @@ module StarkInfra
|
|
|
13
13
|
# ## Attributes (return-only):
|
|
14
14
|
# - id [string]: unique id returned when IssuingBalance is created. ex: '5656565656565656'
|
|
15
15
|
# - amount [integer]: current issuing balance amount of the Workspace in cents. ex: 200 (= R$ 2.00)
|
|
16
|
+
# - limit [integer]: Spending limit of the balance
|
|
17
|
+
# - max_limit [integer]: Maximum spending limit. This field is currently always equal to limit
|
|
16
18
|
# - currency [string]: currency of the current Workspace. Expect others to be added eventually. ex: 'BRL'
|
|
17
19
|
# - updated [DateTime]: latest update datetime for the IssuingBalance. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
18
20
|
class IssuingBalance < StarkCore::Utils::Resource
|
|
19
|
-
attr_reader :amount, :currency, :updated, :id
|
|
20
|
-
def initialize(amount: nil, currency: nil, updated: nil, id: nil)
|
|
21
|
+
attr_reader :amount, :limit, :max_limit, :currency, :updated, :id
|
|
22
|
+
def initialize(amount: nil, limit: nil, max_limit: nil, currency: nil, updated: nil, id: nil)
|
|
21
23
|
super(id)
|
|
22
24
|
@amount = amount
|
|
25
|
+
@limit = limit
|
|
26
|
+
@max_limit = max_limit
|
|
23
27
|
@currency = currency
|
|
24
28
|
@updated = updated
|
|
25
29
|
end
|
|
@@ -44,6 +48,8 @@ module StarkInfra
|
|
|
44
48
|
IssuingBalance.new(
|
|
45
49
|
id: json['id'],
|
|
46
50
|
amount: json['amount'],
|
|
51
|
+
limit: json['limit'],
|
|
52
|
+
max_limit: json['max_limit'],
|
|
47
53
|
currency: json['currency'],
|
|
48
54
|
updated: json['updated']
|
|
49
55
|
)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # IssuingBillingInvoice object
|
|
8
|
+
#
|
|
9
|
+
# The IssuingBillingInvoice objects created in your Workspace report the
|
|
10
|
+
# billing cycle charges of your Issuing operation.
|
|
11
|
+
#
|
|
12
|
+
# ## Attributes (return-only):
|
|
13
|
+
# - id [string]: unique id returned when IssuingBillingInvoice is created. ex: '5656565656565656'
|
|
14
|
+
# - tax_id [string]: payer tax ID (CPF or CNPJ) with or without formatting. ex: '01234567890' or '20.018.183/0001-80'
|
|
15
|
+
# - name [string]: payer name. ex: 'Iron Bank S.A.'
|
|
16
|
+
# - fine [float]: Fine percentage applied when paid after the due date. ex: 2.0
|
|
17
|
+
# - interest [float]: Monthly interest percentage applied when paid after the due date. ex: 1.0
|
|
18
|
+
# - amount [integer]: invoice amount in cents. ex: 1234 (= R$ 12.34)
|
|
19
|
+
# - nominal_amount [integer]: nominal amount of the invoice in cents. ex: 1234 (= R$ 12.34)
|
|
20
|
+
# - status [string]: current IssuingBillingInvoice status. ex: 'created', 'paid', 'overdue'
|
|
21
|
+
# - brcode [string]: BR Code for the invoice payment. ex: '00020101021226930014br.gov.bcb.pix2571brcode-h.development.starkinfra.com'
|
|
22
|
+
# - link [string]: public invoice webpage URL. ex: 'https://starkbank-card-issuer.sandbox.starkbank.com/billinginvoicelink/97de4d51e8984c459639a645ce920abb'
|
|
23
|
+
# - due [DateTime]: invoice due and expiration datetime in UTC ISO format. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
24
|
+
# - period_start [DateTime]: billing cycle start datetime. Maps to wire field 'start'. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
25
|
+
# - period_end [DateTime]: billing cycle end datetime. Maps to wire field 'end'. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
26
|
+
# - created [DateTime]: creation datetime for the IssuingBillingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
27
|
+
# - updated [DateTime]: latest update datetime for the IssuingBillingInvoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
28
|
+
class IssuingBillingInvoice < StarkCore::Utils::Resource
|
|
29
|
+
attr_reader :id, :tax_id, :name, :fine, :interest, :amount, :nominal_amount, :status, :brcode, :link,
|
|
30
|
+
:due, :period_start, :period_end, :created, :updated
|
|
31
|
+
def initialize(
|
|
32
|
+
id: nil, tax_id: nil, name: nil, fine: nil, interest: nil, amount: nil, nominal_amount: nil, status: nil,
|
|
33
|
+
brcode: nil, link: nil, due: nil, period_start: nil, period_end: nil, created: nil, updated: nil
|
|
34
|
+
)
|
|
35
|
+
super(id)
|
|
36
|
+
@tax_id = tax_id
|
|
37
|
+
@name = name
|
|
38
|
+
@fine = fine
|
|
39
|
+
@interest = interest
|
|
40
|
+
@amount = amount
|
|
41
|
+
@nominal_amount = nominal_amount
|
|
42
|
+
@status = status
|
|
43
|
+
@brcode = brcode
|
|
44
|
+
@link = link
|
|
45
|
+
@due = StarkCore::Utils::Checks.check_datetime(due)
|
|
46
|
+
@period_start = StarkCore::Utils::Checks.check_datetime(period_start)
|
|
47
|
+
@period_end = StarkCore::Utils::Checks.check_datetime(period_end)
|
|
48
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
49
|
+
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# # Retrieve a specific IssuingBillingInvoice
|
|
53
|
+
#
|
|
54
|
+
# Receive a single IssuingBillingInvoice 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
|
+
# - IssuingBillingInvoice 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 IssuingBillingInvoices
|
|
69
|
+
#
|
|
70
|
+
# Receive a generator of IssuingBillingInvoice 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
|
+
# - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'paid', 'overdue']
|
|
77
|
+
# - id [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
|
78
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
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 IssuingBillingInvoice objects with updated attributes
|
|
83
|
+
def self.query(limit: nil, after: nil, before: nil, status: nil, id: 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
|
+
status: status,
|
|
91
|
+
id: id,
|
|
92
|
+
tags: tags,
|
|
93
|
+
user: user,
|
|
94
|
+
**resource
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# # Retrieve paged IssuingBillingInvoices
|
|
99
|
+
#
|
|
100
|
+
# Receive a list of up to 100 IssuingBillingInvoice 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
|
+
# - status [list of strings, default nil]: filter for status of retrieved objects. ex: ['created', 'paid', 'overdue']
|
|
109
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
110
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
111
|
+
#
|
|
112
|
+
# ## Return:
|
|
113
|
+
# - list of IssuingBillingInvoice objects with updated attributes
|
|
114
|
+
# - cursor to retrieve the next page of IssuingBillingInvoice objects
|
|
115
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, user: nil)
|
|
116
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
117
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
118
|
+
StarkInfra::Utils::Rest.get_page(
|
|
119
|
+
cursor: cursor,
|
|
120
|
+
limit: limit,
|
|
121
|
+
after: after,
|
|
122
|
+
before: before,
|
|
123
|
+
status: status,
|
|
124
|
+
tags: tags,
|
|
125
|
+
user: user,
|
|
126
|
+
**resource
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.resource
|
|
131
|
+
{
|
|
132
|
+
resource_name: 'IssuingBillingInvoice',
|
|
133
|
+
resource_maker: proc { |json|
|
|
134
|
+
IssuingBillingInvoice.new(
|
|
135
|
+
id: json['id'],
|
|
136
|
+
tax_id: json['tax_id'],
|
|
137
|
+
name: json['name'],
|
|
138
|
+
fine: json['fine'],
|
|
139
|
+
interest: json['interest'],
|
|
140
|
+
amount: json['amount'],
|
|
141
|
+
nominal_amount: json['nominal_amount'],
|
|
142
|
+
status: json['status'],
|
|
143
|
+
brcode: json['brcode'],
|
|
144
|
+
link: json['link'],
|
|
145
|
+
due: json['due'],
|
|
146
|
+
period_start: json['start'],
|
|
147
|
+
period_end: json['end'],
|
|
148
|
+
created: json['created'],
|
|
149
|
+
updated: json['updated']
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('starkcore')
|
|
4
|
+
require_relative('../utils/rest')
|
|
5
|
+
|
|
6
|
+
module StarkInfra
|
|
7
|
+
# # IssuingBillingTransaction object
|
|
8
|
+
#
|
|
9
|
+
# The IssuingBillingTransaction objects created in your Workspace report the
|
|
10
|
+
# transactions that compose the billing invoices of your Issuing operation.
|
|
11
|
+
#
|
|
12
|
+
# ## Attributes (return-only):
|
|
13
|
+
# - id [string]: unique id returned when IssuingBillingTransaction is created. ex: '5656565656565656'
|
|
14
|
+
# - amount [integer]: transaction amount in cents. ex: 1234 (= R$ 12.34)
|
|
15
|
+
# - invoice_id [string]: id of the parent billing invoice the transaction belongs to. May be nil when the transaction is not tied to an invoice. ex: '5656565656565656'
|
|
16
|
+
# - installment [integer]: installment number of the transaction. ex: 1
|
|
17
|
+
# - installment_count [integer]: total number of installments of the transaction. ex: 12
|
|
18
|
+
# - balance [integer]: remaining issuing balance in cents after the transaction. ex: 1234 (= R$ 12.34)
|
|
19
|
+
# - holder_name [string]: card holder name. ex: 'Tony Stark'
|
|
20
|
+
# - source [string]: transaction source. ex: 'issuing-purchase'
|
|
21
|
+
# - external_id [string]: external transaction id. ex: 'my-external-id-123456'
|
|
22
|
+
# - description [string]: transaction description. ex: 'Purchase at Stark Store'
|
|
23
|
+
# - card_ending [string]: last 4 digits of the card number. ex: '1234'
|
|
24
|
+
# - tax [integer]: IOF amount in cents applied to the transaction
|
|
25
|
+
# - rate [float]: Conversion rate applied to international transactions
|
|
26
|
+
# - merchant_amount [integer]: merchant amount in cents. ex: 1234 (= R$ 12.34)
|
|
27
|
+
# - merchant_currency_code [string]: merchant currency code in ISO 4217 format. ex: 'USD'
|
|
28
|
+
# - created [DateTime]: creation datetime for the IssuingBillingTransaction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
|
29
|
+
class IssuingBillingTransaction < StarkCore::Utils::Resource
|
|
30
|
+
attr_reader :id, :amount, :invoice_id, :installment, :installment_count, :balance, :holder_name, :source,
|
|
31
|
+
:external_id, :description, :card_ending, :tax, :rate, :merchant_amount, :merchant_currency_code,
|
|
32
|
+
:created
|
|
33
|
+
def initialize(
|
|
34
|
+
id: nil, amount: nil, invoice_id: nil, installment: nil, installment_count: nil, balance: nil,
|
|
35
|
+
holder_name: nil, source: nil, external_id: nil, description: nil, card_ending: nil, tax: nil, rate: nil,
|
|
36
|
+
merchant_amount: nil, merchant_currency_code: nil, created: nil
|
|
37
|
+
)
|
|
38
|
+
super(id)
|
|
39
|
+
@amount = amount
|
|
40
|
+
@invoice_id = invoice_id
|
|
41
|
+
@installment = installment
|
|
42
|
+
@installment_count = installment_count
|
|
43
|
+
@balance = balance
|
|
44
|
+
@holder_name = holder_name
|
|
45
|
+
@source = source
|
|
46
|
+
@external_id = external_id
|
|
47
|
+
@description = description
|
|
48
|
+
@card_ending = card_ending
|
|
49
|
+
@tax = tax
|
|
50
|
+
@rate = rate
|
|
51
|
+
@merchant_amount = merchant_amount
|
|
52
|
+
@merchant_currency_code = merchant_currency_code
|
|
53
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# # Retrieve IssuingBillingTransactions
|
|
57
|
+
#
|
|
58
|
+
# Receive a generator of IssuingBillingTransaction objects previously created in the Stark Infra API
|
|
59
|
+
#
|
|
60
|
+
# ## Parameters (optional):
|
|
61
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
|
62
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
63
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
64
|
+
# - invoice_id [string, default nil]: filter for transactions of a specific billing invoice. ex: '5656565656565656'
|
|
65
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
66
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
67
|
+
#
|
|
68
|
+
# ## Return:
|
|
69
|
+
# - generator of IssuingBillingTransaction objects with updated attributes
|
|
70
|
+
def self.query(limit: nil, after: nil, before: nil, invoice_id: nil, tags: nil, user: nil)
|
|
71
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
72
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
73
|
+
StarkInfra::Utils::Rest.get_stream(
|
|
74
|
+
limit: limit,
|
|
75
|
+
after: after,
|
|
76
|
+
before: before,
|
|
77
|
+
invoice_id: invoice_id,
|
|
78
|
+
tags: tags,
|
|
79
|
+
user: user,
|
|
80
|
+
**resource
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# # Retrieve paged IssuingBillingTransactions
|
|
85
|
+
#
|
|
86
|
+
# Receive a list of up to 100 IssuingBillingTransaction objects previously created in the Stark Infra API and the cursor to the next page.
|
|
87
|
+
# Use this function instead of query if you want to manually page your requests.
|
|
88
|
+
#
|
|
89
|
+
# ## Parameters (optional):
|
|
90
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call.
|
|
91
|
+
# - limit [integer, default 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
|
|
92
|
+
# - after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
|
93
|
+
# - before [Date or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
|
94
|
+
# - invoice_id [string, default nil]: filter for transactions of a specific billing invoice. ex: '5656565656565656'
|
|
95
|
+
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
|
96
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
|
|
97
|
+
#
|
|
98
|
+
# ## Return:
|
|
99
|
+
# - list of IssuingBillingTransaction objects with updated attributes
|
|
100
|
+
# - cursor to retrieve the next page of IssuingBillingTransaction objects
|
|
101
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, invoice_id: nil, tags: nil, user: nil)
|
|
102
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
|
103
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
|
104
|
+
StarkInfra::Utils::Rest.get_page(
|
|
105
|
+
cursor: cursor,
|
|
106
|
+
limit: limit,
|
|
107
|
+
after: after,
|
|
108
|
+
before: before,
|
|
109
|
+
invoice_id: invoice_id,
|
|
110
|
+
tags: tags,
|
|
111
|
+
user: user,
|
|
112
|
+
**resource
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.resource
|
|
117
|
+
{
|
|
118
|
+
resource_name: 'IssuingBillingTransaction',
|
|
119
|
+
resource_maker: proc { |json|
|
|
120
|
+
IssuingBillingTransaction.new(
|
|
121
|
+
id: json['id'],
|
|
122
|
+
amount: json['amount'],
|
|
123
|
+
invoice_id: json['invoice_id'],
|
|
124
|
+
installment: json['installment'],
|
|
125
|
+
installment_count: json['installment_count'],
|
|
126
|
+
balance: json['balance'],
|
|
127
|
+
holder_name: json['holder_name'],
|
|
128
|
+
source: json['source'],
|
|
129
|
+
external_id: json['external_id'],
|
|
130
|
+
description: json['description'],
|
|
131
|
+
card_ending: json['card_ending'],
|
|
132
|
+
tax: json['tax'],
|
|
133
|
+
rate: json['rate'],
|
|
134
|
+
merchant_amount: json['merchant_amount'],
|
|
135
|
+
merchant_currency_code: json['merchant_currency_code'],
|
|
136
|
+
created: json['created']
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -25,12 +25,13 @@ module StarkInfra
|
|
|
25
25
|
# - city [string, default sub-issuer city]: card holder address city. ex: 'Rio de Janeiro'
|
|
26
26
|
# - state_code [string, default sub-issuer state code]: card holder address state. ex: 'GO'
|
|
27
27
|
# - zip_code [string, default sub-issuer zip code]: card holder address zip code. ex: '01311-200'
|
|
28
|
+
# - type [string, default 'virtual']: card type, settable on creation. Options: 'virtual', 'physical'. ex: 'virtual'
|
|
28
29
|
#
|
|
29
30
|
# ## Attributes (return-only):
|
|
30
31
|
# - id [string]: unique id returned when IssuingCard is created. ex: '5656565656565656'
|
|
31
32
|
# - holder_id [string]: card holder unique id. ex: '5656565656565656'
|
|
32
|
-
# - type [string]: card type. ex: 'virtual'
|
|
33
33
|
# - status [string]: current IssuingCard status. ex: 'active', 'blocked', 'canceled', 'expired'.
|
|
34
|
+
# - is_pin_defined [boolean]: Whether the card has a PIN defined. Returned only when "expand=isPinDefined" is informed in the request
|
|
34
35
|
# - number [string]: [EXPANDABLE] masked card number. Expand to unmask the value. ex: '123'.
|
|
35
36
|
# - security_code [string]: [EXPANDABLE] masked card verification value (cvv). Expand to unmask the value. ex: '123'.
|
|
36
37
|
# - expiration [DateTime]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: DateTime.new(2032, 3, 10, 10, 30, 0, 0)
|
|
@@ -39,11 +40,11 @@ module StarkInfra
|
|
|
39
40
|
class IssuingCard < StarkCore::Utils::Resource
|
|
40
41
|
attr_reader :id, :holder_name, :holder_tax_id, :holder_external_id, :display_name, :rules, :product_id, :tags,
|
|
41
42
|
:street_line_1, :street_line_2, :district, :city, :state_code, :zip_code, :holder_id,
|
|
42
|
-
:type, :status, :number, :security_code, :expiration, :created, :updated
|
|
43
|
+
:type, :status, :is_pin_defined, :number, :security_code, :expiration, :created, :updated
|
|
43
44
|
def initialize(
|
|
44
45
|
holder_name: , holder_tax_id: , holder_external_id: , display_name: nil, rules: nil, product_id: nil, tags: nil,
|
|
45
46
|
street_line_1: nil, street_line_2: nil, district: nil, city: nil, state_code: nil, zip_code: nil, id: nil,
|
|
46
|
-
holder_id: nil, type: nil, status: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil
|
|
47
|
+
holder_id: nil, type: nil, status: nil, is_pin_defined: nil, number: nil, security_code: nil, expiration: nil, created: nil, updated: nil
|
|
47
48
|
)
|
|
48
49
|
super(id)
|
|
49
50
|
@holder_name = holder_name
|
|
@@ -62,6 +63,7 @@ module StarkInfra
|
|
|
62
63
|
@holder_id = holder_id
|
|
63
64
|
@type = type
|
|
64
65
|
@status = status
|
|
66
|
+
@is_pin_defined = is_pin_defined
|
|
65
67
|
@number = number
|
|
66
68
|
@security_code = security_code
|
|
67
69
|
expiration = nil if !expiration.nil? && expiration.include?('*')
|
|
@@ -72,7 +74,8 @@ module StarkInfra
|
|
|
72
74
|
|
|
73
75
|
# # Create IssuingCards
|
|
74
76
|
#
|
|
75
|
-
# Send a list of IssuingCard objects for creation in the Stark Infra API
|
|
77
|
+
# Send a list of IssuingCard objects for creation in the Stark Infra API. Use this method to create up
|
|
78
|
+
# to 100 new IssuingCards at a time.
|
|
76
79
|
#
|
|
77
80
|
# ## Parameters (required):
|
|
78
81
|
# - cards [list of IssuingCard objects]: list of IssuingCard objects to be created in the API
|
|
@@ -190,7 +193,7 @@ module StarkInfra
|
|
|
190
193
|
#
|
|
191
194
|
# ## Parameters (optional):
|
|
192
195
|
# - status [string, default nil]: You may block the IssuingCard by passing 'blocked' or activate by passing 'active' in the status
|
|
193
|
-
# - pin [string, default nil]:
|
|
196
|
+
# - pin [string, default nil]: numeric string of 4 to 6 digits, used to unlock a physical card and authorize purchases. Write-only — never returned; check expand: ['isPinDefined'] to see whether a PIN is set. A pending physical card must also receive this PIN to be activated: passing it alone activates the card, and setting status to 'active' on a pending physical card without a PIN is rejected.
|
|
194
197
|
# - display_name [string, default nil]: card displayed name
|
|
195
198
|
# - rules [list of IssuingRule objects, default nil]: [EXPANDABLE] list of card spending rules.
|
|
196
199
|
# - tags [list of strings, default nil]: list of strings for tagging
|
|
@@ -213,7 +216,7 @@ module StarkInfra
|
|
|
213
216
|
|
|
214
217
|
# # Cancel an IssuingCard entity
|
|
215
218
|
#
|
|
216
|
-
# Cancel an IssuingCard entity previously created in the Stark Infra API
|
|
219
|
+
# Cancel an IssuingCard entity previously created in the Stark Infra API. This action is irreversible.
|
|
217
220
|
#
|
|
218
221
|
# ## Parameters (required):
|
|
219
222
|
# - id [string]: IssuingCard unique id. ex: '5656565656565656'
|
|
@@ -249,6 +252,7 @@ module StarkInfra
|
|
|
249
252
|
holder_id: json['holder_id'],
|
|
250
253
|
type: json['type'],
|
|
251
254
|
status: json['status'],
|
|
255
|
+
is_pin_defined: json['is_pin_defined'],
|
|
252
256
|
number: json['number'],
|
|
253
257
|
security_code: json['security_code'],
|
|
254
258
|
expiration: json['expiration'],
|
|
@@ -104,6 +104,15 @@ module StarkInfra
|
|
|
104
104
|
StarkInfra::Utils::Rest.get_content(id: id, user: user, sub_resource_name: 'pdf', **resource)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
# # Parse IssuingDesigns
|
|
108
|
+
#
|
|
109
|
+
# Converts a list of hashes into a list of IssuingDesign objects.
|
|
110
|
+
#
|
|
111
|
+
# ## Parameters (required):
|
|
112
|
+
# - designs [list of hashes]: list to be parsed.
|
|
113
|
+
#
|
|
114
|
+
# ## Return:
|
|
115
|
+
# - list of parsed IssuingDesign objects
|
|
107
116
|
def self.parse_designs(designs)
|
|
108
117
|
resource_maker = StarkInfra::IssuingDesign.resource[:resource_maker]
|
|
109
118
|
return designs if designs.nil?
|
|
@@ -18,7 +18,7 @@ module StarkInfra
|
|
|
18
18
|
# - shipping_state_code [string]: shipping state code. ex: "NY"
|
|
19
19
|
# - shipping_street_line_1 [string]: shipping main address. ex: "AVENUE OF THE AMERICAS"
|
|
20
20
|
# - shipping_street_line_2 [string]: shipping address complement. ex: "Apt. 6"
|
|
21
|
-
# - shipping_service [string]: shipping service.
|
|
21
|
+
# - shipping_service [string]: shipping service. Options: 'loggi', 'conveyor'.
|
|
22
22
|
# - shipping_tracking_number [string]: shipping tracking number. ex: "5656565656565656"
|
|
23
23
|
# - shipping_zip_code [string]: shipping zip code. ex: "12345-678"
|
|
24
24
|
#
|
|
@@ -73,7 +73,8 @@ module StarkInfra
|
|
|
73
73
|
|
|
74
74
|
# # Create IssuingEmbossingRequests
|
|
75
75
|
#
|
|
76
|
-
# Send a list of IssuingEmbossingRequest objects for creation in the Stark Infra API
|
|
76
|
+
# Send a list of IssuingEmbossingRequest objects for creation in the Stark Infra API. Use this method to
|
|
77
|
+
# create up to 100 new IssuingEmbossingRequests at a time.
|
|
77
78
|
#
|
|
78
79
|
# ## Parameters (required):
|
|
79
80
|
# - requests [list of IssuingEmbossingRequest objects]: list of IssuingEmbossingRequest objects to be created in the API
|
|
@@ -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
|